/* BitStatic UI: shared by /admin and /browse. No inline styles anywhere (the
   pages' CSP is style-src 'self'); dynamic sizes are set from JS via CSSOM. */

:root {
  --bg: #0a0a0d;
  --bg-glow: rgba(225, 29, 42, .10);
  --panel: #111116;
  --panel-2: #16161c;
  --panel-3: #1c1c23;
  --border: #23232b;
  --border-strong: #2e2e38;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #e11d2a;
  --accent-hover: #f0313d;
  --accent-deep: #9f1019;
  --accent-soft: rgba(225, 29, 42, .12);
  --accent-line: rgba(225, 29, 42, .35);
  --accent-text: #ff6b74;
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, .12);
  --warn: #f59e0b;
  --orange: #fb923c;
  --yellow: #facc15;
  --blue: #60a5fa;
  --hatch: #24242c;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 280px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-glow: rgba(225, 29, 42, .06);
  --panel: #ffffff;
  --panel-2: #f7f7f9;
  --panel-3: #efeff3;
  --border: #e6e6eb;
  --border-strong: #d6d6de;
  --text: #111114;
  --muted: #52525b;
  --faint: #8a8a94;
  --accent-soft: rgba(225, 29, 42, .08);
  --accent-text: #c8101c;
  --hatch: #e4e4ea;
  --shadow: 0 1px 2px rgba(16, 16, 24, .04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code, kbd, .mono { font-family: var(--mono); }
svg { flex-shrink: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.accent { color: var(--accent-text); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── Buttons & inputs ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--panel);
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 8px 24px -10px rgba(225, 29, 42, .7);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-pill { border-radius: 999px; height: 52px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--panel-3); }
.btn-danger:hover { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: transparent;
  transition: background .15s;
}
.icon-btn:hover { background: var(--panel-3); }
.icon-btn svg { width: 19px; height: 19px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--panel-2);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: .55; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 24px; border-radius: 999px; background: var(--panel-3);
  border: 1px solid var(--border-strong); position: relative; transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 6px; border: 1px solid var(--border-strong); background: var(--panel-2);
  font: 600 11px/1 var(--mono); letter-spacing: .4px; text-transform: uppercase; color: var(--muted);
}
.badge-red { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.badge-green { color: var(--ok); border-color: rgba(34, 197, 94, .35); background: var(--ok-soft); }
.badge-blue { color: var(--blue); border-color: rgba(96, 165, 250, .35); background: rgba(96, 165, 250, .1); }
.badge-orange { color: var(--orange); border-color: rgba(251, 146, 60, .35); background: rgba(251, 146, 60, .1); }
.count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px;
  display: inline-grid; place-items: center; font: 600 11px/1 var(--mono);
  border: 1px solid var(--border-strong); color: var(--muted);
}

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  font-size: 14px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-text);
}
.alert svg { width: 18px; height: 18px; margin-top: 1px; }
.alert-ok { border-color: rgba(34, 197, 94, .35); background: var(--ok-soft); color: var(--ok); }

