/* PXLNET — presentation site + control panel.
   Two themes via [data-theme], one accent gradient, no external requests. */

:root {
  --accent: #5b6ee1;
  --accent-2: #8b5cc6;
  --lav: #cdd0f5;
  --grad: linear-gradient(135deg, #5b6ee1, #8b5cc6);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --shadow: 0 8px 30px rgba(15, 20, 50, .10);
  --sidebar-w: 232px;
  --speed: .18s;
}

[data-theme="dark"] {
  --bg: #0d1018;
  --bg-2: #11141f;
  --surface: #161a27;
  --surface-2: #1c2132;
  --line: #262c40;
  --line-soft: #212639;
  --text: #e8eaf6;
  --text-2: #9aa1be;
  --ok: #3ddc97;
  --warn: #f6c553;
  --amber: #f5a623;
  --bad: #ff6b7e;
  --info: #7aa2ff;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f5fb;
  --bg-2: #eceef8;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --line: #e2e5f2;
  --line-soft: #eceefa;
  --text: #171a2b;
  --text-2: #6a7194;
  --ok: #12a06a;
  --warn: #a97a06;
  --amber: #b4700a;
  --bad: #d43a52;
  --info: #3b62d6;
  --shadow: 0 8px 30px rgba(30, 40, 100, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

h1, h2, h3 { line-height: 1.25; margin: 0; }

img { display: block; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- helpers ------------------------------------------------------------- */

.mono { font-family: var(--mono); font-size: .92em; }
.dim { color: var(--text-2); }
.sm { font-size: .86em; }
.ok { color: var(--ok); }
.center { text-align: center; }
.center-pad { padding: 28px; text-align: center; }
.spacer { flex: 1; }
.gap { gap: 14px; }
.pad-top { margin-top: 22px; }

.container {
  width: min(1140px, 100% - 40px);
  margin-inline: auto;
}

.lede {
  color: var(--text-2);
  font-size: 1.06rem;
  max-width: 720px;
}
.lede.sm { font-size: .98rem; }

.link { color: var(--accent); }
.link:hover { text-decoration: underline; }
.strong { font-weight: 600; }

/* ---- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: .94rem;
  font-weight: 550;
  cursor: pointer;
  transition: transform var(--speed), box-shadow var(--speed),
    background var(--speed), border-color var(--speed), opacity var(--speed);
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(91, 110, 225, .35);
}
.btn.primary:hover { box-shadow: 0 10px 26px rgba(139, 92, 198, .4); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; border-color: transparent; color: var(--bad); }
.btn.danger:hover { background: rgba(255, 107, 126, .12); border-color: rgba(255, 107, 126, .4); }
.btn.lg { padding: 13px 24px; font-size: 1rem; border-radius: 12px; }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn.xs { padding: 4px 9px; font-size: .8rem; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--speed), border-color var(--speed);
}
.chip:hover { color: var(--text); border-color: var(--accent); }

.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* ---- badges -------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: rgba(61, 220, 151, .35); background: rgba(61, 220, 151, .1); }
.badge.warn { color: var(--warn); border-color: rgba(246, 197, 83, .4); background: rgba(246, 197, 83, .1); }
.badge.bad { color: var(--bad); border-color: rgba(255, 107, 126, .4); background: rgba(255, 107, 126, .1); }
.badge.info { color: var(--info); border-color: rgba(122, 162, 255, .35); background: rgba(122, 162, 255, .1); }
.badge.muted { color: var(--text-2); }

/* Visibility in the network list: a lock in front of the name instead of a
   word — closed and amber-orange where new devices wait for approval, open
   and green where the key alone is enough. */
.vis-lock { display: inline-flex; vertical-align: -2px; margin-right: 7px; }
.vis-lock svg { display: block; }
.vis-lock.private { color: var(--amber); }
.vis-lock.public { color: var(--ok); }

.badge-pill {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-2);
  vertical-align: middle;
}
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(61, 220, 151, .18); }

/* ---- forms --------------------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field legend { font-size: .84rem; font-weight: 600; color: var(--text-2); }
.field input, .field select, .filters select, .filters input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  transition: border-color var(--speed), box-shadow var(--speed);
}
.field input:focus, .field select:focus, .filters select:focus, .filters input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 110, 225, .22);
}
.field small { font-size: .8rem; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { padding: 0; margin-bottom: 7px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card {
  position: relative; /* keeps the invisible input below inside the card:
                         without it "width: 100%" resolves against the
                         viewport and scrolls the whole page sideways */
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color var(--speed), background var(--speed);
}
.radio-card:hover { border-color: var(--accent); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: rgba(91, 110, 225, .1);
  box-shadow: 0 0 0 3px rgba(91, 110, 225, .16);
}
.rc-title { font-weight: 650; font-size: .92rem; }
.rc-desc { font-size: .78rem; color: var(--text-2); line-height: 1.4; }

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form input {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  min-width: 150px;
  flex: 1;
}
.inline-form input:focus { outline: none; border-color: var(--accent); }

/* The filter bar: one line of controls that wraps rather than pushing the
   page sideways. Inside a card it sits between the header and the table, so
   it is the card's rhythm it follows — on a page head it takes whatever room
   is left next to the badges and keeps itself right-aligned. */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; min-width: 140px; padding: 7px 10px; font-size: .9rem; }
