:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #14161a; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --chip: #eef1f5;
  --tab: rgba(255,255,255,.92);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b21; --text: #eef0f3; --muted: #9aa3af; --line: #262a33;
    --accent: #60a5fa; --ok: #22c55e; --warn: #f59e0b; --bad: #f87171; --chip: #222631;
    --tab: rgba(20,22,27,.92);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { padding-top: env(safe-area-inset-top); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
h1 { font-size: 28px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; font-weight: 600; }
.top { max-width: 720px; margin: 0 auto; display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 6px; }
main { padding: 0 16px calc(90px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .d { font-size: 13px; font-weight: 600; } .up { color: var(--ok); } .down { color: var(--bad); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .name { flex: 1; min-width: 0; } .row .val { color: var(--muted); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.hint { font-size: 12px; color: var(--muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chip { background: var(--chip); color: var(--text); border: 0; border-radius: 999px; padding: 6px 12px; font-size: 14px; white-space: nowrap; }
a.chip { text-decoration: none; }
.chip.on { background: var(--accent); color: #fff; }
.alert { padding: 12px 0; border-top: 1px solid var(--line); }
.alert:first-child { border-top: 0; }
.alert .h { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.alert .t { margin-top: 4px; font-weight: 600; } .alert.unread .t::before { content: "● "; color: var(--accent); }
.alert .b { margin-top: 4px; font-size: 14px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 600;
  background: var(--chip); color: var(--text); margin-top: 10px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.small { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; margin: 0; }
input, select { width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); margin-top: 10px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--tab);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; font-size: 11px; color: var(--muted); text-decoration: none; padding: 8px 0 6px; position: relative; }
.tabs a .ic { display: block; font-size: 22px; line-height: 1.2; filter: grayscale(1); opacity: .7; }
.tabs a.on { color: var(--accent); } .tabs a.on .ic { filter: none; opacity: 1; }
.badge { position: absolute; top: 4px; left: 50%; margin-left: 8px; background: var(--bad); color: #fff; font-size: 11px;
  border-radius: 999px; padding: 1px 6px; font-weight: 700; }
.login-box { max-width: 360px; margin: 18vh auto 0; padding: 0 24px; text-align: center; }
.logo { font-size: 48px; color: var(--accent); }
.msg { min-height: 20px; color: var(--bad); font-size: 14px; }
.bar { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.spark { width: 100%; height: 44px; display: block; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: 16px; padding: 16px; text-decoration: none; color: var(--text); }
.tile .ic { font-size: 28px; } .tile .n { font-weight: 600; margin-top: 6px; } .tile .s { font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
td, th { padding: 7px 4px; border-top: 1px solid var(--line); text-align: right; } th { color: var(--muted); font-weight: 500; font-size: 12px; }
td:first-child, th:first-child { text-align: left; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 9; }
.ptr { text-align: center; color: var(--muted); font-size: 13px; height: 0; overflow: hidden; transition: height .2s; }
.back { background: none; border: 0; color: var(--accent); font-size: 34px; line-height: 1; padding: 0 10px 0 0; margin-right: 2px; }
.top h1 { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.tile { display: block; }
label.btn { cursor: pointer; }
