/* Overmorrow KPI (kpi.overmorrow.app). v2 tokens from the accepted boards; Expanded layout with the desktop side panel (platforms §4). Light by default, dark follows the system. */
:root {
  --ink: #1c1e21; --ink-soft: #6b7280; --ink-faint: #9ca3af; --ink-ghost: #c3c7cf;
  --line: #e8e9ec; --card-line: #eceef1; --grid: #f0f1f3; --row-line: #f1f2f4;
  --fill: #f3f4f6; --fill-hover: #eceef1; --sheet: #f6f7f9; --white: #fff;
  --month-red: #e5484d;
  --ok-bg: #e7f5ec; --ok-ink: #1f7a45; --soon-bg: #fdf2d3; --soon-ink: #8a5d00; --danger-soft: #fbe3e2; --danger-soft-ink: #a8322c;
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #8e5bd8; --s5: #d9a400; --s6: #7a8aa0;
  --av-bg: #eef0fd; --av-ink: #3446a8; --live: #1f9d55; --live-ring: #e7f5ec; --tip-bg: #1c1e21; --mark-bg: #1c1e21; --mark-ink: #fff;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--sheet); color: var(--ink); }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; font-size: 13px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }

/* shell */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 14px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 0; }
.mark { width: 34px; height: 34px; border-radius: 11px; background: var(--mark-bg); color: var(--mark-ink); display: grid; place-items: center; }
.brand b { font-size: 15px; font-weight: 800; letter-spacing: -.01em; display: block; }
.brand small { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); }
.navcap { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); padding: 0 8px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.sidemid { min-height: 0; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.nav a svg { flex: none; }
.nav a:hover { background: var(--fill); color: var(--ink); }
.nav a.on { background: var(--fill); color: var(--ink); font-weight: 700; }
.nav a .cnt { margin-left: auto; }
.side .foot { margin-top: auto; border-top: 1px solid var(--row-line); padding: 12px 6px 0; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--av-bg); color: var(--av-ink); font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: none; }
.who b { font-size: 13px; font-weight: 700; display: block; }
.who small { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.syncline { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px var(--live-ring); flex: none; }

main { min-width: 0; }
.hdr { position: sticky; top: 0; z-index: 10; background: var(--white); border-bottom: 1px solid var(--line); height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.hdr .t { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.hdr .s { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); }
.hdr .sp { flex: 1; }
.seg { display: inline-flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 9px; font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.seg button.on { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(20,22,30,.08), 0 1px 1px rgba(20,22,30,.04); }
.btn { height: 34px; border-radius: 11px; padding: 0 12px; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; background: var(--fill); }
.btn:hover { background: var(--fill-hover); }
.tile { width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--card-line); background: var(--white); display: grid; place-items: center; }

.content { padding: 20px 24px 60px; display: flex; flex-direction: column; gap: 28px; max-width: 1480px; }
.sect { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 80px; }
.sect > h2 { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.sect > h2 .r { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.cnt { font-size: 10px; font-weight: 700; background: var(--fill); color: var(--ink-soft); border-radius: 6px; padding: 1px 6px; letter-spacing: 0; }

.grid { display: grid; gap: 12px; }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.top { align-items: start; }
.g2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--white); border: 1px solid var(--card-line); border-radius: 18px; padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card h3 { font-size: 14px; font-weight: 800; letter-spacing: -.005em; display: flex; align-items: center; gap: 8px; }
.card h3 small { font-size: 12px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.card h3 .r { margin-left: auto; }
.card .sub { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-top: -8px; }

/* stat tiles */
.stat { gap: 6px; padding: 14px 16px 12px; }
.stat .k { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat .v small { font-size: 14px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0; margin-left: 2px; }
.stat .d { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stat svg.spark { width: 100%; height: 30px; display: block; margin-top: 2px; overflow: visible; }
.delta { font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 1px 6px; display: inline-flex; align-items: center; gap: 2px; }
.up { background: var(--ok-bg); color: var(--ok-ink); }
.dn { background: var(--danger-soft); color: var(--danger-soft-ink); }
.flat { background: var(--fill); color: var(--ink-soft); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text { font-size: 10.5px; font-weight: 600; fill: var(--ink-faint); font-family: var(--font); }
.gridl { stroke: var(--grid); stroke-width: 1; }
.base { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.ln { height: 3px; border-radius: 2px; width: 14px; }
.legend i.dash { height: 0; border-top: 2px dashed var(--ink-ghost); width: 14px; border-radius: 0; }
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--tip-bg); color: #fff; border-radius: 10px; padding: 7px 10px; font-size: 11.5px; font-weight: 600; line-height: 1.45; box-shadow: 0 6px 20px rgba(20,22,30,.18); opacity: 0; transition: opacity .1s; white-space: nowrap; }
#tip b { font-weight: 800; }
#tip .tl { color: #b9bec7; font-size: 10.5px; }
#tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* kv rows */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--row-line); font-size: 12.5px; }
.row:last-child { border-bottom: 0; }
.row .l { font-weight: 600; flex: 1; min-width: 0; }
.row .l small { display: block; font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.row .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.row .muted { color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok-ink); } .neg { color: var(--danger-soft-ink); }

/* horizontal bars */
.hb { display: flex; flex-direction: column; gap: 9px; }
.hb .it { display: grid; grid-template-columns: 128px 1fr minmax(84px, auto); align-items: center; gap: 10px; font-size: 12.5px; border-radius: 8px; }
.hb .it .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.hb .track { height: 14px; background: var(--fill); border-radius: 4px; overflow: hidden; }
.hb .bar { height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.hb .it:hover .bar { filter: brightness(.92); }
.hb .v { white-space: nowrap; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.hb .v small { color: var(--ink-faint); font-weight: 600; margin-left: 4px; }
.prem { font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--av-ink); background: var(--av-bg); border-radius: 5px; padding: 1px 5px; }

/* funnel */
.fun { display: flex; flex-direction: column; gap: 12px; }
.fun .st { display: grid; grid-template-columns: 1fr auto 52px; gap: 4px 10px; align-items: center; font-size: 12.5px; }
.fun .st .bw { grid-column: 1 / -1; grid-row: 2; }
.fun .bw { position: relative; height: 26px; }
.fun .bw { background: var(--fill); border-radius: 4px; overflow: hidden; height: 10px; }
.fun .b { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; }
.fun .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fun .c { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.fun .p { text-align: right; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; font-size: 11.5px; }

/* segmented share */
.share { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; }
.share div { height: 100%; }

/* cohort */
.coh { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.coh th { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); padding: 4px 6px; text-align: center; }
.coh th:first-child, .coh td:first-child { text-align: left; white-space: nowrap; }
.coh td { height: 30px; text-align: center; font-weight: 700; border-radius: 6px; min-width: 40px; }
.coh td:first-child { font-weight: 700; padding-right: 10px; color: var(--ink); }
.coh td:first-child small { display: block; font-size: 10.5px; color: var(--ink-faint); font-weight: 600; }
.coh td.na { background: transparent; }
.coh td.c:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.scale { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: var(--ink-faint); }
.scale .ramp { width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #cce3fd, #84b9f3, #338ced, #1b64be, #0e3d7e); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--row-line); font-weight: 600; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-feature-settings: 'calt' 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--ink-soft); }
.pill { font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px 2px 6px; display: inline-flex; align-items: center; gap: 4px; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.warn { background: var(--soon-bg); color: var(--soon-ink); }
.pill.bad { background: var(--danger-soft); color: var(--danger-soft-ink); }
.pill.neu { background: var(--fill); color: var(--ink-soft); }

/* health */
.health { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.health.h4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hc { background: var(--white); border: 1px solid var(--card-line); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.hc .k { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.hc .v { font-size: 18px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hc .pill { align-self: flex-start; }

/* feed */
.feed .row { min-height: 46px; }
.fi { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--fill); }
.feed .when { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; white-space: nowrap; }

/* design notes */
.notes { border-top: 2px solid var(--ink); padding-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 32px; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); }
.notes h4 { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 4px; }
.notes ul { padding-left: 16px; display: flex; flex-direction: column; gap: 3px; }
.notes b { color: var(--ink); font-weight: 700; }
.notes .call { grid-column: 1 / -1; color: var(--ink); font-size: 13.5px; font-weight: 600; }

.tview { display: none; }
.tview.on { display: block; }
.linkbtn { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); padding: 3px 8px; border-radius: 8px; }
.linkbtn:hover { background: var(--fill); color: var(--ink); }

:root:not([data-theme="light"]) { }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8eaed; --ink-soft: #a0a6b1; --ink-faint: #7d8491; --ink-ghost: #4a4f5a;
    --line: #2a2d34; --card-line: #2a2d34; --grid: #23262c; --row-line: #23262c;
    --fill: #262930; --fill-hover: #2f333b; --sheet: #121316; --white: #1a1c21;
    --month-red: #ff6369;
    --ok-bg: #12301f; --ok-ink: #5fd18b; --soon-bg: #3a2d0a; --soon-ink: #f0c25a; --danger-soft: #3c1a19; --danger-soft-ink: #ff8f8a;
    --s1: #4d9bf0; --s2: #ff8a4f; --s3: #19c9a6; --s4: #a98af0; --s5: #e8bb2a; --s6: #93a1b5;
    --av-bg: #232a52; --av-ink: #a9b6f5; --live-ring: #12301f; --tip-bg: #2e323a; --mark-bg: #e8eaed; --mark-ink: #1a1c21;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e8eaed; --ink-soft: #a0a6b1; --ink-faint: #7d8491; --ink-ghost: #4a4f5a;
  --line: #2a2d34; --card-line: #2a2d34; --grid: #23262c; --row-line: #23262c;
  --fill: #262930; --fill-hover: #2f333b; --sheet: #121316; --white: #1a1c21;
  --month-red: #ff6369;
  --ok-bg: #12301f; --ok-ink: #5fd18b; --soon-bg: #3a2d0a; --soon-ink: #f0c25a; --danger-soft: #3c1a19; --danger-soft-ink: #ff8f8a;
  --s1: #4d9bf0; --s2: #ff8a4f; --s3: #19c9a6; --s4: #a98af0; --s5: #e8bb2a; --s6: #93a1b5;
  --av-bg: #232a52; --av-ink: #a9b6f5; --live-ring: #12301f; --tip-bg: #2e323a; --mark-bg: #e8eaed; --mark-ink: #1a1c21;
  color-scheme: dark;
}

/* views: loading, sign-in, dashboard */
[hidden] { display: none !important; }
body:not([data-view="app"]) .app { display: none; }
.auth { display: none; min-height: 100vh; place-items: center; padding: 24px 16px; }
body[data-view="signin"] .auth, body.plain .auth { display: grid; }
.authcard { width: 100%; max-width: 380px; background: var(--white); border: 1px solid var(--card-line); border-radius: 18px; padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.authcard .brand { padding: 0; }
.authcard h1 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.authcard p { font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.authcard label { font-size: 12px; font-weight: 700; color: var(--ink-soft); display: flex; flex-direction: column; gap: 6px; }
.authcard input { height: 38px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; font: inherit; font-size: 13.5px; background: var(--sheet); color: var(--ink); }
.authcard input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.primary { background: var(--ink); color: var(--white); height: 40px; justify-content: center; font-size: 13.5px; }
.btn.primary:hover { background: var(--ink); opacity: .9; }
.btn[disabled] { opacity: .5; cursor: default; }
.msg { font-size: 12.5px; font-weight: 600; min-height: 18px; color: var(--ink-soft); }
.msg.err { color: var(--danger-soft-ink); }
.msg.good { color: var(--ok-ink); }
.banner { background: var(--soon-bg); color: var(--soon-ink); border-radius: 12px; padding: 8px 14px; font-size: 12.5px; font-weight: 600; }
.na { color: var(--ink-faint); }
.sect > h2 .since { margin-left: 0; text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 600; color: var(--soon-ink); background: var(--soon-bg); border-radius: 6px; padding: 1px 7px; }
.tvbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.attrib { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); }
.attrib a { text-decoration: underline; }
.def { font-size: 12px; font-weight: 600; color: var(--ink-soft); line-height: 1.5; }
.bignum { display: flex; gap: 28px; flex-wrap: wrap; }
.bignum > div { display: flex; flex-direction: column; gap: 2px; }
.bignum b { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.bignum small { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.hc .why { font-size: 11px; font-weight: 600; color: var(--ink-faint); }
.hb .it .n { min-width: 0; }
.show-s { display: none; }
@media (max-width: 1023px) { .show-s { display: inline-flex; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g4 .hb .it { grid-template-columns: 76px 1fr 52px; }
@media (max-width: 640px) { .g4 { grid-template-columns: 1fr; } .bignum { gap: 18px; } }

@media (max-width: 1280px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .health, .health.h4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .navcap, .side .foot { display: none; }
  .sidemid { overflow: visible; max-width: 100%; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { height: 34px; white-space: nowrap; } .nav a .cnt { display: none; }
  .g2, .g2e, .g3 { grid-template-columns: 1fr; }
  .hdr { padding: 0 16px; } .content { padding: 16px; }
}
@media (max-width: 640px) {
  .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .health, .health.h4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hdr { position: static; height: auto; flex-wrap: wrap; padding: 10px 16px; } .hdr .sp { display: none; }
  .seg { width: 100%; } .seg button { flex: 1; padding: 0 6px; }
  .hb .it { grid-template-columns: 96px 1fr 64px; }
  .card { padding: 14px; }
  .hide-s { display: none; }
}
