/* ============================================
   CALIBER — Components
   ============================================ */

/* ── Layout shell ─────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.shell--collapsed { grid-template-columns: 64px 1fr; }

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: var(--s-6) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width var(--dur-base) var(--ease-out);
}

.sidebar__brand {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: 0 var(--s-2);
}

.sidebar__brand-mark {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
}

.sidebar__brand-mark em {
  font-style: normal;
  font-weight: 300;
  color: var(--gold);
}

.sidebar__brand-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-quiet);
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar__section { display: flex; flex-direction: column; gap: var(--s-1); }

.sidebar__section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  padding: 0 var(--s-3);
  margin-bottom: var(--s-2);
  font-weight: 500;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  text-decoration: none;
  font-weight: 450;
  cursor: pointer;
  position: relative;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item--active {
  background: var(--ink);
  color: var(--surface);
}

.nav-item--active .nav-item__count {
  background: rgba(255, 255, 255, 0.15);
  color: var(--surface);
}

.nav-item__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item__label { flex: 1; }

.nav-item__count {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  color: var(--ink-mute);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  letter-spacing: -0.02em;
}

/* "soon" nav items — visible but inert (shows the full vision) */
.nav-item--soon { opacity: 0.45; cursor: default; }
.nav-item--soon:hover { background: transparent; color: var(--ink-soft); }
.nav-soon {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}

.sidebar__footer {
  margin-top: auto;
  padding: var(--s-3);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--gold-soft), var(--gold-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--surface);
  font-weight: 500;
  flex-shrink: 0;
}

.avatar--lg { width: 40px; height: 40px; font-size: 16px; }
.avatar--xl { width: 56px; height: 56px; font-size: 22px; }

.sidebar__user-meta { line-height: 1.3; min-width: 0; }
.sidebar__user-name {
  font-size: var(--text-sm);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  font-size: var(--text-2xs);
  color: var(--ink-quiet);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ── Main content ─────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--s-8);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(250, 248, 244, 0.85);
}

.topbar__left { display: flex; align-items: center; gap: var(--s-6); }
.topbar__right { display: flex; align-items: center; gap: var(--s-3); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--ink-quiet);
}

.breadcrumb__sep { opacity: 0.5; }
.breadcrumb__current { color: var(--ink); }

.cmdk-trigger {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 10px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink-quiet);
  font-size: var(--text-xs);
  cursor: pointer;
  min-width: 240px;
  transition: border-color var(--dur-fast);
}

.cmdk-trigger:hover { border-color: var(--line-strong); }

.cmdk-trigger__kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-mute);
}

/* ── Content padding ──────────────────────── */
.content { padding: var(--s-8); flex: 1; overflow: auto; }
.content--flush { padding: 0; }

/* ── Page header ──────────────────────────── */
.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: var(--s-10);
  gap: var(--s-8);
}

.page-header__title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
  margin: 0;
  font-feature-settings: "ss01" on;
}

.page-header__title em {
  font-style: normal;
  font-weight: 300;
  color: var(--gold);
}

.page-header__sub {
  margin-top: var(--s-3);
  color: var(--ink-mute);
  font-size: var(--text-sm);
  max-width: 56ch;
}

