/* AI-шлюз Фитбейс, панель владельца. Стиль панели Тимлида (tl.fb-team.site): Vercel / Geist,
   цвет значит статус, остальное чернила и серые ступени. Без внешних шрифтов и url().
   Без style="" в разметке (CSP style-src 'self'); геометрия графиков в атрибутах SVG. */
:root {
  color-scheme: light;
  --bg: #fafafa; --side: #fafafa; --surface: #ffffff; --surface-2: #f5f5f5; --surface-3: #ebebeb;
  --border: #ebebeb; --border-strong: #d4d4d4;
  --text: #171717; --text-2: #4d4d4d; --text-3: #666666;
  --primary: #171717; --on-primary: #ffffff;
  --accent: #0070f3; --link: #0761d1; --accent-soft: #e9f2fe; --info-text: #0761d1;
  --danger-fill: #c50000;
  --good: #29bc9b; --good-text: #171717; --good-bg: #e6f7f3;
  --warning: #f5a623; --warning-text: #ab570a; --warning-bg: #ffefcf;
  --critical: #ee0000; --critical-text: #c50000; --critical-bg: #fde8e9;
  --code-bg: #f5f5f5;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", sans-serif;
  --radius: 8px; --radius-sm: 6px; --row-h: 44px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a; --side: #0a0a0a; --surface: #111111; --surface-2: #1a1a1a; --surface-3: #262626; --border: #262626; --border-strong: #3a3a3a;
  --text: #ededed; --text-2: #b4b4b4; --text-3: #a1a1a1; --primary: #ededed; --on-primary: #0a0a0a;
  --accent: #3291ff; --link: #52a8ff; --accent-soft: #0f2340; --info-text: #52a8ff;
  --good: #29bc9b; --good-text: #ededed; --good-bg: #0d2a24;
  --warning: #f5a623; --warning-text: #f5b544; --warning-bg: #3a2a0a;
  --critical: #ff4d4f; --critical-text: #ff6166; --critical-bg: #3c1618; --code-bg: #1a1a1a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0a0a; --side: #0a0a0a; --surface: #111111; --surface-2: #1a1a1a; --surface-3: #262626; --border: #262626; --border-strong: #3a3a3a;
    --text: #ededed; --text-2: #b4b4b4; --text-3: #a1a1a1; --primary: #ededed; --on-primary: #0a0a0a;
    --accent: #3291ff; --link: #52a8ff; --accent-soft: #0f2340; --info-text: #52a8ff;
    --good: #29bc9b; --good-text: #ededed; --good-bg: #0d2a24;
    --warning: #f5a623; --warning-text: #f5b544; --warning-bg: #3a2a0a;
    --critical: #ff4d4f; --critical-text: #ff6166; --critical-bg: #3c1618; --code-bg: #1a1a1a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/20px var(--sans); letter-spacing: -.1px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 8px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--text); color: var(--bg); }
[hidden] { display: none !important; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.small { font-size: 12px; line-height: 16px; }
.mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.bad-text { color: var(--critical-text); font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 0 12px; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; transition: background .12s, border-color .12s, color .12s; white-space: nowrap; text-decoration: none; min-height: 32px;
}
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.sm, .btn.sm { padding: 0 10px; font-size: 13px; min-height: 28px; }
button.big, .btn.big { min-height: 40px; font-size: 15px; }
.btn.primary, button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover, button.primary:hover { background: color-mix(in srgb, var(--primary) 86%, var(--bg)); border-color: transparent; }
.btn.danger, button.danger { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.btn.danger:hover, button.danger:hover { background: color-mix(in srgb, var(--danger-fill) 88%, #000); }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-2); color: var(--text); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  font: inherit; font-size: 14px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 10px; width: 100%; min-height: 32px;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input::placeholder { color: #737373; }
:root[data-theme="dark"] ::placeholder { color: #8f8f8f; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); flex: none; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; min-width: 0; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; min-width: 0; }
form.inline { display: inline-flex; margin: 0; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { border: 0; background: transparent; padding: 0 10px; border-radius: 4px; font-size: 13px; font-weight: 500; color: var(--text-2); min-height: 26px; display: inline-flex; align-items: center; }
.seg a:hover, .seg button:hover { text-decoration: none; color: var(--text); background: transparent; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 12px; line-height: 16px; color: var(--text-3); margin: 0; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 12px 8px; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; font-weight: 600; font-size: 11px;
  background: var(--primary); color: var(--on-primary); flex: none; font-family: var(--mono); }
.brand b { display: block; font-size: 14px; font-weight: 600; }
.brand small { display: block; font-size: 12px; line-height: 16px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 32px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; position: relative; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--surface-2); color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 2px; border-radius: 0 2px 2px 0; background: var(--primary); }
.nav-sect { font: 500 11px/16px var(--mono); text-transform: uppercase; color: var(--text-3); padding: 14px 10px 4px; }
.side .foot { margin-top: auto; border-top: 1px solid var(--border); padding: 10px 2px 0; display: grid; gap: 8px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; padding: 12px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top h1 { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.4px; }
.top .sub { font-size: 12px; line-height: 16px; color: var(--text-3); }
.top .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.crumbs svg.icon { width: 14px; height: 14px; }
.view { padding: 16px 24px 48px; max-width: 1280px; width: 100%; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.align { align-items: start; }

/* ---------- blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 16px 12px; margin: 0; }
.card > h2, details > summary > h2 { font-size: 14px; line-height: 20px; font-weight: 600; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .right { margin-left: auto; font-weight: 400; display: flex; gap: 8px; align-items: center; }
.card-pad { padding: 0 16px 14px; margin: 0; }
.card.danger-zone { border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); }
.lead { color: var(--text-2); font-size: 14px; max-width: 78ch; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 20px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--text); }
.pill.ok::before { background: var(--good); }
.pill.warning { background: var(--warning-bg); color: var(--warning-text); }
.pill.critical { background: var(--critical-bg); color: var(--critical-text); }
.pill.info { background: var(--accent-soft); color: var(--info-text); }
.pill.idle { color: var(--text-3); }
.pill.plain::before { display: none; }
.tag.paid { background: var(--warning-bg); color: var(--warning-text); border-color: transparent; }
.tag { display: inline-flex; font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge { font-size: 12px; line-height: 18px; font-weight: 500; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.flash { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border: 1px solid transparent; margin: 0; }
.flash.ok { background: var(--surface); border-color: var(--border); }
.flash.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.flash.info { background: var(--accent-soft); color: var(--info-text); display: block; }
.flash.warning { background: var(--warning-bg); color: var(--warning-text); }
.flash.error { background: var(--critical-bg); color: var(--critical-text); }
.flash.once { align-items: flex-start; flex-wrap: nowrap; font-size: 15px; line-height: 22px; }
.flash.once svg.icon { width: 20px; height: 20px; margin-top: 1px; }
.empty { padding: 24px 16px; display: grid; gap: 12px; justify-items: start; color: var(--text-2); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--text-3); }
.kpi .value { font-size: 24px; line-height: 32px; font-weight: 600; margin-top: 2px; letter-spacing: -.5px; white-space: nowrap; display: flex; align-items: baseline; gap: 6px; }
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.kpi .value.small-value { font-size: 18px; }
.kpi .sub { font-size: 12px; color: var(--text-2); }
.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.counts div { display: grid; gap: 2px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.counts b { font-size: 22px; line-height: 28px; font-weight: 600; }
.counts span { font-size: 12px; color: var(--text-3); }
.counts .good b { color: var(--text); } .counts .good { box-shadow: inset 3px 0 0 var(--good); }
.counts .warn { background: var(--warning-bg); } .counts .warn b, .counts .warn span { color: var(--warning-text); }
.counts .bad { background: var(--critical-bg); } .counts .bad b, .counts .bad span { color: var(--critical-text); }

/* list rows (providers on «Сейчас») */
.rows li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); }
.rows .t { min-width: 0; display: grid; gap: 2px; }
.rows .t small { color: var(--text-3); font-size: 12px; }
.model-circuits { display: grid; gap: 4px; }
.model-circuits li { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
small.detail, .detail { display: block; color: var(--text-2); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.detail.bad { color: var(--critical-text); }

/* tables */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font: 500 11px/16px var(--mono); color: var(--text-3); text-transform: uppercase; padding: 6px 10px; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); white-space: nowrap; }
table.data th.r, table.data td.r { text-align: right; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; height: var(--row-h); font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tr.off td { color: var(--text-3); }
.card.flush table.data th:first-child, .card.flush table.data td:first-child { padding-left: 16px; }
.card.flush table.data th:last-child, .card.flush table.data td:last-child { padding-right: 16px; }

/* explanations, folds */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.explain > summary, details.fold-card > summary { display: flex; align-items: center; gap: 8px; }
details.explain > summary::after, details.fold-card > summary::after, details.fold > summary::after { content: "▾"; color: var(--text-3); font-size: 12px; transition: transform .12s; }
details[open] > summary::after { transform: rotate(180deg); }
details.fold-card > summary { padding: 14px 16px; }
details.fold-card > summary > h2 { margin: 0; }
details.card.fold-card:not(.flush) { padding: 0; }
details.card.fold-card:not(.flush) > form { padding: 0 16px 16px; }
.explain-body { margin-top: 12px; display: grid; gap: 12px; color: var(--text-2); }
.explain-body p { margin: 0; max-width: 80ch; }
ol.steps { counter-reset: step; display: grid; gap: 8px; }
ol.steps li { counter-increment: step; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; max-width: 80ch; }
ol.steps li::before { content: counter(step); width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text); }
details.fold > summary { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; min-height: 28px; }
details.fold[open] { display: grid; gap: 10px; }
pre.code, code.secret { font-family: var(--mono); font-size: 13px; line-height: 20px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.secret-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
code.secret { flex: 1 1 360px; font-size: 14px; user-select: all; -webkit-user-select: all; }

/* forms */
.form-card { max-width: 920px; }
fieldset.fs { border: 0; margin-inline: 0; margin-bottom: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.form-card > fieldset.fs + fieldset.fs, .form-card > fieldset.fs + details.fold { border-top: 1px solid var(--border); padding-top: 16px; }
fieldset.fs legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 4px; }
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.mode { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.mode:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.mode input { margin-top: 3px; accent-color: var(--primary); flex: none; }
.mode b { display: block; font-weight: 600; font-size: 13px; }
.mode small { display: block; color: var(--text-3); font-size: 12px; line-height: 16px; }
[data-models-pick].off { opacity: .45; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.row-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row-form .grow { flex: 1 1 260px; }
.route-form { padding-top: 10px; }
.inline-confirm { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
td.wide details.edit[open] { min-width: min(640px, 70vw); }

/* providers */
.providers { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--text-3); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* accounts */
ul.accounts > li { padding: 12px 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.acc-head { display: flex; gap: 6px 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.acc-head .t { display: grid; gap: 2px; min-width: 0; }
.acc-head .t small { color: var(--text-3); font-size: 12px; }
.email { overflow-wrap: anywhere; }
.quotas { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 6px 24px; }
.quota { display: grid; grid-template-columns: minmax(130px, 1fr) 72px minmax(0, auto); gap: 8px; align-items: center; }
.quota .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.inline-fold { display: inline-grid; }
progress.meter { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: block; }
progress.meter::-webkit-progress-bar { background: var(--surface-3); border-radius: 3px; }
progress.meter::-webkit-progress-value { background: var(--good); border-radius: 3px; }
progress.meter::-moz-progress-bar { background: var(--good); border-radius: 3px; }
progress.meter.warning::-webkit-progress-value { background: var(--warning); }
progress.meter.warning::-moz-progress-bar { background: var(--warning); }
progress.meter.critical::-webkit-progress-value { background: var(--critical); }
progress.meter.critical::-moz-progress-bar { background: var(--critical); }

/* OAuth wizard */
.timer-box { position: sticky; top: 61px; z-index: 10; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--info-text); font-size: 15px; }
.timer-box svg.icon { width: 20px; height: 20px; }
.timer-box .countdown { font-size: 22px; line-height: 28px; font-weight: 600; }
.timer-box .small { color: inherit; opacity: .85; }
.timer-box.low { background: var(--warning-bg); color: var(--warning-text); }
.timer-box.over { background: var(--critical-bg); color: var(--critical-text); }
ol.wizard { display: grid; gap: 12px; }
ol.wizard > li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; }
ol.wizard .n { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 600; }
ol.wizard h2 { font-size: 15px; margin: 2px 0 0; }
ol.wizard .lead { margin: 0; }
ol.wizard.done .n { background: var(--surface-3); color: var(--text-3); }

/* charts */
svg.plot { display: block; width: 100%; height: auto; overflow: visible; }
svg.plot .grid line { stroke: var(--border); stroke-width: 1; }
svg.plot text { fill: var(--text-3); font-size: 10px; font-family: var(--sans); }
svg.plot .b1 { fill: var(--accent); }
svg.plot .bc { fill: var(--critical); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l1 { background: var(--accent); } .legend .lc { background: var(--critical); }

/* «Ещё» */
.more { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.more a { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); min-height: 64px; }
.more a:hover { text-decoration: none; border-color: var(--border-strong); }
.more .ico { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.more b { display: block; }
.more small { display: block; color: var(--text-3); font-size: 12px; }

/* sign in, messages */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.center .card { width: 100%; max-width: 400px; padding: 26px; display: grid; gap: 14px; }
.center h1 { font-size: 20px; }
.center .brand { padding: 0; }

.tabbar { display: none; }

/* ---------- phones ---------- */
@media (max-width: 1100px) {
  .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  body { font-size: 15px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top { padding: 10px 16px; gap: 8px; }
  .top h1 { font-size: 18px; line-height: 24px; }
  .top .tools { margin-left: 0; width: 100%; }
  .top .tools:empty { display: none; }
  .view { padding: 12px 16px calc(88px + env(safe-area-inset-bottom)); }
  .stack > * + * { margin-top: 12px; }
  .card { padding: 14px; }
  button, .btn { min-height: 44px; padding: 9px 14px; }
  button.sm, .btn.sm { min-height: 36px; }
  .seg a, .seg button { min-height: 36px; padding: 6px 12px; }
  input[type="text"], input[type="password"], input[type="number"], input[type="date"], select { min-height: 44px; font-size: 16px; }
  label.check { min-height: 32px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .value { font-size: 20px; }
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quotas { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .quota { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name info" "bar bar"; gap: 4px 8px; }
  .quota > :first-child { grid-area: name; }
  .quota > progress { grid-area: bar; }
  .quota > :last-child { grid-area: info; text-align: right; }
  .top { position: static; }
  svg.plot text { font-size: 17px; }
  .timer-box { top: 0; }
  td.wide details.edit[open] { min-width: 0; }
  table.data.cards thead { display: none; }
  table.data.cards, table.data.cards tbody, table.data.cards tr, table.data.cards td { display: block; width: 100%; height: auto; }
  table.data.cards tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.data.cards tr:last-child { border-bottom: 0; }
  table.data.cards td, .card.flush table.data.cards td:first-child, .card.flush table.data.cards td:last-child { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
  table.data.cards td[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: 12px; flex: none; }
  table.data.cards td:first-child, table.data.cards td.wide { display: block; }
  table.data.cards td.r { text-align: right; }
  table.data.cards tbody tr:hover td { background: transparent; }
  table.data.cards { border-top: 1px solid var(--border); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--side) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--text-3); padding: 4px 0; border-radius: var(--radius-sm); min-height: 52px; }
  .tabbar a.active { color: var(--text); font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg.icon { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
