/* StreetAI customer dashboard — matches the commercial site theme
   (business/styles.css tokens), self-contained so it has no build step. */

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1a1a1a;
  --bg-section: #111111;
  --red: #e11d48;
  --red-dim: #be123c;
  --red-glow: rgba(225, 29, 72, 0.18);
  --green: #4ade80;
  --green-glow: rgba(34, 197, 94, 0.14);
  --text: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #666;
  --border: #222;
  --border-light: #2a2a2a;
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 600; font-family: inherit;
  padding: 11px 20px; border-radius: var(--radius-sm);
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 20px var(--red-glow); }
.btn-primary:hover:not(:disabled) { background: var(--red-dim); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-light); }
.btn-outline:hover:not(:disabled) { background: var(--bg-card); border-color: #3a3a3a; }
.btn-block { width: 100%; }

/* ── Form fields ── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-secondary); }
.field input {
  background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 11px 13px; color: var(--text); font-size: 15px; font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--red); }
.form-msg { font-size: 14px; padding: 10px 12px; border-radius: var(--radius-sm); }
.form-msg.err { background: var(--red-glow); color: #fb7185; }
.form-msg.ok  { background: var(--green-glow); color: var(--green); }

/* ── Modal + toast (custom, replacing native confirm/alert) ── */
.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 26px; width: 100%; max-width: 400px; }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--text-secondary); font-size: 14.5px; line-height: 1.55; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 12px 18px; font-size: 14px; z-index: 1100; opacity: 0; transition: opacity .25s ease, transform .25s ease; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(225,29,72,.4); color: #fb7185; }
.toast.ok { border-color: rgba(34,197,94,.35); color: var(--green); }

/* ── Site header (shown above auth screens so they read as part of the site) ── */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(10,10,10,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-nav-logo img { height: 56px; width: auto; }   /* same size as homepage */
.site-nav-links { display: flex; gap: 24px; margin-left: auto; }
.site-nav-links a { color: var(--text-secondary); font-size: 15px; }
.site-nav-links a:hover { color: var(--text); }
@media (max-width: 600px) { .site-nav-links { display: none; } }

/* ── Auth screen ── */
.auth-wrap { min-height: calc(100vh - 85px); display: grid; place-items: center; padding: 24px; }
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 34px 30px; width: 100%; max-width: 420px;
}
.auth-card h1 { font-size: 23px; text-align: center; letter-spacing: -0.01em; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-secondary); font-size: 14.5px; margin-bottom: 24px; }
.auth-tabs { display: flex; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 22px; }
.auth-tab {
  flex: 1; text-align: center; padding: 9px; font-size: 14.5px; font-weight: 600;
  color: var(--text-secondary); background: none; border: none; cursor: pointer;
  border-radius: 6px; font-family: inherit; transition: background .15s, color .15s;
}
.auth-tab.active { background: var(--bg-card-hover); color: var(--text); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-foot { text-align: center; color: var(--text-muted); font-size: 13px; margin-top: 18px; }
.link-btn {
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--text-secondary); font-size: 13.5px; text-align: center;
  padding: 2px; transition: color .15s;
}
.link-btn:hover { color: var(--text); }
.link-btn:disabled { color: var(--text-muted); cursor: default; }

/* ── Notice banners ── */
.notice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 14px; border: 1px solid transparent;
}
.notice .txt { flex: 1; min-width: 200px; }
.notice .ico { font-size: 15px; }
.notice .link-btn { color: inherit; font-weight: 600; text-decoration: underline; }
.notice.warn { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #fbbf24; }
.notice.ok   { background: var(--green-glow); border-color: rgba(34,197,94,.25); color: var(--green); }
.notice.err  { background: var(--red-glow); border-color: rgba(225,29,72,.3); color: #fb7185; }

/* ── Dashboard shell ── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-section); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
/* align-self:flex-start stops the column-flex sidebar from stretching the logo
   to full width (which fixes a fixed height = distortion). 56px = homepage. */
.sidebar-logo { height: 56px; width: auto; align-self: flex-start; margin: 4px 6px 22px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-secondary); font-size: 15px; font-weight: 500;
  transition: background .15s, color .15s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--red-glow); color: var(--text); }