.page-header__num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-quiet);
  letter-spacing: 0.12em;
  margin-bottom: var(--s-3);
}

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn--primary { background: var(--ink); color: var(--surface); }
.btn--primary:hover { background: #000; transform: translateY(-1px); }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }

.btn--gold { background: var(--gold); color: var(--surface); }
.btn--gold:hover { background: var(--gold-deep); }

.btn--danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn--danger:hover { background: var(--danger-tint); border-color: var(--danger); }

.btn--success { background: var(--success); color: var(--surface); }
.btn--success:hover { background: #3a4a31; transform: translateY(-1px); }

.btn--icon { padding: 8px; min-width: 32px; }

.btn--lg { padding: 12px 20px; font-size: var(--text-md); }
.btn--sm { padding: 5px 10px; font-size: var(--text-xs); }

/* ── Cards ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.card__header {
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

.card__body { padding: var(--s-6); }

/* ── KPI tiles ────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}

.kpi {
  padding: var(--s-6) var(--s-6) var(--s-5);
  border-right: 1px solid var(--line);
  position: relative;
  transition: background var(--dur-base);
}

.kpi:last-child { border-right: none; }
.kpi:hover { background: var(--surface-2); }

.kpi__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  font-weight: 500;
  margin-bottom: var(--s-4);
}

.kpi__value {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}

.kpi__value sup {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0;
  top: -1em;
}

.kpi__delta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  margin-top: var(--s-3);
  letter-spacing: 0;
}

.kpi__delta--up    { color: var(--success); }
.kpi__delta--down  { color: var(--danger); }
.kpi__delta--flat  { color: var(--ink-quiet); }

.kpi__spark {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  opacity: 0.6;
  pointer-events: none;
}

/* ── Tags / Pills ─────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--ink-mute);
  background: var(--surface);
  font-weight: 500;
  text-transform: uppercase;
}

.tag--gold   { background: var(--gold-tint); color: var(--gold-deep); border-color: var(--gold-soft); }
.tag--hot    { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tag--success{ background: var(--success-tint); color: var(--success); border-color: rgba(74, 93, 63, 0.3); }
.tag--danger { background: var(--danger-tint); color: var(--danger); border-color: rgba(139, 58, 46, 0.3); }
.tag--info   { background: var(--info-tint); color: var(--info); border-color: rgba(74, 84, 102, 0.3); }
.tag--ghost  { background: transparent; }

/* ── Pillar tag (special) ─────────────────── */
.pillar-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--surface);
}

.pillar-tag--active { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ── Score dial ───────────────────────────── */
.score-dial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 64px;
  height: 64px;
}

.score-dial__num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.02em;
  position: relative;
  z-index: 2;
  line-height: 1;
}

.score-dial__num em {
  font-size: var(--text-xs);
  color: var(--ink-quiet);
  font-style: normal;
  font-family: var(--font-mono);
  margin-left: 1px;
}

.score-dial svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.score-dial__track { stroke: var(--line); fill: none; }
.score-dial__fill  { stroke: var(--ink); fill: none; transition: stroke-dashoffset var(--dur-slow) var(--ease-out); }
.score-dial--warm .score-dial__fill { stroke: var(--gold); }
.score-dial--cool .score-dial__fill { stroke: var(--ink-quiet); }

/* Score dial inverted (on dark surfaces) */
.call-brief--current .score-dial__num,
.summary-banner .score-dial__num { color: var(--surface); }
.call-brief--current .score-dial__num em,
.summary-banner .score-dial__num em { color: rgba(255,255,255,0.5); }
.call-brief--current .score-dial__track,
.summary-banner .score-dial__track { stroke: rgba(255,255,255,0.15); }
.call-brief--current .score-dial__fill,
.summary-banner .score-dial__fill { stroke: var(--gold-soft); }

/* ── Status dot ───────────────────────────── */
.dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  display: inline-block;
}
.dot--hot   { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.dot--warm  { background: var(--ink-mute); }
.dot--cool  { background: var(--ink-faint); }
.dot--live  {
  background: #46BB7D;
  box-shadow: 0 0 0 3px rgba(70, 187, 125, 0.18);
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(70, 187, 125, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(70, 187, 125, 0.08); }
}

/* ── Tables ───────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  font-weight: 500;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.table td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.table tr { transition: background var(--dur-fast); }
.table tr:hover td { background: var(--surface-2); cursor: pointer; }
.table tr:last-child td { border-bottom: none; }

/* ── Inputs ───────────────────────────────── */
.input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast);
}

.input:focus {
  outline: none;
  border-color: var(--ink);
}

.input::placeholder { color: var(--ink-quiet); }

.input-group { display: flex; flex-direction: column; gap: 6px; }

/* ── Filters bar ──────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  flex-wrap: wrap;
}

.filter-chip {
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--dur-fast);
}

.filter-chip:hover { background: var(--surface-2); }
.filter-chip--active { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ── Divider with label ───────────────────── */
.divider-label {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin: var(--s-10) 0 var(--s-6);
}

.divider-label__line {
  height: 1px;
  background: var(--line);
  flex: 1;
}

