:root {
  --bg: #0E0F13;
  --card: #17181E;
  --card2: #1F2028;
  --line: #2A2C35;
  --text: #F2F3F5;
  --muted: #9A9DA8;
  --accent: #FC5200;
  --accent2: #FF8A3D;
  --good: #3DD68C;
  --z1: #5B8DEF; --z2: #3DD68C; --z3: #F5C542; --z4: #FF8A3D; --z5: #F0455A;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--accent2); }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) 18px 10px; background: rgba(14,15,19,.88); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main { padding: 16px 16px calc(var(--safe-b) + 96px); max-width: 760px; margin: 0 auto; outline: none; }
h1 { font-size: 26px; margin: 6px 0 2px; }
h2 { font-size: 16px; margin: 22px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.sub { color: var(--muted); margin: 0 0 14px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around;
  padding: 8px 6px calc(var(--safe-b) + 8px); background: rgba(14,15,19,.92); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted);
  text-decoration: none; font-size: 11px; font-weight: 600; padding: 4px 0; }
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.active { color: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.stat .d { font-size: 12px; margin-top: 2px; color: var(--muted); }
.up { color: var(--good) !important; } .down { color: var(--z5) !important; }

.hero { background: linear-gradient(135deg, #2A1408, #17181E 60%); border-color: #3A2215; }
.hero-row { display: flex; align-items: center; gap: 16px; }
.ring { width: 104px; height: 104px; flex: none; }
.ring text { fill: var(--text); stroke: none; font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 14px;
  border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; }
.btn.secondary { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--z5); border: 1px solid #4a2028; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.act { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px; text-decoration: none; color: inherit; }
.act .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #2A1408; color: var(--accent2); flex: none; font-size: 20px; }
.act .body { flex: 1; min-width: 0; }
.act .t { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act .m { color: var(--muted); font-size: 13px; }
.act .r { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.act .r small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip { padding: 7px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted);
  font-weight: 600; font-size: 13px; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.bar-row { display: grid; grid-template-columns: 88px 1fr 64px; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.bar { height: 10px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.bar-row .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.chart svg text { fill: var(--muted); stroke: none; font-size: 10px; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field select, textarea { background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 12px;
  padding: 12px; font-size: 16px; font-family: inherit; width: 100%; }
.field input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.hint { font-size: 13px; color: var(--muted); }
ol.steps { padding-left: 20px; margin: 8px 0; color: var(--muted); }
ol.steps li { margin-bottom: 6px; }
ol.steps b { color: var(--text); }
code { background: var(--card2); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }

.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty .big { font-size: 42px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--card2); color: var(--muted); }
.pill.demo { background: #3A2215; color: var(--accent2); }
.route { width: 100%; height: 200px; background: var(--card2); border-radius: 14px; }
.route path { stroke: var(--accent); stroke-width: 3; }
.zone-legend { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.zone-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: var(--c); }
table.splits { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.splits th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 4px; }
table.splits td { padding: 7px 4px; border-top: 1px solid var(--line); }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 84px); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: #2B2D36; color: var(--text); padding: 10px 16px; border-radius: 12px; font-size: 14px; pointer-events: none;
  transition: .25s; z-index: 10; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 620px) { .grid3.wide4 { grid-template-columns: repeat(4, 1fr); } }