.nav-item.active .nav-ico { color: var(--red); }
.nav-ico { width: 19px; height: 19px; flex: none; color: var(--text-muted); }
.nav-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }
.nav-item .soon { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.sidebar-spacer { flex: 1; }

/* topbar (mobile) + main */
.topbar {
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-section); position: sticky; top: 0; z-index: 30;
}
.topbar img { height: 40px; width: auto; }
.topbar-logo { display: flex; align-items: center; }
.menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 4px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.main-head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px clamp(18px, 4vw, 40px); border-bottom: 1px solid var(--border);
}
.main-head h1 { font-size: 22px; letter-spacing: -0.01em; }
.main-head .spacer { flex: 1; }
.account-chip { display: flex; align-items: center; gap: 10px; }
.account-chip .biz { font-size: 14px; color: var(--text-secondary); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--red), var(--red-dim));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
}
.view { padding: clamp(20px, 4vw, 36px) clamp(18px, 4vw, 40px); max-width: 940px; width: 100%; }

/* ── Cards / content ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card + .card { margin-top: 18px; }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card .card-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 18px; }
.card-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--border); }
.card-row:first-of-type { border-top: none; }
.card-row .label { color: var(--text-muted); font-size: 13.5px; width: 140px; flex: none; }
.card-row .val { color: var(--text); font-size: 14.5px; }

.welcome { font-size: 26px; letter-spacing: -0.02em; margin-bottom: 6px; }
.welcome-sub { color: var(--text-secondary); margin-bottom: 26px; font-size: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.stat .num { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.stat .cap { color: var(--text-secondary); font-size: 13.5px; margin-top: 2px; }

.pill { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 100px; }
.pill.soon { color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); }
.pill.live { color: var(--green); background: var(--green-glow); }

.empty { text-align: center; padding: 40px 20px; }
.empty .ico { width: 46px; height: 46px; margin: 0 auto 14px; color: var(--text-muted); }
.empty .ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--text-secondary); font-size: 14.5px; max-width: 380px; margin: 0 auto; }

/* Section labels sit ABOVE the card they describe: clear gap from the previous
   block, tight gap to their own card below. */
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 28px 0 10px 2px; }
.view > #billingRoot > .section-label:first-child,
.view > #usageRoot > .section-label:first-child,
.view > #apikeysRoot > .section-label:first-child,
.view > .section-label:first-child { margin-top: 4px; }