.divider-label__text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* ── Conversation bubbles ─────────────────── */
.bubble {
  max-width: 70%;
  padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm);
  line-height: 1.55;
  border-radius: var(--r-lg);
}

.bubble--ai {
  background: var(--surface-2);
  color: var(--ink);
  border-bottom-left-radius: 2px;
  align-self: flex-start;
}

.bubble--lead {
  background: var(--ink);
  color: var(--surface);
  border-bottom-right-radius: 2px;
  align-self: flex-end;
}

.bubble__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-quiet);
  margin-top: 4px;
  letter-spacing: 0.04em;
}

.bubble--lead + .bubble__meta { text-align: right; }

/* ── Lead card (large) ────────────────────── */
.lead-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--s-8);
  transition: border-color var(--dur-base), transform var(--dur-base) var(--ease-out);
}

.lead-card:hover { border-color: var(--ink); }

.lead-card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.lead-card__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
}

.lead-card__handle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-quiet);
  letter-spacing: 0;
}

.lead-card__meta {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px var(--s-4);
  font-size: var(--text-sm);
  margin-bottom: var(--s-5);
}

.lead-card__meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  font-weight: 500;
  align-self: center;
}

.lead-card__meta dd {
  margin: 0;
  color: var(--ink);
}

.lead-card__why {
  background: var(--surface-2);
  border-left: 2px solid var(--gold);
  padding: var(--s-4) var(--s-5);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin-top: var(--s-5);
}

.lead-card__why-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 500;
  margin-bottom: 6px;
}

.lead-card__why ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lead-card__why li {
  font-size: var(--text-sm);
  color: var(--ink);
  padding-left: var(--s-4);
  position: relative;
}

.lead-card__why li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--gold);
}

.lead-card__actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-2);
  border-left: 1px solid var(--line);
  padding-left: var(--s-6);
}

.lead-card__action-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }

/* ── Theme page card ──────────────────────── */
.tpage-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  display: grid;
  grid-template-columns: 36px 1fr auto auto auto auto;
  gap: var(--s-4);
  align-items: center;
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast), background var(--dur-fast);
  cursor: pointer;
}

.tpage-card:hover { border-color: var(--ink); }
.tpage-card--selected { background: var(--surface-2); border-color: var(--ink); }

.tpage-card__star {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-faint);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast);
}

.tpage-card__star--on { color: var(--gold); }
.tpage-card__star:hover { color: var(--gold); }

.tpage-card__handle {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink);
}

.tpage-card__followers {
  font-family: var(--font-mono);
  color: var(--ink-mute);
  font-size: var(--text-xs);
}

.tpage-card__price {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink);
  letter-spacing: -0.01em;
}

.tpage-card__audit {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--r-sm);
  letter-spacing: 0;
}

.tpage-card__audit--high { background: var(--success-tint); color: var(--success); }
.tpage-card__audit--mid  { background: var(--gold-tint); color: var(--gold-deep); }
.tpage-card__audit--low  { background: var(--danger-tint); color: var(--danger); }

/* ── Creative tile ────────────────────────── */
.creative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-4);
}

.creative-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base);
}

