:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f3f1ed;
  --border: #ebe7e1;
  --text: #1c1917;
  --text-2: #57534e;
  --muted: #8a837b;
  --brand: #9b1c1c;
  --brand-hover: #7f1414;
  --brand-ink: #ffffff;
  --brand-soft: #fcebea;
  --series: #b42323;
  --good: #15803d;
  --good-soft: #e5f6ea;
  --warn: #a16207;
  --warn-soft: #fef3d7;
  --bad: #c22b2b;
  --bad-soft: #fde7e7;
  --hot: #c2410c;
  --hot-soft: #ffedd5;
  --warm: #a16207;
  --warm-soft: #fef6d8;
  --cold: #2563eb;
  --cold-soft: #e8efff;
  --hero-1: #7a1212;
  --hero-2: #b3262b;
  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 6px 18px rgba(28, 25, 23, .05);
  --radius: 16px;
  --font: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12100f;
    --surface: #1c1917;
    --surface-2: #26211e;
    --border: #322b27;
    --text: #f5f2ee;
    --text-2: #d3ccc5;
    --muted: #9b928a;
    --brand: #f06868;
    --brand-hover: #f58585;
    --brand-ink: #1a0d0d;
    --brand-soft: #3a1a1a;
    --series: #ef6b6b;
    --good: #5ccf7c;
    --good-soft: #15301f;
    --warn: #f0b44c;
    --warn-soft: #33270f;
    --bad: #f07a7a;
    --bad-soft: #3a1a1d;
    --hot: #ff9a62;
    --hot-soft: #3a2014;
    --warm: #f2c75c;
    --warm-soft: #33290f;
    --cold: #8fb3e8;
    --cold-soft: #18253a;
    --hero-1: #5c0e0e;
    --hero-2: #8f1f22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12100f;
  --surface: #1c1917;
  --surface-2: #26211e;
  --border: #322b27;
  --text: #f5f2ee;
  --text-2: #d3ccc5;
  --muted: #9b928a;
  --brand: #f06868;
  --brand-hover: #f58585;
  --brand-ink: #1a0d0d;
  --brand-soft: #3a1a1a;
  --series: #ef6b6b;
  --good: #5ccf7c;
  --good-soft: #15301f;
  --warn: #f0b44c;
  --warn-soft: #33270f;
  --bad: #f07a7a;
  --bad-soft: #3a1a1d;
  --hot: #ff9a62;
  --hot-soft: #3a2014;
  --warm: #f2c75c;
  --warm-soft: #33290f;
  --cold: #8fb3e8;
  --cold-soft: #18253a;
  --hero-1: #5c0e0e;
  --hero-2: #8f1f22;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
svg.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #7b5cff, #5a3de6); color: #fff; font-weight: 800;
}
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count {
  margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 99px; text-align: center;
  background: var(--brand); color: var(--brand-ink); font-size: 12px; line-height: 20px;
}
.side-foot { margin-top: auto; display: flex; gap: 6px; padding: 8px; }

.main { min-width: 0; padding: 22px 28px 60px; }
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- pieces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card > header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card > header .hint { color: var(--muted); font-size: 12.5px; }
.card > header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-wide { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border);
  background: var(--surface); padding: 7px 13px; border-radius: 10px; cursor: pointer; font-weight: 600;
  font-size: 13px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.good { color: var(--good); }
.btn.bad { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.chip.hot { background: var(--hot-soft); color: var(--hot); }
.chip.warm { background: var(--warm-soft); color: var(--warm); }
.chip.cold { background: var(--cold-soft); color: var(--cold); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

.banner {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--warn); font-weight: 600; margin-bottom: 16px;
}
.banner a { color: inherit; text-decoration: underline; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi .foot { color: var(--muted); font-size: 12px; }
.kpi.attn { border-color: var(--brand); background: var(--brand-soft); }
.kpi.attn .value { color: var(--brand); }

/* funnel */
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 92px 1fr 64px; align-items: center; gap: 12px; }
.funnel-row .name { color: var(--text-2); font-weight: 600; font-size: 13px; }
.funnel-row .track { height: 22px; position: relative; }
.funnel-row .bar {
  height: 22px; background: var(--series); border-radius: 0 4px 4px 0; min-width: 2px;
}
.funnel-row .val { text-align: right; font-weight: 700; }
.funnel-row .val small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; line-height: 1.1; }