.filters input { width: auto; padding: 7px 10px; font-size: .9rem; }
.filters input[type="search"] { min-width: 200px; }
.filters input[type="date"] { min-width: 136px; }
.card > .filters { margin-bottom: 14px; }
.page-head .filters { flex: 1 1 440px; justify-content: flex-end; }
/* The last-seen bound: two days with the word between them read as one
   thing rather than as two stray boxes. */
.date-range { display: inline-flex; align-items: center; gap: 6px; }
/* The hint under the network switches has to span the row it explains. */
.checks p { flex: 1 0 100%; margin: 0; line-height: 1.45; }

/* ---- cards --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  /* Cards stacked in the page body would otherwise touch each other. */
  margin-bottom: 16px;
}
/* …except where the space already exists: a grid gap or a flex gap would
   count the row twice, a modal carries its own padding, and a margin inside
   a centering container would pull the card off centre. */
.split > .card, .stack > .card, .modal-body .card, .auth-card { margin-bottom: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-head h2, .card-head h3 { font-size: 1.02rem; font-weight: 650; }
.card h3 { font-size: .96rem; }

/* A destructive action parked at the bottom of a card (network settings):
   its own form, set apart by a hairline and stretched across the width. */
.danger-zone { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

.split { display: grid; gap: 16px; margin-bottom: 16px; }
.split.side-left { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; }
.split.top { grid-template-columns: 1fr; }
/* A grid child may shrink below its content: otherwise a wide card pushes the
   whole page sideways instead of scrolling inside its own box. */
.split > * { min-width: 0; }
/* Forms stay readable when the column is as wide as the page. */
.split.top .form-card { max-width: 460px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ---- tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 8px; text-align: left; vertical-align: middle; }
thead th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
/* A sortable header is a link, so it must still read as the column title:
   same type, no underline, and an arrow only when the table is ordered by
   that column — an unsorted column shows the neutral pair so it is obvious
   it can be clicked. */
thead th a.sort {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
thead th a.sort::after {
  content: "⇅";
  font-size: .9em;
  opacity: .32;
}
thead th a.sort:hover { color: var(--text); }
thead th a.sort:hover::after { opacity: .7; }
thead th a.sort.sort-asc, thead th a.sort.sort-desc { color: var(--text); }
thead th a.sort.sort-asc::after { content: "↑"; opacity: 1; color: var(--accent); }
thead th a.sort.sort-desc::after { content: "↓"; opacity: 1; color: var(--accent); }
tbody tr { border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty { text-align: center; color: var(--text-2); padding: 26px 8px; }
.actions-col { text-align: right; white-space: nowrap; }
/* Secondary columns give way to the row actions on narrower windows: a table
   you can act on beats a table you have to scroll sideways. Each threshold is
   the width at which that table still fits once the columns are gone. */
@media (max-width: 1320px) {
  th.col-opt-wide, td.col-opt-wide { display: none; }
}
@media (max-width: 1160px) {
  th.col-opt, td.col-opt { display: none; }
}
.row-warn { background: rgba(246, 197, 83, .05); }
.row-muted { opacity: .6; }
.cell-strong { font-weight: 600; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions form { display: inline-flex; gap: 6px; align-items: center; }
/* Inside a table cell the action groups stack: laid out on one line (they are
   inline-flex) they would force the row far wider than the table itself. */
.actions-col .row-actions { display: flex; }
.row-actions.gap { display: flex; justify-content: flex-start; }

.add-box { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; }
.add-box summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; }
.add-box[open] summary { margin-bottom: 6px; }

/* ---- pager ----------------------------------------------------------------
   The row range, the page numbers and the page size share one line at the
   bottom of the table, on a hairline so they read as the table's own footer
   rather than as another card. They are links: everything the current view
   asks for — sort, filters, page size — travels in the query string. */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.pager-pages, .pager-per { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-per { gap: 8px; }
.pager-page, .pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: border-color var(--speed), color var(--speed), background var(--speed);
}
.pager-page:hover, .pager-btn:hover { border-color: var(--accent); color: var(--text); }
.pager-page.active {
  border-color: var(--accent);
  background: rgba(91, 110, 225, .14);
  color: var(--text);
  font-weight: 650;
}

/* ---- flash / banner ------------------------------------------------------ */

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: .93rem;
  border: 1px solid;
  animation: slide .25s ease;
}
.flash.ok { background: rgba(61, 220, 151, .1); border-color: rgba(61, 220, 151, .4); color: var(--ok); }
.flash.err { background: rgba(255, 107, 126, .1); border-color: rgba(255, 107, 126, .4); color: var(--bad); }
.flash-x {
  border: 0; background: transparent; color: inherit; font-size: 1.1rem;
  cursor: pointer; opacity: .7; line-height: 1;
}
.flash-x:hover { opacity: 1; }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(246, 197, 83, .4);
  background: rgba(246, 197, 83, .09);
  font-size: .93rem;
}

.notice {
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: .93rem;
}

@keyframes slide { from { transform: translateY(-6px); opacity: 0; } }

/* ---- public header / footer ---------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.brand img { width: 26px; height: 26px; border-radius: 8px; } /* скруглённые углы логотипа */
.brand-name {
  font-weight: 800;
  letter-spacing: .12em;
  font-size: .95rem;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag { font-size: .74rem; color: var(--text-2); letter-spacing: .04em; }

.topnav { display: flex; gap: 22px; margin-left: 12px; }
.topnav a, .topnav button { color: var(--text-2); font-size: .93rem; font-weight: 550; }
.topnav a:hover, .topnav button:hover { color: var(--text); }
/* Пункты меню — кнопки прокрутки, без якорей в адресе */
.topnav button { background: none; border: none; padding: 0; font: inherit; cursor: pointer; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.site-footer { border-top: 1px solid var(--line); margin-top: 70px; }
.site-footer-in {
  width: min(1140px, 100% - 40px);
  margin-inline: auto;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  padding: 26px 0;
  font-size: .85rem;
}

/* ---- landing ------------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(56px, 9vw, 110px) 0 clamp(40px, 6vw, 70px);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto;
  height: 620px;
  background:
    radial-gradient(600px 300px at 20% 40%, rgba(91, 110, 225, .28), transparent 70%),
    radial-gradient(520px 280px at 80% 20%, rgba(139, 92, 198, .26), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}
.hero > .container { position: relative; }

.eyebrow {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2.1rem, 5.2vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -.02em;
  max-width: 880px;
  margin-bottom: 18px;
  background: linear-gradient(120deg, var(--text), var(--lav));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-theme="light"] .hero-title {
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0 26px; }

.hero-stats {
  display: flex;
  gap: 14px 30px;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  list-style: none;
  color: var(--text-2);
  font-size: .93rem;
}
.hero-stats li { display: flex; align-items: center; gap: 9px; }
.hero-stats svg { width: 19px; height: 19px; color: var(--accent); }

.section { padding: clamp(46px, 7vw, 84px) 0; scroll-margin-top: 70px; }
.section.alt { background: var(--bg-2); border-block: 1px solid var(--line); }

.section-head { margin-bottom: 34px; max-width: 760px; }
.section-head h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 750;
  letter-spacing: -.01em;
  margin-bottom: 10px;
}

.feature, .client, .step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform var(--speed), border-color var(--speed), box-shadow var(--speed);
}
.feature:hover, .client:hover, .step:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 198, .5);
  box-shadow: 0 14px 34px rgba(20, 24, 60, .16);
}
.feature h3, .client h3, .step h3 { font-size: 1.02rem; font-weight: 650; margin-bottom: 7px; }
.feature p, .client p, .step p { margin: 0; color: var(--text-2); font-size: .92rem; }

.feature-ic, .client-ic {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(91, 110, 225, .2), rgba(139, 92, 198, .2));
  color: var(--accent);
  margin-bottom: 14px;
}
.feature-ic svg, .client-ic svg { width: 23px; height: 23px; }

.step { position: relative; padding-top: 26px; }
.step-n {
  position: absolute;
  top: -16px;
  left: 22px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  box-shadow: 0 8px 20px rgba(91, 110, 225, .4);
}

.cta-band {
  margin-top: 20px;
  padding: clamp(44px, 7vw, 76px) 0;
  background:
    radial-gradient(700px 300px at 30% 0%, rgba(91, 110, 225, .3), transparent 70%),
    radial-gradient(600px 300px at 75% 100%, rgba(139, 92, 198, .3), transparent 70%),
    var(--bg-2);
  border-block: 1px solid var(--line);
  text-align: center;
}
.cta-band h2 { font-size: clamp(1.4rem, 3.2vw, 2rem); font-weight: 750; margin-bottom: 8px; }
.cta-band .lede { margin-inline: auto; }
.cta-band .hero-cta { justify-content: center; }

/* ---- auth ---------------------------------------------------------------- */

.auth-wrap { display: grid; place-items: center; padding: clamp(30px, 7vw, 76px) 20px; }
.auth-card { width: min(420px, 100%); padding: 30px; }
.auth-card.center { text-align: center; }
.auth-title { font-size: 1.45rem; font-weight: 750; margin-bottom: 6px; }
.auth-alt { margin-top: 20px; text-align: center; font-size: .9rem; color: var(--text-2); }
.auth-alt br { line-height: 1.9; }
.err-code {
  font-size: 3rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}

/* ---- panel shell --------------------------------------------------------- */

.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.shell .col { display: flex; flex-direction: column; min-width: 0; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar .brand { padding: 4px 8px 16px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: .93rem;
  font-weight: 550;
  transition: background var(--speed), color var(--speed);
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(91, 110, 225, .18), rgba(139, 92, 198, .18));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 198, .35);
}
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(16px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; }

.user-menu { display: flex; align-items: center; gap: 10px; }
.user-link { display: flex; align-items: center; gap: 9px; color: var(--text); }
.user-link:hover .user-name { color: var(--accent); }
.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
}
.user-name { font-size: .9rem; font-weight: 600; }

.app-main { flex: 1; padding: clamp(16px, 3vw, 28px); }
.app-footer {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 16px clamp(16px, 3vw, 28px);
  border-top: 1px solid var(--line);
  font-size: .82rem;
  color: var(--text-2);
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, .55);
  z-index: 45;
}

.crumbs { margin: 0 0 14px; font-size: .88rem; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--accent); }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-h2 { font-size: 1.5rem; font-weight: 750; margin-bottom: 9px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- dashboard ----------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-2);
  font-weight: 700;
}
.stat-value { font-size: 2rem; font-weight: 780; letter-spacing: -.02em; line-height: 1.15; }
.stat-value.accent {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-link { font-size: .84rem; color: var(--text-2); }
.stat-link:hover { color: var(--accent); }
.stat-link.warn { color: var(--warn); font-weight: 600; }

.chart { width: 100%; height: clamp(160px, 24vw, 220px); display: block; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 6; stroke-width: 1; }
/* One hairline per series: the fill area must not be stroked (it would trace
   the same polyline a second time and make every line look doubled). */
.chart .chart-area { stroke: none; }
.chart polyline { stroke-width: 1; stroke-linecap: butt; stroke-linejoin: round; }

.legend { display: flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--text-2); flex-wrap: wrap; }
.legend .lg { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.legend .lg.in { background: #5b6ee1; }
.legend .lg.out { background: #8b5cc6; }

/* ---- misc page bits ------------------------------------------------------ */

.secret-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.secret-row .secret { flex: 1; min-width: 220px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); color: var(--text); font-family: var(--mono); font-size: .9rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 20px; margin: 0; }
.kv dt { color: var(--text-2); font-size: .86rem; }
.kv dd { margin: 0; font-size: .94rem; }

/* ---- modal windows -------------------------------------------------------- */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 8, 20, .6);
}
.modal-root[hidden] { display: none; }

