@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #050505;
  --bg-1: rgba(12, 12, 12, 0.78);
  --bg-2: rgba(18, 18, 18, 0.88);
  --bg-3: #1a1a1a;
  --bd: rgba(255, 255, 255, 0.09);
  --bd-2: rgba(255, 255, 255, 0.16);
  --fg: #f5f5f5;
  --mut: #8a8a8a;
  --acc: #00e676;
  --acc-2: #69f0ae;
  --acc-dim: rgba(0, 230, 118, 0.14);
  --danger: #ff6b6b;
  --warn: #ffd54f;
  --rx: #00e676;
  --tx: #7dd3fc;
  --side: 248px;
  --r: 4px;
  --r-sm: 4px;
  --r-xs: 4px;
  --glass: rgba(10, 10, 10, 0.72);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; min-height: 100dvh; }
body {
  background:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(0, 230, 118, 0.09), transparent 52%),
    #050505;
  color: var(--fg);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  letter-spacing: -0.02em;
}
code, pre, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0; }
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
::selection { background: var(--acc-dim); color: var(--fg); }

html.locked #app,
html.setup #app { display: none !important; }
html.ready #auth-gate { display: none !important; }
html.locked #form-setup { display: none !important; }
html.setup #form-login { display: none !important; }
html.ready #app { display: grid; position: relative; z-index: 1; }
#auth-gate { position: relative; z-index: 1; }

.logo {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.05em;
  padding: 0;
  font-size: 18px;
  border-radius: 0;
  text-transform: lowercase;
}

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
  background: transparent;
}
.gate-wrap { width: min(420px, 100%); }
.gate-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px 6px;
  color: var(--mut);
  font-size: 13px;
  font-weight: 500;
}
.share-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--bd);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg);
  font-size: 12.5px;
}
.share-who i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--acc);
  color: #04140b;
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
}
.gate-panel {
  width: 100%;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid var(--bd);
  border-radius: 4px;
  padding: 26px 22px 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.gate-panel h1 { font-size: 30px; margin-bottom: 6px; letter-spacing: -0.045em; }
.gate-panel .lead { color: #c8c8c8; }
.gate-panel .btn { width: 100%; margin-top: 4px; }

.kicker {
  color: var(--acc);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 8px;
  font-weight: 500;
}
h1 { margin: 0 0 8px; font-size: 28px; font-weight: 600; letter-spacing: -0.04em; }
h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.04em; }
h3 {
  margin: 32px 0 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mut);
}
.lead { color: var(--mut); margin: 0 0 22px; }
label { display: block; margin: 0 0 6px; font-weight: 500; font-size: 13px; }
.hint { display: block; color: var(--mut); font-weight: 400; font-size: 12px; margin-top: 2px; }

input, textarea, select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg);
  border: 1px solid var(--bd);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--bd-2); }
