/* ==========================================================================
   Mailforge — the signed-in app.

   Everything here reads design tokens, so one set of rules serves both
   themes, seven accents, three text sizes, two densities, three corner
   styles and the rest of the Customize panel. The tokens are set on
   body.dash-mode from the data-* attributes prefs.js puts on <html>.
   ========================================================================== */

/* ── tokens: dark (default) ───────────────────────────────────────────── */

body.dash-mode {
  --bg: #0a0d12;
  --bg-2: #0e1218;
  --panel: #12171e;
  --panel-2: #181e27;
  --sunk: #0c1016;
  --border: #222a35;
  --border-soft: #1a212b;
  --text: #ece7df;
  --text-dim: #a8a196;
  --text-faint: #6f6a62;
  --section: #5c5850;
  --hover: rgba(255, 245, 230, .04);
  --side-bg: rgba(12, 15, 20, .86);
  --top-bg: rgba(10, 13, 18, .74);
  --shadow: 0 30px 60px -24px rgba(0, 0, 0, .75);
  --tile-sheen: rgba(255, 245, 230, .025);
  --pass: #5cc48c; --medium: #e3ac4a; --high: #ec8b52; --critical: #ec6670;
  --pass-rgb: 92 196 140; --medium-rgb: 227 172 74; --critical-rgb: 236 102 112;
  --accent-rgb: 232 163 61; --accent-2: #f2c46b; --accent-ink: #1a1206;
  --accent: rgb(var(--accent-rgb));
  --glow-a: rgb(var(--accent-rgb) / .08);
  --glow-b: rgba(92, 196, 140, .04);
  --display: var(--serif); --display-w: 400; --display-ls: -.3px;
  --rk: 1;
  background: var(--bg);
  color: var(--text);
}

