:root {
  --bg: #0e1116; --panel: #161b22; --line: #262d36; --text: #e6edf3; --muted: #8b949e;
  --green: #2ebd85; --red: #f6465d; --yellow: #f0b90b; --blue: #3b82f6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
.muted { color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; gap: 8px; flex-wrap: wrap; }
.brand { display: flex; gap: 10px; align-items: center; font-size: 16px; }
.top-right { display: flex; gap: 10px; align-items: center; }
.badge, .pill { font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 600; letter-spacing: .03em; }
.badge.test { background: #3b2f00; color: var(--yellow); }
.badge.live { background: #3a0d14; color: var(--red); }
.pill.on { background: #0d3324; color: var(--green); }
.pill.off { background: #2a2f37; color: var(--muted); }

main { padding: 16px; max-width: 1400px; margin: 0 auto; display: grid; gap: 16px; }
.alert { background: #3a0d14; color: #ffb3bd; border: 1px solid #5c1a24; padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi b { font-size: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { color: var(--muted); font-size: 11px; min-height: 14px; }

.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { background: #21262d; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; cursor: pointer; font: inherit; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.small { padding: 5px 10px; font-weight: 500; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.warn { background: #3b2f00; border-color: #6b5300; color: var(--yellow); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.card h2 { margin: 0 0 10px; font-size: 15px; }
.table-wrap { max-height: 420px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }
tr.marker td { color: var(--yellow); font-weight: 600; background: #1f1a05; }
.lvl-error { color: var(--red); } .lvl-warn { color: var(--yellow); } .lvl-fill { color: var(--green); } .lvl-grid { color: var(--blue); }

.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
@media (max-width: 520px) { .settings { grid-template-columns: 1fr; } }
.settings label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.settings label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
input, select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus { outline: none; border-color: var(--blue); }
.settings-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.preview { grid-column: 1 / -1; margin: 0; font-size: 12px; }

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 100%; max-width: 360px; display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
