/* 🦉 O2 Dashboard · premium theme ("VRL language")
   Linked right after each page's own <style>, so it re-tokenises the page and the
   phone shell (linked after it) still has the last word on phones.
   - Type: Archivo (numbers, titles) · Manrope (text) · JetBrains Mono (labels)
   - Surfaces: cool grey page with a faint dot field; white cards lifted by a soft
     shadow RING instead of a border; navy feature surfaces with a dot texture
   - Density: 14px radius, tighter gaps, small mono labels, big tabular numbers
   The agency accent stays the single brand colour. */

:root {
  --fd: 'Archivo', system-ui, -apple-system, sans-serif;
  --ft: 'Manrope', system-ui, -apple-system, sans-serif;
  --fm: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --bg: #F3F5F9;
  --card: #FFFFFF;
  --soft: #F6F8FB;
  --soft-2: #EEF1F6;
  --border: #E4E7EC;
  --border-strong: #D1D5DD;
  --ink: #0B1532;
  --ink-2: #2A3148;
  --muted: #4C5260;
  --muted-2: #6D7484;
  --good: #08783D;
  --good-soft: #ECFDF3;
  --good-line: #BBF7D0;
  --bad: #C81E1E;
  --bad-soft: #FEF2F2;
  --bad-line: #FECACA;
  --warn: #B45309;
  --warn-soft: #FFFBEB;
  --warn-line: #FDE68A;
  --radius: 14px;
  --radius-sm: 10px;
  --pad: 16px;
  --navy: #010F2D;
  --navy-2: #0A1F47;
  --navy-3: #163063;
  --hero: #0A1F47;
  --hero-2: #010F2D;
  --on-hero: #FFFFFF;
  --dot: rgba(1, 15, 45, 0.045);
  --ring: 0 0 0 1px rgba(1, 15, 45, .07), 0 1px 2px rgba(1, 15, 45, .05), 0 14px 30px -22px rgba(1, 15, 45, .30);
  --ring-hover: 0 0 0 1px rgba(1, 15, 45, .16), 0 2px 4px rgba(1, 15, 45, .06), 0 18px 34px -20px rgba(1, 15, 45, .38);
  --shadow-card: var(--ring);
  --navy-surface: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px) 0 0 / 14px 14px, linear-gradient(145deg, var(--navy-3), var(--navy-2) 42%, var(--navy) 88%);
  --navy-ring: 0 0 0 1px var(--navy), inset 0 1px 0 rgba(226, 239, 255, .10), 0 16px 32px -20px rgba(1, 15, 45, .7);
}
[data-theme="dark"] {
  --bg: #070D1F;
  --card: #0E1630;
  --soft: #111A36;
  --soft-2: #16203F;
  --border: #1E2A4A;
  --border-strong: #2A3658;
  --ink: #F2F4F8;
  --ink-2: #D5DBE6;
  --muted: #A0A9BA;
  --muted-2: #8992A6;
  --good: #3FCF83;
  --good-soft: rgba(63, 207, 131, .12);
  --good-line: rgba(63, 207, 131, .28);
  --bad: #FF7A6B;
  --bad-soft: rgba(255, 122, 107, .12);
  --bad-line: rgba(255, 122, 107, .3);
  --warn: #F2B544;
  --warn-soft: rgba(242, 181, 68, .12);
  --warn-line: rgba(242, 181, 68, .3);
  --hero: #12245A;
  --hero-2: #081430;
  --dot: rgba(255, 255, 255, .035);
  --ring: 0 0 0 1px rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .3), 0 14px 30px -22px rgba(0, 0, 0, .7);
  --ring-hover: 0 0 0 1px rgba(255, 255, 255, .14), 0 2px 4px rgba(0, 0, 0, .3), 0 18px 34px -20px rgba(0, 0, 0, .8);
  --navy-ring: 0 0 0 1px rgba(255, 255, 255, .08), inset 0 1px 0 rgba(226, 239, 255, .08), 0 16px 32px -20px rgba(0, 0, 0, .8);
}

