@import url("/static/brand.css");

/* RedRouter app design system. Tokens first; components consume only tokens.
   Spacing is a 4px grid; controls share one height scale so rows of mixed controls align. */

:root {
  color-scheme: light;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 9px;
  --radius-full: 999px;

  --control-sm: 30px;
  --control: 36px;
  --control-lg: 40px;
  --header-height: 56px;
  --content-width: 1200px;
  --gutter: var(--space-6);

  --bg: #fafafb;
  --bg-subtle: #f5f5f7;
  --bg-muted: #eeeef1;
  --surface: #ffffff;
  --surface-hover: #f6f6f7;
  --border: #e6e6e9;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-muted: #5f5f6a;
  --text-subtle: #8b8b96;
  --primary: #b0161c;
  --primary-hover: #8e1116;
  --primary-fg: #ffffff;
  --brand: #b0161c;
  --brand-soft: #f8e9e9;
  --brand-text: #9a1419;
  --success: #15803d;
  --success-soft: #e8f6ed;
  --warning: #a15c07;
  --warning-soft: #fdf3e1;
  --danger: #c4221d;
  --danger-soft: #fdecec;
  --info: #3b5bdb;
  --info-soft: #edf1fd;
  --ring: rgba(176, 22, 28, 0.28);
  --overlay: rgba(9, 9, 11, 0.4);
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, 0.05);
  --shadow: 0 1px 3px rgba(16, 16, 24, 0.06), 0 1px 2px rgba(16, 16, 24, 0.04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 16, 24, 0.18), 0 4px 8px -4px rgba(16, 16, 24, 0.08);
  --chart-1: #b0161c;
  --chart-2: #e3a5a6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0c0e;
    --bg-subtle: #111114;
    --bg-muted: #1a1a1e;
    --surface: #131316;
    --surface-hover: #1c1c20;
    --border: #26262b;
    --border-strong: #35353c;
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --text-subtle: #71717a;
    --primary: #b8191f;
    --primary-hover: #cc2229;
    --primary-fg: #ffffff;
    --brand: #e4504a;
    --brand-soft: #2a1112;
    --brand-text: #ef6b62;
    --success: #4ade80;
    --success-soft: #0f2618;
    --warning: #fbbf24;
    --warning-soft: #2a1f08;
    --danger: #ff7a74;
    --danger-soft: #2c1314;
    --info: #8da2fb;
    --info-soft: #161c33;
    --ring: rgba(228, 80, 74, 0.4);
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border);
    --chart-1: #d23a35;
    --chart-2: #5c1f1f;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0e;
  --bg-subtle: #111114;
  --bg-muted: #1a1a1e;
  --surface: #131316;
  --surface-hover: #1c1c20;
  --border: #26262b;
  --border-strong: #35353c;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  --primary: #b8191f;
  --primary-hover: #cc2229;
  --primary-fg: #ffffff;
  --brand: #e4504a;
  --brand-soft: #2a1112;
  --brand-text: #ef6b62;
  --success: #4ade80;
  --success-soft: #0f2618;
  --warning: #fbbf24;
  --warning-soft: #2a1f08;
  --danger: #ff7a74;
  --danger-soft: #2c1314;
  --info: #8da2fb;
  --info-soft: #161c33;
  --ring: rgba(228, 80, 74, 0.4);
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border);
  --chart-1: #d23a35;
  --chart-2: #5c1f1f;
}

/* Self-hosted Geist, shared with the landing page. */
@font-face { font-family: "Geist"; font-weight: 100 900; font-display: swap; src: url(/static/fonts/geist.woff2) format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 100 900; font-display: swap; src: url(/static/fonts/geist-mono.woff2) format("woff2"); }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--text-2xl); line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: var(--text-lg); line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--text-md); line-height: 1.4; font-weight: 600; }
a { color: inherit; text-decoration: none; }
a.link, .prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a.link:hover, .prose a:hover { text-decoration-color: currentColor; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.92em; }
pre { margin: 0; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-soft); color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.small { font-size: var(--text-sm); }
.num { font-variant-numeric: tabular-nums; }

