:root {
  --bg: #0b0f14; --card: #131a22; --card2: #18212b; --line: #223040; --text: #e8eef5; --dim: #8b9bb0;
  --ok: #3ddc97; --bad: #ff5d5d; --warn: #ffb547; --run: #5aa9ff; --accent: #7c6cff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom)); min-height: 100vh; font-size: 16px; line-height: 1.4; }
header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 8px; position: sticky; top: 0;
  background: linear-gradient(var(--bg) 70%, transparent); z-index: 5; }
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.brand em { font-style: normal; color: var(--dim); font-weight: 500; }
.mark { width: 12px; height: 12px; border-radius: 3px; background: linear-gradient(135deg, var(--ok), var(--run)); display: inline-block; }
.fresh { font-size: 12px; color: var(--dim); }
.fresh.stale { color: var(--warn); }
main { padding: 4px 14px 20px; max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; }
.card h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); font-weight: 600; }
.hero { padding: 20px 18px; border-radius: 20px; }
.hero .big { font-size: 26px; font-weight: 700; margin: 6px 0 4px; }
.hero p { margin: 0; color: var(--dim); }
.hero.ok { border-color: #1f5b45; background: linear-gradient(160deg, #10261f, var(--card)); }
.hero.bad { border-color: #6b2630; background: linear-gradient(160deg, #2a1418, var(--card)); }
.hero.run { border-color: #264a73; background: linear-gradient(160deg, #11202f, var(--card)); }
.hero.warn { border-color: #6b5320; background: linear-gradient(160deg, #2a2212, var(--card)); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; background: var(--dim); }
.ok .dot, .dot.ok { background: var(--ok); } .bad .dot, .dot.bad { background: var(--bad); }
.run .dot, .dot.run { background: var(--run); animation: pulse 1.4s infinite; } .warn .dot, .dot.warn { background: var(--warn); }
@keyframes pulse { 50% { opacity: .35; } }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); font-weight: 600; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
.row .k { color: var(--dim); flex: 0 0 auto; } .row .v { text-align: right; overflow-wrap: anywhere; }
.count { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.sub { color: var(--dim); font-size: 14px; }
ol.plan { margin: 10px 0 0; padding-left: 20px; color: #c7d2df; font-size: 14px; } ol.plan li { margin: 6px 0; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.badge { flex: 0 0 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--card2); color: var(--dim); border: 1px solid var(--line); }
.done .badge { background: #123526; color: var(--ok); border-color: #1f5b45; }
.stopped .badge { background: #3a161b; color: var(--bad); border-color: #6b2630; }
.running .badge { background: #13283f; color: var(--run); border-color: #264a73; animation: pulse 1.4s infinite; }
.steps .t { font-weight: 600; } .steps .d { color: var(--dim); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--card2); color: var(--dim); white-space: nowrap; }
.chip.complete, .chip.done { background: #123526; color: var(--ok); } .chip.needs_attention, .chip.failed, .chip.timeout { background: #3a161b; color: var(--bad); }
.chip.running, .chip.queued, .chip.starting { background: #13283f; color: var(--run); } .chip.closed, .chip.recorded, .chip.cancelled, .chip.refused { background: #2a2212; color: var(--warn); }
.item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.item:first-of-type { border-top: 0; }
.item .a { font-weight: 600; } .item .b { color: var(--dim); font-size: 13px; }
button.btn { appearance: none; border: 0; border-radius: 12px; padding: 13px 16px; font-size: 16px; font-weight: 600; width: 100%;
  background: var(--accent); color: #fff; margin-top: 10px; }
button.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
button.btn.danger { background: #b4323c; }
button.btn:disabled { opacity: .45; }
.problem { border-color: #6b2630; }
.problem .t { font-weight: 700; } .problem .d { color: #e3b9bd; font-size: 14px; margin-top: 4px; }
.event { padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; } .event:first-of-type { border-top: 0; }
.event .when { color: var(--dim); font-size: 12px; }
.event.problem-e .tt { color: var(--bad); } .event.complete .tt { color: var(--ok); }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: rgba(13, 18, 24, .94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
nav[hidden] { display: none; }
nav button { flex: 1; background: none; border: 0; color: var(--dim); font-size: 11px; padding: 6px 0; display: grid; gap: 2px; justify-items: center; }
nav button i { font-style: normal; font-size: 19px; } nav button.on { color: var(--text); }
nav button .n { position: absolute; margin-left: 22px; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; }
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 20; display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-body { background: var(--bg); border-radius: 20px 20px 0 0; width: 100%; max-width: 640px; margin: 0 auto; max-height: 92vh; overflow: auto;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); border: 1px solid var(--line); position: relative; }
.close { position: sticky; top: 0; float: right; background: var(--card2); color: var(--text); border: 1px solid var(--line); width: 34px; height: 34px;
  border-radius: 50%; font-size: 20px; }
h1 { font-size: 20px; margin: 4px 0 2px; } h3 { font-size: 15px; margin: 18px 0 6px; }
pre { background: #080b0f; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 12px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; }
textarea, input[type=text], select { width: 100%; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 16px; font-family: inherit; }
label.opt { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; background: var(--card2); }
label.opt input { margin-top: 4px; accent-color: var(--accent); } label.opt b { display: block; } label.opt span { color: var(--dim); font-size: 13px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: #26323f; padding: 10px 16px;
  border-radius: 12px; z-index: 30; font-size: 14px; max-width: 90vw; }
.toast[hidden] { display: none; }
.switch { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
a { color: var(--run); }
.note { color: var(--dim); font-size: 13px; margin-top: 8px; }