html { -webkit-font-smoothing: antialiased; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 18px 18px;
  font-family: var(--ft);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ===================== Client dashboard ===================== */
.app .canvas { padding-top: 18px; }
.app .card { border-color: transparent; box-shadow: var(--ring); border-radius: var(--radius); }
.app .card:hover { box-shadow: var(--ring-hover); }
.app .bento { gap: 12px; }
.app .card-title { font-family: var(--fd); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: var(--ink); }
.app .card-title small { font-family: var(--fm); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); font-weight: 500; }
.app .eyebrow { font-family: var(--fm); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }

/* Rail: quiet, tight, an active pill on a ring */
.app .rail { background: transparent; border-right: 1px solid var(--border); }
.app .brand-sub { font-family: var(--fm); font-size: 9.5px; letter-spacing: .16em; color: var(--muted-2); }
.app .nav-group-title { font-family: var(--fm); font-size: 9.5px; letter-spacing: .16em; color: var(--muted-2); }
.app .nav-item { font-family: var(--ft); font-size: 13.5px; font-weight: 600; color: var(--muted); border-radius: 10px; }
.app .nav-item:hover { background: rgba(1, 15, 45, .04); color: var(--ink); }
.app .nav-item.active { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--ring); }
[data-theme="dark"] .app .nav-item:hover { background: rgba(255, 255, 255, .04); }

/* Top bar */
.app .avatar { width: 34px; height: 34px; border-radius: 10px; font-family: var(--fd); font-size: 11.5px; box-shadow: 0 0 0 1px rgba(1, 15, 45, .08); }
.app .avatar.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.app .avatar.more { background: var(--card); box-shadow: var(--ring); }
.app .view-toggle { background: var(--card); border: 0; box-shadow: var(--ring); padding: 3px; }
.app .view-toggle button { font-family: var(--ft); font-weight: 700; font-size: 12px; }
.app .view-toggle button.active { background: linear-gradient(180deg, var(--navy-3), var(--navy)); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px var(--navy); }
.app .theme-toggle { border: 0; background: var(--card); box-shadow: var(--ring); border-radius: 12px; }
.ask-btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; border: 0; cursor: pointer; padding: 0 16px; border-radius: 9999px;
  font-family: var(--ft); font-size: 12.5px; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, var(--navy-3), var(--navy));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px var(--navy), 0 6px 14px -6px rgba(1, 15, 45, .6);
  transition: transform 140ms ease, filter 140ms ease;
}
.ask-btn:hover { filter: brightness(1.12); }
.ask-btn:active { transform: scale(0.98); }
.ask-btn svg { width: 15px; height: 15px; color: var(--accent); }
.ask-btn[hidden] { display: none; }
[data-theme="dark"] .ask-btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px rgba(255, 255, 255, .12), 0 6px 14px -6px rgba(0, 0, 0, .7); }
@media (min-width: 821px) { .app ~ .ai-fab, .ai-fab { display: none !important; } }

