:root {
  color-scheme: dark;
  --bg: #070b12;
  --raise: #121a27;
  --sunken: #0b111a;
  --line: #243044;
  --ink: #f3f6fb;
  --muted: #8ea0b8;
  --accent: #79b0ff;
  --accent-ink: #07111f;
  --ok: #7ddec0;
  --warn: #f0c97a;
  --bad: #ff9b9b;
  --shadow: 0 24px 70px #02040a66;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 100% -10%, #1c3f7333, transparent 55%),
    radial-gradient(700px 420px at -10% 0%, #16305628, transparent 50%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: #79b0ff44; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}
.card, .panel {
  background: #121a27ee;
  border: 1px solid #2a3a52;
  border-radius: 16px;
  box-shadow: 0 1px 0 #ffffff0d inset;
}
.auth .card {
  width: min(680px, 100%);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.summary { display: grid; gap: 8px; margin: 8px 0 16px; padding: 12px 14px; background: var(--sunken); border-radius: 12px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; word-break: break-word; }
details.advanced { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #0c131ecc; }
details.advanced summary { cursor: pointer; color: var(--ink); font-weight: 650; }
details.advanced[open] summary { margin-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { font-size: 16px; letter-spacing: -0.03em; }
.mark {
  width: 16px;
  height: 16px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, #d7e8ff, var(--accent) 45%, #4d7dff);
  box-shadow: 0 0 0 4px #79b0ff22;
}
h1, h2, h3 { font-weight: 650; letter-spacing: -0.03em; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.lede { color: var(--muted); line-height: 1.5; margin: 8px 0 18px; max-width: 62ch; }
.center { text-align: center; padding: 48px; }
.field .muted, .field span.muted { font-size: 12px; line-height: 1.45; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #0b111acc;
  border-right: 1px solid #1d2838;
  padding: 22px 14px;
  backdrop-filter: blur(16px);
}
.rail nav { display: grid; gap: 4px; margin-top: 22px; }
.rail a, .button, button { border-radius: 10px; text-decoration: none; }
.rail a {
  color: var(--muted);
  padding: 10px 12px;
  font-weight: 600;
}
.rail a.active, .rail a:hover { background: #1a2942; color: var(--ink); }
.rail a.active { box-shadow: inset 2px 0 0 var(--accent); }
.who { display: grid; gap: 2px; margin: 0; padding: 12px; border-top: 1px solid #1d2838; }
.who span:first-child { font-weight: 650; }
.main { padding: 32px 36px 48px; max-width: 1180px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 8px; }
.stats, .split, .exports { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(4, 1fr); margin: 16px 0 18px; }
.stat, .panel { padding: 16px 18px; }
.stat { min-height: 108px; }
.stat .muted { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.stat b {
  display: block;
  font-size: 30px;
  margin-top: 8px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.split { grid-template-columns: 1.45fr 0.75fr; align-items: start; }
.list { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 1.1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
}
.row:hover { border-color: #3a5278; }
.device-head, .user-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.user-head { margin-bottom: 14px; }
.list { margin-top: 16px; }
.mono, code, .config { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
.mono { font-size: 13px; color: var(--muted); }
.sub { margin-top: 4px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #1a2433;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6d7d96;
}
.pill.ok { background: #12352c; color: var(--ok); }
.pill.ok::before { background: var(--ok); box-shadow: 0 0 0 3px #7ddec033; }
.pill.warn { background: #332a16; color: var(--warn); }
.pill.warn::before { background: var(--warn); }
.lamp { display: none; }
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--muted);
}

form { display: grid; gap: 14px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
label { font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%;
  background: var(--sunken);
  border: 1px solid #2a3b52;
  border-radius: 10px;
  padding: 11px 12px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 600; }
.check input { width: auto; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
button:hover, a.button:hover { filter: brightness(1.08); }
button.ghost, a.button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid #334860;
}
button.ghost:hover, a.button.ghost:hover { background: #182436; filter: none; }
button.danger { background: transparent; color: var(--bad); border: 1px solid #ff9d9d55; }
button.danger:hover { background: #3a1c24; filter: none; }
button:disabled { opacity: 0.6; cursor: wait; }

.banner { border-radius: 12px; padding: 12px 14px; margin: 12px 0; line-height: 1.45; }
.banner.ok { background: #12352c; color: var(--ok); }
.banner.warn { background: #332a16; color: var(--warn); }
.banner.bad { background: #3a1c24; color: var(--bad); }
.qr { width: 220px; height: 220px; background: white; padding: 8px; border-radius: 12px; }
.auth .card .actions { margin: 8px 0 12px; }
.auth .card .qr { display: block; margin-top: 12px; }
.config {
  white-space: pre-wrap;
  background: var(--sunken);
  border-radius: 12px;
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  line-height: 1.45;
}
.guide { margin: 8px 0 0; padding-left: 18px; line-height: 1.5; }
.guide li { margin: 6px 0; }
.steps { display: grid; gap: 10px; margin-top: 8px; }
.step { display: flex; gap: 10px; align-items: start; line-height: 1.45; }
.num {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: #1b2c48; color: var(--accent); font-size: 12px; flex: none;
}

@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail nav { display: flex; overflow: auto; margin-top: 14px; }
  .rail a { white-space: nowrap; }
  .who { border-top: 0; padding: 8px 12px 0; }
  .split, .fields, .row { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  h1 { font-size: 26px; }
}
