:root {
  --bg: #f3f5f7; --card: #ffffff; --ink: #121a22; --muted: #5d6b79; --line: #e1e6eb;
  --brand: #0f1720; --ok: #12805c; --ok-bg: #e3f4ee; --warn: #a15c00; --warn-bg: #fdf0db;
  --stop: #c62828; --stop-bg: #fdeaea; --accent: #1f5fbf; --shadow: 0 1px 3px rgba(15,23,32,.08);
  --on-solid: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1218; --card: #151e27; --ink: #e9eef3; --muted: #93a1af; --line: #24303c;
    --brand: #0a0f14; --ok: #4fd1a5; --ok-bg: #12332a; --warn: #f2b65a; --warn-bg: #3a2c12;
    --stop: #ff6b6b; --stop-bg: #3b1717; --accent: #7fb0ff; --shadow: none;
    --on-solid: #0c1218;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 84px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }

header { background: var(--brand); color: #fff; padding: calc(14px + env(safe-area-inset-top)) 16px 14px; position: sticky; top: 0; z-index: 5; }
header .org { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
header h1 { margin: 2px 0 6px; font-size: 20px; font-weight: 650; }
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.who { text-align: right; font-size: 12.5px; opacity: .9; }
.who span { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn { color: #fff; text-decoration: underline; font-size: 13px; padding: 6px 0 2px; }
.global.unknown .big { color: var(--muted); }
.conn { font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #93a1af; display: inline-block; }
.dot.ok { background: #4fd1a5; }
.dot.bad { background: #ff6b6b; }
.notice { background: var(--warn-bg); color: var(--warn); font-size: 13px; padding: 8px 16px; text-align: center; }
.notice.bad { background: var(--stop-bg); color: var(--stop); }

main { padding: 14px 16px; }
.card { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.label.gap { margin: 4px 2px 8px; }
.big { font-size: 24px; font-weight: 700; margin: 2px 0 4px; }
.big.small { font-size: 20px; }
.sub { font-size: 13.5px; color: var(--muted); }
.note { margin: 12px 2px; }

.global.running .big { color: var(--ok); }
.global.stopped { background: var(--stop-bg); }
.global.stopped .big { color: var(--stop); }
.btn { display: block; width: 100%; padding: 15px; border-radius: 12px; font-weight: 650; font-size: 17px; margin-top: 14px; }
.btn.stop { background: var(--stop); color: var(--on-solid); }
.btn.go { background: var(--ok); color: var(--on-solid); }
.btn.plain { background: transparent; border: 1px solid var(--line); font-weight: 550; }
.btn:disabled { opacity: .55; }

.tools { display: flex; gap: 8px; margin: 4px 0 10px; }
.tools input { flex: 1; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; min-width: 0; }
.chips { display: flex; gap: 8px; margin-bottom: 10px; overflow-x: auto; }
.chip { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13.5px; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.list { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .sym { font-weight: 650; font-size: 16px; }
.row .sys { font-size: 12.5px; color: var(--muted); }
.row .grow { flex: 1; min-width: 0; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.run { background: var(--ok-bg); color: var(--ok); }
.badge.paused { background: var(--warn-bg); color: var(--warn); }
.badge.pending { background: var(--line); color: var(--muted); }
.badge.stopped { background: var(--stop-bg); color: var(--stop); }
.mini { padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); font-size: 14px; font-weight: 600; min-width: 76px; }
.mini.resume { border-color: var(--ok); color: var(--ok); }
.empty { padding: 22px; text-align: center; color: var(--muted); font-size: 14px; }
.pos { font-weight: 650; }
.pos.up { color: var(--ok); }
.pos.down { color: var(--stop); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-of-type { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv .good { color: var(--ok); font-weight: 600; }
.kv .bad { color: var(--stop); font-weight: 600; }
.feed .item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.feed .item:last-child { border-bottom: 0; }
.feed .t { font-size: 12.5px; color: var(--muted); }
.feed .m { font-size: 15px; margin-top: 1px; }

nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
nav button { flex: 1; padding: 12px 4px 10px; font-size: 12.5px; color: var(--muted); }
nav button.on { color: var(--ink); font-weight: 650; }
nav .ico { display: block; font-size: 20px; line-height: 1; margin-bottom: 3px; }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 6px; font-size: 19px; }
.sheet p { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; }
.sheet .label { margin-top: 12px; }
.opts { display: flex; gap: 8px; margin: 12px 0 2px; }
.opts button { flex: 1; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; }
.opts button.on { border-color: var(--ink); background: var(--ink); color: var(--bg); }

.signin { padding: 72px 24px; text-align: center; }
.signin .logo { width: 64px; height: 64px; border-radius: 16px; background: var(--brand); color: #fff; font-weight: 700; font-size: 26px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.signin-title { margin: 0 0 4px; font-size: 22px; }
.signin-note { margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px;
  border-radius: 999px; font-size: 14px; z-index: 12; max-width: 90%; text-align: center; }