/* Layout */
.container { width: 100%; max-width: var(--content-width); margin: 0 auto; padding: 0 var(--gutter); }
.page { padding: var(--space-8) 0 var(--space-12); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-header .lede { margin-top: var(--space-2); color: var(--text-muted); font-size: var(--text-base); max-width: 60ch; }
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-xs { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-2); }
.row.wrap { flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.grid-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }

/* Header */
.app-header { position: sticky; top: 0; z-index: 40; height: var(--header-height); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--border); }
.app-header .container { height: 100%; display: flex; align-items: center; gap: var(--space-6); }
.brand { display: inline-flex; align-items: center; gap: .45em; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; flex: none; }
.header-search { position: relative; flex: 0 1 380px; margin-left: auto; }
.header-search .input { height: 34px; padding-left: 34px; padding-right: 40px; background: var(--bg-subtle); }
.header-search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-subtle); pointer-events: none; }
.header-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.header-nav { display: flex; align-items: center; gap: 2px; margin-left: var(--space-4); }
.container-wide { max-width: none; padding: 0 var(--space-6); }
.container-models { max-width: 1440px; }
.header-nav > a { height: 34px; display: inline-flex; align-items: center; padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text-muted); font-size: var(--text-md); font-weight: 450; }
.header-nav > a:hover { color: var(--text); background: var(--surface-hover); }
.header-nav > a[aria-current="page"] { color: var(--brand-text); }
.header-account { display: flex; align-items: center; gap: var(--space-2); margin-left: var(--space-3); }
.app-header .header-toggle { display: none; }
.mobile-nav { display: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control); padding: 0 var(--space-4); border: 1px solid transparent; border-radius: var(--radius); font-size: var(--text-base); font-weight: 550; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none; transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:not(:disabled):hover { background: var(--primary-hover); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:not(:disabled):hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:not(:disabled):hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:not(:disabled):hover { background: var(--surface-hover); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:not(:disabled):hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-sm { height: var(--control-sm); padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: var(--control-lg); padding: 0 var(--space-5); }
.btn-icon { width: var(--control); padding: 0; }
.btn-icon.btn-sm { width: var(--control-sm); }
.btn-block { width: 100%; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--space-4); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 6px; }
.label { font-size: var(--text-sm); font-weight: 550; color: var(--text); }
.hint { font-size: var(--text-sm); color: var(--text-muted); }
.input, .select, .textarea { width: 100%; height: var(--control); padding: 0 var(--space-3); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: var(--text-base); box-shadow: var(--shadow-sm); transition: border-color 120ms ease, box-shadow 120ms ease; }
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border-strong)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--text-subtle) 50%), linear-gradient(135deg, var(--text-subtle) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.select:disabled, .input:disabled { opacity: 0.6; cursor: not-allowed; }
.textarea { height: auto; min-height: 96px; padding: var(--space-2) var(--space-3); line-height: 1.5; resize: vertical; }
.input-sm, .select.input-sm { height: var(--control-sm); font-size: var(--text-sm); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-6); }
.form-error { font-size: var(--text-sm); color: var(--danger); }

