/* evdev ops — панель управления VPN и Telegram-прокси.
   Без внешних шрифтов и картинок: системный стек + моно для технических значений. */

:root {
  color-scheme: light dark;

  --bg: #f1f0ea;
  --surface: #ffffff;
  --surface-2: #f6f5f0;
  --glass: rgba(241, 240, 234, 0.86);
  --glass-nav: rgba(255, 255, 255, 0.88);
  --ink: #16191a;
  --ink-2: #464c4f;
  --muted: #62686b;
  --line: #e1dfd6;
  --line-2: #c9c6b9;

  --accent: #0a6b6b;
  --accent-soft: #dcefed;

  --ok-dot: #1fb36b;
  --ok-ink: #0c6b41;
  --ok-soft: #dbf1e5;
  --warn-ink: #7a4b00;
  --warn-soft: #f8ecd0;
  --danger: #b82f25;
  --danger-soft: #fae3e0;
  --danger-solid: #b82f25;

  --btn: #16191a;
  --btn-ink: #ffffff;

  --radius: 16px;
  --nav-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

/* Тёмная тема: по системе, а в Telegram — принудительно по data-theme
   (его ставит JS из WebApp.colorScheme). Наборы переменных держать в синхроне. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1110;
    --surface: #171b1a;
    --surface-2: #1d2221;
    --glass: rgba(14, 17, 16, 0.86);
    --glass-nav: rgba(23, 27, 26, 0.9);
    --ink: #ecebe6;
    --ink-2: #bdc0bb;
    --muted: #8d9490;
    --line: #272d2b;
    --line-2: #3a4340;

    --accent: #4cc2b4;
    --accent-soft: #123532;

    --ok-dot: #45d08a;
    --ok-ink: #62e0a0;
    --ok-soft: #12301f;
    --warn-ink: #e8b14a;
    --warn-soft: #33270f;
    --danger: #ff7d70;
    --danger-soft: #3a1b18;
    --danger-solid: #c4382c;

    --btn: #ecebe6;
    --btn-ink: #101312;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e1110;
  --surface: #171b1a;
  --surface-2: #1d2221;
  --glass: rgba(14, 17, 16, 0.86);
  --glass-nav: rgba(23, 27, 26, 0.9);
  --ink: #ecebe6;
  --ink-2: #bdc0bb;
  --muted: #8d9490;
  --line: #272d2b;
  --line-2: #3a4340;

  --accent: #4cc2b4;
  --accent-soft: #123532;

  --ok-dot: #45d08a;
  --ok-ink: #62e0a0;
  --ok-soft: #12301f;
  --warn-ink: #e8b14a;
  --warn-soft: #33270f;
  --danger: #ff7d70;
  --danger-soft: #3a1b18;
  --danger-solid: #c4382c;

  --btn: #ecebe6;
  --btn-ink: #101312;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
}

button, input, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
a { color: var(--accent); }
code { font-family: var(--mono); }
h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.sr-clip { position: fixed; top: 0; left: -9999px; opacity: 0; font-size: 16px; }

.noscript { padding: 24px; text-align: center; }

/* ---------- иконки ---------- */
.ico {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 28px; height: 28px; }
[data-icon] { display: inline-flex; }

/* ---------- загрузка ---------- */
.boot {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--muted);
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.is-spinning { animation: spin 0.9s linear infinite; }

/* ---------- экран входа ---------- */
.gate {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) calc(env(safe-area-inset-right) + 20px)
           calc(env(safe-area-inset-bottom) + 24px) calc(env(safe-area-inset-left) + 20px);
}
.gate-card {
  width: 100%; max-width: 420px;
  padding: 32px 24px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  text-align: center;
}
.gate-mark {
  width: 60px; height: 60px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.gate-mark .ico { width: 28px; height: 28px; }
.gate-card h1 { font-size: 23px; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 10px; }
.gate-text { color: var(--ink-2); }
.gate-text code, .inline-code {
  padding: 1px 7px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.92em;
  color: var(--ink);
}
.gate-extra { margin-top: 22px; display: grid; gap: 10px; }
.gate-extra:empty { display: none; }

/* ---------- каркас ---------- */
.shell { min-height: 100dvh; }
.view {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px);
}