/* ── Billing ── */
.wallet-head { display: flex; align-items: center; gap: 16px; }
.wallet-label { color: var(--text-muted); font-size: 13px; }
.wallet-balance { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.wallet-head .btn { margin-left: auto; }

.topup-panel { border-top: 1px solid var(--border); margin-top: 18px; }
.amt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; margin-bottom: 16px; }
.amt-btn {
  background: var(--bg); border: 1px solid var(--border-light); color: var(--text);
  font-size: 16px; font-weight: 600; font-family: inherit; padding: 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.amt-btn:hover { border-color: #3a3a3a; }
.amt-btn.active { border-color: var(--red); background: var(--red-glow); color: var(--text); }
.amt-custom { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 0 13px; margin-bottom: 16px; transition: border-color .15s; }
.amt-custom:focus-within { border-color: var(--red); }
.amt-custom.invalid, .amt-custom:has(input.invalid) { border-color: #fb7185; }
.amt-prefix { color: var(--text-muted); font-size: 15px; }
.amt-custom input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; font-family: inherit; padding: 12px 0; }
.amt-custom input::placeholder { color: var(--text-muted); }
.amt-custom input.invalid { color: #fb7185; }
.amt-custom input::-webkit-outer-spin-button, .amt-custom input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amt-custom input[type=number] { -moz-appearance: textfield; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-secondary); margin-bottom: 16px; cursor: pointer; }
.consent input { margin-top: 3px; accent-color: var(--red); flex: none; }
.consent b { color: var(--text); font-weight: 600; }
.fineprint { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-top: 12px; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border-light); border-radius: 22px; cursor: pointer; transition: background .15s; }
.slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + .slider { background: var(--red); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Spend breakdown — every cost category on equal footing with a proportion bar. */
.spend { display: flex; flex-direction: column; gap: 16px; }
.spend-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.spend-label { font-size: 14.5px; }
.spend-meta { color: var(--text-muted); font-size: 12.5px; margin-left: 10px; }
.spend-amt { font-size: 14.5px; font-weight: 600; }
.spend-bar { height: 7px; background: var(--bg); border-radius: 100px; overflow: hidden; }
.spend-fill { height: 100%; border-radius: 100px; background: var(--text-muted); transition: width .3s ease; }
.spend-fill.cat-llm { background: #6366f1; }
.spend-fill.cat-audio { background: #ec4899; }
.spend-fill.cat-telnyx { background: #22d3ee; }
.spend-fill.cat-voice { background: #2dd4bf; }
.spend-fill.cat-number { background: #f59e0b; }
.spend-fill.cat-sms { background: #a855f7; }
.spend-fill.cat-other { background: #94a3b8; }

/* Assistant cards — a customer's published assistants + their installers. */
.assistant-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.assistant-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.assistant-ico { flex: none; width: 42px; height: 42px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.assistant-ico svg { width: 22px; height: 22px; fill: none; stroke: var(--text-secondary); stroke-width: 1.6; }
.assistant-ico.has-img { background: none; }
.assistant-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.assistant-meta { min-width: 0; }
.assistant-meta h2 { font-size: 17px; margin: 0; }
.assistant-meta .card-sub { margin: 3px 0 0; }
.assistant-actions { display: flex; align-items: center; gap: 16px; flex: none; }
.assistant-actions .btn { white-space: nowrap; }
@media (max-width: 560px) {
  .assistant-card { align-items: stretch; }
  .assistant-actions { width: 100%; justify-content: space-between; }
}

/* Hosted assistant: whole card is a link to its in-account dashboard. */
a.assistant-hosted { text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
a.assistant-hosted:hover { border-color: var(--accent, #29a9eb); transform: translateY(-2px); box-shadow: 0 8px 26px rgba(0,0,0,.12); }
.assistant-status { font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 4px 10px; border-radius: 100px; white-space: nowrap; }
.assistant-status.is-active { color: #0a7d33; background: rgba(16,163,74,.12); }
.assistant-status.is-off { color: #6b7280; background: rgba(107,114,128,.14); }
.assistant-open { font-size: 13px; font-weight: 600; color: var(--accent, #29a9eb); white-space: nowrap; }

.ledger { display: flex; flex-direction: column; }
.ledger-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-top: 1px solid var(--border); }
.ledger-row:first-child { border-top: none; }
.ledger-label { font-size: 14.5px; }
.ledger-when { color: var(--text-muted); font-size: 12.5px; margin-left: 10px; }
.ledger-amt { font-size: 14.5px; font-weight: 600; }
.ledger-amt.credit { color: var(--green); }
.ledger-amt.debit { color: var(--text-secondary); }

/* ── Models & pricing ── */
.price-table { display: flex; flex-direction: column; margin-top: 4px; }
.price-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px;
}
.price-row > span:first-child { text-align: left; }
.price-row > span:not(:first-child) { text-align: right; min-width: 78px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.price-row:first-child { border-top: none; }
.price-head { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.price-head > span { color: var(--text-muted); }
.price-row .pm { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--text); }

/* ── Settings forms ── */
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 10px 2px; }
.set-head .section-label { margin: 0; }
.btn-edit {
  background: var(--bg-card-hover); color: var(--text-secondary);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 6px 16px; transition: background .15s, color .15s, border-color .15s;
}
.btn-edit:hover { background: #222; color: var(--text); border-color: #3a3a3a; }
.view > .set-head:first-child { margin-top: 4px; }
.form-actions { display: flex; gap: 10px; }
.set-form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.set-form[hidden] { display: none; }
.set-form input {
  background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 11px 13px; color: var(--text); font-size: 15px; font-family: inherit;
}
.set-form input:focus { outline: none; border-color: var(--red); }
.set-form input:disabled { color: var(--text-muted); background: var(--bg-section); cursor: not-allowed; }
.field-hint { font-size: 12px; color: var(--text-muted); }

/* ── Usage ── */
.usage-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.usage-head .welcome-sub { flex: 1; min-width: 200px; }
.period-sel { display: flex; gap: 4px; background: var(--bg-section); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.period-btn {
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 6px; transition: background .15s, color .15s;
}
.period-btn.active { background: var(--bg-card-hover); color: var(--text); }

.usage-table { display: flex; flex-direction: column; }
.usage-row {
  display: grid; grid-template-columns: 1.4fr 0.6fr 1.2fr 0.8fr; gap: 12px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--border); font-size: 14px;
}
.usage-row.recent { grid-template-columns: 1.2fr 1fr 1fr 0.7fr; }
.usage-row:first-child { border-top: none; }
.usage-row span:not(.um) { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.usage-head-row { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.usage-head-row span { color: var(--text-muted) !important; }
.usage-row .um { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--text); }
.usage-row .ucost { text-align: right; color: var(--text); font-weight: 600; }
.usage-row .uwhen { font-size: 12.5px; color: var(--text-muted); }

/* ── API keys ── */
.key-new { display: flex; gap: 10px; }
.key-label-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 10px 13px; color: var(--text);
  font-size: 14.5px; font-family: inherit;
}
.key-label-input:focus { outline: none; border-color: var(--red); }
.key-reveal { display: flex; align-items: center; gap: 10px; }
.key-reveal code {
  flex: 1; background: rgba(0,0,0,.35); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px;
  color: var(--text); word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.keys { display: flex; flex-direction: column; }
.key-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.key-row:first-child { border-top: none; }
.key-row.revoked { opacity: .5; }
.key-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.key-prefix { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--text-secondary); }
.key-label { font-size: 13.5px; color: var(--text); }
.key-used { color: var(--text-muted); font-size: 12.5px; }

/* ── Mobile launcher (home grid) ── */
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.launch-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 18px; color: var(--text);
  transition: border-color .15s, background .15s, transform .1s;
}
.launch-card:hover { border-color: #333; background: var(--bg-card-hover); }
.launch-card:active { transform: translateY(1px); }
.launch-ico { width: 26px; height: 26px; color: var(--red); }
.launch-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }
.launch-label { font-size: 16px; font-weight: 600; }

/* ── Responsive: sidebar → drawer ── */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease; width: var(--sidebar-w);
    height: auto; /* top:0 + bottom:0 size it to the VISIBLE viewport (100vh hides the bottom behind mobile browser chrome) */
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.6); }
  /* Don't bottom-anchor Log out on mobile — let it flow right after the nav
     items so it's always visible (bottom-anchoring pushed it off-screen). */
  .sidebar-spacer { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 35; }
  .scrim[hidden] { display: none; }
  /* Row 1 (topbar) carries the account; the desktop header chip is hidden. */
  .account-chip.desktop-only { display: none; }
  .menu-btn { display: inline-flex; align-items: center; }
  .topbar .biz { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* On the launcher (home), hide row 2 — no hamburger, no "Home" label. */
  .main.is-home .main-head { display: none; }
}

/* ── Phone: reflow tables + tighten so nothing overflows ── */
@media (max-width: 600px) {
  .view { padding: 18px 16px; }
  .card { padding: 18px 16px; }
  .main-head { padding: 16px; }
  .main-head h1 { font-size: 20px; }
  .wallet-balance { font-size: 28px; }
  .stat .num { font-size: 24px; }

  /* Usage "By model" → 2-line rows: model + cost on top, reqs/tokens below */
  .usage-head-row { display: none; }
  .usage-row, .usage-row.recent { grid-template-columns: 1fr auto; gap: 3px 12px; padding: 12px 0; }
  .usage-row > * { min-width: 0; }
  .usage-row .um { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .usage-row > :nth-child(1) { grid-area: 1 / 1; }
  .usage-row > :nth-child(2) { grid-area: 2 / 1; font-size: 12.5px; }
  .usage-row > :nth-child(3) { grid-area: 2 / 2; font-size: 12.5px; text-align: right; }
  .usage-row > :nth-child(4) { grid-area: 1 / 2; text-align: right; }
  /* Recent calls row order is model, tokens, when, cost */
  .usage-row.recent > :nth-child(2) { grid-area: 2 / 2; font-size: 12.5px; text-align: right; }
  .usage-row.recent > :nth-child(3) { grid-area: 2 / 1; font-size: 12.5px; text-align: left; }

  /* Pricing → model on its own line, In/Out labelled below */
  .price-head { display: none; }
  .price-row { grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .price-row > :first-child { grid-column: 1 / -1; }
  .price-row > span:not(:first-child) { min-width: 0; }
  .price-row > span:nth-child(2) { text-align: left; }
  .price-row > span:nth-child(2)::before { content: "In "; color: var(--text-muted); }
  .price-row > span:nth-child(3)::before { content: "Out "; color: var(--text-muted); }

  /* API keys → key on top line, used + Revoke wrap below */
  .key-row { flex-wrap: wrap; gap: 4px 12px; }
  .key-main { flex: 1 1 100%; }
  .key-revoke { margin-left: auto; }

  /* Add-funds presets a touch smaller */
  .amt-grid { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
}