/* accents, dark */
html[data-accent="terracotta"] body.dash-mode { --accent-rgb: 226 112 79;  --accent-2: #f3a083; --accent-ink: #1f0d07; }
html[data-accent="sage"] body.dash-mode       { --accent-rgb: 143 184 150; --accent-2: #b9d8be; --accent-ink: #0d1a10; }
html[data-accent="forest"] body.dash-mode     { --accent-rgb: 76 175 120;  --accent-2: #86d3a5; --accent-ink: #04140b; }
html[data-accent="clay"] body.dash-mode       { --accent-rgb: 217 128 128; --accent-2: #efb0a8; --accent-ink: #200b0b; }
html[data-accent="olive"] body.dash-mode      { --accent-rgb: 176 172 82;  --accent-2: #d6d38a; --accent-ink: #17160a; }
html[data-accent="graphite"] body.dash-mode   { --accent-rgb: 200 194 184; --accent-2: #e8e3da; --accent-ink: #141310; }

/* ── tokens: light ─ warm paper, not stark white ─────────────────────── */

html[data-mode="light"] body.dash-mode {
  --bg: #f4f0e8;
  --bg-2: #f9f6f0;
  --panel: #fffdf9;
  --panel-2: #f3eee5;
  --sunk: #f1ece3;
  --border: #e2dace;
  --border-soft: #ebe4d9;
  --text: #1f1b16;
  --text-dim: #5b544a;
  --text-faint: #8b8377;
  --section: #a39a8c;
  --hover: rgba(60, 40, 10, .045);
  --side-bg: rgba(250, 247, 241, .9);
  --top-bg: rgba(244, 240, 232, .8);
  --shadow: 0 24px 48px -24px rgba(60, 40, 10, .25);
  --tile-sheen: rgba(255, 255, 255, .6);
  --pass: #1f8a57; --medium: #a8730f; --high: #c2561f; --critical: #c3394a;
  --pass-rgb: 31 138 87; --medium-rgb: 168 115 15; --critical-rgb: 195 57 74;
  --accent-rgb: 184 116 26; --accent-2: #8f560e; --accent-ink: #fffaf2;
  --glow-a: rgb(var(--accent-rgb) / .10);
  --glow-b: rgba(31, 138, 87, .05);
}
html[data-mode="light"][data-accent="terracotta"] body.dash-mode { --accent-rgb: 192 82 50;  --accent-2: #93391f; }
html[data-mode="light"][data-accent="sage"] body.dash-mode       { --accent-rgb: 74 128 88;  --accent-2: #33603f; }
html[data-mode="light"][data-accent="forest"] body.dash-mode     { --accent-rgb: 30 125 76;  --accent-2: #145c37; }
html[data-mode="light"][data-accent="clay"] body.dash-mode       { --accent-rgb: 178 80 86;  --accent-2: #873a40; }
html[data-mode="light"][data-accent="olive"] body.dash-mode      { --accent-rgb: 128 122 30; --accent-2: #5e5a12; }
html[data-mode="light"][data-accent="graphite"] body.dash-mode   { --accent-rgb: 60 57 52;   --accent-2: #22201d; }
html[data-mode="light"] body.dash-mode { --accent-ink: #fffaf2; }

/* high contrast */
html[data-contrast="high"] body.dash-mode { --text-dim: #d8d2c7; --text-faint: #a8a196; --border: #3a4350; --border-soft: #2c3440; }
html[data-mode="light"][data-contrast="high"] body.dash-mode { --text-dim: #2e2923; --text-faint: #5b544a; --border: #b9ae9c; --border-soft: #d3c9b9; }

/* headings, sizes, corners, motion */
html[data-heading="sans"] body.dash-mode { --display: var(--sans); --display-w: 650; --display-ls: -.6px; }
html[data-radius="sharp"] body.dash-mode { --rk: .4; }
html[data-radius="round"] body.dash-mode { --rk: 1.4; }
html[data-size="s"] body.dash-mode .app { zoom: .92; }
html[data-size="l"] body.dash-mode .app { zoom: 1.1; }
html[data-motion="reduced"] body.dash-mode *, html[data-motion="reduced"] body.dash-mode *::before,
html[data-motion="reduced"] body.dash-mode *::after { animation: none !important; transition: none !important; }

/* backdrop */
html[data-backdrop="glow"] body.dash-mode {
  background: radial-gradient(900px 520px at 88% -12%, var(--glow-a), transparent 62%),
    radial-gradient(800px 520px at 8% 112%, var(--glow-b), transparent 60%), var(--bg);
  background-attachment: fixed;
}
html[data-backdrop="grain"] body.dash-mode {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .4 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-color: var(--bg);
}

/* ── shared pieces, re-themed for the app ─────────────────────────────── */

body.dash-mode > .nav { display: none; }
body.dash-mode .acct-main { width: 100%; max-width: none; margin: 0; padding: 0; }
/* The marketing pages cap every section at --max and centre it; the app uses the whole screen. */
body.dash-mode .acct-main > .app { width: 100%; max-width: none; margin: 0; }
body.dash-mode .card, body.dash-mode .stat, body.dash-mode .table-wrap, body.dash-mode .callout {
  border-radius: calc(16px * var(--rk)); background-color: var(--panel); border-color: var(--border); }
body.dash-mode .callout { border-color: rgb(var(--accent-rgb) / .3);
  background: radial-gradient(400px 180px at 0% 0%, rgb(var(--accent-rgb) / .12), transparent 70%), var(--panel); }
body.dash-mode .btn { border-radius: calc(10px * var(--rk)); }
body.dash-mode .btn-primary { background: var(--accent); color: var(--accent-ink); }
body.dash-mode .btn-primary:hover { filter: brightness(1.07); background: var(--accent); }
body.dash-mode .btn-ghost { color: var(--text-dim); border-color: var(--border); background: transparent; }
body.dash-mode .btn-ghost:hover { color: var(--text); border-color: var(--accent); }
body.dash-mode .link-btn, body.dash-mode .tile-link { color: var(--accent-2); }
body.dash-mode .pill.allow { color: var(--pass); border-color: rgb(var(--pass-rgb) / .35); background: rgb(var(--pass-rgb) / .08); }
body.dash-mode .pill.suspicious { color: var(--medium); border-color: rgb(var(--medium-rgb) / .35); background: rgb(var(--medium-rgb) / .08); }
body.dash-mode .pill.highrisk, body.dash-mode .pill.malicious { color: var(--critical); border-color: rgb(var(--critical-rgb) / .35);
  background: rgb(var(--critical-rgb) / .08); }
body.dash-mode .pill.admin { color: var(--accent-2); border-color: rgb(var(--accent-rgb) / .35); }
body.dash-mode .btn-danger { color: var(--critical); border-color: rgb(var(--critical-rgb) / .4); }
body.dash-mode .matrix .current { background: rgb(var(--accent-rgb) / .07); }
body.dash-mode .matrix th, body.dash-mode .matrix td { border-color: var(--border-soft); }
body.dash-mode .steps-list li::before { border-color: rgb(var(--accent-rgb) / .35); color: var(--accent); }
body.dash-mode .steps-list li.done::before { border-color: rgb(var(--pass-rgb) / .4); color: var(--pass); }
body.dash-mode input, body.dash-mode select, body.dash-mode textarea { background: var(--sunk); color: var(--text); border-color: var(--border); }
body.dash-mode .meter i, body.dash-mode .you-tag { background: var(--accent); color: var(--accent-ink); }
body.dash-mode .avatar-sm, body.dash-mode .avatar-lg { color: var(--accent-ink); background: var(--accent); }
body.dash-mode .toast { background: var(--text); color: var(--bg); }
body.dash-mode .pane h2 { color: var(--text); }
body.dash-mode .pane .lead, body.dash-mode .fine { color: var(--text-dim); }
body.dash-mode .table th { color: var(--text-faint); }
body.dash-mode .table td { color: var(--text-dim); border-color: var(--border-soft); }

/* ── layout ───────────────────────────────────────────────────────────── */

.app { --side-w: 252px; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh;
  transition: grid-template-columns .35s var(--ease); }
.app.collapsed { --side-w: 76px; }

.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 10px; padding: 16px 12px;
  border-right: 1px solid var(--border-soft); background: var(--side-bg); backdrop-filter: blur(14px); z-index: 30; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 14px; }
.side-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
  font: 400 21px var(--serif); white-space: nowrap; }
.side-brand em { color: var(--accent); }
.side-brand .brand-mark { width: 32px; height: 32px; flex: none; color: var(--accent-ink); background: var(--accent);
  border-radius: calc(9px * var(--rk)); }
.side-collapse { width: 28px; height: 28px; display: grid; place-items: center; border-radius: calc(8px * var(--rk));
  border: 1px solid var(--border); background: none; color: var(--text-faint); cursor: pointer;
  transition: transform .35s var(--ease), color .2s; }
.side-collapse:hover { color: var(--text); }
.side-collapse svg { width: 15px; height: 15px; }
.app.collapsed .side-collapse { transform: rotate(180deg); }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; }
.side-section { margin: 14px 12px 6px; font: 600 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--section); }
.side-nav button, .side-link { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px;
  border: 0; border-radius: calc(11px * var(--rk)); background: none; color: var(--text-dim); font: 500 14px var(--sans);
  text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
.side-nav button svg, .side-link svg { width: 19px; height: 19px; flex: none; }
.side-nav button:hover, .side-link:hover { color: var(--text); background: var(--hover); }
.side-nav button.on { color: var(--text); background: linear-gradient(90deg, rgb(var(--accent-rgb) / .16), rgb(var(--accent-rgb) / .03)); }
.side-nav button.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); }
.side-nav button.on svg { color: var(--accent); }
.side-dot { position: absolute; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--medium);
  box-shadow: 0 0 0 3px rgb(var(--medium-rgb) / .18); }
.side-link { color: var(--accent-2); }
.side-bottom { display: grid; gap: 10px; }
.side-plan { padding: 14px; border-radius: calc(14px * var(--rk)); border: 1px solid var(--border);
  background: linear-gradient(160deg, rgb(var(--accent-rgb) / .10), transparent 60%), var(--panel); }
.sp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sp-name { font-weight: 600; font-size: 13.5px; }
.sp-tag { padding: 2px 8px; border-radius: 99px; font: 600 10px var(--mono); letter-spacing: .04em; color: var(--pass);
  background: rgb(var(--pass-rgb) / .12); white-space: nowrap; }
.sp-tag.wait { color: var(--accent-2); background: rgb(var(--accent-rgb) / .14); }
.sp-usage { margin: 10px 0 2px; font-size: 12px; color: var(--text-faint); }
.sp-bar { height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; margin-top: 6px; }
.sp-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 1s var(--ease); }
.side-plan .btn { width: 100%; justify-content: center; margin-top: 10px; }
.side-user { display: flex; align-items: center; gap: 11px; padding: 8px 6px; }
.side-user .avatar-lg { width: 36px; height: 36px; font-size: 14px; }
.side-user-text { min-width: 0; }
.side-user .who-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who-plan { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app.collapsed .side-label, .app.collapsed .side-section, .app.collapsed .side-plan, .app.collapsed .side-dot { display: none; }
.app.collapsed .side-top { flex-direction: column; gap: 12px; }
.app.collapsed .side-nav button, .app.collapsed .side-link { justify-content: center; padding: 11px; }
.app.collapsed .side-user { justify-content: center; }

/* top bar */
.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px clamp(20px, 2.4vw, 44px); border-bottom: 1px solid var(--border-soft); background: var(--top-bg); backdrop-filter: blur(14px); }
.top-menu { display: none; width: 38px; height: 38px; border-radius: calc(10px * var(--rk)); border: 1px solid var(--border);
  background: none; color: var(--text); cursor: pointer; }
.top-menu svg { width: 20px; height: 20px; }
.top-title { min-width: 0; flex: 1; }
.top-crumb { display: block; font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); }
.top-title h1 { margin: 2px 0 0; font-family: var(--display); font-weight: var(--display-w); letter-spacing: var(--display-ls);
  font-size: 28px; line-height: 1.1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-search { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 12px; min-width: 220px;
  border-radius: calc(11px * var(--rk)); border: 1px solid var(--border); background: var(--sunk); color: var(--text-faint);
  font: 400 13px var(--sans); cursor: pointer; }
.top-search:hover { border-color: var(--accent); color: var(--text-dim); }
.top-search svg { width: 15px; height: 15px; }
.kbd, .top-search kbd { display: inline-block; margin-left: auto; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border);
  font: 500 10.5px var(--mono); color: var(--text-faint); background: var(--panel); }
.top-status { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim); white-space: nowrap; cursor: pointer; background: none; }
.top-status:hover { color: var(--text); }
.top-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.top-status.on i { background: var(--pass); box-shadow: 0 0 0 4px rgb(var(--pass-rgb) / .16); animation: pulse 2.4s infinite; }
.top-status.off i { background: var(--medium); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(var(--pass-rgb) / 0); } }
.top-bell-wrap { position: relative; }
.top-icon { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: calc(11px * var(--rk));
  border: 1px solid var(--border); background: none; color: var(--text-dim); cursor: pointer; }
.top-icon:hover { color: var(--text); border-color: var(--accent); }
.top-icon svg { width: 18px; height: 18px; }
.top-icon .ic-sun { display: none; }
html[data-mode="light"] .top-icon .ic-sun { display: block; }
html[data-mode="light"] .top-icon .ic-moon { display: none; }
.top-badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  font: 700 10px/17px var(--sans); font-style: normal; text-align: center; color: #fff; background: var(--critical); }
.top-pop { position: absolute; right: 0; top: 46px; width: 340px; padding: 16px; border-radius: calc(16px * var(--rk));
  border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow); animation: pop .2s var(--ease); z-index: 40; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }
.top-pop h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--text); }
.top-pop p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.top-pop ul { margin: 8px 0 0; padding: 0; list-style: none; }
.top-pop li { padding: 9px 0; border-top: 1px solid var(--border-soft); font-size: 13px; color: var(--text-dim); line-height: 1.45; }
.top-pop li b { color: var(--text); }
.top-check svg { width: 16px; height: 16px; }
.app-content { padding: 28px clamp(20px, 2.4vw, 44px) 70px; width: 100%; }
.app-content .pane > h1:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.side-scrim { display: none; }

/* ── overview tiles ───────────────────────────────────────────────────── */

.ov-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 16px; }
.tile { position: relative; padding: 20px; border-radius: calc(18px * var(--rk)); border: 1px solid var(--border); overflow: hidden;
  background: linear-gradient(180deg, var(--tile-sheen), transparent 40%), var(--panel); animation: rise .5s var(--ease) both; }
html[data-mode="light"] .tile { box-shadow: 0 10px 30px -24px rgba(60, 40, 10, .35); }
.tile h3 { margin: 0 0 4px; font: 600 14px var(--sans); color: var(--text); }
.tile .sub { margin: 0; font-size: 12.5px; color: var(--text-faint); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }

.ov-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 26px; align-items: center; padding: 24px 26px;
  background: radial-gradient(600px 240px at 0% 0%, rgb(var(--accent-rgb) / .13), transparent 70%),
    linear-gradient(180deg, var(--tile-sheen), transparent), var(--panel); }