.creative-tile:hover { transform: translateY(-2px); border-color: var(--ink); }
.creative-tile--add {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.creative-tile--add:hover { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }

.creative-tile__thumb {
  aspect-ratio: 4/5;
  background: linear-gradient(135deg, #2C2620, #4D453C);
  position: relative;
  overflow: hidden;
}

.creative-tile__thumb--reel {
  background:
    radial-gradient(circle at 30% 40%, rgba(184, 145, 90, 0.4) 0%, transparent 50%),
    linear-gradient(135deg, #2C2620, #4D453C);
}

.creative-tile__thumb--carousel {
  background:
    radial-gradient(circle at 70% 60%, rgba(184, 145, 90, 0.3) 0%, transparent 50%),
    linear-gradient(135deg, #1A1814, #2C2620);
}

.creative-tile__thumb--static {
  background:
    radial-gradient(circle at 50% 50%, rgba(212, 181, 135, 0.3) 0%, transparent 60%),
    linear-gradient(135deg, #4D453C, #6B6259);
}

.creative-tile__play {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
}

.creative-tile__angle {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  font-style: normal;
}

.creative-tile__meta {
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
}

.creative-tile__hook {
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 var(--s-1);
  font-size: var(--text-sm);
  line-height: 1.3;
}

.creative-tile__stats {
  font-family: var(--font-mono);
  color: var(--ink-quiet);
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* ── Modal / overlay ──────────────────────── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-8);
  animation: fadein var(--dur-base) var(--ease-out);
}

.modal-bg--open { display: flex; }

.modal {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
  animation: slidein var(--dur-base) var(--ease-out);
}

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cmd-K palette ────────────────────────── */
.cmdk {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  max-width: 560px;
  width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-popover);
  animation: cmdk-in var(--dur-base) var(--ease-out);
}

@keyframes cmdk-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cmdk__input {
  width: 100%;
  border: none;
  background: transparent;
  padding: var(--s-5) var(--s-6);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--ink);
  outline: none;
  border-bottom: 1px solid var(--line);
}

.cmdk__input::placeholder { color: var(--ink-quiet); font-style: normal; }

.cmdk__list { padding: var(--s-2); max-height: 320px; overflow: auto; }
.cmdk__group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  padding: var(--s-3) var(--s-3) var(--s-2);
  font-weight: 500;
}

.cmdk__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--ink);
}

.nav-item, a.nav-item { text-decoration: none; }

.cmdk__item:hover, .cmdk__item--active { background: var(--surface-2); }
.cmdk__item-icon { color: var(--ink-mute); }
.cmdk__item-shortcut {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-quiet);
  letter-spacing: 0.06em;
}

/* ── Empty states ─────────────────────────── */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-16) var(--s-6);
  text-align: center;
  gap: var(--s-3);
}

.empty__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  margin-bottom: var(--s-2);
}

.empty__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--ink);
  margin: 0;
}

.empty__sub { color: var(--ink-mute); font-size: var(--text-sm); max-width: 36ch; }

/* ── Reveal on load (subtle) ──────────────── */
.reveal { opacity: 0; transform: translateY(8px); animation: reveal var(--dur-slow) var(--ease-out) forwards; }
.reveal-1 { animation-delay: 40ms; }
.reveal-2 { animation-delay: 100ms; }
.reveal-3 { animation-delay: 160ms; }
.reveal-4 { animation-delay: 220ms; }
.reveal-5 { animation-delay: 280ms; }
.reveal-6 { animation-delay: 340ms; }

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Utils ────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.gap-8 { gap: var(--s-8); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.text-mute { color: var(--ink-mute); }
.text-quiet { color: var(--ink-quiet); }
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }
.italic { font-style: normal; }
.font-light { font-weight: 300; }
.font-medium { font-weight: 500; }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.06em; }
.tracking-wider { letter-spacing: 0.14em; }
.w-full { width: 100%; }

/* ============================================
   ADS ANALYTICS — funnel, metrics, insights
   ============================================ */

/* Connection banner */
.conn-banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  background: var(--gold-tint);
  border: 1px solid var(--gold-soft);
  border-radius: var(--r-md);
  margin-bottom: var(--s-6);
  font-size: var(--text-sm);
}
.conn-banner__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.conn-banner__text { color: var(--ink-soft); }
.conn-banner__text strong { color: var(--ink); }
.conn-banner__cta { margin-left: auto; }