.modal-card {
  width: min(780px, 100%);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 26px 64px rgba(0, 0, 0, .45);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.modal-head h3 { flex: 1; font-size: 1.02rem; font-weight: 700; }

.modal-body { padding: 16px; overflow: auto; }
/* The modal replaces the page: the "back to network" link and the page
   header are redundant inside it, and the first card should not be pushed
   down by margins meant for a full page. */
.modal-body .crumbs { display: none; }
.modal-body > .page-head,
.modal-body > .banner { margin-top: 0; }
.modal-body .card { padding: 14px; }

/* ---- confirmation ---------------------------------------------------------- */

.confirm-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 8, 20, .6);
}
.confirm-root[hidden] { display: none; }

/* .field is display:flex, and an author rule outranks the user-agent's
   "[hidden] { display: none }" — so the typed-name field used to stay
   visible in every confirmation (device delete/block included), asking for
   a network name that nothing there ever wanted. It is shown by JS only
   when a confirmation actually carries data-confirm-name. */
.confirm-card .field[hidden] { display: none; }

.confirm-card {
  width: min(430px, 100%);
  padding: 18px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 26px 64px rgba(0, 0, 0, .45);
}
.confirm-card h3 { margin: 0 0 8px; font-size: 1.03rem; font-weight: 700; }
.confirm-card p { margin: 0 0 16px; color: var(--text-2); line-height: 1.5; }
.confirm-card .field { margin-bottom: 14px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- navigation progress -------------------------------------------------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 90;
  opacity: 0;
  transition: width .3s ease, opacity .25s ease;
}
.progress[hidden] { display: none; }
.progress.on { opacity: 1; }

/* ---- responsive ---------------------------------------------------------- */

@media (max-width: 1080px) {
  .split.side-left { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .icon-btn.menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 84vw);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .35);
  }
  .sidebar.open { transform: none; }
  .topnav { display: none; }
  .user-name { display: none; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .radio-cards { grid-template-columns: 1fr; }
  .appbar .chip-label { display: none; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .auth-card { padding: 22px; }
  .topbar-right .btn.ghost { display: none; }
  .actions-col, .row-actions { font-size: .86rem; }
  th, td { padding: 9px 6px; }
}

/* Переключатель темы: кнопка отдаёт сразу обе иконки и обе подписи,
   а какая из них видна, решает атрибут data-theme на <html>. Поэтому
   смена темы не требует перезагрузки страницы. */
[data-theme="dark"] .theme-ico-sun,
[data-theme="dark"] .theme-name-dark,
[data-theme="light"] .theme-ico-moon,
[data-theme="light"] .theme-name-light {
  display: none;
}