/* 14-day small multiples */
.minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mini h3 { font-size: 13px; color: var(--text-2); }
.mini .big { font-size: 22px; font-weight: 700; }
.mini .big small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.mini svg { display: block; width: 100%; height: 68px; margin-top: 6px; overflow: visible; }
.mini .base { stroke: var(--border); stroke-width: 1; }
.mini .axis-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }
.mini .col { fill: var(--series); }
.mini .hit { fill: transparent; cursor: default; }
.mini .hit:hover + .col, .mini g:hover .col { opacity: .75; }
.mini .axis { fill: var(--muted); font-size: 10.5px; }
.tip {
  position: fixed; z-index: 50; pointer-events: none; padding: 7px 10px; border-radius: 9px;
  background: var(--text); color: var(--surface); font-size: 12.5px; box-shadow: var(--shadow);
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; display: none;
}
.tip b { font-weight: 700; }

/* lists */
.list { display: flex; flex-direction: column; }
.list .row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.list .row:first-child { border-top: 0; padding-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .meta { color: var(--muted); font-size: 12.5px; }
.row .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }

.actor {
  width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--text-2);
}
.actor.hermes { background: var(--brand-soft); color: var(--brand); }
.actor.user { background: var(--good-soft); color: var(--good); }
.actor.lead { background: var(--hot-soft); color: var(--hot); }

/* table */
.table-wrap { overflow-x: auto; }
table.leads { width: 100%; border-collapse: collapse; }
.leads th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.leads td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.leads tr.click { cursor: pointer; }
.leads tr.click:hover td { background: var(--surface-2); }
.leads .lname { font-weight: 600; }
.leads .lsub { color: var(--muted); font-size: 12.5px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.input, select.input, textarea.input {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 7px 11px;
  min-width: 0;
}
.input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea.input { width: 100%; resize: vertical; min-height: 140px; line-height: 1.5; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); }

/* forms */
.form { display: grid; gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 3px; }
.field .input { width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* approvals */
.draft { display: grid; gap: 10px; }
.draft .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.draft .to { color: var(--muted); font-size: 12.5px; }
.draft .buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.draft .rewrite { display: none; gap: 8px; }
.draft.rewriting .rewrite { display: flex; }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(10, 8, 25, .35); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 31; overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--border); padding: 22px; display: flex; flex-direction: column; gap: 14px;
}
.drawer .close { margin-left: auto; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.msg { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); }
.msg.in { border-color: var(--hot); }
.msg .mhead { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.msg .body { white-space: pre-wrap; font-size: 13.5px; }
.gaps { display: flex; gap: 6px; flex-wrap: wrap; }

/* services */
.svc { display: flex; flex-direction: column; gap: 8px; }
.svc .head { display: flex; align-items: center; gap: 10px; }
.svc .icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.svc .icon svg { width: 18px; height: 18px; }
.svc p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.svc ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }

/* toast */
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--surface); font-weight: 600;
  box-shadow: var(--shadow); max-width: 360px;
}
.toast.err { background: var(--bad); color: #fff; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); display: grid; gap: 14px; }

code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.codebox {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
  word-break: break-all;
}

/* ---------- responsive */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-wide, .g3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 8px 0 0; }
  .brand small, .side-foot, .nav .label-long { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { padding: 8px; }
  .nav a span.lbl { display: none; }
  .main { padding: 16px 16px 60px; }
  .g2, .minis { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form .two { grid-template-columns: 1fr; }
  .leads .hide-sm { display: none; }
}

/* ---------- agency mode */
.nav-group {
  margin: 14px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.nav-group:first-child { margin-top: 2px; }
.section-title { font-size: 15px; margin: 6px 0 12px; color: var(--text-2); }
.section-title + .grid { margin-bottom: 22px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.svc-row { padding: 6px 0; border-bottom: 1px solid var(--border); }
.svc-row:last-of-type { border-bottom: 0; }
.small-select { width: auto; padding: 5px 8px; font-size: 12.5px; }
.top .actions select.input { width: auto; min-width: 150px; }
.stars { color: var(--warm); letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--border); }
.client-card .kv { margin: 0; }

.post { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.post .pimg, .post .noimg.pimg { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; }
.post .pbody { display: grid; gap: 10px; }
.post .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post .head h2 { margin: 0; font-size: 16px; }
.post .head .to { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.post textarea.input { min-height: 200px; }
.post .buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.post .rewrite { display: none; gap: 8px; }
.post.rewriting .rewrite { display: flex; }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; }
.noimg {
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 11px;
  border: 1px dashed var(--border); border-radius: 8px;
}
.noimg.thumb { width: 48px; height: 48px; }
.review { margin-bottom: 10px; }
.reply-box {
  margin-top: 8px; padding: 10px 12px; background: var(--surface-2); border-left: 3px solid var(--brand);
  border-radius: 8px; white-space: pre-wrap; font-size: 13.5px;
}
.col-btns { display: flex; flex-direction: column; gap: 6px; flex: none; }
.report .report-head { font-size: 15px; margin-bottom: 12px; }
.report .kpis { margin-bottom: 14px; }
.print-only { display: none; }

@media (max-width: 860px) {
  .post { grid-template-columns: 1fr; }
  .post .pimg { max-width: 320px; }
  .nav-group { display: none; }
}

/* ---------- print: the monthly client report */
@media print {
  :root { color-scheme: light; }
  body { background: #fff; }
  .side, .top .actions, .quick, .no-print, .toasts, .banner, #drawer { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ddd; }
  .print-only { display: block; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .g2 { grid-template-columns: 1fr 1fr; }
}
.post .pmedia { display: grid; gap: 8px; align-content: start; }
.btn.upload { cursor: pointer; justify-content: center; }

/* ---------- lead care, plans, money */
details.lead-row { display: block; padding: 10px 0; }
details.lead-row > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
details.lead-row > summary::-webkit-details-marker { display: none; }
.lead-body { display: grid; gap: 8px; margin: 10px 0 4px; }
.lead-body .filters { margin: 0; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.md h2, .md h3, .md h4, .md h5 { margin: 16px 0 6px; }
.md p { margin: 6px 0; line-height: 1.6; }
.md ul, .md ol { margin: 6px 0 6px 20px; padding: 0; line-height: 1.6; }
.doc-read { max-width: 820px; }
.invoice { max-width: 860px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-head h2 { margin: 0 0 4px; }
.inv-meta { text-align: right; }
.inv-title { font-weight: 800; letter-spacing: .08em; color: var(--brand); margin-bottom: 4px; }
.inv-to { margin-bottom: 14px; }
.inv-totals { max-width: 320px; margin: 14px 0 0 auto; }
.inv-pay { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.main.portal { max-width: 1100px; margin: 0 auto; }

/* =====================================================================
   Maroon theme (CoDude-style): icon rail, red hero banner, soft cards
   ===================================================================== */
body { font-size: 14.5px; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 600; }
.top { margin-bottom: 24px; }
.top .sub { font-size: 15px; margin-top: 4px; }

/* side bar: labels + group headings, maroon active state */
.shell { grid-template-columns: 248px 1fr; }
.side { padding: 18px 14px; gap: 2px; overflow-y: auto; scrollbar-width: thin; }
.side .brand { padding: 4px 8px 16px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--hero-2), var(--hero-1)); font-size: 16px; }
.brand b { font-size: 16px; font-weight: 700; }
.nav-group { margin: 16px 12px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.nav a { padding: 10px 12px; border-radius: 12px; font-weight: 500; font-size: 14.5px; color: var(--text-2); border: 1.5px solid transparent; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 600; }
.nav svg { width: 20px; height: 20px; stroke-width: 1.8; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; }

/* top strip */
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 32px; background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 500; font-size: 15.5px; position: sticky; top: 0; z-index: 15; }
.topbar .live { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.main { padding: 28px 32px 60px; }

/* cards + buttons */
.card { border-radius: var(--radius); padding: 22px; }
.btn { border-radius: 12px; padding: 8px 15px; font-weight: 600; font-size: 13.5px; }
.btn.primary { box-shadow: 0 6px 16px -6px rgba(155, 28, 28, .55); }
.input, select.input, textarea.input { border-radius: 12px; padding: 8px 12px; }
.input:focus { outline: 3px solid var(--brand-soft); }
.chip { padding: 2px 10px; }

/* hero banner = the first KPI row of a page */
#view > .kpis {
  gap: 0; padding: 30px 36px 32px; margin-bottom: 22px; border-radius: 24px;
  background: linear-gradient(110deg, var(--hero-1) 0%, var(--hero-2) 100%); color: #fff;
  box-shadow: 0 14px 34px -18px rgba(122, 18, 18, .65);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
#view > .kpis::before {
  content: "↗  YOUR NUMBERS"; grid-column: 1 / -1; font-weight: 700; font-size: 13.5px; letter-spacing: .04em; margin-bottom: 16px;
}
#view > .kpis .kpi { display: flex; flex-direction: column; background: transparent; border: 0; box-shadow: none; padding: 4px 18px 4px 0; }
#view > .kpis .kpi .label { order: 2; color: rgba(255, 255, 255, .92); font-size: 14.5px; font-weight: 500; }
#view > .kpis .kpi .value { order: 1; color: #fff; font-size: 40px; font-weight: 700; line-height: 1.1; margin: 0 0 4px; }
#view > .kpis .kpi .foot { order: 3; color: rgba(255, 255, 255, .7); font-size: 12.5px; }
#view > .kpis .kpi.attn .value { color: #ffe08a; }
.kpi .value { font-size: 28px; }
.funnel-row .bar { border-radius: 0 6px 6px 0; }
.login .card { padding: 30px; border-radius: 22px; }

/* segmented tabs, sortable table, chat (Meta campaigns + AI) */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); }
.crumbs a { cursor: pointer; }
table.leads th.sort { cursor: pointer; user-select: none; }
table.leads th.sort:hover { color: var(--text); }
table.leads td.num, table.leads th.num { text-align: right; }
.colpick { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 260px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.bubble { max-width: 85%; padding: 11px 14px; border-radius: 16px; line-height: 1.55; }
.bubble.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 5px; white-space: pre-wrap; }
.bubble.ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.bubble.ai .md p:first-child { margin-top: 0; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; }
.chat-input textarea.input { min-height: 48px; height: 48px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto; }
  .side .brand { border: 0; padding: 0 8px 0 0; margin: 0; width: auto; }
  .nav { flex-direction: row; width: auto; }
  .nav-group { display: none; }
  .nav a span.lbl { display: none; }
  .nav a { width: 42px; height: 42px; }
  .side-foot { display: none; }
  .topbar { padding: 12px 16px; position: static; }
  .main { padding: 18px 16px 60px; }
  #view > .kpis { padding: 22px; border-radius: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view > .kpis .kpi .value { font-size: 30px; }
}

.colpick[hidden] { display: none; }
.colpick { padding: 14px; margin-bottom: 14px; background: var(--surface-2); border-radius: 12px; }


/* top creatives */
.crt-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
.crt{padding:0;overflow:hidden;display:flex;flex-direction:column}
.crt-img{position:relative;aspect-ratio:1/1;background:var(--brand-soft)}
.crt-img img{width:100%;height:100%;object-fit:cover;display:block}
.crt-img .noimg{display:grid;place-items:center;height:100%;color:var(--muted)}
.crt-rank{position:absolute;top:10px;left:10px;background:var(--brand);color:#fff;font-weight:700;border-radius:999px;padding:3px 10px;font-size:13px}
.crt-body{padding:14px 16px 16px}
.crt-copy{margin:0;color:var(--muted);font-size:13px;line-height:1.5}
.crt-verdict{position:absolute;top:10px;right:10px;border-radius:999px;padding:3px 10px;font-size:12px;font-weight:700;background:#fff;color:var(--text)}
.crt-verdict.good{background:#16a34a;color:#fff}.crt-verdict.bad{background:#6b7280;color:#fff}
.crt-why{background:var(--brand-soft);border-left:3px solid var(--brand);border-radius:8px;padding:10px 12px;margin:0 0 10px;font-size:13.5px}
.crt-why b{display:flex;gap:6px;align-items:center;color:var(--brand);font-size:12.5px}.crt-why p{margin:6px 0 0;line-height:1.5}
.crt-why.muted{color:var(--muted);border-left-color:var(--line,#ddd)}
.crt-angle{margin-bottom:16px;border-left:4px solid var(--brand)}.crt-angle b{display:flex;gap:6px;align-items:center;color:var(--brand)}.crt-angle p{margin:8px 0;line-height:1.55}
.topic-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px}
.topic{display:flex;gap:12px;padding:12px;border:1px solid var(--line,#e5e5e5);border-radius:12px}
.topic-n{flex:none;width:28px;height:28px;border-radius:50%;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:700;font-size:13px}
.topic-hook{font-weight:600;line-height:1.4}