/* Account head: compact title row + sub line + range pills */
.app .client-head { align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.app .ch-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.app .client-name { font-family: var(--fd); font-weight: 800; font-size: clamp(24px, 2.3vw, 30px); letter-spacing: -0.025em; line-height: 1.1; margin: 0; }
.app .ch-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.app .client-meta { margin-top: 10px; gap: 6px; }
.app .client-meta + .client-meta { margin-top: 6px; }
.app .meta-chip { border: 0; background: var(--card); box-shadow: 0 0 0 1px rgba(1, 15, 45, .07); font-size: 11.5px; padding: 3px 10px; min-height: 26px; }
[data-theme="dark"] .app .meta-chip { box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 9999px;
  font-family: var(--fm); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--good); background: var(--good-soft); box-shadow: 0 0 0 1px var(--good-line);
}
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in oklab, currentColor, transparent 78%); animation: o2-live 2.4s ease-in-out infinite; }
.live-pill.sample { color: var(--warn); background: var(--warn-soft); box-shadow: 0 0 0 1px var(--warn-line); }
@keyframes o2-live { 50% { box-shadow: 0 0 0 6px transparent; } }
.app .head-actions { align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9999px; background: var(--card); box-shadow: var(--ring); }
.seg button { border: 0; background: none; cursor: pointer; padding: 7px 14px; border-radius: 9999px; font-family: var(--ft); font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .01em; min-height: 32px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: #fff; background: linear-gradient(180deg, var(--navy-3), var(--navy)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px var(--navy); }
[data-theme="dark"] .seg button[aria-pressed="true"] { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px rgba(255, 255, 255, .12); }
.app .head-actions .range-select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.app .btn-primary {
  min-height: 38px; padding: 0 16px; border-radius: 9999px; font-family: var(--ft); font-size: 12.5px; font-weight: 800;
  background: var(--card); color: var(--ink); box-shadow: var(--ring); border: 0;
}
.app .btn-primary:hover { box-shadow: var(--ring-hover); }

/* KPI cards */
.app .kpi { gap: 8px; padding: 14px 16px; min-height: 118px; }
.app .kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 26px; }
.app .kpi .label { font-family: var(--fm); font-size: 10px; letter-spacing: .12em; color: var(--muted-2); }
.app .kpi-spark { flex: 0 1 96px; min-width: 56px; height: 26px; color: var(--ink-2); }
.app .kpi-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.app .kpi .num { font-family: var(--fd); font-weight: 800; font-size: clamp(26px, 2vw, 30px); letter-spacing: -0.03em; line-height: 1; color: var(--ink); }
.app .kpi-say { font-size: 12px; color: var(--muted); line-height: 1.4; gap: 0; flex-wrap: wrap; }
.app .kpi-src { color: var(--muted-2); margin-left: 4px; }
.app .kpi-vs { display: none; }
.app .delta { font-family: var(--fm); font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 9999px; letter-spacing: 0; }
.app .delta.good { color: var(--good); background: var(--good-soft); box-shadow: 0 0 0 1px var(--good-line); }
.app .delta.bad { color: var(--bad); background: var(--bad-soft); box-shadow: 0 0 0 1px var(--bad-line); }
.app .delta.warn { color: var(--warn); background: var(--warn-soft); box-shadow: 0 0 0 1px var(--warn-line); }
.app .delta.flat { color: var(--muted); background: var(--soft); box-shadow: 0 0 0 1px var(--border); }

