/* ─────────────────────────────────────────────────────────────────────
   Component primitives
   ───────────────────────────────────────────────────────────────────── */

/* ── Button ──────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink-1);
  --btn-border: var(--line-2);
  --btn-bg-hover: var(--canvas-tint);
  --btn-shadow: var(--shadow-xs);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-8);
  box-shadow: var(--btn-shadow);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-glide),
    border-color var(--dur-fast) var(--ease-glide),
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-glide),
    color var(--dur-fast) var(--ease-glide);
}
.btn:hover { background: var(--btn-bg-hover); border-color: var(--line-3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(0.98); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--primary {
  --btn-bg: var(--brand-red);
  --btn-fg: white;
  --btn-border: transparent;
  --btn-bg-hover: var(--brand-red-deep);
  --btn-shadow: var(--shadow-sm), 0 0 0 0 rgba(231, 27, 36, 0);
  font-weight: var(--fw-semibold);
}
.btn--primary:hover {
  border-color: transparent;
  box-shadow: var(--shadow-md), 0 0 24px rgba(231, 27, 36, 0.32);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-shadow: none;
  --btn-bg-hover: var(--canvas-tint);
}

.btn--sm { height: 26px; padding: 0 var(--space-2); font-size: var(--fs-12); border-radius: var(--radius-6); }
.btn--lg { height: 40px; padding: 0 var(--space-5); font-size: var(--fs-14); border-radius: var(--radius-10); }
.btn--icon { width: 32px; padding: 0; }
.btn--icon.btn--sm { width: 26px; }

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line-1);
  border-radius: var(--radius-12);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    transform var(--dur-base) var(--ease-spring),
    box-shadow var(--dur-base) var(--ease-glide),
    border-color var(--dur-base) var(--ease-glide);
}
.card--interactive { cursor: pointer; }
.card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-2);
}

/* ── Badge / Pill ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 20px;
  padding: 0 var(--space-2);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  color: var(--ink-3);
  background: var(--canvas-tint);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge--success { color: var(--success); background: var(--success-soft); }
.badge--warning { color: var(--warning); background: var(--warning-soft); }
.badge--danger  { color: var(--danger);  background: var(--danger-soft); }
.badge--info    { color: var(--info);    background: var(--info-soft); }
.badge--solid {
  color: white;
  background: var(--brand-red);
}

/* ── Status dot ──────────────────────────────────────────────────── */
.dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--ink-5);
  flex-shrink: 0;
}
.dot--live {
  background: var(--brand-red);
  box-shadow: 0 0 0 0 rgba(231, 27, 36, 0.6);
  animation: pulse-bloom 1.8s var(--ease-out) infinite;
}
.dot--success { background: var(--success); }
.dot--warning { background: var(--warning); }

/* ── Input ───────────────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  height: 34px;
  padding: 0 var(--space-3);
  font-size: var(--fs-14);
  color: var(--ink-1);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-8);
  transition: border-color var(--dur-fast) var(--ease-glide), box-shadow var(--dur-fast) var(--ease-glide);
}
.input::placeholder { color: var(--ink-4); }
.input:hover { border-color: var(--line-3); }
.input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(231, 27, 36, 0.12);
  outline: none;
}
textarea.input { min-height: 96px; padding: var(--space-3); resize: vertical; }

/* ── Avatar ──────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  background: var(--canvas-tint);
  color: var(--ink-2);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  border: 1px solid var(--line-1);
}
.avatar--lg { width: 40px; height: 40px; font-size: var(--fs-13); }

/* ── Tooltip ─────────────────────────────────────────────────────── */
/* Portaled by tooltip.js — mounted to <body> so stacking contexts can't clip it. */
.tt {
  position: fixed;
  padding: 4px 8px;
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  color: white;
  background: var(--ink-1);
  border-radius: var(--radius-6);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10000;
  box-shadow: var(--shadow-md);
  animation: rise var(--dur-fast) var(--ease-out);
}
.has-tip { position: relative; }

/* ── Skeleton ────────────────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, var(--canvas-tint) 0%, var(--surface) 50%, var(--canvas-tint) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-6);
}

/* ── Divider ─────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--line-1); width: 100%; }
.divider--v { width: 1px; height: 100%; background: var(--line-1); }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--ink-3);
  gap: var(--space-3);
}
.empty .empty-title {
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  color: var(--ink-1);
}
.empty .empty-desc { max-width: 360px; font-size: var(--fs-13); color: var(--ink-3); }
