:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #181c25;
  --line: #262b37;
  --text: #e7e9ee;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent-2: #3d6bf0;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel-2);
  padding: 8px 14px; border-radius: 8px; font-weight: 500; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: #3a4152; background: #1e2330; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #04130a; font-weight: 600; }
.btn.ok:hover:not(:disabled) { filter: brightness(1.08); background: var(--ok); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.muted { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #5b8cff, #a855f7);
  display: grid; place-items: center; font-size: 14px; color: #fff; }

/* ---- auth / simple pages ---- */
.center-page { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; }
.card h1 { font-size: 20px; margin: 18px 0 4px; }
.card form { display: grid; gap: 12px; margin-top: 18px; }
.err { color: var(--bad); min-height: 20px; font-size: 13px; }

/* ---- top bar ---- */
.topbar { height: 52px; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--line); font-variant-numeric: tabular-nums; font-weight: 600; }
.pill .lbl { color: var(--muted); font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.rec { background: var(--bad); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; min-width: 200px; padding: 6px; display: none; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.menu.open .menu-list { display: block; }
.menu-list button, .menu-list a { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 6px; color: var(--text); }
.menu-list button:hover, .menu-list a:hover { background: #232836; }

/* ---- toast ---- */
#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.ok { border-color: rgba(34,197,94,.5); }

/* ---- modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 80; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(520px, 92vw); max-height: 85vh; overflow: auto; }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
