:root {
  --bg: #10161d;
  --bar: #17212b;
  --line: #22303d;
  --card: #1e2a36;
  --chip: #2a3846;
  --text: #e6ebf0;
  --soft: #c9d4de;
  --muted: #8b9aa8;
  --tab: #a9b6c2;
  --accent: #e3a35f;
  --accent-bg: #4a3a26;
  --link: #6cb6f0;
  --primary: #2b5278;
  --danger-bg: #5a3a2a;
  --danger: #f0c9a8;
  --ok: #5fbf86;
  --warn: #e3a35f;
  --bad: #f08c8c;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--link); }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; background: var(--bar); border-bottom: 1px solid var(--line);
}
.top-title { font-weight: 600; font-size: 15px; }
.badge { padding: 3px 8px; border-radius: 6px; background: var(--accent-bg); color: var(--accent); font-size: 12px; font-weight: 600; }

.view { flex: 1; overflow-y: auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bar); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { min-height: 56px; border: 0; background: none; color: var(--tab); font-size: 12px; font-weight: 500; cursor: pointer; }
.tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }

.card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 14px; background: var(--card); }
.card.outline { background: none; border: 1px solid var(--chip); }
.card h2 { margin: 0; font-size: 14px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 2px; }

.hero-state { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; background: var(--card); }
.stat b { font-size: 20px; font-weight: 600; }

.btn { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--chip); color: var(--text); font-weight: 500; cursor: pointer; }
.btn.small { min-height: 36px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.btn.primary { background: var(--primary); font-weight: 600; }
.btn.danger { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.btn.big { min-height: 48px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--chip); background: var(--bg); cursor: pointer; font-size: 13px; }
.pill[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); color: #f0d2a8; }

.field { min-height: 40px; padding: 0 12px; border: 1px solid var(--chip); border-radius: 8px; background: var(--bg); }
.field:focus { outline: 2px solid var(--link); outline-offset: -1px; }
label { font-weight: 600; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: #3a5068; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.list > * + * { border-top: 1px solid var(--bg); padding-top: 8px; }
.events { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.events .t { color: var(--muted); width: 44px; flex-shrink: 0; }

.log { margin: 0; padding: 12px; border-radius: 12px; background: #0b1016; border: 1px solid #1f2b37; font: 11.5px/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; }
.log .e { color: var(--warn); }
.log .w { color: #d8c48a; }
.log .c { color: var(--bad); }

details summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
details ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: 72px; padding: 12px 14px; border-radius: 12px; background: #2a3846; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