/* ── App shell ──────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { --sidebar: 84px; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 18px 20px; border-right: 1px solid var(--border); background: var(--bg);
  overflow-y: auto;
}
.brand { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 10px; row-gap: 8px; padding: 4px 6px 24px; }
.brand-logo { grid-area: 1 / 1; display: block; height: 34px; width: auto; }
.brand-name { display: contents; }
.brand-name b { grid-area: 1 / 2; }
.brand-name span { grid-area: 2 / 1 / 3 / 4; }
.brand .icon-btn { grid-area: 1 / 3; }
.brand-name { line-height: 1.1; }
.brand-name b { display: block; font-size: 16px; font-weight: 800; letter-spacing: .3px; }
.brand-name span { display: block; font-size: 12px; font-weight: 700; letter-spacing: 4px; color: var(--accent-text); }
.brand .icon-btn { width: 36px; height: 36px; border: 0; }

.nav-label { margin: 10px 14px 10px; font: 600 11.5px/1 var(--mono); letter-spacing: 2.5px; color: var(--faint); text-transform: uppercase; }
.nav { display: grid; gap: 4px; margin-bottom: 18px; }
.nav a, .nav button {
  position: relative; display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 14px;
  border-radius: 12px; border: 1px solid transparent; background: none; color: var(--muted);
  font-size: 15px; font-weight: 500; text-align: left; width: 100%;
}
.nav a:hover, .nav button:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--text); background: var(--panel-2); border-color: var(--border-strong); }
.nav a.active::before {
  content: ""; position: absolute; left: -19px; top: 10px; bottom: 10px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--accent);
}
.nav a.active svg { color: var(--accent-text); }
.nav svg { width: 20px; height: 20px; }

.promo {
  margin-top: auto; position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius);
  background: linear-gradient(150deg, var(--accent-hover), var(--accent-deep)); color: #fff;
}
.promo::after {
  content: ""; position: absolute; right: -70px; top: -70px; width: 190px; height: 190px;
  border-radius: 50%; border: 26px solid rgba(255, 255, 255, .08);
}
.promo-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .16); margin-bottom: 14px; }
.promo-icon svg { width: 20px; height: 20px; }
.promo h4 { margin: 0 0 6px; font-size: 19px; }
.promo p { margin: 0 0 16px; font-size: 13px; opacity: .85; line-height: 1.55; word-break: break-word; }
.promo .btn { position: relative; z-index: 1; width: 100%; background: rgba(0, 0, 0, .28); border-color: transparent; color: #fff; }
.promo .btn:hover { background: rgba(0, 0, 0, .4); }

.app.collapsed .brand-name, .app.collapsed .nav-label, .app.collapsed .nav span,
.app.collapsed .count, .app.collapsed .promo { display: none; }
.app.collapsed .brand { display: flex; flex-direction: column; padding-bottom: 16px; }
.app.collapsed .brand-logo { height: auto; width: 48px; }
.app.collapsed .app.collapsed .brand .icon-btn { margin: 8px 0 0; }
.app.collapsed .nav a, .app.collapsed .nav button { justify-content: center; padding: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  height: 84px; padding: 0 36px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
}
.search { position: relative; flex: 0 1 520px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }
.search .input { height: 50px; padding-left: 46px; padding-right: 56px; border-radius: 999px; background: var(--panel); }
.search kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-strong);
  font-size: 11.5px; color: var(--faint); background: var(--panel-2);
}
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 12px; padding-left: 6px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); font-weight: 700; font-size: 17px;
}
.who-text { line-height: 1.25; }
.who-text b { display: block; font-size: 15px; }
.who-text span { font-size: 13px; color: var(--muted); }
.menu-btn { display: none; }

.content { padding: 36px 36px 56px; display: grid; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.page-head h1 { margin: 0; font-size: 40px; line-height: 1.1; letter-spacing: -.8px; font-weight: 800; }
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 17px; }
.page-head .actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Cards & grid ───────────────────────────────────────────────── */
.grid { display: grid; gap: 24px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.card {
  position: relative; min-width: 0; padding: 28px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.card-head h3 { margin: 0; font-size: 19px; font-weight: 700; }
.card-head small { color: var(--muted); font-size: 13px; }
.card-head .sub { display: block; margin-top: 4px; }

.stat { display: flex; flex-direction: column; min-height: 210px; }
.stat h4 { margin: 0; font-size: 17px; font-weight: 600; }
.stat .value { margin-top: auto; font-size: 52px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; }
.stat .value small { font-size: 22px; font-weight: 700; letter-spacing: -.3px; margin-left: 4px; }
.stat .hint { margin-top: 8px; color: var(--muted); font-size: 15px; }
.stat .corner {
  position: absolute; top: 24px; right: 24px; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--border-strong); color: var(--text);
}
.stat .corner svg { width: 18px; height: 18px; }
.stat.hero {
  overflow: hidden; border: 0; color: #fff;
  background: linear-gradient(140deg, var(--accent-hover) 0%, var(--accent) 45%, var(--accent-deep) 100%);
}
.stat.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px;
  border-radius: 50%; border: 34px solid rgba(255, 255, 255, .09);
}
.stat.hero .corner { background: #fff; color: var(--accent); border: 0; z-index: 1; }
.stat.hero .hint { color: rgba(255, 255, 255, .85); }
.value.danger { color: var(--accent-text); }

/* Activity bars */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 14px; align-items: end; height: 250px; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 12px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 76px; border-radius: 999px; min-height: 48px;
  background: repeating-linear-gradient(135deg, var(--hatch) 0 6px, transparent 6px 12px);
  border: 1px solid var(--border-strong); position: relative; transition: height .5s ease;
  max-height: calc(100% - 34px);
}
.bar.filled { background: var(--accent); border-color: var(--accent); box-shadow: 0 12px 30px -14px rgba(225, 29, 42, .9); }
.bar.filled.low { background: color-mix(in srgb, var(--accent) 55%, var(--panel)); border-color: transparent; box-shadow: none; }
.bar-num { position: absolute; top: 10px; left: 0; right: 0; text-align: center; font: 700 13px/1 var(--mono); color: #fff; }
.bar-col label { font-size: 13px; color: var(--faint); }
.bar-col.today label { color: var(--text); font-weight: 700; }

/* Next step */
.next h2 { margin: 0 0 10px; font-size: 26px; color: var(--accent-text); letter-spacing: -.3px; }
.next p { margin: 0; color: var(--muted); line-height: 1.65; }
.next { display: flex; flex-direction: column; }
.next .btn { margin-top: auto; }
.next .body { margin-bottom: 24px; }

/* Lists (owners, recent) */
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 0; min-width: 0; }
.tile {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-3); color: var(--yellow); border: 1px solid var(--border-strong);
}
.tile svg { width: 20px; height: 20px; }
.tile.red { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.tile.blue { color: var(--blue); background: rgba(96, 165, 250, .1); border-color: rgba(96, 165, 250, .3); }
.tile.orange { color: var(--orange); background: rgba(251, 146, 60, .1); border-color: rgba(251, 146, 60, .3); }
.tile.yellow { color: var(--yellow); background: rgba(250, 204, 21, .08); border-color: rgba(250, 204, 21, .25); }
.row-main { flex: 1; min-width: 0; }
.row-main b { display: block; font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main span { display: block; font-size: 13px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; font: 700 14px/1.3 var(--mono); color: var(--yellow); white-space: nowrap; }
.row-end small { display: block; font-weight: 500; font-size: 11.5px; color: var(--faint); }
.list.wrap .row-main b { white-space: normal; overflow-wrap: anywhere; }
.empty { padding: 28px 0; text-align: center; color: var(--faint); font-size: 14px; }
.meter { height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--accent); width: 0; }

/* Gauge */
.gauge { position: relative; width: 100%; max-width: 300px; margin: 8px auto 0; }
.gauge svg { width: 100%; height: auto; display: block; }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; }
.gauge-center b { display: block; font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.gauge-center span { color: var(--muted); font-size: 15px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin-top: 18px; font: 500 13px/1.3 var(--mono); }
.legend div { display: flex; align-items: center; gap: 8px; color: var(--muted); text-transform: uppercase; }
.legend b { margin-left: auto; color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: var(--accent); }
.dot.orange { background: var(--orange); }
.dot.yellow { background: var(--yellow); }
.dot.blue { background: var(--blue); }

/* Session countdown */
.session { overflow: hidden; background: linear-gradient(160deg, var(--panel) 30%, color-mix(in srgb, var(--accent) 22%, var(--panel)) 100%); }
.session::after {
  content: ""; position: absolute; right: -90px; top: -90px; width: 220px; height: 220px;
  border-radius: 50%; border: 30px solid var(--accent-soft);
}
.clock { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin: 6px 0 22px; position: relative; z-index: 1; }
.clock div { text-align: center; flex: 1; }
.clock b { display: block; font: 700 clamp(30px, 2.7vw, 50px)/1 var(--mono); letter-spacing: -1.5px; }
.clock span { font-size: 11px; letter-spacing: 1.5px; color: var(--muted); }
.clock i { font: 700 clamp(20px, 1.6vw, 30px)/1.5 var(--mono); color: var(--faint); font-style: normal; }
.session .btn { position: relative; z-index: 1; }

/* Steps + code */
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.step { display: flex; gap: 14px; padding: 18px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--panel-2); }
.step b { display: block; margin-bottom: 4px; font-size: 15.5px; }
.step p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.step code { color: var(--text); font-size: 13px; }
.check {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid var(--border-strong); color: var(--faint); font: 700 13px/1 var(--mono);
}
.check svg { width: 16px; height: 16px; }
.check.done { color: var(--ok); background: var(--ok-soft); border-color: rgba(34, 197, 94, .35); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--panel-2); margin-bottom: 12px; }
.tabs button { height: 32px; padding: 0 14px; border-radius: 8px; border: 0; background: none; color: var(--muted); font: 600 13px/1 var(--mono); }
.tabs button.active { background: var(--panel-3); color: var(--text); }
.code { display: flex; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--panel-2); overflow: hidden; }
.code pre { flex: 1; margin: 0; padding: 18px 20px; overflow-x: auto; font: 13.5px/1.9 var(--mono); }
.code pre .p { color: var(--accent-text); user-select: none; }
.code pre .c { color: var(--faint); }
.copy-col {
  display: grid; place-items: center; align-content: center; gap: 6px; width: 92px; border: 0;
  border-left: 1px solid var(--border-strong); background: none; color: var(--muted);
  font: 600 11px/1 var(--mono); letter-spacing: 1px;
}
.copy-col:hover { color: var(--text); background: var(--panel-3); }
.copy-col svg { width: 18px; height: 18px; }
.foot-note { margin: 12px 0 0; color: var(--muted); font-size: 13.5px; }