/* Cost funnel — horizontal bars that taper */
.funnel { display: flex; flex-direction: column; gap: var(--s-2); }
.funnel-row {
  display: grid;
  grid-template-columns: 170px 1fr 130px;
  align-items: center;
  gap: var(--s-4);
}
.funnel-row__label { display: flex; flex-direction: column; gap: 2px; }
.funnel-row__stage { font-size: var(--text-sm); font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.funnel-row__count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-quiet); }
.funnel-row__bar-wrap { position: relative; height: 38px; display: flex; align-items: center; }
.funnel-row__bar {
  height: 100%;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  padding: 0 var(--s-4);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  transition: width 700ms var(--ease-out);
  min-width: 60px;
}
.funnel-row__cost { text-align: right; }
.funnel-row__cost-val { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; color: var(--ink); letter-spacing: -0.01em; }
.funnel-row__cost-lbl { font-family: var(--font-mono); font-size: 10px; color: var(--ink-quiet); letter-spacing: 0.04em; }
.funnel-row__drop {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint);
  text-align: center; padding: 2px 0;
}
.funnel-meta-tag {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em;
  padding: 1px 5px; border-radius: 3px; text-transform: uppercase;
}
.funnel-meta-tag--api { background: #E7EFFF; color: #0866FF; }
.funnel-meta-tag--calc { background: var(--surface-3); color: var(--ink-mute); }

/* Metric cell (for campaign table) */
.metric { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: -0.01em; }
.metric--good { color: var(--success); }
.metric--warn { color: var(--gold-deep); }
.metric--bad  { color: var(--danger); }

/* Insight cards */
.insight-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }
.insight {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  background: var(--surface);
  border-left-width: 3px;
}
.insight--good { border-left-color: var(--success); }
.insight--bad  { border-left-color: var(--danger); }
.insight--warn { border-left-color: var(--gold); }
.insight__head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.insight__icon { flex-shrink: 0; }
.insight--good .insight__icon { color: var(--success); }
.insight--bad  .insight__icon { color: var(--danger); }
.insight--warn .insight__icon { color: var(--gold-deep); }
.insight__title { font-family: var(--font-display); font-size: var(--text-md); font-weight: 500; letter-spacing: -0.01em; }
.insight__body { font-size: var(--text-sm); color: var(--ink-soft); line-height: 1.5; margin-bottom: var(--s-4); }
.insight__action {
  font-family: var(--font-mono); font-size: var(--text-xs);
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); padding: 5px 10px; border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; transition: all var(--dur-fast);
}
.insight__action:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* Breakdown bar (targeting) */
.bd-row {
  display: grid;
  grid-template-columns: 120px 1fr 64px;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line-soft);
}
.bd-row:last-child { border-bottom: none; }
.bd-row__label { font-size: var(--text-sm); color: var(--ink); font-weight: 450; }
.bd-row__track { background: var(--surface-2); height: 8px; border-radius: 4px; overflow: hidden; }
.bd-row__fill { height: 100%; background: var(--ink); border-radius: 4px; transition: width 700ms var(--ease-out); }
.bd-row__fill--gold { background: var(--gold); }
.bd-row__val { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-mute); text-align: right; }

/* Audience card */
.aud-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-3) var(--s-4);
  align-items: center;
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast);
}
.aud-card:hover { border-color: var(--ink); }
.aud-card__name { font-size: var(--text-sm); font-weight: 500; color: var(--ink); }
.aud-card__size { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-quiet); margin-top: 2px; }
.aud-card__suggested { font-size: var(--text-xs); color: var(--ink-mute); grid-column: 1 / -1; padding-top: var(--s-2); border-top: 1px solid var(--line-soft); }
.aud-card__suggested strong { color: var(--ink); font-weight: 500; }

/* Math console */
.math-grid { display: grid; grid-template-columns: 360px 1fr; gap: var(--s-6); }
.math-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}
.math-slider-row { margin-bottom: var(--s-6); }
.math-slider-row__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s-3); }
.math-slider-row__label { font-size: var(--text-sm); color: var(--ink-soft); }
.math-slider-row__value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; color: var(--ink); }
.math-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: var(--surface-3); outline: none;
}
.math-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ink); cursor: pointer; border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.math-result {
  background: var(--ink); color: var(--surface);
  border-radius: var(--r-lg); padding: var(--s-8);
  position: relative; overflow: hidden;
}
.math-result::before {
  content: ""; position: absolute; top: -60px; right: -40px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(184,145,90,0.28), transparent 70%);
}
.math-out-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-6); position: relative; }
.math-out__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.5); margin-bottom: var(--s-2); }
.math-out__value { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 400; letter-spacing: -0.02em; line-height: 1; }
.math-out__value em { color: var(--gold-soft); font-weight: 300; }
.math-out__sub { font-size: var(--text-xs); color: rgba(255,255,255,0.55); margin-top: var(--s-2); }

/* Projection table */
.proj-tab { display: flex; gap: 4px; }

/* ============================================
   COMMAND CENTER — funnel, inbox, triage
   ============================================ */