input:focus, textarea:focus, select:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-dim);
  background: rgba(0, 230, 118, 0.04);
}
textarea {
  min-height: 220px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--bd-2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  padding: 11px 16px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: -0.02em;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, filter 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--acc);
  color: #04140b;
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(0, 230, 118, 0.22);
}
.btn.primary:hover { filter: brightness(1.06); color: #04140b; }
.btn.danger {
  border-color: rgba(255, 107, 107, 0.45);
  color: var(--danger);
  background: rgba(255, 107, 107, 0.06);
}
.btn.danger:hover { background: rgba(255, 107, 107, 0.12); color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 12.5px; border-radius: 4px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn, .chip, .op-btn, nav a { -webkit-tap-highlight-color: transparent; }
.err { color: var(--danger); min-height: 1.2em; font-size: 13px; }

#app {
  display: none;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}
aside {
  border-right: 1px solid var(--bd);
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  padding: calc(22px + var(--safe-t)) 14px calc(18px + var(--safe-b)) calc(14px + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 20;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand .sub {
  display: inline;
  color: var(--mut);
  font-size: 18px;
  margin-top: 0;
  letter-spacing: -0.04em;
  font-weight: 600;
}
.nav-toggle {
  display: none;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--bd);
  background: var(--glass);
  border-radius: 4px;
  padding: 0;
  place-items: center;
  gap: 6px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
nav a {
  color: var(--fg);
  padding: 11px 14px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
}
nav a:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; color: var(--fg); }
nav a.active {
  background: var(--acc-dim);
  color: var(--acc);
  border-color: rgba(0, 230, 118, 0.28);
}
.aside-foot { display: flex; flex-direction: column; gap: 10px; }
.tls-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 8px 10px;
  border: 1px solid var(--bd);
  border-radius: 4px;
  color: var(--mut);
  text-align: center;
}
.tls-pill.on { color: var(--acc); border-color: rgba(0, 230, 118, 0.35); background: var(--acc-dim); }

main {
  padding: calc(28px + var(--safe-t)) calc(32px + var(--safe-r)) calc(72px + var(--safe-b)) 32px;
  min-width: 0;
}
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}
.top-lead { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.top-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav-scrim { display: none; }
.nav-close { display: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.toolbar, .user-toolbar { flex-wrap: wrap; }
.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  border: 1px solid var(--bd);
  background: rgba(255, 255, 255, 0.03);
  padding: 7px 11px;
  color: var(--acc);
  border-radius: 4px;
}
.pill.dim { color: var(--mut); }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 16px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }

.card {
  background: var(--glass);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 16px 16px 14px;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.kpi-grid { margin-bottom: 12px; }
.card.kpi .val { font-size: 24px; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.spark { width: 88px; height: 28px; display: block; flex-shrink: 0; }
.donut { width: 140px; height: 140px; display: block; margin: 8px auto 0; }
.donut-wrap { display: grid; place-items: center; }
.hbar { margin: 0 0 10px; }
.hbar-lab { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 4px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.card .lbl {
  color: var(--mut);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.card .val {
  font-size: 22px;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.card .val.ok { color: var(--acc); }
.card .val.bad { color: var(--danger); }
.card .sub { color: var(--mut); font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }

.st-hero .val { font-size: 34px; font-variant-numeric: tabular-nums; }
.st-bar {
  height: 3px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 14px;
}
.st-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--acc);
  transition: width 0.2s linear;
}
.st-bar.run > span {
  width: 70%;
  animation: st-load 1.2s ease-in-out infinite;
}
@keyframes st-load {
  0% { width: 8%; margin-left: 0; }
  50% { width: 45%; margin-left: 30%; }
  100% { width: 8%; margin-left: 92%; }
}
.st-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.st-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}
.st-params .togl { min-height: 44px; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--mut);
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
}
.dot.on { background: var(--acc); box-shadow: 0 0 0 4px var(--acc-dim); }
.dot.off { background: var(--danger); }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--bd);
  font-size: 13px;
  vertical-align: middle;
}
th {
  color: var(--mut);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }
.table-wrap {
  overflow: auto;
  border: 1px solid var(--bd);
  border-radius: var(--r);
  background: var(--glass);
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { min-width: 680px; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: end;
}
.toolbar .field { flex: 1; min-width: 160px; }
.toolbar .field input,
.toolbar .field select { margin-bottom: 0; }
.muted { color: var(--mut); }
.ok { color: var(--acc); }
.bad { color: var(--danger); }
.warn { color: var(--warn); }

pre.log {
  background: var(--glass);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 16px;
  overflow: auto;
  max-height: 62vh;
  font-size: 12px;
  white-space: pre-wrap;
}
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--bd);
  background: rgba(255, 255, 255, 0.03);
  color: var(--mut);
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
}
.tabs button.on { color: #04140b; background: var(--acc); border-color: var(--acc); }

.chart-wrap {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--bd);
  border-radius: 4px;
  padding: 10px 8px 6px;
  min-height: 240px;
}
.chart { width: 100%; height: 240px; display: block; }
.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--mut);
  flex-wrap: wrap;
  align-items: center;
}
.chart-legend select { width: auto; margin: 0 0 0 auto; padding: 6px 8px; }
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 3px;
}
.swatch.rx { background: var(--rx); }
.swatch.tx { background: var(--tx); }
.swatch.ss { background: var(--warn); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--mut); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

