:root {
  --bg: #0c0e14;
  --bg-2: #11141c;
  --card: #151924;
  --card-2: #1b2030;
  --line: #242a3a;
  --line-2: #2f3649;
  --text: #eef0f6;
  --text-2: #b4bacb;
  --muted: #7d8497;
  --accent: #b4f06b;
  --accent-ink: #10150a;
  --accent-soft: rgba(180, 240, 107, .12);
  --sky: #7cc4ff;
  --violet: #b59cff;
  --mint: #5ee0b4;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --none: #3a4152;
  --in: #b4f06b;
  --out: #7cc4ff;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 20px 40px -24px rgba(0, 0, 0, .6);
  --r: 20px;
  --r-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-2: #eceef2;
  --card: #ffffff;
  --card-2: #f3f4f7;
  --line: #e3e6ec;
  --line-2: #d4d8e1;
  --text: #12151d;
  --text-2: #444b5c;
  --muted: #737a8c;
  --accent: #4d8a12;
  --accent-ink: #ffffff;
  --accent-soft: rgba(77, 138, 18, .1);
  --sky: #1f7bd1;
  --violet: #6d4fd8;
  --mint: #0f9a74;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --none: #d4d8e1;
  --in: #6aa82a;
  --out: #3b8fe0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -20px rgba(16, 24, 40, .18);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.logo {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 24px -8px var(--accent);
}
.logo svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.logo-lg { width: 52px; height: 52px; border-radius: 16px; }
.logo-lg svg { width: 30px; height: 30px; }
.wordmark { font-weight: 700; font-size: 22px; letter-spacing: -.02em; }

.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 28px; }
.boot-bar { width: 160px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--accent); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.login { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; overflow: hidden; }
.login-glow {
  position: absolute; inset: -30% -10% auto; height: 80vh; pointer-events: none;
  background:
    radial-gradient(40% 50% at 30% 40%, rgba(180, 240, 107, .16), transparent 70%),
    radial-gradient(35% 45% at 72% 30%, rgba(124, 196, 255, .14), transparent 70%);
  filter: blur(20px);
}
.login-wrap { position: relative; width: 100%; max-width: 460px; display: grid; gap: 28px; }
.login-brand { display: flex; align-items: center; gap: 14px; justify-content: center; }
.login-brand .wordmark { font-size: 30px; }
.login-card {
  display: grid; gap: 12px;
  padding: 36px 32px 30px;
  border: 1px solid var(--line); border-radius: 28px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 32px; line-height: 1.15; letter-spacing: -.025em; }
