:root {
  --bg: #f4f6fb; --bg-2: #eef1f8; --surface: #ffffff; --surface-2: #f7f8fc;
  --text: #121626; --muted: #5d6479; --faint: #9aa1b4; --border: #e2e6f0;
  --primary: #4f5ff0; --primary-2: #7a5cf5; --on-primary: #fff;
  --ok: #0f8a4a; --ok-bg: #e2f6ea; --warn: #a3610a; --warn-bg: #fff1d6;
  --danger: #cf2e45; --danger-bg: #fde8ec; --info: #2a6fdb; --info-bg: #e5eefd;
  --log-bg: #0d1222; --log-text: #d3d9e8;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 4px 16px rgb(16 24 40 / .06);
  --radius: 16px; --radius-sm: 10px;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --bg-2: #0f1528; --surface: #141a2e; --surface-2: #1a2138;
    --text: #e8ebf5; --muted: #9aa3bd; --faint: #646d88; --border: #252d47;
    --primary: #7282ff; --primary-2: #9b7bff; --on-primary: #fff;
    --ok: #43d68a; --ok-bg: #12301f; --warn: #f5b84a; --warn-bg: #36280e;
    --danger: #ff6b81; --danger-bg: #3a1620; --info: #6aa4ff; --info-bg: #14264a;
    --log-bg: #070b16; --log-text: #cdd4e6;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1 { font-size: 24px; margin: 8px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h3 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); margin: 8px 0 0; white-space: pre-line; }
.error:empty { display: none; }
b { font-weight: 650; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* ---------- controls */
input {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--faint); }
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
button:focus-visible, pre:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
label { display: block; font-size: 13px; font-weight: 550; color: var(--muted); margin-bottom: 14px; }
label input { margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; border-radius: 999px; padding: 9px 16px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform .08s, background .15s, border-color .15s, opacity .15s; min-height: 40px;
}
.btn svg { width: 16px; height: 16px; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: var(--on-primary); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-bg); }
.btn.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-bg); }
.btn.success { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-bg); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.link { background: none; border: 0; color: var(--primary); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px; }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 8px; border-radius: 10px; cursor: pointer; }

