/* TeamUp Hub. One stylesheet, light + dark, phone-first.
   Brand yellow is for chrome (the header, buttons, the active tab), never for data: charts use the
   validated series palette and the status colours, each with a label or icon beside it. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f2f1ec;
  --surface-3: #e8e6df;
  --ink: #111111;
  --ink-2: #4b4a46;
  --ink-3: #7c7a74;
  --line: #e4e2db;
  --line-2: #d3d1c9;
  --brand: #ffe500;
  --brand-ink: #0a0a0a;
  --accent: #7a6800;
  --accent-soft: rgba(255, 229, 0, .22);
  --s1: #2a78d6;  /* series 1, blue */
  --s2: #eb6834;  /* series 2, orange */
  --s3: #1baf7a;  /* series 3, aqua */
  --s1-soft: rgba(42, 120, 214, .12);
  --good: #0a7d0a;
  --good-fill: #0ca30c;
  --good-soft: rgba(12, 163, 12, .1);
  --warn: #9a6400;
  --warn-fill: #fab219;
  --warn-soft: rgba(250, 178, 25, .18);
  --bad: #b8302f;
  --bad-fill: #d03b3b;
  --bad-soft: rgba(208, 59, 59, .1);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --shadow: 0 1px 2px rgba(20, 20, 15, .05), 0 6px 20px rgba(20, 20, 15, .05);
  --shadow-lg: 0 24px 64px rgba(20, 20, 15, .22);
  --avatar-l: 88%;
  --avatar-ink: 30%;
  --radius: 14px;
  --top-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0c; --surface: #161616; --surface-2: #1d1d1d; --surface-3: #272727;
    --ink: #f4f4f2; --ink-2: #bdbcb5; --ink-3: #85847e; --line: #262626; --line-2: #343434;
    --accent: #ffe500; --accent-soft: rgba(255, 229, 0, .12);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s1-soft: rgba(57, 135, 229, .16);
    --good: #3fc23f; --good-soft: rgba(12, 163, 12, .16); --warn: #fab219; --warn-soft: rgba(250, 178, 25, .14);
    --bad: #ef6b6a; --bad-soft: rgba(208, 59, 59, .18); --grid: #2c2c2a; --axis: #383835;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
    --avatar-l: 24%; --avatar-ink: 86%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0c; --surface: #161616; --surface-2: #1d1d1d; --surface-3: #272727;
  --ink: #f4f4f2; --ink-2: #bdbcb5; --ink-3: #85847e; --line: #262626; --line-2: #343434;
  --accent: #ffe500; --accent-soft: rgba(255, 229, 0, .12);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s1-soft: rgba(57, 135, 229, .16);
  --good: #3fc23f; --good-soft: rgba(12, 163, 12, .16); --warn: #fab219; --warn-soft: rgba(250, 178, 25, .14);
  --bad: #ef6b6a; --bad-soft: rgba(208, 59, 59, .18); --grid: #2c2c2a; --axis: #383835;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
  --avatar-l: 24%; --avatar-ink: 86%;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 60; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(.96); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--ink); opacity: .9; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; min-height: 44px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(127, 127, 127, .14); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ top bar */