.pring { position: relative; width: 112px; height: 112px; flex: none; }
.pring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pring circle { fill: none; stroke-width: 9; }
.pring .track { stroke: var(--border); }
.pring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease); }
.pring.full .val { stroke: var(--pass); }
.ring-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-txt b { font-family: var(--display); font-weight: var(--display-w); font-size: 34px; line-height: 1; color: var(--text); }
.ring-txt small { display: block; margin-top: 4px; font: 500 9.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); }
.hero-greet { font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); }
.ov-hero h2 { margin: 6px 0 6px; font-family: var(--display); font-weight: var(--display-w); letter-spacing: var(--display-ls);
  font-size: 32px; line-height: 1.1; color: var(--text); }
.ov-hero p { margin: 0; color: var(--text-dim); max-width: 600px; }
.psteps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pstep { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border);
  font: 400 12.5px var(--sans); color: var(--text-dim); background: var(--sunk); text-decoration: none; cursor: default; }
.pstep i { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font: 700 10px var(--sans);
  font-style: normal; color: var(--bg); background: var(--text-faint); }
.pstep.done { color: var(--text); border-color: rgb(var(--pass-rgb) / .4); }
.pstep.done i { background: var(--pass); color: #fff; }
button.pstep, a.pstep { cursor: pointer; }
button.pstep:hover, a.pstep:hover { border-color: var(--accent); color: var(--text); }
.hero-side { display: grid; gap: 8px; justify-items: end; }

.kpi { display: flex; flex-direction: column; gap: 6px; min-height: 132px; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; color: var(--text-faint); font-size: 12.5px; }
.kpi-ico { width: 30px; height: 30px; border-radius: calc(9px * var(--rk)); display: grid; place-items: center; background: var(--hover); }
.kpi-ico svg { width: 16px; height: 16px; }
.kpi b { font-family: var(--display); font-weight: var(--display-w); letter-spacing: var(--display-ls); font-size: 40px; line-height: 1;
  margin-top: 4px; color: var(--text); }
.kpi small { font-size: 12px; color: var(--text-faint); position: relative; z-index: 1; }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 60%; height: 50px; }
.kpi.threat .kpi-ico { color: var(--critical); background: rgb(var(--critical-rgb) / .1); }
.kpi.safe .kpi-ico { color: var(--pass); background: rgb(var(--pass-rgb) / .1); }
.kpi.checks .kpi-ico, .kpi.left .kpi-ico { color: var(--accent); background: rgb(var(--accent-rgb) / .1); }