.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--glass-nav);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--line);
}
.nav-brand { display: none; }
.nav-link {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--nav-h);
  padding: 6px 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11.5px; font-weight: 600;
}
.nav-link[aria-current="page"] { color: var(--accent); }
.nav-link .ico { width: 24px; height: 24px; }

/* ---------- шапка панели ---------- */
.pane-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px 20px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
}
.pane-head h1 {
  flex: 1; min-width: 0;
  font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -0.025em;
}
.pane-head .back { margin-left: -8px; }

.back {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 44px; padding: 0 12px 0 4px;
  color: var(--accent); font-weight: 600; text-decoration: none;
}
.back .ico { width: 24px; height: 24px; }

/* ---------- кнопки ---------- */
.btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px;
  background: var(--surface-2); color: var(--ink);
  font-weight: 600; font-size: 16px; line-height: 1.1;
  text-decoration: none; text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.5; cursor: default; pointer-events: none; }
.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-secondary { background: var(--surface-2); border-color: var(--line-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger-solid); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 15px; }

.icon-btn {
  appearance: none; -webkit-appearance: none;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--muted);
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

@media (hover: hover) {
  .btn-primary:hover { opacity: 0.88; }
  .btn-secondary:hover { background: var(--line); }
  .btn-danger:hover { background: var(--danger-soft); }
  .icon-btn:hover { background: var(--surface-2); color: var(--ink); }
  a.row:hover { background: var(--surface-2); }
  .linkrow:hover, .action-row:hover { background: var(--surface-2); }
}