/* Choice cards (e.g. top-up amount) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--space-2); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-weight: 600; font-variant-numeric: tabular-nums; transition: border-color 120ms ease, background-color 120ms ease; }
.choice input:hover + span { background: var(--surface-hover); }
.choice input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-muted); border-radius: var(--radius); }
.segmented button { height: 28px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font-size: var(--text-sm); font-weight: 550; cursor: pointer; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: var(--text-md); }
.card-header .hint { margin-top: 2px; }
.card-header:last-child { border-bottom: 0; }
.card-body { padding: var(--space-5); }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); background: var(--bg-subtle); border-radius: 0 0 var(--radius-lg) var(--radius-lg); font-size: var(--text-sm); color: var(--text-muted); }
.card-flush { overflow: hidden; }

/* Stats */
.stat { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.stat-label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.stat-value { font-size: var(--text-2xl); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-meta { font-size: var(--text-sm); color: var(--text-subtle); }

/* Description list */
.dl { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0; margin: 0; }
.card-body > .dl:first-child { margin-top: calc(-1 * var(--space-3)); }
.card-body > .dl:last-child { margin-bottom: calc(-1 * var(--space-3)); }
.card-body > .dl + * { margin-top: var(--space-4); }
.dl dt, .dl dd { display: flex; align-items: center; min-height: 48px; margin: 0; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.dl dt { color: var(--text-muted); padding-right: var(--space-6); }
.dl dd { overflow-wrap: anywhere; }
.dl dd > * { min-width: 0; }
.dl dd > .row-between { flex: 1; }
.dl > :nth-last-child(-n + 2) { border-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { height: 38px; padding: 0 var(--space-4); text-align: left; font-weight: 550; color: var(--text-muted); background: var(--bg-subtle); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { white-space: nowrap; height: 48px; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg-subtle); }
.table th:first-child, .table td:first-child { padding-left: var(--space-5); }
.table th:last-child, .table td:last-child { padding-right: var(--space-5); }
.table .right { text-align: right; }
.table td svg { width: 14px; height: 14px; flex: none; color: var(--text-subtle); }
.table td.right { font-variant-numeric: tabular-nums; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 550; line-height: 1; white-space: nowrap; background: var(--bg-muted); color: var(--text-muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.plain::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }

/* Copyable identifiers */
.id-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 var(--space-1) 0 var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); cursor: pointer; transition: border-color 120ms ease, color 120ms ease; }
.id-chip:hover { color: var(--text); border-color: var(--border-strong); }
.id-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-chip svg { width: 13px; height: 13px; flex: none; margin-right: 2px; }
.id-chip[data-copied] { color: var(--success); }

kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--radius-sm); background: var(--surface); font-size: 11px; color: var(--text-subtle); }

/* Notices */
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); font-size: var(--text-sm); color: var(--text-muted); }
.notice svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.notice strong { color: var(--text); font-weight: 600; }
.notice-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); color: color-mix(in srgb, var(--warning) 70%, var(--text)); }
.notice-warning svg { color: var(--warning); }
.notice-info svg { color: var(--info); }
.page-notice { margin-bottom: var(--space-5); }

/* Code */
.code { position: relative; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); }
.code pre { padding: var(--space-4); overflow-x: auto; font-size: 12.5px; line-height: 1.65; color: var(--text); }
.code .btn { position: absolute; top: var(--space-2); right: var(--space-2); }
.tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--border); margin-bottom: var(--space-5); overflow-x: auto; }
.tabs button, .tabs a { position: relative; height: 40px; padding: 0; border: 0; background: none; color: var(--text-muted); font-weight: 550; cursor: pointer; white-space: nowrap; }
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs [aria-selected="true"] { color: var(--brand-text); }
.tabs [aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; }

/* Menus and dialogs */
.menu-anchor { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 232px; padding: var(--space-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 50; }
.menu-header { padding: var(--space-2) var(--space-3) var(--space-3); border-bottom: 1px solid var(--border); margin-bottom: var(--space-1); }
.menu-header .email { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu a, .menu button { display: flex; align-items: center; gap: var(--space-2); width: 100%; height: 34px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font-size: var(--text-base); text-align: left; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--surface-hover); }
.menu svg { width: 15px; height: 15px; color: var(--text-muted); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-muted); color: var(--text-muted); font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; cursor: pointer; }
.avatar:hover { border-color: var(--border-strong); color: var(--text); }

dialog.dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.dialog::backdrop { background: var(--overlay); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-6) 0; }
.dialog-header p { margin-top: var(--space-1); color: var(--text-muted); }
.dialog-body { padding: var(--space-5) var(--space-6); }
.dialog-body > * + * { margin-top: var(--space-4); }
.dialog-footer { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); background: var(--bg-subtle); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.toast-region { position: fixed; bottom: var(--space-6); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); pointer-events: none; }
.toast { padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--text); color: var(--bg); font-size: var(--text-sm); font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in 160ms ease-out; max-width: min(480px, calc(100vw - 32px)); }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Empty, loading */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-12) var(--space-6); text-align: center; color: var(--text-muted); }
.empty > svg { width: 28px; height: 28px; color: var(--text-subtle); margin-bottom: var(--space-1); }
.empty strong { color: var(--text); font-weight: 600; }
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--bg-muted) 25%, var(--surface-hover) 50%, var(--bg-muted) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.page-error { padding: var(--space-4); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border)); border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); }

