/* TurnDisk admin console.
   Restrained blue palette taken from the drive icon; light by default, dark via
   prefers-color-scheme. No inline styles anywhere (the CSP has no 'unsafe-inline'),
   so anything dynamic is set through the CSSOM from JS. */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --line: #e1e6ef;
  --line-strong: #cfd7e4;
  --text: #0f1b2e;
  --text-2: #33415a;
  --muted: #66738a;
  --brand: #1666dc;
  --brand-strong: #0f50b4;
  --brand-ink: #ffffff;
  --brand-soft: #e9f1fd;
  --brand-line: #c4d9f8;
  --navy: #0d1b36;
  --ok: #157a4a;
  --ok-soft: #e6f4ec;
  --warn: #9a5b00;
  --warn-soft: #fdf3e2;
  --bad: #c0352b;
  --bad-soft: #fcebea;
  --shadow: 0 1px 2px rgba(15, 27, 46, .05), 0 4px 16px rgba(15, 27, 46, .05);
  --shadow-lg: 0 24px 60px rgba(15, 27, 46, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111b;
    --surface: #111a27;
    --surface-2: #142032;
    --surface-3: #1a273b;
    --line: #223049;
    --line-strong: #2e3e5a;
    --text: #e5ebf4;
    --text-2: #c1cbdb;
    --muted: #8d9ab0;
    --brand: #4c8ff2;
    --brand-strong: #6aa3f7;
    --brand-ink: #06101f;
    --brand-soft: rgba(76, 143, 242, .14);
    --brand-line: rgba(76, 143, 242, .38);
    --navy: #e5ebf4;
    --ok: #4cc38a;
    --ok-soft: rgba(76, 195, 138, .13);
    --warn: #e2a64b;
    --warn-soft: rgba(226, 166, 75, .13);
    --bad: #f07a70;
    --bad-soft: rgba(240, 122, 112, .13);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic.sm { width: 15px; height: 15px; }
.ic.lg { width: 22px; height: 22px; }

/* ---------- Light/dark-specific bits ---------- */
@media not (prefers-color-scheme: dark) {
  .only-dark { display: none !important; }
}
@media (prefers-color-scheme: dark) {
  .only-light { display: none !important; }
}

/* ---------- Wordmark ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--navy); }
.wordmark img { width: 34px; height: 34px; }
.wordmark .wm-text { font-weight: 800; font-style: italic; font-size: 20px; letter-spacing: -.03em; line-height: 1; }
.wordmark .wm-text b { color: var(--brand); font-weight: 800; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  font: 600 13.5px/1 var(--sans); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text-2); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.quiet:hover { background: var(--surface-3); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.93); }
.btn.danger-ghost { background: var(--surface); color: var(--bad); border-color: var(--line-strong); }
.btn.danger-ghost:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }

.btn.google { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.google:hover { background: var(--surface-3); }
.btn.google svg { width: 18px; height: 18px; }

.input, select.input, textarea.input {
  height: 36px; width: 100%; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 14px/1.4 var(--sans);
}
textarea.input { height: auto; min-height: 72px; padding: 8px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field.dirty > label::after { content: " • changed"; color: var(--brand); font-weight: 500; }

.search-box { position: relative; }
.search-box .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 35px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Spinner ---------- */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--muted); }

/* ---------- Badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.chip.google { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.chip.apple { color: var(--text); }
.chip.dev { color: var(--warn); border-color: transparent; background: var(--warn-soft); }
.chip.relay { color: var(--muted); font-weight: 500; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ---------- Usage bar ---------- */
.usage { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.usage .bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.usage .bar > i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; }
.usage .bar.warn > i { background: var(--warn); }
.usage .bar.bad > i { background: var(--bad); }
.usage .txt { font-size: 12px; color: var(--muted); }
.usage .txt b { color: var(--text-2); font-weight: 600; }
.usage.lg .bar { height: 9px; }