/* Daily insight banner (AI) */
.insight-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-5) var(--s-6);
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-8);
  position: relative;
  overflow: hidden;
}
.insight-banner::before {
  content: ""; position: absolute; top: -60px; right: -30px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(184,145,90,0.28), transparent 70%);
}
.insight-banner__icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
  color: var(--gold-soft); position: relative; flex-shrink: 0;
}
.insight-banner__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-soft); margin-bottom: 4px; }
.insight-banner__headline { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; letter-spacing: -0.01em; position: relative; }
.insight-banner__detail { font-size: var(--text-sm); color: rgba(255,255,255,0.65); margin-top: 4px; position: relative; max-width: min(70ch, 100%); }
.insight-banner > div { min-width: 0; }
.insight-banner__actions { display: flex; flex-direction: column; gap: 6px; position: relative; }
.insight-action {
  font-family: var(--font-mono); font-size: var(--text-xs); white-space: nowrap;
  color: var(--surface); background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14); border-radius: var(--r-sm);
  padding: 6px 10px; cursor: pointer; text-align: left; transition: background var(--dur-fast);
}
.insight-action:hover { background: rgba(255,255,255,0.16); }

/* Vertical funnel — one row per stage */
.fstage {
  display: grid;
  grid-template-columns: 40px 1fr 220px 150px;
  align-items: stretch;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  position: relative;
  transition: border-color var(--dur-base), transform var(--dur-base) var(--ease-out);
}
.fstage:hover { border-color: var(--line-strong); }
.fstage--bottleneck { border-color: var(--danger); border-width: 1.5px; background: linear-gradient(90deg, var(--danger-tint) 0%, var(--surface) 22%); }
.fstage--money { border-left: 3px solid var(--gold); }
.fstage--close { border-left: 3px solid var(--success); }

.fstage__num {
  font-family: var(--font-mono); font-size: var(--text-lg); font-weight: 500;
  color: var(--ink-quiet); display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border-radius: var(--r-md);
}
.fstage--bottleneck .fstage__num { background: var(--danger); color: var(--surface); }

.fstage__main { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.fstage__label { font-family: var(--font-display); font-size: var(--text-md); font-weight: 500; letter-spacing: -0.01em; display: flex; align-items: center; gap: var(--s-2); }
.fstage__what { font-size: var(--text-sm); color: var(--ink-mute); margin-top: 2px; }
.fstage__count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-quiet); margin-top: 6px; }

.fstage__metric { display: flex; flex-direction: column; justify-content: center; }
.fstage__metric-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-quiet); margin-bottom: 4px; }
.fstage__metric-val { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 500; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 6px; }
.fstage__goal { font-family: var(--font-mono); font-size: var(--text-xs); }
.fstage__goal--ok { color: var(--success); }
.fstage__goal--off { color: var(--danger); }
.fstage__bar { height: 5px; border-radius: 3px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.fstage__bar-fill { height: 100%; border-radius: 3px; background: var(--ink); transition: width 700ms var(--ease-out); }
.fstage--bottleneck .fstage__bar-fill { background: var(--danger); }

.fstage__conv { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; text-align: right; }
.fstage__conv-val { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; color: var(--ink); }
.fstage__conv-lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-quiet); }

.fstage-arrow { display: flex; justify-content: center; padding: 2px 0; color: var(--ink-faint); }
.fstage-arrow span { font-family: var(--font-mono); font-size: 10px; color: var(--ink-quiet); }

.emphasis-tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; padding: 1px 6px; border-radius: var(--r-sm); }
.emphasis-tag--money { background: var(--gold-tint); color: var(--gold-deep); }
.emphasis-tag--close { background: var(--success-tint); color: var(--success); }
.emphasis-tag--bottleneck { background: var(--danger); color: var(--surface); }