/* Chart */
.chart { position: relative; height: 240px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis text { fill: var(--text-subtle); font-size: 11px; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--chart-1); pointer-events: none; }
.chart .bar.dim { fill: var(--chart-2); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.active { fill: color-mix(in srgb, var(--chart-1) 80%, var(--text)); }
.chart-tip { position: absolute; pointer-events: none; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-lg); font-size: var(--text-xs); white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); }
.tooltip { position: fixed; inset: auto; margin: 0; max-width: min(280px, calc(100vw - 16px)); padding: 6px var(--space-3); border: 0; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: var(--text-xs); font-weight: 450; line-height: 1.45; text-wrap: pretty; pointer-events: none; overflow: visible; animation: tooltip-in 100ms ease-out; }
@keyframes tooltip-in { from { opacity: 0; } }
.info { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 20px; height: 20px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-subtle); cursor: help; vertical-align: middle; transition: color 120ms ease; }
.info::before { content: "i"; display: flex; align-items: center; justify-content: center; width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 50%; font: 700 9px/1 var(--font-sans); }
.info:hover, .info:focus-visible { color: var(--text); }
.info:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.title-row { display: flex; align-items: center; gap: 6px; }
.chart-tip strong { display: block; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }

/* Models */
.toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.toolbar .search { position: relative; flex: 1 1 280px; }
.toolbar .search .input { padding-left: 36px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-subtle); pointer-events: none; }
.toolbar .select { width: auto; min-width: 180px; }
.search-box { position: relative; flex: 0 1 420px; }
.search-box .input { padding-left: 36px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-subtle); pointer-events: none; }
.model-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-6); flex-wrap: wrap; margin-bottom: var(--space-6); }
.model-hero .row { margin-top: var(--space-3); flex-wrap: wrap; }
.hero-desc { margin-top: var(--space-3); color: var(--text-muted); max-width: 70ch; }
.breadcrumb { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-subtle); margin-bottom: var(--space-3); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb svg { width: 14px; height: 14px; }
.spec-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-6); }
.spec { padding: var(--space-4) var(--space-5); border-right: 1px solid var(--border); }
.spec:last-child { border-right: 0; }
.spec .stat-label { margin-bottom: var(--space-1); }
.spec strong { font-size: var(--text-lg); font-weight: 650; font-variant-numeric: tabular-nums; }

/* Settings */
.settings-section { scroll-margin-top: calc(var(--header-height) + var(--space-6)); }
.settings-section + .settings-section { margin-top: var(--space-6); }
.key-secret { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-subtle); }
.key-secret code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: var(--text-sm); user-select: all; }

/* Auth pages */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-10) var(--space-4); background: var(--bg-subtle); }
.auth .brand { margin-bottom: var(--space-8); }
.auth-card { width: 100%; max-width: 400px; padding: var(--space-8); }
.auth-card h1 { font-size: var(--text-xl); }
.auth-card .lede { margin: var(--space-2) 0 var(--space-6); color: var(--text-muted); }
.auth-card .btn-block { margin-top: var(--space-5); }
.auth-foot { margin-top: var(--space-6); font-size: var(--text-sm); color: var(--text-muted); text-align: center; }
.status-line { margin-top: var(--space-4); font-size: var(--text-sm); color: var(--text-muted); }
.status-line.error { color: var(--danger); }
.status-line.success { color: var(--success); }

