:root {
  --bg: #0e1320; --panel: #151b2b; --panel-2: #1b2236; --line: #262f47;
  --fg: #e4e8f3; --muted: #8890a8; --accent: #f0a93b; --accent-ink: #1a1306;
  --up: #2fc48d; --down: #ef5a6f; --up-soft: rgba(47,196,141,.14); --down-soft: rgba(239,90,111,.14);
  --f-display: "Unbounded", "Arial Black", sans-serif;
  --f-body: "Instrument Sans", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root {
  --bg: #eef0f5; --panel: #ffffff; --panel-2: #f5f6fa; --line: #dfe2eb;
  --fg: #161b2a; --muted: #636b82; --accent: #c97a0a; --accent-ink: #ffffff;
  --up: #12895e; --down: #d23a52; --up-soft: rgba(18,137,94,.1); --down-soft: rgba(210,58,82,.1);
  color-scheme: light; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 14px; padding-inline: 16px; padding-block: 12px 24px; }
[hidden] { display: none !important; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); }
.lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding-block: 6px 14px; }
.logo { font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.logo i { width: 10px; height: 10px; background: var(--accent); transform: rotate(45deg); display: inline-block; }
.badge { font-size: 11px; padding: 3px 8px; border: 1px dashed var(--accent); color: var(--accent); border-radius: 4px; font-weight: 600; letter-spacing: .04em; }
.badge.live { border-style: solid; border-color: var(--down); color: var(--down); }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--down); }
.conn.on i { background: var(--up); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.kpis { display: flex; gap: 24px; margin-left: auto; flex-wrap: wrap; }
.kpi b { display: block; font-family: var(--f-mono); font-size: 16px; font-weight: 500; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.ph { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); gap: 8px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.tf { display: flex; gap: 4px; }
.tf button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; font-size: 12px; font-family: var(--f-mono); color: var(--muted); }
.tf button[aria-pressed="true"] { border-color: var(--accent); color: var(--fg); }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 8px 14px; }
td { padding: 8px 14px; border-top: 1px solid var(--line); white-space: nowrap; }
td.num, th.num { text-align: right; }
.empty { color: var(--muted); white-space: normal; }
.x { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; font-size: 12px; }
.x:hover { border-color: var(--down); color: var(--down); }
.tag { font-size: 11px; padding: 2px 6px; border-radius: 3px; background: var(--panel-2); color: var(--muted); }

.sw { width: 36px; height: 20px; border-radius: 99px; background: var(--line); border: 0; position: relative; flex: none; }
.sw::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--fg); top: 3px; left: 3px; transition: left .15s; }
.sw[aria-checked="true"] { background: var(--accent); }
.sw[aria-checked="true"]::after { left: 19px; background: var(--accent-ink); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field input, .inp { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; color: var(--fg); font-family: var(--f-mono); font-size: 14px; }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 9px 14px; font-weight: 600; }

.note { font-size: 12px; color: var(--muted); padding: 12px 14px; line-height: 1.5; margin: 0; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-size: 13px; opacity: 0; transition: .25s; pointer-events: none; max-width: calc(100% - 32px); z-index: 10; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--down); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