.kv { display: grid; gap: 18px; }
.kv dt { color: var(--muted); font-size: 14.5px; }
.kv dd { margin: 4px 0 0; font-size: 15.5px; font-weight: 500; word-break: break-word; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -28px; padding: 0 28px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font: 600 11.5px/1 var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); padding: 0 14px 14px 0; white-space: nowrap; }
td { padding: 14px 14px 14px 0; border-top: 1px solid var(--border); vertical-align: middle; }
td:last-child, th:last-child { padding-right: 0; text-align: right; }
td .row-main b { font-size: 14.5px; }
.actions-cell { display: inline-flex; gap: 6px; }
.usage { min-width: 120px; }
.usage small { color: var(--faint); font-size: 12px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.secret-box {
  margin-top: 20px; padding: 18px; border-radius: 14px; border: 1px solid var(--accent-line); background: var(--accent-soft);
}
.secret-box p { margin: 0 0 10px; color: var(--accent-text); font-size: 13.5px; font-weight: 600; }
.secret-line { display: flex; align-items: center; gap: 10px; }
.secret-line code { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border-strong); font-size: 14px; word-break: break-all; }

.dropzone {
  display: grid; place-items: center; text-align: center; gap: 10px; padding: 44px 20px;
  border-radius: 16px; border: 2px dashed var(--border-strong); background: var(--panel-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .tile { width: 56px; height: 56px; }
.dropzone + .form-grid { margin-top: 22px; }
.dropzone b { font-size: 16px; }
.dropzone span { color: var(--muted); font-size: 14px; }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; margin-bottom: 18px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 18px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .5); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── API docs ───────────────────────────────────────────────────── */
.docs-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.doc-nav { position: sticky; top: 108px; padding: 18px; max-height: calc(100vh - 132px); overflow-y: auto; display: grid; gap: 2px; }
.doc-nav-label { margin: 14px 8px 8px; font: 600 11px/1 var(--mono); letter-spacing: 2px; text-transform: uppercase; color: var(--faint); }
.doc-nav-label:first-child { margin-top: 2px; }
.doc-global { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 4px; gap: 2px; }
.doc-global button { padding: 0 10px; }
.doc-nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--muted); font-size: 14px; text-align: left;
}
.doc-nav-link:hover { background: var(--panel-2); color: var(--text); }
.doc-nav-link.active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.doc-nav-link .m { width: 34px; flex-shrink: 0; font: 700 10px/1 var(--mono); letter-spacing: .5px; }
.m-get { color: var(--blue); }
.m-post { color: var(--ok); }
.m-delete { color: var(--accent-text); }
.doc-body { display: grid; gap: 20px; min-width: 0; }
.doc-group { margin: 16px 0 -4px; font-size: 13px; font-family: var(--mono); letter-spacing: 2.5px; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.doc-section { scroll-margin-top: 104px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.doc-section h3 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.doc-section h4 { margin: 10px 0 -4px; font-size: 16px; }
.doc-section p { margin: 0; color: var(--muted); line-height: 1.7; }
.doc-section p b, .doc-section li b, .callout b { color: var(--text); }
.doc-section code, .callout code { font-size: .88em; padding: 1px 6px; border-radius: 6px; background: var(--panel-3); color: var(--text); }
.doc-section pre code, .doc-table code { padding: 1px 5px; }
.endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border-strong); }
.endpoint code { background: none !important; padding: 0 !important; font-size: 15px !important; font-weight: 600; word-break: break-all; }
.doc-auth { font-size: 13.5px; color: var(--faint); }
.doc-label { display: flex; align-items: center; gap: 8px; margin-top: 6px; font: 600 11.5px/1 var(--mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); }
.doc-table { font-size: 14px; }
.doc-table td { color: var(--muted); }
.doc-table td:first-child { color: var(--text); white-space: nowrap; }
.doc-table td:last-child, .doc-table th:last-child { text-align: left; }
.doc-section .table-wrap { margin: 0 -28px; padding: 0 28px; }
.doc-section .code pre { font-size: 13px; line-height: 1.75; white-space: pre; }
.doc-code { min-width: 0; }
.doc-code .tabs { margin-bottom: 8px; flex-wrap: wrap; }
.code pre { min-width: 0; }
.callout { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--muted); font-size: 14px; line-height: 1.65; }
.callout-warn { border-color: var(--accent-line); background: var(--accent-soft); }
.doc-list { margin: 0; padding-left: 22px; color: var(--muted); line-height: 1.8; }
.doc-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.doc-checks li { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); line-height: 1.6; }
.doc-checks .check { width: 26px; height: 26px; }