/* ---------- сводка ---------- */
.overview {
  display: flex; align-items: center; gap: 16px;
  margin: 4px 16px 16px;
  padding: 16px 8px 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 4px 0 0 var(--line-2);
}
.overview[data-state="live"] { box-shadow: inset 4px 0 0 var(--ok-dot); }
.overview[data-state="warn"] { box-shadow: inset 4px 0 0 #d99a1f; }
.ov-big {
  min-width: 1ch;
  font-size: 46px; line-height: 1; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.ov-text { flex: 1; min-width: 0; }
.ov-title { font-weight: 600; }
.ov-sub { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 16px 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-soft); color: var(--warn-ink);
  font-size: 14px; line-height: 1.4;
}
.banner .ico { margin-top: 1px; }
.banner a { color: inherit; font-weight: 600; }
.banner.is-info { background: var(--accent-soft); color: var(--accent); }
.banner.is-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- группы и строки ---------- */
.label {
  margin: 26px 20px 8px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
  color: var(--muted);
}
.label-note { margin: -2px 20px 8px; font-size: 13px; color: var(--muted); }

.group {
  list-style: none;
  margin: 0 16px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.group > li + li, .group > * + * { border-top: 1px solid var(--line); }
.group > li { list-style: none; }

.row {
  display: flex; align-items: center; gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  color: inherit; text-decoration: none;
}
a.row:active { background: var(--surface-2); }
a.row[aria-current="true"] { background: var(--accent-soft); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-size: 17px; font-weight: 600; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-sub {
  font-size: 14px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.row-sub.is-wrap { white-space: normal; }
.row-sub[data-s="online"] { color: var(--ok-ink); }
.row-mono {
  display: block;
  font: 12.5px/1.35 var(--mono); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-aside {
  flex: none; text-align: right;
  font-size: 13px; line-height: 1.3; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.row-aside .strong { display: block; color: var(--ink); font-weight: 600; font-size: 15px; }
.chev { color: var(--line-2); width: 18px; height: 18px; }
.row-static { cursor: default; }

/* индикатор «на связи» */
.dot {
  position: relative;
  flex: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--line-2);
}
.dot[data-s="offline"] { background: #a8a598; }
.dot[data-s="never"], .dot[data-s="noawg"], .dot[data-s="unknown"] {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--line-2);
}
.dot[data-s="unknown"] { box-shadow: none; border: 2px dashed var(--line-2); }
.dot[data-s="online"] { background: var(--ok-dot); }
.dot[data-s="online"]::after {
  content: ""; position: absolute; inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--ok-dot);
  opacity: 0;
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  0%   { transform: scale(0.55); opacity: 0.75; }
  80%  { opacity: 0; }
  100% { transform: scale(1.15); opacity: 0; }
}

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px; font-weight: 600;
}
.chip[data-s="online"] { background: var(--ok-soft); border-color: transparent; color: var(--ok-ink); }
.chip .dot { width: 9px; height: 9px; }
.chip .dot[data-s="online"]::after { inset: -4px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.pill-live {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); font-weight: 600; font-size: 15px;
}
.pill-live.is-on { color: var(--ok-ink); }

/* трафик */
.tr { display: block; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr span { display: block; }

/* ключ-значение */
.kv {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 50px; padding: 10px 16px;
}
.kv-k { color: var(--muted); }
.kv-v { font-family: var(--mono); font-size: 14px; text-align: right; overflow-wrap: anywhere; }
.kv-v.is-plain { font-family: inherit; font-size: 16px; }

/* метрики прокси */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats > div { padding: 14px 12px 14px 16px; min-width: 0; }
.stats > div + div { padding-left: 14px; }
.stats > div + div { border-left: 1px solid var(--line); }
.stat-k { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-v {
  font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}

/* строка «копировать» */
.linkrow {
  appearance: none; -webkit-appearance: none;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 68px;
  padding: 12px 16px;
  border: 0; background: transparent; text-align: left;
  cursor: pointer;
}
.linkrow:active, .action-row:active { background: var(--surface-2); }
.linkrow-main { flex: 1; min-width: 0; }
.linkrow-title { font-weight: 600; }
.linkrow-hint { font-size: 13px; color: var(--muted); }
.linkrow code {
  display: block; margin-top: 3px;
  font-size: 12.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.linkrow-ico { color: var(--muted); display: grid; }
.linkrow-ico .ico-ok { display: none; }
.linkrow.is-copied .linkrow-ico { color: var(--ok-ink); }
.linkrow.is-copied .linkrow-ico .ico-copy { display: none; }
.linkrow.is-copied .linkrow-ico .ico-ok { display: block; }
.linkrow.is-copied .linkrow-hint { color: var(--ok-ink); font-weight: 600; }

/* файлы .conf */
.conf { display: grid; gap: 4px; padding: 14px 16px 16px; }
.conf-title { font-weight: 600; }
.conf-desc { font-size: 14px; color: var(--muted); }
.conf-file { font: 12.5px/1.4 var(--mono); color: var(--ink-2); word-break: break-all; margin-top: 2px; }
.conf-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 10px; }

/* строки-действия */
.action-row {
  appearance: none; -webkit-appearance: none;
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 68px;
  padding: 12px 16px;
  border: 0; background: transparent; text-align: left;
  cursor: pointer;
}
.action-row[aria-busy="true"] { opacity: 0.5; pointer-events: none; }
.action-ico {
  flex: none; display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2);
}
.action-main { flex: 1; min-width: 0; }
.action-title { font-weight: 600; }
.action-desc { font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.action-row.is-danger .action-title { color: var(--danger); }
.action-row.is-danger .action-ico { color: var(--danger); }

.danger-zone { margin: 30px 16px 0; }

/* ---------- детали ---------- */
.hero { padding: 2px 20px 6px; }
.hero h2 {
  font-size: 31px; line-height: 1.1; font-weight: 700; letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  margin-bottom: 10px;
}
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--muted); font-size: 14px; }
.hero-comment { margin-bottom: 10px; color: var(--ink-2); overflow-wrap: anywhere; }
.detail-actions { margin: 16px 16px 0; display: grid; gap: 10px; }

.detail-placeholder {
  display: none;
  height: 100%;
  place-items: center;
  align-content: center; gap: 10px;
  padding: 32px;
  color: var(--muted); text-align: center;
}
.detail-placeholder .ico { width: 36px; height: 36px; color: var(--line-2); }

.empty { padding: 40px 28px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty .ico { width: 34px; height: 34px; color: var(--line-2); }
.empty h3 { font-size: 18px; color: var(--ink); }
.empty .btn { margin-top: 10px; }

/* скелетон */
.sk {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk-row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px; }
.sk-col { flex: 1; display: grid; gap: 8px; }
.sk-w60 { width: 60%; } .sk-w40 { width: 40%; } .sk-w30 { width: 30%; }
.sk-dot { width: 12px; height: 12px; border-radius: 50%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- уведомления ---------- */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 100;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  max-width: 460px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--btn); color: var(--btn-ink);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.45);
  font-size: 15px; font-weight: 500; line-height: 1.35;
  animation: toast-in 0.2s ease-out;
}
.toast .ico { margin-top: 1px; }
.toast-error { background: var(--danger-solid); color: #fff; }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- диалог ---------- */
dialog.sheet {
  border: 0; padding: 0;
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  margin: calc(env(safe-area-inset-top) + 12px) auto auto;
  border-radius: 22px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55);
  overflow: auto;
}
dialog.sheet[open] { animation: sheet-in 0.2s ease-out; }
dialog.sheet::backdrop { background: rgba(8, 12, 11, 0.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }

.sheet-form { display: grid; gap: 16px; padding: 22px 20px 20px; }
.sheet-title { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.sheet-lead { color: var(--ink-2); font-size: 15px; }
.sheet-lead b { color: var(--ink); overflow-wrap: anywhere; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field .opt { color: var(--muted); font-weight: 500; }
.input {
  width: 100%; min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface-2);
  font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea.input { min-height: 76px; resize: vertical; line-height: 1.4; }
.field-hint { font-size: 13px; color: var(--muted); }
.field-hint.is-bad { color: var(--danger); }
.form-error {
  padding: 10px 12px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  font-size: 14px; font-weight: 500;
}
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }

/* ================= Telegram Mini App ================= */
/* Системная кнопка «Назад» уже есть — своя ссылка в шапке карточки лишняя. */
html.tg-back .pane-detail .pane-head { display: none; }
html.tg-back .detail-body { padding-top: 16px; }

/* ================= широкий экран ================= */
@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); }

  .nav {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto;
    height: 100dvh;
    flex-direction: column; gap: 4px;
    padding: 22px 12px;
    background: var(--surface);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .nav-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 10px 18px;
    font-size: 17px; letter-spacing: -0.01em;
  }
  .nav-brand b { color: var(--accent); }
  .brand-mark {
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--btn); color: var(--ok-dot);
  }
  .brand-mark .ico { width: 20px; height: 20px; }
  .nav-link {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 44px; padding: 0 12px;
    border-radius: 11px; font-size: 15.5px;
  }
  .nav-link .ico { width: 21px; height: 21px; }
  .nav-link[aria-current="page"] { background: var(--accent-soft); }
  @media (hover: hover) { .nav-link:hover { background: var(--surface-2); } }

  .view { height: 100dvh; overflow-y: auto; padding-bottom: 0; }
  .toasts { bottom: 24px; }

  .pane-head { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }

  /* список + карточка */
  .split {
    display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    height: 100dvh;
  }
  .pane { height: 100dvh; overflow-y: auto; padding-bottom: 40px; }
  .pane-list { border-right: 1px solid var(--line); }
  .pane-list .pane-head { background: var(--bg); }
  .split .pane-detail { padding-bottom: 60px; }
  .split .pane-detail .back { display: none; }
  .split[data-pane="list"] .detail-placeholder { display: grid; }
  .detail-body { max-width: 720px; }
  .pane-detail .pane-head { min-height: 20px; padding-bottom: 0; }

  /* одиночные страницы */
  .page { max-width: 760px; padding-bottom: 60px; }
  .page .pane-head { padding-left: 20px; }
}

/* ================= узкий экран: одна панель за раз ================= */
@media (max-width: 959.98px) {
  .split[data-pane="list"] .pane-detail { display: none; }
  .split[data-pane="detail"] .pane-list { display: none; }
}

/* планшет в портрете: одна колонка, но не растягиваем на весь экран */
@media (min-width: 600px) and (max-width: 959.98px) {
  .pane, .page { max-width: 680px; margin-inline: auto; }
  .nav { justify-content: center; }
  .nav-link { max-width: 200px; }
}

@media (max-width: 359px) {
  .row-aside.is-secondary { display: none; }
  .ov-big { font-size: 38px; }
  .hero h2 { font-size: 27px; }
  .stat-v { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .dot[data-s="online"]::after { display: none; }
}