/* ── Inbox split view ─────────────────────── */
.inbox-shell { display: grid; grid-template-columns: 340px 1fr 300px; height: calc(100vh - 61px); overflow: hidden; }
.inbox-list { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inbox-list__head { padding: var(--s-5) var(--s-5) var(--s-3); border-bottom: 1px solid var(--line); background: var(--bg); }
.inbox-list__body { flex: 1; overflow-y: auto; }
.ilead { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line-soft); cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s-3); transition: background var(--dur-fast); }
.ilead:hover { background: var(--surface-2); }
.ilead--active { background: var(--surface-2); border-left: 2px solid var(--ink); padding-left: calc(var(--s-5) - 2px); }
.ilead__name { font-weight: 500; font-size: var(--text-sm); color: var(--ink); display: flex; align-items: center; gap: 6px; }
.ilead__time { font-family: var(--font-mono); font-size: 10px; color: var(--ink-quiet); }
.ilead__preview { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ilead__meta { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; margin-top: 4px; }

.score-pill { font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: var(--r-full); }
.score-pill--hot  { background: var(--ink); color: var(--surface); }
.score-pill--warm { background: var(--gold-tint); color: var(--gold-deep); }
.score-pill--cold { background: var(--surface-3); color: var(--ink-mute); }

.inbox-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.inbox-main__head { padding: var(--s-4) var(--s-6); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.inbox-main__body { flex: 1; overflow-y: auto; padding: var(--s-6) var(--s-8); display: flex; flex-direction: column; gap: var(--s-2); }
.inbox-main__footer { padding: var(--s-4) var(--s-6); border-top: 1px solid var(--line); background: var(--surface); }

/* copilot suggestion box */
.copilot {
  border: 1px solid var(--gold-soft); background: var(--gold-tint);
  border-radius: var(--r-md); padding: var(--s-4); margin-bottom: var(--s-3);
}
.copilot__label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: var(--s-2); display: flex; align-items: center; gap: 6px; }
.copilot__text { font-size: var(--text-sm); color: var(--ink); line-height: 1.5; }
.copilot__why { font-size: var(--text-xs); color: var(--ink-mute); margin-top: var(--s-2); font-style: normal; }
.copilot__rules { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--s-3); }
.copilot__rule { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.04em; padding: 2px 6px; border-radius: var(--r-sm); background: rgba(255,255,255,0.6); color: var(--gold-deep); }
.copilot__actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); }

/* triage context panel */
.triage { padding: var(--s-6); overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); }
.triage__score-wrap { text-align: center; padding: var(--s-5); background: var(--surface-2); border-radius: var(--r-md); margin-bottom: var(--s-6); }
.triage__axes { display: flex; flex-direction: column; gap: var(--s-3); }
.triage__axis-row { }
.triage__axis-head { display: flex; justify-content: space-between; font-size: var(--text-xs); margin-bottom: 4px; }
.triage__axis-track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.triage__axis-fill { height: 100%; background: var(--ink); border-radius: 3px; transition: width 600ms var(--ease-out); }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* ── Focus ring ───────────────────────────── */
button:focus-visible,
a:focus-visible,
.nav-item:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ============================================
   RESPONSIVE — phone & tablet
   ============================================ */

/* Responsive grid utility classes (used in HTML instead of inline grids) */
.grid-2       { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6); }
.grid-3       { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-6); }
.grid-split   { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--s-6); }
.grid-split-l { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s-6); }
.ads-snapshot-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-6); }
@media (max-width: 1024px) { .ads-snapshot-grid { grid-template-columns: repeat(3, 1fr); gap: var(--s-5); row-gap: var(--s-6); } }
@media (max-width: 560px)  { .ads-snapshot-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-5); } }

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.sidebar__scrim { display: none; }

/* Tables inside cards scroll horizontally instead of breaking layout */
.card__body:has(.table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { min-width: 640px; }

/* ── Tablet (≤1024px) ─────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: none; }
  .kpi:nth-child(1), .kpi:nth-child(2) { border-bottom: 1px solid var(--line); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-split, .grid-split-l { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  /* Conversations: not enough room for 3 zones → show the chat only */
  .conv-shell { grid-template-columns: 1fr; height: auto; }
  .conv-list { display: none; }
  .conv-aside { display: none; }
  /* Math console stacks */
  .math-grid { grid-template-columns: 1fr; }
}