.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.chart-tools { display: grid; justify-items: end; gap: 8px; }
.chart-range { display: inline-flex; padding: 2px; border-radius: calc(9px * var(--rk)); border: 1px solid var(--border); background: var(--sunk); }
.chart-range button { padding: 4px 9px; border: 0; border-radius: calc(7px * var(--rk)); background: none; color: var(--text-faint);
  font: 500 11.5px var(--sans); cursor: pointer; }
.chart-range button.on { color: var(--text); background: var(--panel-2); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-faint); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart-tile { display: flex; flex-direction: column; }
.chart-tile .vbars { flex: 1; min-height: 170px; height: auto; }
.vbars { display: grid; gap: 6px; align-items: end; height: 170px; padding-top: 8px; border-bottom: 1px solid var(--border-soft); }
.vbar { position: relative; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; }
.vbar span { display: block; border-radius: calc(4px * var(--rk)); transition: filter .2s; }
.vbar:hover span { filter: brightness(1.12); }
.vbar .b-safe { background: rgb(var(--pass-rgb) / .55); }
.vbar .b-warn { background: var(--medium); }
.vbar .b-bad { background: var(--critical); }
.vbar .b-none { background: var(--border); height: 4px; }
.vbar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 5px 8px; border-radius: 7px; font-size: 11.5px; white-space: nowrap; color: var(--bg); background: var(--text); z-index: 2; }
.vbar-days { display: grid; gap: 6px; margin-top: 8px; font: 500 10px var(--mono); color: var(--text-faint); text-align: center; }

