/* Mail Agent dashboard — "Data-Dense Dashboard" (UI UX Pro Max), charts per the dataviz method.
   Every color is a token; light and dark are each chosen, not inverted. */

@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/vazirmatn-arabic.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200D;
}

:root {
  color-scheme: light;
  --font-sans: "Fira Sans", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Fira Code", ui-monospace, "SF Mono", Menlo, monospace;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e8edf5;
  --border: #e1e6ef;
  --border-strong: #c9d2e0;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --primary: #1e40af;
  --primary-hover: #1e3a8a;
  --primary-soft: #e8eefc;
  --on-primary: #ffffff;
  --accent: #b45309;
  --ring: #1e40af;
  --danger: #b42318;
  --danger-soft: #fdecea;

  /* status: fixed, always with an icon and a label */
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --warning-text: #8a5a00;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-text: #b42318;

  /* charts (validated: tests in the dataviz validator, light surface #ffffff) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e7eaf0;
  --axis: #c3c9d4;
  --chart-muted: #6b7280;
  --heat-0: #f1f4f9;
  --heat-1: #cde2fb;
  --heat-2: #9ec5f4;
  --heat-3: #6da7ec;
  --heat-4: #3987e5;
  --heat-5: #256abf;
  --heat-6: #184f95;
  --heat-7: #0d366b;
  --meter-track: #dbe7fb;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --z-sticky: 10;
  --z-drawer: 40;
  --z-modal: 100;
  --z-toast: 1000;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #162238;
    --surface-3: #1c2a44;
    --border: #22304b;
    --border-strong: #31415f;
    --text: #e6ebf3;
    --text-2: #aab5c7;
    --text-3: #8592a8;
    --primary: #2563eb;
    --primary-hover: #3b74f0;
    --primary-soft: #18294d;
    --on-primary: #ffffff;
    --accent: #f59e0b;
    --ring: #7aa7ff;
    --danger: #f87171;
    --danger-soft: #3a1717;
    --good-text: #2fbf2f;
    --warning-text: #fab219;
    --critical-text: #f08a8a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #1f2b43;
    --axis: #34425f;
    --chart-muted: #8592a8;
    --heat-0: #162238;
    --heat-1: #0d366b;
    --heat-2: #104281;
    --heat-3: #1c5cab;
    --heat-4: #2a78d6;
    --heat-5: #5598e7;
    --heat-6: #86b6ef;
    --heat-7: #cde2fb;
    --meter-track: #1b2d52;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111a2e;
  --surface-2: #162238;
  --surface-3: #1c2a44;
  --border: #22304b;
  --border-strong: #31415f;
  --text: #e6ebf3;
  --text-2: #aab5c7;
  --text-3: #8592a8;
  --primary: #2563eb;
  --primary-hover: #3b74f0;
  --primary-soft: #18294d;
  --on-primary: #ffffff;
  --accent: #f59e0b;
  --ring: #7aa7ff;
  --danger: #f87171;
  --danger-soft: #3a1717;
  --good-text: #2fbf2f;
  --warning-text: #fab219;
  --critical-text: #f08a8a;
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #1f2b43;
  --axis: #34425f;
  --chart-muted: #8592a8;
  --heat-0: #162238;
  --heat-1: #0d366b;
  --heat-2: #104281;
  --heat-3: #1c5cab;
  --heat-4: #2a78d6;
  --heat-5: #5598e7;
  --heat-6: #86b6ef;
  --heat-7: #cde2fb;
  --meter-track: #1b2d52;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.secondary { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: var(--z-toast); background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; box-shadow: var(--shadow-pop); } /* the shadow only once visible: hidden, it bled into the top corner */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); }
.brand-name { font-weight: 600; font-size: 16px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-weight: 500; transition: background 160ms var(--ease), color 160ms var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
:root[data-theme="dark"] .nav a[aria-current="page"] { color: #cfe0ff; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .nav a[aria-current="page"] { color: #cfe0ff; } }
.nav .badge { margin-left: auto; }
.sidebar-foot .btn { justify-content: flex-start; width: 100%; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 4px 0; border-top: 1px solid var(--border); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; font-weight: 600; margin: 0; }
.topbar .spacer { flex: 1; }
.btn.menu-button { display: none; }
.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }
.content.refreshing .card { opacity: 0.6; transition: opacity 200ms var(--ease); }

/* ---------- primitives ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 18px 20px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0; }
.card-sub { font-size: 13px; color: var(--text-3); margin: 2px 0 0; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin: 8px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 120ms var(--ease);
  touch-action: manipulation; white-space: nowrap;
}
a.btn { text-decoration: none; }
.btn, .pill { width: fit-content; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn.icon-only { width: 40px; padding: 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good-text); background: color-mix(in srgb, var(--good) 12%, var(--surface)); border-color: color-mix(in srgb, var(--good) 30%, var(--border)); }
.pill.good .dot { background: var(--good); }
.pill.warn { color: var(--warning-text); background: color-mix(in srgb, var(--warning) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); }
.pill.warn .dot { background: var(--warning); }
.pill.bad { color: var(--critical-text); background: color-mix(in srgb, var(--critical) 10%, var(--surface)); border-color: color-mix(in srgb, var(--critical) 30%, var(--border)); }
.pill.bad .dot { background: var(--critical); }
/* direction is identity, not status: the series colors, as in the charts and the thread */
.pill.dir-incoming .dot { background: var(--series-1); }
.pill.dir-outgoing .dot { background: var(--series-2); }
.pill.dir-draft .dot { background: var(--text-3); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }
.badge.read { background: color-mix(in srgb, var(--series-1) 14%, var(--surface)); color: var(--text); }
.badge.write { background: color-mix(in srgb, var(--warning) 20%, var(--surface)); color: var(--text); }
.badge.send { background: color-mix(in srgb, var(--series-2) 18%, var(--surface)); color: var(--text); }

/* stat tiles and the one hero figure */
.hero { display: flex; flex-direction: column; gap: 4px; }
.hero-value { font-size: 52px; font-weight: 600; line-height: 1.05; letter-spacing: -0.01em; }
.hero-label { color: var(--text-2); font-weight: 500; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.15; }
.stat-note { font-size: 12.5px; color: var(--text-3); }

.meter { position: relative; height: 8px; border-radius: 999px; background: var(--meter-track); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--series-1); transition: width 300ms var(--ease); }
.meter.done > span { background: var(--good); }

/* forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.input, select.input, textarea.input {
  min-height: 42px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); width: 100%; font-size: 15px;
}
textarea.input { min-height: 160px; resize: vertical; line-height: 1.55; }
.input:focus { outline: 3px solid color-mix(in srgb, var(--ring) 40%, transparent); outline-offset: 0; border-color: var(--ring); }
.help { font-size: 13px; color: var(--text-3); font-weight: 400; }
.error-text { color: var(--critical-text); font-size: 13.5px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-weight: 500; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.switch { position: relative; display: inline-flex; align-items: center; width: 44px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); transition: background 160ms var(--ease); }
.switch .thumb { position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 180ms var(--ease); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track + .thumb { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--ring); outline-offset: 2px; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12.5px; letter-spacing: 0.02em; background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }

/* checklist */
.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.check .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.check.ok .mark { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--good-text); }
.check.todo .mark { background: color-mix(in srgb, var(--warning) 22%, var(--surface)); color: var(--warning-text); }
.check.opt .mark { background: var(--surface-3); color: var(--text-3); }

/* mailbox explorer */
.explorer { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
.results { max-height: calc(100dvh - 230px); overflow-y: auto; padding: 6px; }
.result {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid transparent;
  border-radius: var(--radius); background: transparent; cursor: pointer; transition: background 140ms var(--ease);
}
.result:hover { background: var(--surface-2); }
.result[aria-selected="true"] { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.result .line1 { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.result .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .when { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.result .subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .snippet { font-size: 13px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result.unread .who::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--series-1); vertical-align: 1px; }
.reader { min-height: 420px; }
.reader-head h2 { font-size: 19px; margin: 0 0 8px; line-height: 1.35; }
.meta { display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; font-size: 14px; }
.meta dt { color: var(--text-3); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 15px; max-width: 78ch; unicode-bidi: plaintext; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-block: 1px solid var(--border); margin: 14px 0; }
.thread { display: flex; flex-direction: column; gap: 2px; }
.thread-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%; }
.thread-item:hover { background: var(--surface-2); }
.thread-item[aria-current="true"] { background: var(--primary-soft); }
.thread-rail { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; flex: none; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.thread-rail.incoming { background: var(--series-1); }
.thread-rail.outgoing { background: var(--series-2); }
.thread-rail.draft { background: var(--text-3); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--chart-muted); font: 12px var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .label-strong { fill: var(--text); font-weight: 600; }
.chart .label-2 { fill: var(--text-2); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .bar { transition: filter 120ms var(--ease); }
.chart .bar:hover, .chart .bar:focus { filter: brightness(1.12); outline: none; }
.chart .cell:hover, .chart .cell:focus { stroke: var(--text); stroke-width: 1.5; outline: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; }
.legend .line-key { width: 16px; height: 2px; border-radius: 2px; }
.tooltip {
  position: absolute; z-index: var(--z-drawer); pointer-events: none; min-width: 140px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-size: 13px; opacity: 0; transition: opacity 120ms var(--ease);
}
.tooltip.on { opacity: 1; }
.tooltip .t-title { color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .t-row b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.tooltip .t-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .t-key i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-top: 10px; }
.heat-legend .ramp { display: flex; gap: 2px; }
.heat-legend .ramp span { width: 18px; height: 10px; border-radius: 2px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 28px 12px; color: var(--text-3); }

/* code */
pre.code { margin: 0; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font: 13px/1.55 var(--font-mono); overflow-x: auto; white-space: pre; }

/* device code */
.device-code { font: 600 34px/1 var(--font-mono); letter-spacing: 0.12em; padding: 16px 20px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); text-align: center; user-select: all; }

/* modal + toast */
.scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(2, 6, 23, 0.55); display: grid; place-items: center; padding: 16px; animation: fade 160ms var(--ease); }
.modal { width: min(720px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 22px 24px; animation: rise 200ms var(--ease); }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: flex-start; gap: 10px; max-width: 420px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); animation: rise 200ms var(--ease); }
.toast.ok .icon { color: var(--good-text); }
.toast.err .icon { color: var(--critical-text); }

/* token gate */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.gate .card { width: min(520px, 100%); padding: 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .grid.cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explorer { grid-template-columns: 1fr; }
  .results { max-height: 420px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: var(--z-drawer); transform: translateX(-100%); transition: transform 220ms var(--ease); box-shadow: var(--shadow-pop); }
  .shell.nav-open .sidebar { transform: none; }
  .btn.menu-button { display: inline-flex; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 40px; }
}
@media (max-width: 560px) {
  .grid.cols-4 { grid-template-columns: 1fr; }
  .grid.cols-3, .grid.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #updated { display: none; }
  .hero-value { font-size: 44px; }
  .meta { grid-template-columns: 1fr; }
}