/* ── Mobile (≤768px) ──────────────────────── */
@media (max-width: 768px) {
  /* Off-canvas sidebar */
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 270px; max-width: 82vw; height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
    z-index: 70; box-shadow: var(--shadow-lg);
    padding: var(--s-6) var(--s-4);
  }
  .sidebar--open { transform: translateX(0); }
  /* full labels inside the drawer */
  .nav-item__label, .sidebar__section-label,
  .sidebar__user-meta, .sidebar__brand-tag { display: revert; }
  .nav-item { min-height: 44px; }   /* touch target */

  .sidebar__scrim {
    display: block; position: fixed; inset: 0;
    background: var(--overlay); z-index: 65; opacity: 0;
    pointer-events: none; transition: opacity var(--dur-base);
  }
  .sidebar__scrim--on { opacity: 1; pointer-events: auto; }

  .nav-toggle { display: inline-flex; }

  /* Topbar: hamburger + compact search */
  .topbar { padding: var(--s-3) var(--s-4); gap: var(--s-3); }
  .cmdk-trigger { min-width: 0; flex: 1; }
  .cmdk-trigger span:not(.cmdk-trigger__kbd) { display: none; }
  .cmdk-trigger__kbd { display: none; }
  .breadcrumb { display: none; }

  .content { padding: var(--s-4); max-width: 100%; }
  .main { min-width: 0; max-width: 100vw; overflow-x: hidden; }

  /* Constrain flex children so wide text/maxwidths don't overflow */
  .page-header > div { width: 100%; min-width: 0; }
  .page-header__sub, .page-header__title { max-width: 100%; }
  .conn-banner { flex-wrap: wrap; }
  .conn-banner__cta { margin-left: 0; }

  /* Everything stacks to 1 column */
  .grid-2, .grid-3, .grid-split, .grid-split-l { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }   /* 2×2 for KPIs */
  .summary-banner { grid-template-columns: 1fr 1fr; }
  /* Shrink big numbers so they fit 2-up without clipping */
  .kpi__value { font-size: var(--text-2xl); }
  .kpi { padding: var(--s-5) var(--s-4) var(--s-4); min-width: 0; }
  .kpi__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .summary-stat__value { font-size: var(--text-2xl); }
  #adsSnapshot .display { font-size: var(--text-2xl) !important; }

  /* Page header: title above actions, fluid size */
  .page-header { flex-direction: column; align-items: flex-start; gap: var(--s-4); margin-bottom: var(--s-6); }
  .page-header__title { font-size: clamp(1.75rem, 1.3rem + 4vw, 2.25rem); }
  .page-header__sub { font-size: var(--text-sm); }

  /* Lead cards stack */
  .lead-card { grid-template-columns: 1fr; }
  .lead-card__actions { border-left: none; padding-left: 0; padding-top: var(--s-5); border-top: 1px solid var(--line); }

  /* Conversations → single pane (the chat), full width */
  .conv-shell { grid-template-columns: 1fr; height: auto; }
  .conv-list { border-right: none; max-height: 38vh; }
  .conv-main { min-height: 60vh; }
  .conv-aside { display: none; }

  /* Math console */
  .math-out-grid { grid-template-columns: 1fr 1fr; gap: var(--s-5); }
  .math-result { padding: var(--s-6); }

  /* Funnel rows: stack label/bar/cost */
  .funnel-row { grid-template-columns: 1fr; gap: var(--s-2); }
  .funnel-row__cost { text-align: left; }
  .bd-row { grid-template-columns: 90px 1fr 70px; }

  /* Agenda hero scales down */
  .agenda-hero { padding: var(--s-8) var(--s-5); }
  .agenda-hero__title { font-size: clamp(2rem, 1.5rem + 6vw, 3rem); }
  .agenda-hero__count { font-size: var(--text-5xl); }
  .agenda-hero__stats { flex-wrap: wrap; gap: var(--s-5) var(--s-8); }
  .call-brief__head { grid-template-columns: 1fr; gap: var(--s-3); }
  .call-brief__body { grid-template-columns: 1fr; gap: var(--s-6); }
  .brief-side { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: var(--s-5); }

  /* Tap targets */
  .btn { min-height: 40px; }
  .filter-chip { min-height: 34px; }

  /* Schedule form (ads) stacks */
  .schedule-form { grid-template-columns: 1fr; }
}

/* ── Small phones (≤400px) ────────────────── */
@media (max-width: 400px) {
  .summary-banner { grid-template-columns: 1fr; }
  .math-out-grid { grid-template-columns: 1fr; }
}