.feed { list-style: none; margin: 10px 0 0; padding: 0; }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0;
  border-top: 1px solid var(--border-soft); }
.feed li:first-child { border-top: 0; }
.feed-ico { width: 34px; height: 34px; border-radius: calc(10px * var(--rk)); display: grid; place-items: center;
  font: 700 13px var(--sans); color: var(--text); background: var(--hover); text-transform: uppercase; }
.feed-ico.bad { color: var(--critical); background: rgb(var(--critical-rgb) / .1); }
.feed-ico.warn { color: var(--medium); background: rgb(var(--medium-rgb) / .12); }
.feed-ico.ok { color: var(--pass); background: rgb(var(--pass-rgb) / .1); }
.feed b { display: block; font: 500 13.5px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed small { display: block; font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed time { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.empty-mini { padding: 26px 6px; text-align: center; color: var(--text-faint); font-size: 13px; line-height: 1.6; }
.tile-link { font-size: 12.5px; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; font-family: var(--sans); }
.tile-link:hover { text-decoration: underline; }

.drop { display: grid; place-items: center; gap: 6px; min-height: 150px; margin-top: 12px; padding: 18px;
  border-radius: calc(14px * var(--rk)); text-align: center; border: 1.5px dashed var(--border); background: var(--sunk);
  color: var(--text-dim); cursor: pointer; transition: border-color .2s, background .2s; }
.drop:hover, .drop.over { border-color: var(--accent); background: rgb(var(--accent-rgb) / .05); }
.drop svg { width: 30px; height: 30px; color: var(--accent); }
.drop small { color: var(--text-faint); font-size: 12px; }
.qc-result { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; margin-top: 12px; padding: 14px;
  border-radius: calc(14px * var(--rk)); border: 1px solid var(--border); background: var(--sunk); animation: rise .4s var(--ease) both; }
.qc-score { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display);
  font-size: 24px; border: 3px solid var(--lvl, var(--text-faint)); color: var(--lvl, var(--text)); }
.qc-result b { display: block; color: var(--lvl, var(--text)); }
.qc-result p { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }
.qc-result .tile-link { display: inline-block; margin-top: 6px; }

.tips { position: relative; min-height: 104px; margin-top: 12px; }
.tip { position: absolute; inset: 0; opacity: 0; transform: translateY(6px); transition: opacity .5s, transform .5s var(--ease); pointer-events: none; }
.tip.on { opacity: 1; transform: none; pointer-events: auto; }
.tip b { display: block; margin-bottom: 4px; font-size: 14px; color: var(--text); }
.tip p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.55; }
.tip-dots { display: flex; gap: 6px; }
.tip-dots button { width: 7px; height: 7px; padding: 0; border-radius: 50%; border: 0; background: var(--border); cursor: pointer;
  transition: width .3s var(--ease), background .3s; }
.tip-dots button.on { width: 18px; border-radius: 99px; background: var(--accent); }

/* ── activity page ────────────────────────────────────────────────────── */

.act-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.seg-f { display: inline-flex; padding: 3px; border-radius: calc(11px * var(--rk)); border: 1px solid var(--border); background: var(--sunk); }
.seg-f button { padding: 7px 12px; border: 0; border-radius: calc(8px * var(--rk)); background: none; color: var(--text-dim);
  font: 500 13px var(--sans); cursor: pointer; }
.seg-f button.on { color: var(--text); background: var(--panel-2); }
.seg-f button em { font-style: normal; color: var(--text-faint); margin-left: 4px; }
.act-search { flex: 1; min-width: 200px; max-width: 320px; }
.act-search input { width: 100%; }

/* ── customize drawer ─────────────────────────────────────────────────── */

.drawer-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(10, 8, 5, .45); backdrop-filter: blur(2px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(440px, 100vw); display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--border); box-shadow: var(--shadow); animation: slidein .3s var(--ease); color: var(--text); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border-soft); }
.drawer-head h2 { margin: 0; font-family: var(--display); font-weight: var(--display-w); letter-spacing: var(--display-ls); font-size: 26px; color: var(--text); }
.drawer-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-faint); }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 22px 22px; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 22px;
  border-top: 1px solid var(--border-soft); font-size: 12.5px; color: var(--text-faint); }