/* Chat */
.chat-page { height: calc(100vh - var(--header-height)); height: calc(100dvh - var(--header-height)); display: flex; flex-direction: column; }
.chat-bar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--gutter); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-bar .spacer { flex: 1; }
.session-badge { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-full); background: var(--bg-muted); color: var(--text-muted); font-size: var(--text-xs); font-weight: 550; white-space: nowrap; }
.model-slots { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; }
.model-slot { display: flex; align-items: center; gap: 2px; min-width: 0; }
.model-pick { display: inline-flex; align-items: center; gap: var(--space-2); height: 34px; max-width: 320px; min-width: 0; padding: 0 var(--space-2) 0 6px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: var(--text-base); font-weight: 550; cursor: pointer; transition: border-color 120ms ease, background 120ms ease; }
.model-pick:hover:not(:disabled) { background: var(--surface-hover); }
.model-pick[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.model-pick:disabled { opacity: 0.6; cursor: default; }
.model-pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-pick > svg { width: 14px; height: 14px; color: var(--text-subtle); flex: none; }
.slot-tag { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-text); font-size: 11px; font-weight: 700; flex: none; }
.picker { position: fixed; z-index: 60; max-height: min(420px, 70vh); overflow-y: auto; padding: var(--space-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.picker-option { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); text-align: left; cursor: pointer; }
.picker-option:hover:not(:disabled), .picker-option:focus-visible { background: var(--surface-hover); outline: none; }
.picker-option[aria-selected="true"] { background: var(--brand-soft); }
.picker-option:disabled { opacity: 0.5; cursor: not-allowed; }
.picker-option > svg, .picker-check { width: 16px; height: 16px; margin-left: auto; color: var(--brand-text); flex: none; }
.picker-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.picker-name { font-weight: 550; }
.picker-sub { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.session-badge svg { width: 14px; height: 14px; }
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-thread { max-width: 780px; margin: 0 auto; padding: var(--space-8) var(--gutter); display: flex; flex-direction: column; gap: var(--space-6); }
.chat-empty { max-width: 520px; margin: auto; padding: var(--space-12) var(--gutter); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.chat-empty .icon-tile { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--radius-lg); background: var(--brand-soft); color: var(--brand-text); margin-bottom: var(--space-2); }
.chat-empty .icon-tile svg { width: 22px; height: 22px; }
.chat-empty p { color: var(--text-muted); }
.chat-empty .notice { text-align: left; margin-top: var(--space-2); }
.msg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.turn { display: flex; flex-direction: column; gap: var(--space-4); }
.replies { display: grid; gap: var(--space-4); }
.replies-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.replies-2 .msg-assistant { padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.comparing .chat-thread { max-width: 1240px; }
.msg-user { align-items: flex-end; }
.msg-user .msg-body { max-width: 85%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg); background: var(--bg-muted); }
.msg-assistant .msg-body { line-height: 1.65; font-size: var(--text-md); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body pre { margin: var(--space-3) 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); font-size: 12.5px; overflow-x: auto; white-space: pre; }
.msg-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; }
.model-dot { width: 20px; height: 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.model-dot svg, .model-dot .maker-mark { width: 12px; height: 12px; }
.msg-meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-size: var(--text-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.msg-meta .error { color: var(--danger); }
.cursor::after { content: ""; display: inline-block; width: 7px; height: 1.1em; margin-left: 2px; vertical-align: text-bottom; background: var(--text-muted); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer-wrap { padding: 0 var(--gutter) var(--space-5); }
.composer { max-width: 780px; margin: 0 auto; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); transition: border-color 120ms ease, box-shadow 120ms ease; }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.composer textarea { display: block; width: 100%; min-height: 52px; max-height: 240px; padding: var(--space-4) var(--space-4) var(--space-2); border: 0; background: transparent; resize: none; outline: none; font-size: var(--text-md); line-height: 1.5; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); }
.composer-foot .hint { font-size: var(--text-xs); }
.composer-foot .row { margin-left: auto; }
.chat-settings { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }

/* Account shell: full-height side navigation beside the page, as on the account pages */
.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - var(--header-height)); }
.side-nav { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); display: flex; flex-direction: column; padding: var(--space-6) var(--space-3) var(--space-3); border-right: 1px solid var(--border); background: var(--bg); overflow-y: auto; }
.side-nav-title { padding: 0 var(--space-3) var(--space-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
.side-nav a { display: flex; align-items: center; gap: var(--space-3); height: 38px; padding: 0 var(--space-3); border-radius: var(--radius); color: var(--text-muted); font-size: var(--text-md); font-weight: 450; }
.side-nav a + a { margin-top: 2px; }
.side-nav a:hover { background: var(--surface-hover); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); font-weight: 550; }
.side-nav a svg { width: 17px; height: 17px; flex: none; }
.side-nav-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-1) 0; border-top: 1px solid var(--border); }
.side-nav-foot .btn-icon.danger { color: var(--danger); }
.shell-main { min-width: 0; padding: var(--space-8) var(--space-8) var(--space-12); }
.shell-main > .page-header { margin-bottom: var(--space-6); }
.shell-content { max-width: 1280px; }