/* ── Sign-in ────────────────────────────────────────────────────── */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(900px 500px at 50% -10%, var(--bg-glow), transparent 70%), var(--bg);
}
.auth-card {
  width: 100%; max-width: 460px; padding: 36px; border-radius: 24px;
  background: var(--panel); border: 1px solid var(--border); box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .7);
}
.auth-card .brand { padding: 0 0 28px; }
.auth-card h1 { margin: 0 0 8px; font-size: 27px; letter-spacing: -.4px; }
.auth-card > p, .auth-step > p { margin: 0 0 24px; color: var(--muted); }
.auth-step { display: grid; gap: 18px; }
.auth-step > p { margin: 0; }
.recipients { display: grid; gap: 10px; }
.recipient {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--panel-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.recipient input { position: absolute; opacity: 0; pointer-events: none; }
.recipient:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.recipient:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); }
.recipient .tile { width: 40px; height: 40px; }
.recipient b { display: block; font-family: var(--mono); font-size: 14.5px; font-weight: 600; color: var(--text); }
.recipient span { font-size: 12.5px; color: var(--faint); }
.radio { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; }
.recipient:has(input:checked) .radio { border-color: var(--accent); }
.recipient:has(input:checked) .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

.otp { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.otp input {
  width: 100%; height: 62px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--panel-2);
  text-align: center; font: 700 26px/1 var(--mono); outline: none; transition: border-color .15s, box-shadow .15s;
  caret-color: var(--accent);
}
.otp input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.otp.error input { border-color: var(--accent); animation: shake .3s; }
.otp.len-8 { gap: 7px; }
.otp.len-8 input { height: 54px; font-size: 22px; border-radius: 12px; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.sent-to { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border-strong); font-size: 14px; }
.sent-to svg { width: 18px; height: 18px; color: var(--ok); }
.sent-to b { font-family: var(--mono); font-weight: 600; }
.timer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.timer { display: inline-flex; align-items: center; gap: 10px; }
.ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; }
.ring .track { stroke: var(--panel-3); }
.ring .prog { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer b { font-family: var(--mono); color: var(--text); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 600; font-size: 14px; }
.link-btn:disabled { color: var(--faint); cursor: default; }
.auth-foot { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--faint); text-align: center; }