.cz-group { padding: 18px 0; border-bottom: 1px solid var(--border-soft); }
.cz-group:last-child { border-bottom: 0; }
.cz-group > h3 { margin: 0 0 12px; font: 600 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }
.cz-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 7px 0; }
.cz-row > span { font-size: 13.5px; color: var(--text); }
.cz-row small { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.seg { display: inline-flex; padding: 2px; border-radius: calc(10px * var(--rk)); border: 1px solid var(--border); background: var(--sunk); }
.seg button { padding: 6px 10px; border: 0; border-radius: calc(8px * var(--rk)); background: none; color: var(--text-dim);
  font: 500 12.5px var(--sans); cursor: pointer; white-space: nowrap; }
.seg button.on { color: var(--text); background: var(--panel-2); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
html[data-mode="light"] .seg button.on { background: var(--panel); }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card { display: grid; gap: 8px; padding: 8px; border-radius: calc(12px * var(--rk)); border: 1.5px solid var(--border);
  background: none; cursor: pointer; text-align: left; color: var(--text-dim); font: 500 12.5px var(--sans); }
.theme-card.on { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .15); }
.theme-card i { display: block; height: 56px; border-radius: calc(8px * var(--rk)); overflow: hidden; position: relative; }
.theme-card i::before, .theme-card i::after { content: ""; position: absolute; border-radius: 4px; }
.theme-card .tc-dark { background: #12171e; }
.theme-card .tc-light { background: #fffdf9; box-shadow: inset 0 0 0 1px #e2dace; }
.theme-card .tc-system { background: linear-gradient(115deg, #fffdf9 50%, #12171e 50%); box-shadow: inset 0 0 0 1px #e2dace; }
.theme-card i::before { left: 8px; top: 8px; width: 20px; bottom: 8px; background: rgb(var(--accent-rgb) / .6); }
.theme-card i::after { left: 34px; right: 10px; top: 11px; height: 7px; background: rgba(128, 120, 110, .45); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); transition: transform .2s var(--ease); }
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.swatch-name { margin-top: 10px; font-size: 12px; color: var(--text-faint); }
.cz-toggle { position: relative; width: 38px; height: 22px; padding: 0; border-radius: 99px; border: 0; background: var(--border); cursor: pointer;
  transition: background .2s; flex: none; }
.cz-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .25s var(--ease); }
.cz-toggle[aria-checked="true"] { background: var(--accent); }
.cz-toggle[aria-checked="true"]::after { transform: translateX(16px); }
.widget-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.widget-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px 8px 12px;
  border-radius: calc(10px * var(--rk)); border: 1px solid var(--border); background: var(--sunk); font-size: 13px; color: var(--text); }
.widget-list li.off span { opacity: .45; }
.widget-list .mv-wrap { display: flex; gap: 4px; }
.widget-list button.mv { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text-dim); cursor: pointer; font-size: 12px; line-height: 1; }
.widget-list button.mv:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.widget-list button.mv:disabled { opacity: .35; cursor: default; }
.cz-preview { margin: 16px 0 2px; padding: 16px; border-radius: calc(14px * var(--rk)); border: 1px solid var(--border);
  background: radial-gradient(300px 120px at 0% 0%, rgb(var(--accent-rgb) / .12), transparent 70%), var(--bg-2); }
.cz-preview b { font-family: var(--display); font-weight: var(--display-w); letter-spacing: var(--display-ls); font-size: 22px; color: var(--text); }
.cz-preview p { margin: 4px 0 12px; font-size: 13px; color: var(--text-dim); }
.cz-preview .row { display: flex; gap: 8px; align-items: center; }
.cz-preview .pill-demo { padding: 3px 9px; border-radius: 99px; font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .04em; }

/* ── command palette and shortcuts ────────────────────────────────────── */

.palette-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(10, 8, 5, .4); animation: fade .15s; }
.palette { position: fixed; left: 50%; top: 14vh; z-index: 71; width: min(620px, calc(100vw - 24px)); transform: translateX(-50%);
  border-radius: calc(16px * var(--rk)); border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow);
  overflow: hidden; color: var(--text); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.palette-input svg { width: 18px; height: 18px; color: var(--text-faint); flex: none; }