/* Header account switcher */
.account-switch { display: inline-flex; align-items: center; gap: var(--space-2); height: 36px; max-width: 280px; padding: 0 var(--space-2) 0 var(--space-1); border: 0; border-radius: var(--radius); background: transparent; color: var(--text); font-size: var(--text-md); font-weight: 550; cursor: pointer; }
.account-switch:hover { background: var(--surface-hover); }
.account-switch .avatar { width: 26px; height: 26px; font-size: 12px; pointer-events: none; }
.account-switch > span:not(.avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-switch svg { width: 14px; height: 14px; color: var(--text-subtle); flex: none; }
.crumb-sep { color: var(--border-strong); font-size: 20px; font-weight: 300; }
.menu.menu-left { left: 0; right: auto; min-width: 272px; }
.menu-title { padding: var(--space-3) var(--space-3) var(--space-1); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
.menu .menu-value { margin-left: auto; color: var(--text-subtle); font-size: var(--text-sm); }
.menu .danger, .menu .danger svg { color: var(--danger); }
.menu hr { margin: var(--space-1) 0; border: 0; border-top: 1px solid var(--border); }

/* Row action menus */
.row-menu { position: relative; display: inline-flex; }
.row-menu .menu { min-width: 200px; top: calc(100% + 4px); }
.menu.menu-fixed { position: fixed; left: auto; }

/* Usage against a limit */
.meter { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.meter-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.meter-track { height: 4px; border-radius: var(--radius-full); background: var(--bg-muted); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--brand); }
.meter-fill.low { background: var(--text-subtle); }
.reset-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-muted); }
.key-name { display: flex; align-items: baseline; gap: var(--space-2); font-weight: 550; }
.key-name .mono { color: var(--text-subtle); font-weight: 400; font-size: var(--text-sm); }
.key-name.revoked { color: var(--text-subtle); text-decoration: line-through; }
.table td.muted-cell { color: var(--text-muted); }

/* Checkbox lists */
.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; padding: var(--space-1); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-sm); cursor: pointer; }
.check:hover { background: var(--surface-hover); }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex: none; }
.check .mono { color: var(--text-subtle); font-size: var(--text-xs); margin-left: auto; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: var(--space-3); }
.field-row > .field { margin-top: 0; }
.field.hint { margin-top: var(--space-2); }