/* Feature surfaces: this week, top campaign, owner brief */
.app .this-week-hero, .app .card-dark, .app .insight-card.is-owner {
  background: var(--navy-surface); box-shadow: var(--navy-ring); border: 0; border-radius: var(--radius); color: var(--on-hero);
}
.app .this-week-hero { padding: 20px 22px; }
.app .this-week-hero h2 { font-family: var(--fd); font-weight: 800; letter-spacing: -0.02em; }
.app .week-eyebrow { font-family: var(--fm); font-size: 10px; letter-spacing: .14em; color: rgba(214, 226, 255, .72); }
.app .hero-detail { color: rgba(226, 235, 255, .82); }
.app .week-cta {
  border-radius: 9999px; font-family: var(--ft); font-weight: 800; border: 0;
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent-fill), #fff 10%), var(--accent-fill));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 0 0 1px color-mix(in oklab, var(--accent-fill), #000 20%), 0 8px 18px -8px color-mix(in oklab, var(--accent-fill), #000 30%);
}
.app .week-cta.secondary { background: rgba(255, 255, 255, .06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .16); color: #fff; }

/* What to know */
.app .alerts-bar.card { display: block; padding: 14px 16px 8px; margin-bottom: 12px; gap: 0; }
.app .ab-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.app .ab-head .card-title { margin: 0; }
.app .alerts-bar .alert {
  display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 12px; align-items: start;
  background: none; border: 0; border-radius: 0; padding: 10px 0; margin: 0; box-shadow: none; color: var(--ink-2); font-size: 13.5px; line-height: 1.45;
}
.app .alerts-bar .alert + .alert { border-top: 1px solid var(--border); }
.app .al-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.app .alert.success .al-dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.app .alerts-bar .alert .icon { display: none; }

/* Movers + pipeline + leads */
.app .movers-eyebrow { font-family: var(--fm); font-size: 10px; letter-spacing: .14em; color: var(--muted-2); }
.app .mover-chip { border: 0; box-shadow: var(--ring); border-radius: 12px; background: var(--card); }
.app .pipeline-tile { border: 0; box-shadow: 0 0 0 1px var(--border); border-radius: 12px; background: var(--soft); }
.app .pipeline-tile .label { font-family: var(--fm); font-size: 10px; letter-spacing: .12em; }
.app .pipeline-tile .num { font-family: var(--fd); font-weight: 800; }
.app .lead-row { border-radius: 12px; }
.app .lead-status-pill, .app .lead-source-chip { font-family: var(--fm); letter-spacing: .06em; }

/* Charts */
.app .chart-area { pointer-events: none; }
.app .grid-line { stroke: var(--border); stroke-dasharray: 2 4; }

/* Modals keep the language */
.modal { border: 0 !important; box-shadow: 0 0 0 1px rgba(1, 15, 45, .08), 0 40px 80px -20px rgba(1, 15, 45, .45) !important; }
.drill-title, .ai-title { font-family: var(--fd); letter-spacing: -0.02em; }

/* ===================== Command center ===================== */
#command-center .panel, #command-center .tile, #command-center .section, #command-center .auto-card {
  border-color: transparent; box-shadow: var(--ring); border-radius: var(--radius);
}
#command-center .tile.hero { background: var(--navy-surface); box-shadow: var(--navy-ring); }
#command-center .tile .value { font-family: var(--fd); font-weight: 800; letter-spacing: -0.03em; }
#command-center h1 { font-family: var(--fd); font-weight: 800; letter-spacing: -0.03em; }
#command-center .tabs { background: var(--card); border: 0; box-shadow: var(--ring); padding: 3px; }
#command-center .tab[aria-selected="true"] { background: linear-gradient(180deg, var(--navy-3), var(--navy)); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px var(--navy); }
#command-center .search input { border: 0; box-shadow: var(--ring); }
#command-center .btn.primary { background: linear-gradient(180deg, var(--navy-3), var(--navy)); border-color: transparent; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 0 0 1px var(--navy), 0 6px 14px -6px rgba(1, 15, 45, .6); }

/* ---------- Layout: numbers first, then this week beside what to know ---------- */
.app .kpi-band { margin-bottom: 12px; }
.app .feature-row { display: grid; gap: 12px; margin-bottom: 12px; }
.app .feature-row.two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: stretch; }
.app .feature-row > * { margin: 0 !important; min-width: 0; }
.app .feature-row.two .this-week-hero { display: flex; flex-direction: column; gap: 14px; }
.app .feature-row.two .this-week-hero > div:empty { display: none; }
.app .feature-row.two .week-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 8px; padding: 0; margin-top: auto; width: auto; }
.app .feature-row.two .week-actions .week-cta { width: auto; }
.app .feature-row.two .alerts-bar.card { max-height: 100%; overflow: auto; }
@media (max-width: 1100px) { .app .feature-row.two { grid-template-columns: minmax(0, 1fr); } }

/* Top bar stays one row */
.app .topbar { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; margin-bottom: 18px; }
.app .topbar .client-switch { flex: 1; min-width: 0; }
.app .topbar > :not(.client-switch) { flex: 0 0 auto; }

/* The sub line carries vertical + location; the descriptive chip row is phone-sheet only. */
@media (min-width: 821px) {
  .app .client-head .ch-sub + .client-meta { display: none; }
  .app .client-head .client-meta { margin-top: 10px; }
  .app .meta-chip { font-size: 11px; min-height: 24px; padding: 2px 9px; }
}