.palette-input input { flex: 1; border: 0 !important; outline: 0 !important; background: none !important; padding: 0 !important;
  font: 400 16px var(--sans); color: var(--text); }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.palette-list .pl-group { padding: 10px 10px 4px; font: 600 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }
.palette-list li.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: calc(9px * var(--rk));
  color: var(--text-dim); font-size: 14px; cursor: pointer; }
.palette-list li.item svg { width: 16px; height: 16px; flex: none; }
.palette-list li.item.on { color: var(--text); background: rgb(var(--accent-rgb) / .13); }
.palette-empty { padding: 26px; text-align: center; color: var(--text-faint); font-size: 13px; }
.palette-foot { display: flex; flex-wrap: wrap; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--border-soft); font-size: 11.5px; color: var(--text-faint); }
.palette-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.palette-head h2 { margin: 0; font-family: var(--display); font-weight: var(--display-w); font-size: 22px; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; padding: 8px 20px 20px; }
.shortcuts h3 { grid-column: 1 / -1; margin: 14px 0 4px; font: 600 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }
.shortcuts div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 13px; color: var(--text-dim); }
.shortcuts div span:last-child { display: flex; gap: 4px; }
.shortcuts .kbd { margin-left: 0; }

/* ── density ──────────────────────────────────────────────────────────── */

html[data-density="compact"] body.dash-mode .app-content { padding-top: 18px; }
html[data-density="compact"] body.dash-mode .ov-grid { gap: 10px; }
html[data-density="compact"] body.dash-mode .tile { padding: 14px 16px; }
html[data-density="compact"] body.dash-mode .ov-hero { padding: 16px 18px; gap: 18px; }
html[data-density="compact"] body.dash-mode .kpi { min-height: 104px; }
html[data-density="compact"] body.dash-mode .kpi b { font-size: 32px; }
html[data-density="compact"] body.dash-mode .side-nav button { padding: 8px 12px; }
html[data-density="compact"] body.dash-mode .topbar { padding-top: 10px; padding-bottom: 10px; }
html[data-density="compact"] body.dash-mode .feed li { padding: 8px 0; }

@keyframes rise { from { transform: translateY(8px); } }

@media (min-width: 1600px) {
  .ov-grid { gap: 20px; }
  .tile { padding: 24px; }
  .kpi b { font-size: 46px; }
}
@media (max-width: 1240px) { .top-search { min-width: 0; } .top-search span, .top-search kbd { display: none; } }
@media (max-width: 1100px) {
  .span-8, .span-7, .span-6, .span-5 { grid-column: span 12; }
  .span-3 { grid-column: span 6; }
  .span-4 { grid-column: span 12; }
}
@media (max-width: 860px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-102%); transition: transform .35s var(--ease); }
  .app.open .side { transform: none; }
  .app.open .side-scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 8, 5, .5); }
  .app.collapsed .side-label, .app.collapsed .side-section, .app.collapsed .side-plan { display: revert; }
  .side-collapse { display: none; }
  .top-menu { display: grid; place-items: center; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .top-title h1 { font-size: 22px; }
  .top-status, .top-search { display: none; }
  .top-check span { display: none; }
  .app-content { padding: 18px 16px 60px; }
  .ov-hero { grid-template-columns: 1fr; justify-items: start; }
  .hero-side { justify-items: start; }
  .span-3 { grid-column: span 12; }
  .top-pop { width: min(320px, calc(100vw - 32px)); }
  .shortcuts { grid-template-columns: 1fr; }
}