/* Models: filters beside a card list or table */
.models-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: var(--space-8); align-items: start; }
.filters { position: sticky; top: calc(var(--header-height) + var(--space-6)); display: flex; flex-direction: column; }
.filter-group { border-bottom: 1px solid var(--border); }
.filter-group summary { display: flex; align-items: center; gap: var(--space-3); height: 48px; padding: 0 var(--space-1); list-style: none; font-size: var(--text-md); font-weight: 500; cursor: pointer; }
.filter-group summary::-webkit-details-marker { display: none; }
.filter-group summary svg { width: 17px; height: 17px; color: var(--text-muted); }
.filter-group summary .chev { margin-left: auto; transition: transform 120ms ease; }
.filter-group[open] summary .chev { transform: rotate(90deg); }
.filter-group .check { margin-bottom: 2px; font-size: var(--text-md); }
.filter-group > div { padding: 0 0 var(--space-3); }
.view-toggle { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.view-toggle button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font-weight: 500; cursor: pointer; }
.view-toggle button svg { width: 15px; height: 15px; }
.view-toggle button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-text); }
.model-cards { display: flex; flex-direction: column; gap: var(--space-3); }
.model-card { padding: var(--space-5) var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); transition: border-color 120ms ease, box-shadow 120ms ease; }
.model-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.model-card-head { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.model-card-head h2 { font-size: var(--text-lg); font-weight: 600; min-width: 0; }
.model-card-head h2 a:hover { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.model-card-head .hover-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity 120ms ease; }
.model-card:hover .hover-actions, .model-card:focus-within .hover-actions { opacity: 1; }
.model-card-head .aside { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; }
.model-logo { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); flex: none; }
.model-logo svg, .model-logo .maker-mark { width: 16px; height: 16px; }
.model-logo-lg { width: 40px; height: 40px; }
.model-logo-lg .maker-mark { width: 22px; height: 22px; }
.model-title { gap: var(--space-3); }
.maker-zai { --mark: url(/static/vendors/zai.svg); }
.maker-qwen { --mark: url(/static/vendors/qwen.svg); }
.maker-mark { display: block; background: currentColor; -webkit-mask: var(--mark) center / contain no-repeat; mask: var(--mark) center / contain no-repeat; }
.model-card p { margin-top: var(--space-3); color: var(--text-muted); font-size: var(--text-md); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; margin-top: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.meta-line > * + *::before { content: ""; display: inline-block; width: 1px; height: 14px; margin: 0 var(--space-3); vertical-align: -2px; background: var(--border-strong); }
.meta-line code { font-size: var(--text-xs); }

/* Breakdown lists (top keys, usage by model) */
.rank { display: flex; flex-direction: column; }
.rank-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: 0; }
.rank-row .n { color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.rank-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .meta { grid-column: 2 / -1; margin-top: -6px; }
.rank-row .bar { grid-column: 2 / -1; height: 4px; border-radius: var(--radius-full); background: var(--bg-muted); overflow: hidden; }
.rank-row .bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.rank-row .value { font-variant-numeric: tabular-nums; font-weight: 550; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }

/* Responsive */
@media (max-width: 1024px) {
  .models-layout { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; display: none; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec:nth-child(2) { border-right: 0; }
  .spec:nth-child(-n + 2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side-nav { position: static; height: auto; flex-direction: row; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-4); border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .side-nav-title, .side-nav-foot { display: none; }
  .side-nav a { height: 34px; white-space: nowrap; font-size: var(--text-base); }
  .side-nav a + a { margin-top: 0; }
  .shell-main { padding: var(--space-6) var(--gutter) var(--space-10); }
  .account-switch > span:not(.avatar) { max-width: 140px; }
  .crumb-sep { display: none; }
  .header-search, .header-nav { display: none; }
  .container-wide { padding: 0 var(--gutter); }
  .app-header .header-toggle { display: inline-flex; margin-left: auto; }
  .header-account { margin-left: 0; }
  .mobile-nav { position: absolute; top: var(--header-height); left: 0; right: 0; padding: var(--space-2) var(--space-4) var(--space-4); background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); flex-direction: column; gap: 2px; }
  .mobile-nav.open { display: flex; }
  .mobile-nav a { display: flex; align-items: center; height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-sm); font-weight: 500; }
  .mobile-nav a[aria-current="page"] { background: var(--bg-muted); }
}
@media (max-width: 640px) {
  .model-card { padding: var(--space-4); }
  .meta-line { gap: var(--space-1) var(--space-3); }
  .meta-line > * + *::before { display: none; }
  .model-card-head .aside { display: none; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .account-switch > span:not(.avatar) { display: none; }
  :root { --gutter: var(--space-4); }
  h1 { font-size: var(--text-xl); }
  .page { padding: var(--space-6) 0 var(--space-10); }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .stat { padding: var(--space-4); }
  .stat-value { font-size: var(--text-lg); }
  .stat-label, .stat-meta { font-size: var(--text-xs); }
  .spec-grid { grid-template-columns: minmax(0, 1fr); }
  .spec { border-right: 0; border-bottom: 1px solid var(--border); }
  .spec:last-child { border-bottom: 0; }
      .card-header, .card-body { padding-left: var(--space-4); padding-right: var(--space-4); }
  .table th:first-child, .table td:first-child { padding-left: var(--space-4); }
  .table th:last-child, .table td:last-child { padding-right: var(--space-4); }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { min-height: 0; padding-bottom: 0; border-bottom: 0; }
  .dl dd { min-height: 0; padding-top: 2px; }
  .chat-bar { gap: var(--space-2); }
  .model-slots { flex: 1 1 100%; }
  .model-slot { flex: 1 1 0; }
  .comparing .model-slot { flex-basis: 100%; }
  .model-pick { flex: 1 1 auto; max-width: none; }
  .replies-2 { grid-template-columns: minmax(0, 1fr); }
  .chat-bar .spacer { display: none; }
  .chat-bar .row { margin-left: auto; }
  .chat-bar .row .btn { width: var(--control-sm); padding: 0; }
  .chat-bar .row .btn span { display: none; }
  .composer-foot .hint { display: none; }
  .toolbar .select { flex: 1; }
  .auth-card { padding: var(--space-6); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.by-redrouter { display: inline-flex; align-items: center; gap: 5px; font-weight: 550; color: var(--text); }
.by-redrouter img { flex: none; }