.login-lead { color: var(--text-2); margin-bottom: 14px; }
.field-label { font-weight: 600; font-size: 15px; }
.key-input {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 0 16px; height: 58px;
  border: 1.5px solid var(--line-2); border-radius: 16px;
  background: var(--bg-2);
  transition: border-color .15s, box-shadow .15s;
}
.key-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.key-input > .ico { color: var(--muted); }
.key-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-family: var(--mono); font-size: 17px; }
.login-error { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-size: 15px; }
.login-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; color: var(--muted); font-size: 14px; }
.login-note .ico { width: 18px; height: 18px; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 14px;
  font-weight: 600; font-size: 16px; white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-lg { height: 58px; font-size: 18px; border-radius: 16px; margin-top: 6px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-soft { background: var(--card-2); border-color: var(--line); }
.btn-soft:hover { border-color: var(--line-2); background: color-mix(in srgb, var(--card-2) 70%, var(--line-2)); }
.btn-danger { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.btn.done { color: var(--ok); }
.ghost-icon {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: none; color: var(--text-2);
  transition: background .15s, color .15s;
}
.ghost-icon:hover { background: var(--card-2); color: var(--text); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; height: 72px; padding: 0 24px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; justify-content: center; gap: 6px; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 18px; border-radius: 14px;
  color: var(--text-2); font-weight: 600;
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); background: var(--card); }
.tab[aria-current="page"] { color: var(--text); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.tab[aria-current="page"] .ico { color: var(--accent); }
.tab-count { min-width: 26px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; text-align: center; }
.tab-count:empty { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.refresh {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px; margin-right: 4px;
  border: 1px solid var(--line); border-radius: 12px;
  background: none; color: var(--text-2); font-size: 14px;
}
.refresh:hover { color: var(--text); border-color: var(--line-2); }
.refresh.spin .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.main { max-width: 1240px; margin: 0 auto; padding: 36px 24px 48px; outline: 0; }
.view { display: grid; gap: 24px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 4px; }
.kicker { color: var(--muted); font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.hero h1 { font-size: clamp(32px, 4.2vw, 46px); line-height: 1.08; letter-spacing: -.035em; font-weight: 750; }
.accent { color: var(--accent); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 15px; font-weight: 600;
}
.chip .ico { width: 18px; height: 18px; color: var(--muted); }
.chip-soft { color: var(--text-2); font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--none); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 20%, transparent); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 20%, transparent); }

.notice { padding: 14px 18px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat, .card {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); box-shadow: var(--shadow);
}
.stat { display: grid; gap: 10px; padding: 22px 22px 20px; }
.stat-head { display: flex; justify-content: space-between; align-items: center; color: var(--text-2); font-weight: 600; font-size: 15px; }
.stat-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; }
.ico-lime { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.ico-sky { background: color-mix(in srgb, var(--sky) 14%, transparent); color: var(--sky); }
.ico-mint { background: color-mix(in srgb, var(--mint) 14%, transparent); color: var(--mint); }
.ico-violet { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }
.stat-value { font-size: 38px; line-height: 1.1; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 22px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.stat-foot { color: var(--muted); font-size: 14px; }
.stat-split { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 14px; }
.stat-split b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }
.sw-in { background: var(--in); }
.sw-out { background: var(--out); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; }
.grid-connect { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.card { padding: 26px; display: grid; gap: 18px; align-content: start; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 16px; }
.card-head h2 { font-size: 21px; letter-spacing: -.015em; margin-bottom: 2px; }
.card-head p { font-size: 15px; }
.link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: 15px; }
.link .ico { width: 18px; height: 18px; transition: transform .15s; }
.link:hover .ico { transform: translateX(3px); }

.seg-group { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button { white-space: nowrap; height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 600; font-size: 15px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--card-2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .2), inset 0 0 0 1px var(--line-2); }

.chart-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chart-total strong { font-size: 30px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chart-total span { color: var(--muted); font-size: 15px; }
.chart { position: relative; height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 5; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .bar { fill: var(--accent); opacity: .85; transition: opacity .12s; }
.chart .bar.zero { fill: var(--line-2); opacity: .7; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { opacity: 1; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-sm); text-align: center; padding: 20px; }

.share { display: grid; gap: 16px; }
.share-row { display: grid; gap: 8px; }
.share-top { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.share-top span:first-child { font-family: var(--mono); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-top b { font-variant-numeric: tabular-nums; }
.track { height: 10px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.track > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .5s cubic-bezier(.2, .8, .2, 1); }

.spend-table { display: grid; }
.spend-row {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(70px, .6fr) minmax(90px, .8fr) minmax(90px, .8fr) minmax(0, 1.5fr);
  align-items: center; gap: 16px; padding: 14px 12px; border-radius: 14px;
  font-variant-numeric: tabular-nums;
}
.spend-row > span:not(:first-child) { text-align: right; }
.spend-headrow { padding-top: 0; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-radius: 0; border-bottom: 1px solid var(--line); }
#spend-body .spend-row:hover { background: var(--bg-2); }
.spend-model { display: flex; align-items: center; gap: 10px; min-width: 0; font-family: var(--mono); font-size: 15px; font-weight: 600; }
.spend-model > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spend-tag { flex: none; padding: 2px 8px; border-radius: 99px; background: var(--bg-2); color: var(--muted); font-family: var(--font); font-size: 12px; font-weight: 600; }
.spend-num { color: var(--text-2); font-size: 15px; }
.spend-total { display: grid; gap: 6px; justify-items: end; }
.spend-total b { font-size: 17px; }
.spend-total b small { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }
.spend-total .track { width: 100%; height: 6px; }
.spend-foot { border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; font-weight: 700; }
.spend-foot .spend-num { color: var(--text); }
.spend-empty { padding: 32px 12px; text-align: center; color: var(--muted); }
.spend-label { display: none; }

.uptime-list { display: grid; gap: 4px; }
.up-row {
  display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(0, 2.4fr) 92px; align-items: center; gap: 20px;
  padding: 14px 12px; border-radius: 14px;
}
.up-row:hover { background: var(--bg-2); }
.up-name { display: flex; align-items: center; gap: 12px; min-width: 0; font-family: var(--mono); font-size: 15px; }
.up-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-pct { text-align: right; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.pct-ok { color: var(--ok); }
.pct-warn { color: var(--warn); }
.pct-bad { color: var(--bad); }
.pct-none { color: var(--muted); font-weight: 500; font-size: 15px; }

.beats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; height: 30px; }
.beat { border-radius: 4px; background: var(--none); opacity: .55; transition: transform .12s, opacity .12s; }
.beat.ok { background: var(--ok); opacity: .9; }
.beat.bad { background: var(--bad); opacity: .95; }
.beat:hover { transform: scaleY(1.15); opacity: 1; }
.beats-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.search {
  flex: 1 1 280px; max-width: 420px;
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search .ico { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; }

.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 16px; }
.model { gap: 20px; }
.model-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.model-name { flex: 1; min-width: 0; font-family: var(--mono); font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-state { font-size: 14px; font-weight: 600; padding: 4px 12px; border-radius: 99px; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.model-state.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.model-state.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.copy-mini { width: 38px; height: 38px; }
.copy-mini .ico { width: 18px; height: 18px; }
.model-up { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 14px 16px; border-radius: 14px; background: var(--bg-2); }
.metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.metric b { font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric b.pct-none { font-size: 18px; }
.model-foot { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.model-foot b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.quota { display: grid; gap: 8px; }
.quota-top { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.quota-top b { color: var(--text-2); }
.quota .track > span.warn { background: var(--warn); }
.quota .track > span.bad { background: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

.copy-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); }
.copy-row code { flex: 1; min-width: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv { display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv > div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.select select {
  height: 44px; padding: 0 40px 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2); font-family: var(--mono); font-size: 14px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 19px, calc(100% - 15px) 19px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.code-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.code-tabs button { position: relative; height: 44px; padding: 0 16px; border: 0; background: none; color: var(--muted); font-weight: 600; }
.code-tabs button:hover { color: var(--text); }
.code-tabs button[aria-selected="true"] { color: var(--text); }
.code-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.code { position: relative; border-radius: 16px; background: #0a0c11; border: 1px solid var(--line); }
:root[data-theme="light"] .code { background: #11141b; border-color: #11141b; }
.code pre { margin: 0; padding: 22px 22px; overflow-x: auto; }
.code code { color: #dfe3ec; font-size: 14.5px; line-height: 1.7; white-space: pre; }
.code .tk-s { color: #b4f06b; }
.code .tk-k { color: #b59cff; }
.code .tk-c { color: #7d8497; }
.code-copy { position: absolute; top: 12px; right: 12px; height: 38px; padding: 0 12px; font-size: 14px; background: #1b2030; border-color: #2f3649; color: #eef0f6; }

.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notes li { display: flex; gap: 12px; color: var(--muted); font-size: 15px; }
.notes li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 10px; border-radius: 50%; background: var(--line-2); }

.foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

.tip {
  position: fixed; z-index: 50; pointer-events: none;
  padding: 10px 12px; border-radius: 12px;
  background: var(--text); color: var(--bg);
  font-size: 13.5px; line-height: 1.45; white-space: pre-line;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
  transform: translate(-50%, calc(-100% - 12px));
}
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 600;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .5);
  animation: rise .2s ease both;
}
.noscript { padding: 24px; text-align: center; }

@media (max-width: 1080px) {
  .stats, .stats.stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-connect { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .topbar { backdrop-filter: none; background: var(--bg); }
  .topbar-inner { grid-template-columns: auto 1fr; height: 64px; padding: 0 16px; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around; gap: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tab { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: 58px; padding: 0 4px; font-size: 12.5px; }
  .tab-count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 0; padding: 0 6px; font-size: 11px; }
  .topbar-actions { justify-self: end; }
  .refresh span { display: none; }
  .main { padding: 24px 16px calc(110px + env(safe-area-inset-bottom)); }
  .up-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; padding: 14px 4px; }
  .spend-headrow { display: none; }
  .card-head > .seg { display: flex; width: 100%; }
  .card-head > .seg button { flex: 1; padding: 0 6px; font-size: 14px; }
  .stats.stats-3 { grid-template-columns: minmax(0, 1fr); }
  .stats.stats-3 .stat:first-child { grid-column: auto; }
  .spend-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 16px 4px; border-bottom: 1px solid var(--line); border-radius: 0; }
  #spend-body .spend-row:hover { background: none; }
  .spend-row > span:not(:first-child) { text-align: left; }
  .spend-model { grid-column: 1 / -1; font-size: 16px; }
  .spend-total { grid-column: 1 / -1; grid-row: 2; justify-items: stretch; }
  .spend-total b { font-size: 20px; }
  .spend-label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
  .spend-foot { border-bottom: 0; }
  .up-row .beats { grid-column: 1 / -1; grid-row: 2; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .stats { gap: 12px; }
  .stat { padding: 18px; }
  .stat-value { font-size: 30px; }
  .card { padding: 20px; border-radius: 18px; }
  .login-card { padding: 28px 22px 24px; }
  .model-up { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 12px; }
  .metric b { font-size: 20px; }
  .copy-row { flex-wrap: wrap; }
  .copy-row code { flex-basis: 100%; }
  .foot { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