/* ---------- Sign-in / gate screens ---------- */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 420px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 34px 32px 28px; box-shadow: var(--shadow); text-align: center; }
.auth-card .brand-logo { width: 260px; max-width: 100%; height: auto; display: block; margin: 0 auto; }
.auth-card .brand-dark { justify-content: center; margin: 4px 0; }
.auth-card .brand-dark img { width: 52px; height: 52px; }
.auth-card .brand-dark .wm-text { font-size: 30px; }
.auth-card .eyebrow { margin: 6px 0 26px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.auth-card .small { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-top: 14px; }
.auth-card .note { text-align: left; }
.auth-card .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.server-status { display: inline-flex; align-items: center; gap: 6px; }
.server-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.server-status.ok .dot { background: var(--ok); }
.server-status.bad .dot { background: var(--bad); }

.note { padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; line-height: 1.55; display: flex; gap: 10px; align-items: flex-start; }
.note .ic { margin-top: 1px; }
.note.info { background: var(--brand-soft); border-color: var(--brand-line); }
.note.info .ic { color: var(--brand); }
.note.warn { background: var(--warn-soft); border-color: transparent; }
.note.warn .ic { color: var(--warn); }
.note.bad { background: var(--bad-soft); border-color: transparent; }
.note.bad .ic { color: var(--bad); }
.note.ok { background: var(--ok-soft); border-color: transparent; }
.note.ok .ic { color: var(--ok); }
.note p:last-child { margin-bottom: 0; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px 14px;
}
.sidebar .brand { padding: 2px 8px 18px; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand small { padding-left: 43px; margin-top: -2px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 11px; border-radius: 8px;
  color: var(--text-2); font-weight: 550; font-size: 14px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav a .ic { color: currentColor; opacity: .9; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.sidebar .me { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; text-transform: uppercase; }
.sidebar .me .who { min-width: 0; flex: 1; }
.sidebar .me .who b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .me .who span { font-size: 11.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 32px 0; min-height: 66px; }
.topbar h1 { font-size: 21px; }
.topbar .spacer { flex: 1; }
.env { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; height: 26px; padding: 0 10px; background: var(--surface); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env.demo { color: var(--warn); border-color: transparent; background: var(--warn-soft); font-weight: 600; }
.env.override { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.content { padding: 18px 32px 48px; max-width: 1240px; width: 100%; }
.page-intro { color: var(--muted); margin: -4px 0 18px; max-width: 760px; }

/* ---------- Cards & tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-h h2 { font-size: 15px; }
.card-h .sub { color: var(--muted); font-size: 12.5px; }
.card-h .spacer { flex: 1; }
.card-b { padding: 18px; }
.card-f { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-f .left { margin-right: auto; color: var(--muted); font-size: 12.5px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; min-height: 108px; }
.tile .t-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile .t-label .ic { color: var(--brand); width: 16px; height: 16px; }
.tile .t-value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .t-value small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.tile .t-foot { font-size: 12px; color: var(--muted); margin-top: auto; }
.tile.wide { grid-column: span 2; }
.storage-tile .t-value { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.section-title { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 26px 0 10px; }

/* ---------- Tables ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search-box { flex: 1; min-width: 220px; max-width: 420px; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl th:first-child { border-top-left-radius: var(--radius); }
.tbl th:last-child { border-top-right-radius: var(--radius); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tr.selected td { background: var(--brand-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .nowrap { white-space: nowrap; }
.tbl .muted, .muted { color: var(--muted); }
.tbl .primary { font-weight: 600; color: var(--text); }
.tbl .sub { font-size: 12px; color: var(--muted); }
.tbl .action { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 2px 6px; border-radius: 5px; color: var(--text-2); white-space: nowrap; }
.tbl .details { font-size: 12.5px; color: var(--muted); max-width: 360px; overflow-wrap: anywhere; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .ic { width: 28px; height: 28px; color: var(--line-strong); margin-bottom: 8px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager .btns { display: flex; gap: 6px; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(9, 16, 28, .38); z-index: 40; opacity: 0; transition: opacity .18s; }
.scrim.open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 41; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.drawer.open { transform: translateX(0); }
.drawer-h { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-h .title { flex: 1; min-width: 0; }
.drawer-h h2 { font-size: 17px; overflow-wrap: anywhere; }
.drawer-h .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 22px 30px; }
.drawer-b h3 { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 22px 0 10px; }
.drawer-b h3:first-child { margin-top: 0; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.kv > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.drawer .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv span { display: block; font-size: 11.5px; color: var(--muted); }
.kv b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.list { border: 1px solid var(--line); border-radius: 8px; }
.list .li { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.list .li:last-child { border-bottom: 0; }
.list .li .grow { flex: 1; min-width: 0; }
.list .li .l1 { font-weight: 600; overflow-wrap: anywhere; }
.list .li .l2 { font-size: 12px; color: var(--muted); }
.list .li.revoked .l1 { color: var(--muted); text-decoration: line-through; }
.list .li .ic-box { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); display: flex; align-items: center; justify-content: center; flex: none; }
.copy { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.copy:hover { color: var(--brand); }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(9, 16, 28, .45); opacity: 0; transition: opacity .15s; }
.modal-wrap.open { opacity: 1; }
.modal { width: 460px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); transform: translateY(8px); transition: transform .15s; }
.modal-wrap.open .modal { transform: none; }
.modal-h { padding: 20px 22px 6px; display: flex; gap: 12px; align-items: flex-start; }
.modal-h .m-ic { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.modal-h .m-ic.danger { background: var(--bad-soft); color: var(--bad); }
.modal-h h3 { font-size: 16px; margin-top: 7px; }
.modal-b { padding: 6px 22px 6px 70px; color: var(--text-2); }
.modal-b .field { margin-top: 12px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 18px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: 380px; max-width: calc(100vw - 40px); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13.5px; transform: translateY(8px); opacity: 0; transition: transform .18s, opacity .18s; }
.toast.show { transform: none; opacity: 1; }
.toast .ic { margin-top: 1px; }
.toast.ok .ic { color: var(--ok); }
.toast.error { border-left: 3px solid var(--bad); }
.toast.error .ic { color: var(--bad); }
.toast .t-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .t-code { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.toast .t-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; line-height: 0; }

/* ---------- Storage test steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.steps li { display: flex; gap: 11px; align-items: flex-start; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .s-ic { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.steps .s-ic .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.steps li.ok .s-ic { background: var(--ok-soft); color: var(--ok); }
.steps li.fail .s-ic { background: var(--bad-soft); color: var(--bad); }
.steps li.skip .s-ic { background: var(--surface-3); color: var(--muted); }
.steps .s-name { font-weight: 600; }
.steps .s-msg { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.steps .s-ms { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Settings rows ---------- */
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding: 16px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.set-row:last-child { border-bottom: 0; }
.set-row .s-label { font-weight: 600; }
.set-row .s-key { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.set-row .s-desc { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.set-row .s-ctl .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.set-row.dirty { background: var(--brand-soft); }
.set-row.dirty .s-label::after { content: "Changed"; margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--brand); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* Sign-in providers */
.provider-urls { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 14px; }
.copy-line { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.copy-line .cl-label { flex: 0 0 84px; font-size: 12px; font-weight: 600; color: var(--muted); }
.copy-line .cl-value { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.plain-steps { margin: 0 0 8px; padding-left: 20px; }
.plain-steps li { margin-bottom: 4px; }

/* Plans (pages/plans.js) */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; margin-top: 16px; }
.plan-grid > .card { margin-top: 0; }
.plan-grid + .card { margin-top: 16px; }
.plan-card .card-h h2 { overflow-wrap: anywhere; }
.qty { display: flex; gap: 8px; }
.qty .input[type=number] { flex: 1 1 auto; min-width: 0; }
.qty select.input { flex: 0 0 76px; width: 76px; }
.money { position: relative; }
.money .cur { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--muted); pointer-events: none; }
.money .input { padding-left: 46px; }
.plan-price { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.saving { font-size: 12.5px; line-height: 1.5; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); margin: -4px 0 14px; }
.saving.ok { background: var(--ok-soft); color: var(--ok); }
.saving.warn { background: var(--warn-soft); color: var(--warn); }
.saving:empty { display: none; }
.plans-form.is-dirty .save-bar { position: sticky; bottom: 16px; z-index: 5; box-shadow: var(--shadow-lg); }
.save-bar .card-f { border-top: 0; border-radius: var(--radius); }

/* Payments (pages/payments.js) */
.badge-row { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.ev-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.event-list li { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.event-list .ic { width: 14px; height: 14px; color: var(--ok); }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .shell { grid-template-columns: 68px 1fr; }
  .sidebar { padding: 16px 10px 12px; align-items: center; }
  .sidebar .brand { padding: 2px 0 16px; }
  .sidebar .brand .wm-text, .sidebar .brand small { display: none; }
  .nav a { width: 46px; justify-content: center; padding: 0; }
  .nav a span { display: none; }
  .nav .sep { width: 36px; }
  .sidebar .me { flex-direction: column; padding: 12px 0 0; }
  .sidebar .me .who { display: none; }
  .topbar, .content { padding-left: 22px; padding-right: 22px; }
  .tile.wide { grid-column: span 1; }
  .tbl th, .tbl td { padding-left: 10px; padding-right: 10px; }
  .usage { min-width: 112px; }
}
@media (max-width: 820px) {
  .set-row { grid-template-columns: 1fr; gap: 10px; }
  .drawer .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .modal-b { padding-left: 22px; }
  .topbar .env { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0s !important; }
}

/* Files page (pages/files.js) */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; min-width: 0; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--muted); }
.tbl.files td.ck, .tbl.files th.ck { width: 36px; padding-right: 0; }
.tbl.files td.nm a, .tbl.files td.nm span { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.tbl.files td.nm a { color: var(--brand); font-weight: 550; }
.tbl.files td.nm a:hover { text-decoration: underline; }
.tbl.files .r, .tbl.files th.r { text-align: right; white-space: nowrap; }
.tbl.files tr:hover td { background: var(--surface-2); }
.pick-list { margin: 8px 0 0; padding-left: 18px; max-height: 180px; overflow: auto; }
p.back { margin-top: 14px; }
p.back a { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); text-decoration: none; }

/* Crashes page (pages/crashes.js) */
.tbl .crash-summary { font-family: var(--mono); font-size: 12px; color: var(--text-2); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .kv.crash-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv.crash-kv b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.kv.crash-kv b.mono { font-size: 12px; }
.kv.crash-kv a { color: var(--brand); text-decoration: none; }
.kv.crash-kv a:hover { text-decoration: underline; }
pre.crash-report { margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto; tab-size: 4; }

/* R2 storage view (js/r2.js, pages/files.js, pages/storage.js) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.seg a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.seg a:hover { background: var(--surface-3); text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.btn.icon-only { width: 28px; height: 28px; padding: 0; }
.r2-key-cell { white-space: nowrap; }
.r2-key { font-size: 12px; color: var(--text); vertical-align: middle; }
.r2-key-cell .btn { vertical-align: middle; margin-left: 2px; }
.r2-tbl td { vertical-align: top; }
.r2-refs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.r2-refs li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.r2-path { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.r2-path .ic { color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--brand); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.r2-lookup { margin-bottom: 16px; }
.lookup-row { display: flex; gap: 8px; }
.lookup-row .input { flex: 1 1 auto; min-width: 0; }
.lookup-result:not(:empty) { margin-top: 14px; }
.lookup-user { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 10px; }
.lookup-user .ic { color: var(--brand); }
.lookup-user a { font-size: 13px; font-weight: 600; }
.drawer .kv b.kv-sm { font-size: 13px; font-weight: 600; }
p.hint { font-size: 12px; color: var(--muted); margin: 8px 0 12px; }
.drawer-b .table-wrap { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; }

/* Usage & costs (pages/usage.js) */
.month-bar { display: inline-flex; align-items: center; gap: 6px; }
.month-bar .month-input { width: 170px; height: 30px; }
.month-bar span.btn { opacity: .45; cursor: default; }
.usage-tiles { margin: 16px 0; }
.usage-tiles .t-value { font-size: 24px; }
.cost-tile { border-color: var(--brand-line); background: var(--brand-soft); }
.prices-card .card-b { padding: 12px 18px; }
.price-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; font-size: 13px; color: var(--text-2); }
.price-line span { display: inline-flex; align-items: center; gap: 6px; }
.price-line .spacer { flex: 1; }
.price-line a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.usage-tbl td.num b { font-size: 14px; }
.act { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.act .ic { color: var(--muted); }
.feed-tbl .file-cell { max-width: 320px; }
.feed-tbl .file-cell .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Settings: grouped keys (Cloudflare prices) */
.set-group-h { padding: 18px 18px 10px; border-top: 1px solid var(--line); background: var(--surface-2); scroll-margin-top: 80px; }
.set-group-h h2 { font-size: 14px; }
.set-group-h .sub { font-size: 12.5px; color: var(--muted); }
.tbl.compact th, .tbl.compact td { padding: 8px 8px; }
.tbl.compact .r2-key { font-size: 11.5px; }
.tbl.compact .btn.icon-only { width: 24px; height: 24px; }