/* reward code card (Plan page) */
body.dash-mode .reward-card { margin-bottom: 26px; }
body.dash-mode .reward-card h2 { margin: 0 0 4px; }
body.dash-mode .reward-row { display: flex; gap: 8px; max-width: 460px; margin-top: 10px; }
body.dash-mode .reward-row input { flex: 1; min-width: 0; font-family: var(--mono); letter-spacing: .04em; }
body.dash-mode .reward-row input[aria-invalid="true"] { border-color: var(--critical); }

/* upgrade button, launch banner */
body.dash-mode .top-upgrade { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
body.dash-mode .top-upgrade:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
body.dash-mode .top-upgrade svg { width: 15px; height: 15px; }
body.dash-mode .launch-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 20px;
  padding: 14px 18px; border-radius: calc(14px * var(--rk, 1)); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent) 4%, transparent)); }
body.dash-mode .launch-banner[hidden] { display: none; }
body.dash-mode .lb-tag { padding: 4px 10px; border-radius: 99px; font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--bg, #14110d); background: var(--accent); }
body.dash-mode .lb-text { flex: 1 1 280px; font-size: 14px; color: var(--text-dim); }
body.dash-mode .lb-text b { color: var(--text); }

/* checks used and left */
body.dash-mode .usage-big { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; margin: 0 0 20px; padding: 20px 22px;
  border-radius: calc(16px * var(--rk, 1)); border: 1px solid var(--border); background: var(--surface, var(--sunk)); }
body.dash-mode .usage-big > div:not(.ub-bar) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
body.dash-mode .ub-num { font: 700 44px/1 var(--sans); letter-spacing: -1px; color: var(--text); }
body.dash-mode .ub-of { font: 600 22px var(--sans); color: var(--text-faint); }
body.dash-mode .ub-lbl { flex-basis: 100%; font-size: 13.5px; font-weight: 600; color: var(--text-dim); }
body.dash-mode .ub-bar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
body.dash-mode .ub-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
body.dash-mode .usage-big.low .ub-bar i { background: var(--warn, #d99a2b); }
body.dash-mode .usage-big.out .ub-bar i { background: var(--critical); }
body.dash-mode .usage-big.out > div:nth-child(2) .ub-num { color: var(--critical); }
body.dash-mode .ub-foot { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--text-faint); }
@media (max-width: 560px) { body.dash-mode .ub-num { font-size: 34px; } }


/* the plans page (after the first sign-in, and Upgrade) */
body.plans-mode > .nav { display: none; }
body.plans-mode .acct-main { width: 100%; max-width: none; margin: 0; padding: 0; }
.plans-page { width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 60px; }
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 34px; }
.pp-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.pp-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #1a1206; }
.pp-brand .brand-mark svg { width: 18px; height: 18px; }
.pp-brand .brand-name { font: 400 24px var(--serif); }
.pp-brand em { color: var(--accent); }
.pp-head { max-width: 760px; margin: 0 auto 40px; text-align: center; }
.pp-head h1 { margin: 10px 0 12px; font: 400 clamp(36px, 5vw, 56px)/1.05 var(--serif); }
.pp-head .lede { margin: 0 auto 22px; }
.pp-offer { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 12px 20px; border-radius: 14px;
  border: 1px solid rgba(92, 196, 140, .35); background: rgba(92, 196, 140, .08); color: var(--text-dim); }
.pp-offer[hidden] { display: none; }
.pp-offer i { width: 8px; height: 8px; border-radius: 50%; background: var(--pass); }
.pp-offer b { color: var(--pass); }
.plans-page .plans { margin-bottom: 26px; }
.plans-page .plan .btn { align-self: stretch; justify-content: center; }
.plans-page .plan .btn:disabled { opacity: .55; cursor: default; transform: none; }
.plans-page .plan.pp-focus { border-color: var(--accent); }
.pp-coupon { margin: 0 0 16px; }
.pp-coupon label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.pp-coupon input { width: 100%; box-sizing: border-box; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #2a3442;
  background: #0a1017; color: var(--text); font: 600 15px var(--mono); letter-spacing: .05em; outline: none; }
.pp-coupon input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(232, 163, 61, .14); }
.pp-coupon input[aria-invalid="true"] { border-color: var(--critical); }
.pp-coupon .form-msg { margin: 8px 0 0; font-size: 13px; }
.pp-coupon .form-msg:empty, .pp-msg:empty { display: none; }
.pp-coupon .after { margin: 10px 0 0; }
.pp-foot { text-align: center; }