body.share {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: #000;
}
.share-card {
  width: min(520px, 100%);
  background: #000;
  border: 1px solid var(--bd);
  border-radius: 4px;
  padding: 28px 24px;
}
.share-prog { display: flex; gap: 6px; margin: 0 0 18px; }
.share-prog span { flex: 1; height: 4px; background: var(--bd); border-radius: 4px; }
.share-prog span.on { background: var(--acc); }
.share-step { display: none; }
.share-step.on { display: block; }
.share-step h1 { margin-bottom: 8px; font-size: 26px; }
.share-step .btn { margin-top: 8px; }
.qr {
  background: #0b0d0f;
  border: 1px solid var(--bd);
  border-radius: 4px;
  padding: 16px;
  margin: 8px 0 18px;
}
.qr svg, .qr img { width: 100%; height: auto; display: block; border-radius: 4px; }
.op-pick { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 8px 0 18px; }
.dev-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}
.dev-row .op-btn { min-width: 0; }
.dev-del {
  align-self: stretch;
  white-space: nowrap;
  min-height: 56px;
  padding: 8px 12px;
}
#device-empty { margin: 0 0 12px; }
.op-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--bd);
  padding: 14px 14px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-height: 56px;
}
.op-btn span { color: var(--mut); font-size: 12px; }
.op-btn.on { border-color: var(--acc); background: var(--acc-dim); }
.op-btn:hover { border-color: var(--acc); }
.steps { color: var(--fg); padding-left: 18px; }
.steps li { margin: 0 0 8px; }
.fine { color: var(--mut); font-size: 12px; margin-top: 20px; }

#data-log { display: none; }
#data-kind[value="logs"] ~ #data-log { display: inline-flex; }