.top { position: sticky; top: 0; z-index: 30; background: #0a0a0a; color: #fff; border-bottom: 3px solid var(--brand); }
.top-in { display: flex; align-items: center; gap: 18px; height: var(--top-h); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #0a0a0a; font-weight: 900; font-size: 13px; letter-spacing: -.5px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-weight: 900; letter-spacing: .6px; font-size: 14px; text-transform: uppercase; }
.brand-text small { color: #a8a8a2; font-size: 12px; }
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px;
  color: #c9c9c3; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.tabs a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.tabs a[aria-current="page"] { color: #0a0a0a; background: var(--brand); }
.tab-count { font-size: 11px; font-weight: 800; min-width: 18px; padding: 0 5px; border-radius: 9px; background: rgba(255, 255, 255, .14); text-align: center; }
.tabs a[aria-current="page"] .tab-count { background: rgba(0, 0, 0, .14); }
.tab-count:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.sync { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .16); background: transparent; color: #c9c9c3; font-size: 12px; cursor: pointer; }
.sync:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #0ca30c; box-shadow: 0 0 0 3px rgba(12, 163, 12, .25); }
.sync[data-state="demo"] .sync-dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(255, 229, 0, .25); }
.sync[data-state="busy"] .sync-dot { background: #fab219; animation: pulse 1s infinite; }
.sync[data-state="error"] .sync-dot { background: #d03b3b; box-shadow: 0 0 0 3px rgba(208, 59, 59, .3); }
@keyframes pulse { 50% { opacity: .35; } }

.bottom-nav { display: none; }

/* ------------------------------------------------------------ layout */
main { padding-top: 22px; padding-bottom: 60px; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid rgba(200, 180, 0, .35); margin-bottom: 18px; font-size: 14px; }
.banner b { font-weight: 700; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h1 { font-size: 26px; font-weight: 850; letter-spacing: -.4px; }
.view-head p { color: var(--ink-3); margin-top: 2px; }
.grid { display: grid; gap: 16px; }
.cols-today { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: grid; gap: 16px; align-content: start; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 0; }
.card-head h2 { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.card-body { padding: 12px 18px 16px; }
.card-foot { padding: 0 18px 14px; }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-3); margin: 6px 0 10px; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }

/* ------------------------------------------------------------ stat tiles */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { position: relative; padding: 14px 16px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; cursor: pointer; overflow: hidden; }
.tile:hover { border-color: var(--line-2); }
.tile-label { font-size: 12px; font-weight: 700; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.tile-value { font-size: 30px; font-weight: 850; letter-spacing: -.8px; line-height: 1.15; margin-top: 4px; }
.tile-value small { font-size: 15px; font-weight: 700; color: var(--ink-3); letter-spacing: 0; margin-left: 2px; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--ink-3); min-height: 24px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--ink-3); }
.tile .spark { width: 64px; height: 24px; flex: none; }
.tile-foot > span:first-child { min-width: 0; }

/* ------------------------------------------------------------ pills, avatars */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.pill svg { width: 12px; height: 12px; }
.pill.trial { background: rgba(232, 68, 47, .12); color: #c2341f; }
.pill.new { background: var(--s1-soft); color: var(--s1); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.brand { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="dark"] .pill.trial { color: #ff8a78; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.trial { color: #ff8a78; } }
.avatar { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font-weight: 800; font-size: 13px; background: hsl(var(--h, 40) 60% var(--avatar-l)); color: hsl(var(--h, 40) 55% var(--avatar-ink)); }
.avatar.lg { width: 54px; height: 54px; font-size: 18px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-text { min-width: 0; display: flex; flex-direction: column; }
.who-name { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name-btn { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.row > .name-btn { flex: 1; }
.row-right { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.name-btn:hover .who-name { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { font-size: 11.5px; font-weight: 800; opacity: .75; }

/* ------------------------------------------------------------ moments */
.moments { display: grid; gap: 10px; }
.moment { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.moment:hover { border-color: var(--line-2); }
.m-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.m-icon svg { width: 18px; height: 18px; }
.m-icon.k-first, .m-icon.k-sessions, .m-icon.k-joined, .m-icon.k-days { background: var(--good-soft); color: var(--good); }
.m-icon.k-quiet, .m-icon.k-missing, .m-icon.k-risk { background: var(--warn-soft); color: var(--warn); }
.m-icon.k-trialEnding, .m-icon.k-trialOver, .m-icon.k-cancelling { background: var(--bad-soft); color: var(--bad); }
.m-icon.k-lead { background: var(--s1-soft); color: var(--s1); }
.m-title { font-weight: 750; font-size: 14px; }
.m-meta { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-actions { display: flex; gap: 6px; }

/* ------------------------------------------------------------ lists */
.rows { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row-right { text-align: right; flex: none; font-size: 13px; color: var(--ink-3); max-width: 55%; }

/* class rows */
.class-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 128px; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.class-row:first-child { border-top: 0; }
.class-row:hover { background: var(--surface-2); }
.class-time { font-weight: 800; font-variant-numeric: tabular-nums; }
.class-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-meta { font-size: 12.5px; color: var(--ink-3); }
.class-past { opacity: .5; }
.fill { display: grid; gap: 4px; justify-items: end; }
.fill-bar { position: relative; width: 100%; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.fill-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--s1); }
.fill-bar i.full { background: var(--good-fill); }
.fill-bar i.low { background: var(--warn-fill); }
.fill-text { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 0 6px; border-bottom: 2px solid var(--ink); margin-bottom: 2px; }
.day-head h3 { font-size: 15px; font-weight: 850; }

/* ------------------------------------------------------------ members table */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); min-width: 240px; flex: 1; max-width: 360px; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; }
select.select { height: 38px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 0 10px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 750; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; }
.table-wrap { overflow-x: auto; }
.wk-bars { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.wk-bars i { display: block; width: 7px; border-radius: 2px 2px 0 0; background: var(--s1); min-height: 2px; }
.wk-bars i.zero { background: var(--surface-3); }
.ms { display: grid; gap: 4px; min-width: 110px; }
.ms-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.ms-bar i { display: block; height: 100%; background: var(--s3); border-radius: 3px; }
.risk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.risk-dot { width: 9px; height: 9px; border-radius: 50%; }
.risk.high { color: var(--bad); } .risk.high .risk-dot { background: var(--bad-fill); }
.risk.watch { color: var(--warn); } .risk.watch .risk-dot { background: var(--warn-fill); }
.risk.ok { color: var(--ink-3); } .risk.ok .risk-dot { background: var(--good-fill); }
.risk.paused { color: var(--ink-3); } .risk.paused .risk-dot { background: var(--axis); }
.mcards { display: none; }

/* ------------------------------------------------------------ kickstarter board */
.board { display: grid; grid-template-columns: repeat(7, minmax(180px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.lane-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; font-weight: 800; font-size: 13px; }
.lane-head .n { font-size: 12px; color: var(--ink-3); }
.lane-cards { display: grid; gap: 8px; }
.kcard { display: grid; gap: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; cursor: pointer; text-align: left; width: 100%; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--ink-3); }
.kprog { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.kprog i { display: block; height: 100%; background: #e8442f; border-radius: 3px; }
.kmeta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); gap: 6px; flex-wrap: wrap; }
.kflags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin: 2px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.legend i.box { width: 10px; height: 10px; border-radius: 3px; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.tip b { font-weight: 750; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.chart-table { margin-top: 10px; font-size: 13px; }
.chart-table table { width: 100%; border-collapse: collapse; }
.chart-table th, .chart-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.heat { display: grid; gap: 3px; }
.heat-row { display: grid; grid-template-columns: 38px repeat(var(--cols), minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat-cell { height: 26px; border-radius: 4px; background: var(--surface-2); position: relative; }
.heat-cell[data-v] { cursor: default; }
.heat-cell.on:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.heat-lbl { font-size: 11px; color: var(--ink-3); text-align: center; }
.heat-day { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-top: 10px; }
.scale-bar { width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #cde2fb, #86b6ef, #3987e5, #1c5cab, #0d366b); }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 14px; border-radius: 0 4px 4px 0; background: transparent; }
.hbar-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); }
.hbar-track i.intro { background: var(--s2); }
.funnel { display: grid; gap: 8px; }
.funnel-step { display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 13px; }
.funnel-bar { height: 26px; border-radius: 0 6px 6px 0; display: flex; align-items: center; padding-left: 8px; color: #fff; font-weight: 800; font-size: 12.5px; min-width: 28px; }

/* ------------------------------------------------------------ report */
.report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kv { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.kv-l { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.kv-v { font-size: 24px; font-weight: 850; letter-spacing: -.4px; }
.kv-d { font-size: 12px; }

/* ------------------------------------------------------------ drawer */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .42); z-index: 40; }
.drawer { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg); box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain; }
.d-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.d-head h2 { font-size: 20px; font-weight: 850; }
.d-close { margin-left: auto; }
.d-body { padding: 16px 18px 40px; display: grid; gap: 16px; }
.d-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.d-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.d-stat b { display: block; font-size: 18px; font-weight: 850; }
.d-stat span { font-size: 12px; color: var(--ink-3); }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cal { display: grid; grid-template-columns: 26px repeat(12, minmax(0, 1fr)); gap: 3px; font-size: 10.5px; color: var(--ink-3); }
.cal i { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); }
.cal i.a { background: var(--s1); }
.cal i.n { background: var(--bad-fill); }
.cal i.l { background: var(--warn-fill); }
.cal i.r { background: transparent; box-shadow: inset 0 0 0 2px var(--s1); }
.cal i.f { opacity: .35; }
.reasons { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
textarea.ta, input.inp { width: 100%; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 10px 12px; resize: vertical; }
input.inp { height: 40px; padding: 0 12px; }
textarea.ta:focus, input.inp:focus, select.select:focus { outline: 2px solid var(--s1); outline-offset: -1px; }
.thread { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; padding: 4px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble.in { background: var(--surface-3); justify-self: start; border-bottom-left-radius: 4px; }
.bubble.out { background: var(--s1); color: #fff; justify-self: end; border-bottom-right-radius: 4px; }
.bubble small { display: block; font-size: 11px; opacity: .7; margin-top: 2px; }

/* ------------------------------------------------------------ dialog, toasts */
dialog.dlg { border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-body { padding: 20px 20px 8px; display: grid; gap: 10px; }
.dlg-body h3 { font-size: 18px; font-weight: 850; }
.dlg-quote { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 600; }
.toast.bad { background: var(--bad-fill); color: #fff; }

/* ------------------------------------------------------------ email studio */
.studio { display: grid; grid-template-columns: 300px minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.seg-list { display: grid; gap: 6px; }
.seg { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.seg:hover { border-color: var(--ink-3); }
.seg[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.seg-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); }
.seg-ic svg { width: 16px; height: 16px; }
.seg[aria-pressed="true"] .seg-ic { background: var(--brand); color: #0a0a0a; }
.seg-l { font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.seg-a { font-size: 12px; color: var(--ink-3); }
.seg-n { font-weight: 850; font-size: 16px; font-variant-numeric: tabular-nums; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 750; color: var(--ink-2); }
.seg-people { display: flex; flex-wrap: wrap; gap: 4px; }
.seg-people .pill { cursor: pointer; }
.studio-step { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.studio-step i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); font-style: normal; font-size: 12px; }
.opts { display: flex; gap: 6px; flex-wrap: wrap; }
.opt { padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 650; text-align: left; }
.opt small { display: block; font-weight: 500; color: var(--ink-3); font-size: 11.5px; }
.opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.preview-wrap { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.preview-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.preview-frame { display: block; width: 100%; height: 760px; min-height: 480px; border: 0; background: #f2f2f0; margin: 0 auto; transition: width .2s; }
.preview-frame.mobile { width: 390px; max-width: 100%; }
.inbox { padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.inbox-from { font-weight: 800; font-size: 14px; }
.inbox-subj { font-weight: 650; font-size: 14px; }
.inbox-pre { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.blocks-ed { display: grid; gap: 8px; }
.block-ed { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); }
.block-ed-h { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px; }
.block-ed textarea { width: 100%; border: 0; background: transparent; resize: vertical; padding: 0; min-height: 44px; outline: none; font-size: 14px; }
.notes { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); font-size: 13.5px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--s1); transition: width .3s; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
details.more summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--ink-2); padding: 4px 0; }

/* ------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #0a0a0a; }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: 18px; padding: 28px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; border-top: 5px solid var(--brand); }
.login-card h1 { font-size: 22px; font-weight: 900; }
.login-err { color: var(--bad); font-weight: 600; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .studio { grid-template-columns: 260px minmax(0, 1fr); }
  .studio-preview { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .cols-today, .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  :root { --top-h: 54px; }
  .tabs { display: none; }
  .brand-text small { display: none; }
  .sync span:last-child { display: none; }
  main { padding-bottom: 96px; padding-top: 16px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    background: #0a0a0a; border-top: 1px solid #222; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; color: #9d9d97; text-decoration: none; font-size: 10.5px; font-weight: 700; position: relative; }
  .bottom-nav a svg { width: 20px; height: 20px; }
  .bottom-nav a[aria-current="page"] { color: var(--brand); }
  .bottom-nav .tab-count { position: absolute; top: -4px; left: 55%; background: #e8442f; color: #fff; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-value { font-size: 26px; }
  .view-head h1 { font-size: 22px; }
  .moment { grid-template-columns: auto minmax(0, 1fr); }
  .m-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .tbl-wrap-members { display: none; }
  .mcards { display: grid; gap: 8px; }
  .mcard { display: grid; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-align: left; width: 100%; cursor: pointer; }
  .mcard-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
  .d-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hbar { grid-template-columns: minmax(0, 120px) minmax(0, 1fr) 36px; }
  .funnel-step { grid-template-columns: 110px minmax(0, 1fr) 70px; }
  .class-row { grid-template-columns: 48px minmax(0, 1fr) 92px; }
  .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-frame { height: 640px; }
  .search { min-width: 0; max-width: none; }
}
@media print {
  .top, .bottom-nav, .toolbar, .no-print, .drawer, .scrim { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