/* ── Browse page ────────────────────────────────────────────────── */
.simple-top { display: flex; align-items: center; gap: 12px; padding: 18px 28px; border-bottom: 1px solid var(--border); }
.simple-top .brand { display: flex; align-items: center; gap: 12px; padding: 0; }
.simple-top .brand-name { display: block; }
.simple-top .spacer { flex: 1; }
.narrow { max-width: 1100px; margin: 0 auto; padding: 36px 24px 56px; display: grid; gap: 24px; }
.key-row { display: flex; gap: 12px; flex-wrap: wrap; }
.key-row .input { flex: 1 1 320px; font-family: var(--mono); font-size: 14px; }
.key-row + .key-row { margin-top: 12px; }

/* Access keys */
.key-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kind-option { position: relative; display: block; cursor: pointer; }
.kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.kind-option > span {
  display: grid; gap: 4px; height: 100%; padding: 16px 18px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--panel-2); transition: border-color .15s, background .15s;
}
.kind-option b { font-size: 15px; }
.kind-option small { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.kind-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.kind-option input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.kind-option input:disabled + span { cursor: default; opacity: .6; }
.kind-option input:disabled:checked + span { opacity: 1; }
.field > span em { font-style: normal; font-weight: 400; }
.perm-row { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 26px; margin-top: 20px; }
.perm-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.key-next { display: grid; gap: 10px; margin-top: 18px; }
.key-next b { font-size: 13.5px; }
.key-next .code pre { font-size: 13px; line-height: 1.7; white-space: pre; }
.key-next a { color: var(--accent-text); font-weight: 600; }
.key-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }
.key-limits { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.key-limits span { white-space: nowrap; }
.key-limits .danger { color: var(--accent-text); }
.perm-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
tr.editing td { background: var(--accent-soft); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: span 2; }
  .key-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); --sidebar: 280px; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: 280px; transform: translateX(-100%);
    transition: transform .2s; box-shadow: 20px 0 60px rgba(0, 0, 0, .4);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.collapsed .brand-name, .app.collapsed .nav-label, .app.collapsed .nav span,
  .app.collapsed .count, .app.collapsed .promo { display: revert; }
  .app.collapsed .brand { display: grid; }
  .app.collapsed .brand-name { display: contents; }
  .app.collapsed .brand-logo { height: 34px; width: auto; }
  .app.collapsed   #collapseBtn { display: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; height: 72px; }
  .who-text, .search kbd { display: none; }
  .content { padding: 24px 16px 40px; }
  .page-head h1 { font-size: 30px; }
  .form-grid, .filters, .steps, .key-steps, .key-kinds { grid-template-columns: minmax(0, 1fr); }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-nav { position: static; max-height: none; }
  .doc-section .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .card { padding: 20px; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .stat { min-height: 170px; }
  .stat .value { font-size: 44px; }
  .bars { gap: 8px; height: 200px; }
  .clock b { font-size: 40px; }
  .auth-card { padding: 26px 20px; }
  .otp { gap: 6px; }
  .otp input { height: 54px; font-size: 22px; }
  .otp.len-8 { gap: 4px; }
  .otp.len-8 input { height: 46px; font-size: 18px; border-radius: 10px; }
  .page-head .actions, .page-head .actions .btn { width: 100%; }
  .topbar #refreshBtn { display: none; }
  .copy-col { width: 64px; }
}

/* ── Two-step verification ──────────────────────────────────────── */
.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: 6px; text-align: center; }
.tf-steps { margin: 0 0 16px; padding-left: 20px; color: var(--muted); line-height: 1.8; }
.tf-secret { display: inline-block; letter-spacing: 2px; word-break: break-all; }
.tf-qr { display: block; margin: 0 0 18px; padding: 8px; border-radius: 12px; background: #fff; }
.tf-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.tf-row .input { flex: 0 1 220px; }
.tf-codes { margin: 14px 0; padding: 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel);
  font: 600 16px/1.9 var(--mono); letter-spacing: 1.5px; column-count: 2; }
.auth .small { font-size: 13px; }