/* ---------- layout */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); }
.tab { max-width: 1120px; margin: 0 auto; padding: 16px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.info { background: var(--info-bg); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.big { width: 12px; height: 12px; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.logo { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.logo svg { width: 60%; height: 60%; stroke: #fff; stroke-width: 3.2; }
.logo.sm { width: 28px; height: 28px; border-radius: 8px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; color: var(--faint); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.tabbar button[aria-current="page"] { color: var(--primary); }
.tabbar svg { width: 22px; height: 22px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
    padding: 20px 14px; border-right: 1px solid var(--border); background: var(--surface);
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; }
  .nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .nav button, .nav-foot {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 0;
    background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; text-align: left;
  }
  .nav button:hover, .nav-foot:hover { background: var(--bg-2); color: var(--text); }
  .nav button[aria-current="page"] { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
  .tabbar, #logout-m, .topbar .logo { display: none; }
  .main { padding-bottom: 32px; min-width: 0; }
  .tab { padding: 24px 28px; }
  .topbar { padding: 14px 28px; }
  .topbar-title { font-size: 18px; }
}

/* ---------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 4px 10px; }
.section-title:first-child { margin-top: 4px; }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.banner { max-width: 1088px; margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (min-width: 900px) { .banner { margin: 16px 28px 0; } }
@media (min-width: 1176px) { .banner { margin-left: auto; margin-right: auto; } }

/* ---------- hero */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 220px at 0% 0%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%),
              radial-gradient(500px 200px at 100% 0%, color-mix(in srgb, var(--primary-2) 12%, transparent), transparent 70%);
}
.hero > * { position: relative; }
.hero-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero-state { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin: 4px 0 2px; }
.hero-state .dot { color: var(--faint); }
.hero-state.ok .dot { color: var(--ok); }
.hero-state.warn .dot { color: var(--warn); }
.hero-state.bad .dot { color: var(--danger); }
.next { text-align: right; min-width: 150px; }
.next-name { font-weight: 700; font-size: 16px; margin-top: 4px; }
.next-when { color: var(--muted); font-size: 13px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.hero-actions .spacer { flex: 1; }
.pause-text { margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 550; }
@media (max-width: 560px) {
  .next { text-align: left; }
  .hero-actions .btn { flex: 1 1 30%; padding: 9px 10px; }
  .hero-actions .spacer { display: none; }
  #btn-pause, #btn-resume { flex-basis: 100%; }
}

/* ---------- kpis */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(5, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 26px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 14px; color: var(--muted); font-weight: 600; }
.kpi span { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi.accent-ok b { color: var(--ok); } .kpi.accent-danger b { color: var(--danger); } .kpi.accent-warn b { color: var(--warn); } .kpi.accent-info b { color: var(--info); }
.kpis .kpi:first-child { grid-column: span 2; }
@media (min-width: 640px) { .kpis .kpi:first-child { grid-column: auto; } }

/* ---------- day bar */
.daybar { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.daybar li { display: grid; grid-template-columns: 56px 18px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; position: relative; }
.daybar li::before { content: ""; position: absolute; left: 74px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.daybar li:first-child::before { top: 50%; } .daybar li:last-child::before { bottom: 50%; }
.daybar time { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--muted); font-size: 13px; }
.daybar .node { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--faint); z-index: 1; margin-left: 3px; }
.daybar .done .node { background: var(--ok); border-color: var(--ok); }
.daybar .now .node { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); }
.daybar .err .node { background: var(--danger); border-color: var(--danger); }
.daybar .what { font-weight: 600; font-size: 14px; }
.daybar .what small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }

/* ---------- feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.feed li:first-child { border-top: 0; }
.feed.audit li { padding: 12px 16px; }
.feed .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 800; background: var(--bg-2); color: var(--muted); }
.feed .ico.ok { background: var(--ok-bg); color: var(--ok); } .feed .ico.danger { background: var(--danger-bg); color: var(--danger); }
.feed .ico.warn { background: var(--warn-bg); color: var(--warn); } .feed .ico.info { background: var(--info-bg); color: var(--info); }
.feed .body { flex: 1; min-width: 0; font-size: 14px; }
.feed .body small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.feed .empty { color: var(--muted); font-size: 14px; }

/* ---------- flow */
.flow-phase { display: flex; align-items: center; gap: 10px; margin: 22px 4px 10px; }
.flow-phase .eyebrow { color: var(--primary); }
.flow-phase time { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.flow-phase::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.step { position: relative; padding-left: 46px; padding-bottom: 12px; }
.step::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: -2px; width: 2px; background: var(--border); }
.step:last-child::before { display: none; }
.step-num {
  position: absolute; left: 0; top: 10px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; background: var(--surface); border: 2px solid var(--border); color: var(--muted); z-index: 1;
}
.step.s-done .step-num { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.step.s-error .step-num { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.step.s-off .step-num { border-style: dashed; }
.step .card { margin: 0; padding: 14px 16px; }
.step-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.step-head h2 { font-size: 15px; }
.step-rule { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.step-rule code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; background: var(--bg-2); padding: 1px 6px; border-radius: 6px; color: var(--text); }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.stat b { display: block; font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.funnel { display: grid; gap: 6px; margin-top: 12px; }
.funnel-row { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.funnel-row span:first-child { color: var(--muted); font-weight: 600; }
.funnel-bar { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.funnel-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); min-width: 3px; }
.funnel-row b { text-align: right; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips:empty::after { content: "None"; color: var(--muted); font-size: 13px; }
.card > .chips:first-child { margin-top: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; padding: 4px 10px; border-radius: 999px; background: var(--bg-2); color: var(--text); }
.chip em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.ok em { color: inherit; opacity: .8; }
.chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.danger { background: var(--danger-bg); color: var(--danger); }
.chip.info { background: var(--info-bg); color: var(--info); }
.note { margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; background: var(--info-bg); color: var(--info); font-weight: 550; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.split { display: grid; gap: 12px; }
@media (min-width: 720px) { .split { grid-template-columns: 1fr 1fr; } }
.split .step::before { display: none; }

details.out { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 8px; }
details.out summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); list-style: none; }
details.out summary::-webkit-details-marker { display: none; }
details.out summary::before { content: "▸ "; }
details.out[open] summary::before { content: "▾ "; }
details.out pre { margin: 8px 0 0; max-height: 260px; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.mini-table th, .mini-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.mini-table tr.hl td { color: var(--ok); font-weight: 650; }

/* ---------- positions */
.pos-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pos-grid:empty::after { content: "No open positions."; color: var(--muted); padding: 18px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.pos { margin: 0; }
.pos-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pos-sym { font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.pos-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pos-meta div span { display: block; font-size: 11px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.pos-meta div b { font-variant-numeric: tabular-nums; font-size: 15px; }
.range { position: relative; height: 8px; border-radius: 999px; margin: 18px 0 6px; background: linear-gradient(90deg, var(--danger) 0%, var(--warn) 30%, var(--ok) 100%); opacity: .85; }
.range i { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text); transform: translate(-50%, -50%); }
.range-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pos-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); gap: 8px; flex-wrap: wrap; }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 650; font-size: 12px; background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.pos-pl { font-weight: 700; } td.up { color: var(--ok); } td.down { color: var(--danger); }
td.empty { color: var(--muted); text-align: center; padding: 20px; }

/* ---------- settings */
fieldset { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 16px 18px 4px; margin: 0 0 14px; box-shadow: var(--shadow); min-width: 0; }
legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); padding: 0 6px; margin-left: -6px; float: left; width: 100%; margin-bottom: 12px; }
.fields { clear: both; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }
.fields label small { display: block; font-size: 11px; font-weight: 500; color: var(--faint); margin-top: 1px; }
.fields input.changed { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.savebar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); z-index: 4;
  display: flex; gap: 8px; justify-content: flex-end; padding: 10px; margin-top: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow);
}
@media (min-width: 900px) { .savebar { bottom: 16px; } }

/* ---------- logs */
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; margin-bottom: 12px; border: 1px solid var(--border); }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 999px; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.grow { flex: 1; min-width: 150px; width: auto; }
.toggle { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; color: var(--text); font-weight: 600; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle span { width: 34px; height: 20px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; }
.toggle span::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 rgb(0 0 0 / .3); }
.toggle input:checked + span { background: var(--primary); }
.toggle input:checked + span::after { transform: translateX(14px); }
.toggle input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.log {
  background: var(--log-bg); color: var(--log-text); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0;
  height: calc(100vh - 290px); min-height: 320px; overflow: auto; font: 12px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.log .err { color: #ff8fa0; } .log .wrn { color: #f6cf73; } .log .good { color: #7ee2a8; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(700px 400px at 50% -10%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow); }
.login-card .muted { margin: 0 0 20px; }
.login-card .btn { margin-top: 6px; min-height: 46px; }

/* ---------- dialog + toast */
dialog { border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); max-width: 440px; width: calc(100% - 32px); padding: 22px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(5 8 20 / .55); backdrop-filter: blur(3px); }
dialog p { font-size: 14px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px); z-index: 20; box-shadow: var(--shadow); animation: fade .2s ease;
}
.toast.bad { background: var(--danger); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
