:root {
  --bg: #0b1220; --panel: #111a2e; --panel2: #16213a; --line: #22304d;
  --text: #e6ecf7; --muted: #8ea0bf; --accent: #1e88e5; --accent2: #26c6da;
  --ok: #2ecc71; --bad: #ef5350; --warn: #ffb74d; --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--accent2); cursor: pointer; text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); min-height: 1.2em; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand.big { font-size: 26px; }
.mark { width: 28px; height: 32px; background: linear-gradient(160deg, var(--accent), var(--accent2));
  clip-path: polygon(50% 0, 100% 16%, 100% 55%, 50% 100%, 0 55%, 0 16%); display: inline-block; position: relative; }
.brand.big .mark { width: 36px; height: 42px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }

.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: var(--muted); padding: 9px 12px; border-radius: 8px; }
.side nav a:hover { background: var(--panel2); color: var(--text); }
.side nav a.active { background: linear-gradient(90deg, rgba(30,136,229,.25), transparent); color: var(--text); box-shadow: inset 3px 0 var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
main { padding: 28px 32px; max-width: 1200px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat .v { font-size: 30px; font-weight: 650; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.stat.good .v { color: var(--ok); } .stat.bad .v { color: var(--bad); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { min-height: 70px; resize: vertical; font-family: Consolas, monospace; font-size: 13px; }
button { font: inherit; border-radius: 8px; padding: 9px 14px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: linear-gradient(135deg, var(--accent), #1565c0); border: 0; font-weight: 600; }
button.danger { color: var(--bad); }
button.ghost { background: transparent; }
button.small { padding: 5px 10px; font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: rgba(255,255,255,.02); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(46,204,113,.4); }
.pill.bad { color: var(--bad); border-color: rgba(239,83,80,.4); }
.pill.warn { color: var(--warn); border-color: rgba(255,183,77,.4); }
.dev { display: flex; gap: 8px; align-items: center; margin: 2px 0; }

.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.toggle { flex-direction: row; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--text); font-size: 14px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.toggle small { display: block; color: var(--muted); font-size: 12px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 22px; max-width: min(720px, 94vw); width: 100%; }
dialog::backdrop { background: rgba(3,7,15,.7); }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 260px; }
.qr svg { width: 100%; height: auto; display: block; }
code, .mono { font-family: Consolas, monospace; font-size: 13px; background: var(--bg); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  main { padding: 18px 16px; }
}