.qos-page { padding-bottom: 88px; }
.qos-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 18px;
  border: 1px solid var(--bd);
  border-radius: 4px;
  margin-bottom: 14px;
  background: var(--glass);
}
.qos-hero.on {
  border-color: rgba(0, 230, 118, 0.28);
  background: linear-gradient(180deg, rgba(0, 230, 118, 0.08), var(--bg-1) 70%);
}
.qos-hero.off {
  border-color: rgba(255, 107, 107, 0.35);
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.08), var(--bg-1) 70%);
}
.qos-hero h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.03em; text-transform: none; color: var(--fg); }
.qos-hero p { margin: 0; color: var(--mut); max-width: 52ch; }
.qos-hero .btn { flex-shrink: 0; }
.qos-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.qos-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--bd);
  border-radius: 4px;
  font-size: 12px;
  color: var(--mut);
  background: var(--bg-1);
}
.qos-flag.ok { color: var(--acc); border-color: rgba(0, 230, 118, 0.28); }
.qos-flag.warn { color: var(--warn); border-color: rgba(255, 213, 79, 0.35); }
.qos-flag.off { color: var(--danger); border-color: rgba(255, 107, 107, 0.28); }
.qos-block { margin-bottom: 14px; }
.qos-sec {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.qos-count {
  font-size: 12px;
  color: var(--mut);
  white-space: nowrap;
  padding-top: 2px;
}
.qos-link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.qos-link-cell select, .qos-link-cell input { margin-bottom: 6px; }
.qos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.qos-card {
  border: 1px solid var(--bd);
  background: var(--glass);
  border-radius: 4px;
  padding: 14px;
  min-width: 0;
}
.qos-card.is-vip {
  border-color: rgba(255, 213, 79, 0.4);
  background: rgba(255, 213, 79, 0.04);
}
.qos-card-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.qos-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qos-who strong { font-size: 15px; letter-spacing: -0.02em; }
.qos-who span { font-size: 12px; color: var(--mut); }
.qos-mode { min-width: 0; }
.qos-card .vip-imp { display: none; }
.qos-card .qos-cap { display: block; }
.qos-card:has(.togl.vip input:checked) .vip-imp { display: block; }
.qos-card:has(.togl.vip input:checked) .qos-cap { display: none; }
.qos-split-lab {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--mut);
  margin-bottom: 8px;
}
.vip-imp input[type=range] {
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #ffd54f;
}
.qos-split-bar {
  height: 8px;
  border-radius: 4px;
  background: #1a1a1a;
  overflow: hidden;
  border: 1px solid var(--bd);
  margin-bottom: 8px;
}
.qos-split-bar > i {
  display: block;
  height: 100%;
  background: #ffd54f;
  max-width: 100%;
}
.vip-imp-lab {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
  color: #ffd54f;
}
.qos-cap label { margin-bottom: 6px; }
.qos-cap select, .qos-cap input { margin-bottom: 6px; }
.qos-save {
  position: sticky;
  bottom: calc(12px + var(--safe-b));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--bd-2);
  border-radius: 4px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  z-index: 5;
}
.qos-save .err { margin: 0; min-height: 0; }
.qos-page.is-off .qos-block { opacity: 0.72; }
.togl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.togl {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--bd);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.togl input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}
.togl-ui {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 4px;
  background: #1c1c1c;
  border: 1px solid var(--bd);
}
.togl-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6a6a6a;
  transition: transform 0.18s ease, background 0.18s ease;
}
.togl-copy { min-width: 0; }
.togl-copy strong { display: block; font-size: 14px; font-weight: 600; letter-spacing: -0.02em; }
.togl-copy em {
  display: block;
  font-style: normal;
  color: var(--mut);
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
  line-height: 1.35;
}
.togl:hover { border-color: var(--bd-2); }
.togl:has(input:checked) { background: #111; }
.togl.vip:has(input:checked) {
  border-color: rgba(255, 213, 79, 0.45);
  background: rgba(255, 213, 79, 0.06);
}
.togl.en:has(input:checked) {
  border-color: rgba(0, 230, 118, 0.35);
  background: var(--acc-dim);
}
.togl.en:not(:has(input:checked)) {
  border-color: rgba(255, 107, 107, 0.28);
}
.togl:has(input:checked) .togl-ui { background: var(--acc); border-color: transparent; }
.togl.vip:has(input:checked) .togl-ui { background: #ffd54f; }
.togl:has(input:checked) .togl-ui::after { transform: translateX(18px); background: #04140b; }
.togl.en:not(:has(input:checked)) .togl-copy strong { color: var(--danger); }
.togl.compact {
  padding: 6px 10px;
  gap: 8px;
  border-radius: 4px;
}
.togl.compact .togl-ui { width: 36px; height: 20px; }
.togl.compact .togl-ui::after { width: 14px; height: 14px; }
.togl.compact:has(input:checked) .togl-ui::after { transform: translateX(16px); }
.togl.compact .togl-copy em { display: none; }
.togl.compact .togl-copy strong { font-size: 12px; }
.split { margin-top: 12px; }
.split-lab {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--mut);
  margin-bottom: 8px;
}
.split-lab b { color: var(--fg); font-weight: 600; }
.split input[type=range] {
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  background: transparent;
  border: 0;
  accent-color: #ffd54f;
}
.split-bar {
  height: 8px;
  border-radius: 4px;
  background: #1a1a1a;
  overflow: hidden;
  border: 1px solid var(--bd);
}
.split-bar > i {
  display: block;
  height: 100%;
  background: #ffd54f;
  max-width: 100%;
}
.pill.vip, .user-card.vip { border-color: rgba(255, 213, 79, 0.45); }
.pill.vip { color: #ffd54f; background: rgba(255, 213, 79, 0.08); }
.flash { box-shadow: 0 0 0 2px var(--acc); }

.empty {
  border: 1px dashed var(--bd-2);
  padding: 36px 24px;
  color: var(--mut);
  background: var(--glass);
  border-radius: var(--r);
  text-align: center;
}

.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.user-grid.view-compact { grid-template-columns: 1fr; gap: 8px; }
.user-card, .device-card {
  background: var(--glass);
  border: 1px solid var(--bd);
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}
.user-card .id { flex: 1; min-width: 0; }
.user-card .id h3 { margin: 0 0 6px; }
.user-card .stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.user-card .stat {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--bd);
  border-radius: 4px;
  padding: 10px 12px;
  min-width: 0;
}
.user-card .stat .k {
  color: var(--mut);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.user-card .stat .v {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.user-card .stat .s { color: var(--mut); font-size: 11px; margin-top: 2px; }
.user-card .facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12px;
  color: var(--mut);
  align-items: center;
}
.user-card .facts b { color: var(--fg); font-weight: 500; }
.user-card .facts .fact-dns { min-width: 160px; }
.user-card .facts .fact-dns select { margin: 0; padding: 6px 8px; font-size: 12px; width: auto; }
.user-grid.view-compact .user-card {
  display: grid;
  grid-template-columns: minmax(110px, 1.2fr) auto minmax(80px, 1fr) 90px 80px 90px auto;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 14px;
  border-radius: 4px;
}
.user-grid.view-compact .user-card .c-name {
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-grid.view-compact .user-card .c-name:hover { color: var(--acc); }
.user-grid.view-compact .user-card .c-dev {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}
.user-grid.view-compact .user-card .c-metric {
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}
.user-grid.view-compact .user-card .row-actions { justify-content: flex-end; }
.user-grid.view-compact .user-card .pill { padding: 4px 8px; font-size: 11px; }
@media (hover: hover) {
  .user-card:hover, .device-card:hover {
    border-color: var(--bd-2);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
  }
}
.user-card.live, .device-card.live {
  border-color: rgba(0, 230, 118, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 230, 118, 0.12), 0 12px 28px rgba(0, 230, 118, 0.06);
}
.user-card.disabled { opacity: 0.55; }
.user-card .uh, .device-card .uh { display: flex; align-items: center; gap: 10px; }
.user-card h3 { margin: 0; font-size: 18px; font-weight: 600; flex: 1; letter-spacing: -0.03em; }
.user-card .meta, .device-card .meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 12px;
}
.user-card .meta .k, .device-card .meta .k {
  color: var(--mut);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.user-card .meta .v, .device-card .meta .v {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  word-break: break-word;
}
.user-card .meta select { margin: 0; padding: 6px 8px; font-size: 12px; width: 100%; }
.user-toolbar select, .toolbar select { width: auto; min-width: 150px; margin: 0; }
.user-toolbar .search, .toolbar .search { margin: 0; max-width: 280px; }
.bar { height: 6px; background: var(--bg-2); margin-top: 6px; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--acc); max-width: 100%; border-radius: 4px; }

.dns-log {
  max-height: 52vh;
  overflow: auto;
  background: var(--glass);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}
.dns-log table {
  margin: 0;
  min-width: 860px;
  table-layout: fixed;
  width: 100%;
}
.dns-log th, .dns-log td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dns-log th:nth-child(1), .dns-log td:nth-child(1) { width: 88px; }
.dns-log th:nth-child(2), .dns-log td:nth-child(2) { width: 110px; }
.dns-log th:nth-child(3), .dns-log td:nth-child(3) { width: 28%; }
.dns-log th:nth-child(4), .dns-log td:nth-child(4) { width: 56px; }
.dns-log th:nth-child(5), .dns-log td:nth-child(5) { width: 92px; }
.dns-log th:nth-child(6), .dns-log td:nth-child(6) { width: 22%; }
.dns-log th:nth-child(7), .dns-log td:nth-child(7) { width: 56px; }
.dns-log th:nth-child(8), .dns-log td:nth-child(8) { width: 72px; }
.dns-log .blk, .dns-log tr.blk { color: var(--danger); }
.dns-log tr.nx { color: var(--warn); }
.dns-log tr.err { color: var(--danger); }
#dns-users .table-wrap table { table-layout: fixed; min-width: 640px; }
#dns-users td, #dns-users th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { max-width: 320px; margin-bottom: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--bd);
  background: rgba(255, 255, 255, 0.03);
  color: var(--mut);
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
}
.chip.on { color: #04140b; background: var(--acc); border-color: var(--acc); }
.chip:hover { color: var(--fg); }
.chip.on:hover { color: #04140b; }

.dns-top { max-height: 380px; overflow: auto; padding-right: 4px; }
.dns-top-row { margin: 0 0 12px; }
.dns-top-lab { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.prompt-preview {
  max-height: 280px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.45;
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 4px;
  padding: 12px;
  margin-top: 16px;
  white-space: pre-wrap;
  color: var(--mut);
}

.dev-line { display: flex; flex-wrap: wrap; gap: 6px; }
.dev-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--bd);
  background: var(--bg);
  padding: 4px 9px;
  font-size: 12px;
  color: var(--mut);
  border-radius: 4px;
}
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

@media (max-width: 1280px) {
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1080px) {
  #app { grid-template-columns: 1fr; }
  html.ready #app { display: grid; }
  .nav-toggle { display: grid; }
  .nav-close {
    display: inline-flex;
    align-items: center;
    border: 0;
    background: transparent;
    color: var(--mut);
    font-size: 13px;
    padding: 8px 4px;
    cursor: pointer;
  }
  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  body.nav-open .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }
  body.nav-open { overflow: hidden; }
  aside {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, calc(100vw - 48px));
    height: 100dvh;
    z-index: 40;
    border-right: 1px solid var(--bd-2);
    border-bottom: 0;
    padding: calc(18px + var(--safe-t)) 16px calc(18px + var(--safe-b)) calc(16px + var(--safe-l));
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    background: rgba(8, 8, 8, 0.92);
    backdrop-filter: blur(22px);
  }
  aside.is-open { transform: translateX(0); }
  nav, .aside-foot { display: flex; }
  nav { gap: 2px; overflow: auto; }
  nav a { min-height: 44px; display: flex; align-items: center; }
  .grid, .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .qos-hero { flex-direction: column; }
  .qos-link-grid { grid-template-columns: 1fr; }
  main { padding: calc(16px + var(--safe-t)) 16px 56px; }
  .top { align-items: flex-start; }
}
@media (max-width: 960px) {
  .user-grid.view-compact .user-card {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .user-grid.view-compact .c-dev,
  .user-grid.view-compact .c-metric { display: none; }
}
@media (max-width: 720px) {
  .grid, .grid-2, .grid-6, .grid-3, .togl-row, .st-params { grid-template-columns: 1fr; }
  .user-card .stats { grid-template-columns: 1fr 1fr; }
  .top { flex-direction: column; align-items: stretch; }
  .top-meta { justify-content: flex-start; }
  .top-lead { align-items: center; }
  h2 { font-size: 22px; }
  main { padding: calc(12px + var(--safe-t)) 14px calc(48px + var(--safe-b)); }
  .qos-hero { flex-direction: column; align-items: stretch; }
  .qos-hero .btn { width: 100%; }
  .qos-link-grid, .qos-list { grid-template-columns: 1fr; }
  .qos-save { flex-direction: column; align-items: stretch; }
  .qos-save .btn { width: 100%; }
  .st-hero .val { font-size: 26px; }
  .pill { font-size: 11px; padding: 6px 9px; }
  .user-card .meta, .device-card .meta, .kv { grid-template-columns: 1fr; }
  .user-toolbar, .toolbar { align-items: stretch; }
  .user-toolbar .search, .toolbar .search, .search { max-width: none; width: 100%; flex: 1 1 100%; }
  .user-toolbar select, .toolbar select { width: 100%; min-width: 0; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }
  .share-card { padding: 22px 16px; border-radius: 4px; }
  .card .val { font-size: 20px; }
  nav a { min-height: 44px; display: flex; align-items: center; }
}
