:root {
  --bg: #f4f6f8; --card: #ffffff; --text: #151a20; --muted: #64707d; --line: #e2e7ec;
  --ok: #1f9d55; --warn: #d9930d; --bad: #d6403a; --off: #8b95a1; --accent: #2563eb; --accent-text: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1419; --card: #182028; --text: #e8edf2; --muted: #8f9ba8; --line: #26313b; --ok: #3ccf7a; --warn: #f0b429; --bad: #ff6b64; --off: #6b7683; --accent: #5b8def; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
html { overflow-y: auto; -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; }
body:has(dialog[open]) { overflow: hidden; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); min-height: 100vh; min-height: 100dvh; }
.app { max-width: 560px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; } h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 4px 8px; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .pad { padding: 40px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.banner { display: flex; gap: 12px; align-items: center; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; color: #fff; font-weight: 600; }
.banner.ok { background: var(--ok); } .banner.warn { background: var(--warn); } .banner.bad { background: var(--bad); } .banner.off { background: var(--off); }
.banner small { display: block; font-weight: 400; opacity: .92; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--off); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; } .row.tap { cursor: pointer; } .row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; } .row .sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.metric { padding: 8px 0; } .metric .head span:last-child { text-align: right; } .metric .head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 4px; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.bar > i.warn { background: var(--warn); } .bar > i.bad { background: var(--bad); }
.spark { width: 100%; height: 56px; display: block; } .spark path { fill: none; stroke-width: 2; stroke-linejoin: round; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
button, .btn { font: inherit; border: 0; border-radius: 12px; padding: 13px 16px; background: var(--accent); color: var(--accent-text); font-weight: 600; width: 100%; cursor: pointer; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); } button.danger { background: var(--bad); color: #fff; }
button.small { width: auto; padding: 8px 12px; font-size: 14px; } button:disabled { opacity: .55; }
.stack > * + * { margin-top: 10px; }
input { font: inherit; width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
input.code { text-align: center; font-size: 26px; letter-spacing: .3em; }
.login { padding-top: 8vh; } .login h1 { text-align: center; font-size: 26px; } .login .logo { width: 72px; height: 72px; margin: 0 auto 12px; display: block; border-radius: 18px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; color: var(--muted); border-radius: 0; padding: 12px 4px 10px; font-size: 12px; font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabs button.on { color: var(--accent); } .tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sheet { border: 0; padding: 0; background: var(--card); color: var(--text); border-radius: 20px 20px 0 0; width: 100%; max-width: 560px; margin: auto auto 0; max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.sheet::backdrop { background: rgba(0,0,0,.5); } .sheet .in { padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; } .kv span:last-child { text-align: right; overflow-wrap: anywhere; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); background: #222c36; color: #fff; padding: 12px 14px; border-radius: 12px; text-align: center; z-index: 10; }
a { color: var(--accent); }

.btn { display: block; text-align: center; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.small { display: inline-block; width: auto; padding: 8px 12px; font-size: 14px; }
.row.wrap { flex-wrap: wrap; } .acts { display: flex; gap: 8px; width: 100%; }
.spin { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
pre.logs { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font: 12px/1.35 ui-monospace, Menlo, Consolas, monospace; max-height: 45vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
.tabs button { min-width: 0; }
