/* ============================================================
   Tachyon — Precision Instrument UI (Dark & Light Themes)
   Типографика: Plus Jakarta Sans (UI) · JetBrains Mono (Data)
   ============================================================ */

:root {
  /* Графитовая шкала поверхностей (5 ступеней) */
  --bg: #0B0B0D;
  --surface-1: #121216;
  --surface-2: #18181E;
  --surface-3: #22222A;
  --surface-glass: rgba(18, 18, 22, 0.96);

  /* Тонкие 1px границы без свечения */
  --border: rgba(242, 242, 244, 0.08);
  --border-strong: rgba(242, 242, 244, 0.16);
  --inner-glow: none;

  /* Иерархия текста (3 уровня) */
  --ink: #F2F2F4;
  --ink-soft: #B4B4BE;
  --muted: #7C7C88;

  /* Единственный акцент + семантические статусы */
  --accent: #B9A8FF;
  --accent-bright: #CEC2FF;
  --accent-soft: rgba(185, 168, 255, 0.12);
  --accent-ink: #0B0B0D;

  --emerald: #4CC38A;
  --emerald-bright: #6FD08C;
  --emerald-soft: rgba(76, 195, 138, 0.12);

  --amber: #E5C07B;
  --amber-soft: rgba(229, 192, 123, 0.12);

  --red: #E5484D;
  --red-soft: rgba(229, 72, 77, 0.12);

  /* Строгие тени только для всплывающих слоёв */
  --sh-sm: none;
  --sh-md: 0 12px 32px rgba(0, 0, 0, 0.56);
  --sh-lg: 0 24px 48px rgba(0, 0, 0, 0.72);

  /* Вложенные радиусы по 4px-сетке (12 -> 8 -> 4) */
  --r-xl: 12px;
  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 4px;

  /* Кривая движения */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Размеры каркаса (кратно 4px) */
  --top-h: 96px;

  /* Шрифты */
  --f-ui: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #F6F6F4;
  --surface-1: #FFFFFF;
  --surface-2: #F0F0ED;
  --surface-3: #E4E4DF;
  --surface-glass: rgba(255, 255, 255, 0.96);

  --border: rgba(22, 22, 24, 0.09);
  --border-strong: rgba(22, 22, 24, 0.18);
  --inner-glow: none;

  --ink: #161618;
  --ink-soft: #4A4A52;
  --muted: #74747E;

  --accent: #5440C4;
  --accent-bright: #432FB0;
  --accent-soft: rgba(84, 64, 196, 0.10);
  --accent-ink: #FFFFFF;

  --emerald: #1F7A4C;
  --emerald-bright: #19663A;
  --emerald-soft: rgba(31, 122, 76, 0.10);

  --amber: #9A6700;
  --amber-soft: rgba(154, 103, 0, 0.10);

  --red: #C8282D;
  --red-soft: rgba(200, 40, 45, 0.10);

  --sh-sm: none;
  --sh-md: 0 12px 28px rgba(22, 22, 24, 0.10);
  --sh-lg: 0 24px 48px rgba(22, 22, 24, 0.16);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(242, 242, 244, 0.16);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(242, 242, 244, 0.28);
}
html[data-theme="light"] *::-webkit-scrollbar-thumb {
  background: rgba(22, 22, 24, 0.18);
}
html[data-theme="light"] *::-webkit-scrollbar-thumb:hover {
  background: rgba(22, 22, 24, 0.32);
}

button, input, select, textarea {
  outline: none;
}
select option {
  background: var(--surface-1);
  color: var(--ink);
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  font-family: var(--f-ui);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  position: relative;
}

.ic {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bic {
  flex: none;
  fill: currentColor;
  stroke: none;
}

/* ============================================================
   ЕДИНАЯ ШАПКА + НАВИГАЦИОННЫЙ ДОК (TOPBAR)
   ============================================================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  height: var(--top-h);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__logo {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.tachyon-bolt-svg {
  width: 16px;
  height: 16px;
}

.wordmark-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}
.wordmark-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.wordmark-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.topbar__ver {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--r-sm);
}

.topbar__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  -webkit-app-region: no-drag;
}

.wbtn {
  width: 32px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.wbtn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}
.wbtn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.wbtn--close:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* Сегментированный док навигации */
.nav-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  -webkit-app-region: no-drag;
}

.rail__item {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s var(--ease-out), background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.rail__item .ic {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.rail__item:hover {
  color: var(--ink-soft);
}
.rail__item.is-active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--ink);
}
.rail__item.is-active .ic {
  color: var(--accent);
}

.nav-badge {
  font-style: normal;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  padding: 0 6px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink-soft);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---------- Баннер обновления ---------- */
.updbar {
  position: fixed;
  left: 16px; right: 16px;
  top: calc(var(--top-h) + 8px);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--sh-md);
  font-size: 12px;
}
.updbar__ic { width: 16px; height: 16px; color: var(--accent); }
.updbar__txt { flex: 1; min-width: 0; }
.updbar__btn {
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: var(--r-sm);
  padding: 4px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent);
}
.updbar__x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

/* ============================================================
   ОСНОВНОЙ КОНТЕЙНЕР (SHELL & VIEWS)
   ============================================================ */
.shell {
  position: fixed;
  inset: var(--top-h) 0 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}
.content.is-locked-scroll {
  overflow-y: hidden !important;
}

.view {
  display: none;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}
.view.is-active {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 0 auto;
  animation: viewEnter 0.18s var(--ease-out);
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   1. ГЛАВНЫЙ ЭКРАН (CONNECT VIEW)
   ============================================================ */
.hero {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  transition: border-color 0.2s var(--ease-out);
}

.hero.is-on {
  border-color: var(--emerald);
}

/* Верхняя строка внутри Hero (Статус + Таймер) */
.hero__top {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hero__top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tachyon-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-soft);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.status-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin: 0;
}
.status-chip.is-connecting {
  color: var(--amber);
  border-color: var(--amber);
  background: var(--amber-soft);
}
.status-chip.is-connecting .dot {
  background: var(--amber);
  animation: blink 1s infinite;
}
.status-chip.is-on {
  color: var(--emerald);
  border-color: var(--emerald);
  background: var(--emerald-soft);
}
.status-chip.is-on .dot {
  background: var(--emerald);
}
@keyframes blink { 50% { opacity: 0.35; } }

.session-pill {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--r-md);
}

/* Тахионный реактор (Precision Instrument Dial) */
.orb-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.reactor-stage {
  position: relative;
  width: 156px;
  height: 156px;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

#reactorCanvas {
  position: absolute;
  inset: 0;
  width: 156px;
  height: 156px;
  pointer-events: none;
  z-index: 1;
}

.orb {
  position: relative;
  z-index: 2;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.orb:active .orb__core {
  transform: scale(0.97);
}

.orb__core {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out), transform 0.12s var(--ease-out);
}
.orb:hover .orb__core {
  background: var(--surface-3);
  border-color: var(--accent);
}
.orb.is-on .orb__core {
  background: var(--emerald-soft);
  border-color: var(--emerald);
  color: var(--emerald);
}
.orb.is-connecting .orb__core {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}

.orb__icon {
  display: grid;
  place-items: center;
}
.reactor-bolt-svg {
  width: 24px;
  height: 24px;
}

.orb__live-rate {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
}
.orb.is-on .orb__live-rate {
  color: var(--emerald);
}

@keyframes spin { to { transform: rotate(360deg); } }

.orb__caption {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

/* Селектор локации (внутри Hero) */
.server-pick-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.server-pick {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.server-pick:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.server-pick__tools {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex: none;
}
.server-pick__tools .icon-btn {
  width: 40px;
  height: auto;
  border-radius: var(--r-md);
}

.flag-slot {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  flex: none;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.server-pick__txt {
  flex: 1;
  min-width: 0;
}
.server-pick__txt b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-pick__txt small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.server-pick__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.ping-pill {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.ping-pill b {
  color: var(--ink);
  font-weight: 600;
}
.ping-pill small {
  font-size: 11px;
  color: var(--muted);
}

.server-pick__chev {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.server-pick:hover .server-pick__chev {
  transform: translateX(2px);
  color: var(--ink);
}

/* ---------- Двухколоночный ряд: Выходной узел + Живая телеметрия ---------- */
.bento-row-2 {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 8px;
  flex: none;
}

.hairline-card,
.telemetry-card {
  position: relative;
  flex: none;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 12px 16px;
  overflow: hidden;
}

.exit-node-card,
.telemetry-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

#pingSparklineCanvas,
.telemetry-card #trafficChart {
  display: block;
  width: 100%;
  height: 32px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  pointer-events: none;
}

.exit-node__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.mini-link-btn .ic {
  width: 12px;
  height: 12px;
}
.mini-link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.exit-node__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.exit-node__main b {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exit-node__sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.t-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.t-stat__lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.dot--accent,
.dot--blue { background: var(--accent); }
.dot--emerald { background: var(--emerald); }

.t-stat__val {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-soft);
}
.t-stat__val b {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.t-stat__sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-stat__sub b {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-soft);
}

/* ---------- Панель маршрутизации ---------- */
.route-card {
  flex: none;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 12px 16px;
}

.route-card__bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.route-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.route-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* Универсальный сегментированный контрол */
.seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.seg button .ic {
  width: 14px;
  height: 14px;
}
.seg button:hover {
  color: var(--ink-soft);
}
.seg button.is-active {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--ink);
}

.seg--split {
  width: 100%;
  margin: 8px 0;
}
.seg--split button {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
}

.app-routes {
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.app-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 128px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
}
.app-item__name {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   КНОПКИ И ЭЛЕМЕНТЫ ФОРМ
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--f-ui);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
  width: 100%;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out), opacity 0.15s var(--ease-out);
}
.btn .ic { width: 16px; height: 16px; }
.btn--sm { padding: 8px 12px; font-size: 12px; border-radius: var(--r-md); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--accent-bright);
}

.btn--ghost {
  background: var(--surface-2);
  color: var(--ink-soft);
  border-color: var(--border);
}
.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.btn-act .ic { width: 14px; height: 14px; }
.btn-act:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-act--primary {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.btn-act--primary:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-icon, .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.btn-icon .ic, .icon-btn .ic { width: 16px; height: 16px; }
.btn-icon:hover, .icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-icon.is-busy .ic { animation: spin 1s linear infinite; }

/* ============================================================
   2. УЗЛЫ И ПОДПИСКИ (SUBSCRIPTIONS VIEW)
   ============================================================ */
.sec-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.sec-bar__txt h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.sec-bar__acts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sub-add-card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 16px;
}
.sub-add-card__head h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--ink);
}
.sub-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 0.15s var(--ease-out);
}
.field:focus-within {
  border-color: var(--accent);
}
.field .field__ic { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.field--textarea {
  align-items: flex-start;
}
.field--textarea .field__ic {
  margin-top: 2px;
}
.field input,
.field textarea {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-family: var(--f-ui);
  font-size: 13px;
  color: var(--ink);
  user-select: text;
}
.field textarea {
  resize: vertical;
  min-height: 44px;
  max-height: 180px;
  line-height: 1.4;
  font-family: var(--f-mono);
  font-size: 12px;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); font-family: var(--f-ui); }

.sub-add-card__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.sub-add-card__foot .btn { width: auto; min-width: 96px; }

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

.sub-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  transition: border-color 0.15s var(--ease-out);
}
.sub-card:hover {
  border-color: var(--border-strong);
}

.sub-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sub-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
}
.sub-card__title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-card__badge {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
  flex: none;
}

.sub-card__url {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}

.sub-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-soft);
}
.sub-card__meta b {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}

.sub-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.pill-btn .ic { width: 14px; height: 14px; }
.pill-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}
.pill-btn.is-busy { opacity: 0.6; pointer-events: none; }

.proto-badge {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  text-transform: uppercase;
}

.sec-subhead {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 8px 4px 4px;
}

.sub-empty {
  text-align: center;
  padding: 32px 20px;
  background: var(--surface-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  margin-top: 8px;
}
.sub-empty__icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
}
.sub-empty h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.sub-empty p { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }

/* ============================================================
   3. ВЫЕЗЖАЮЩАЯ ШТОРКА СЕРВЕРОВ (BOTTOM SHEET DRAWER)
   ============================================================ */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
}
.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 13, 0.72);
  opacity: 0;
  transition: opacity 0.2s var(--ease-out);
}
.drawer.show .drawer__backdrop {
  opacity: 1;
}

.drawer__panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  top: 40px;
  background: var(--surface-1);
  border-top: 1px solid var(--border-strong);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sh-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.24s var(--ease-out);
}
.drawer.show .drawer__panel {
  transform: translateY(0);
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 12px;
  gap: 8px;
}
.drawer__title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.drawer__head h2 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}
.drawer__count {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.drawer__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.search-row {
  margin-bottom: 8px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 0.15s var(--ease-out);
}
.search:focus-within {
  border-color: var(--accent);
}
.search .ic { width: 16px; height: 16px; color: var(--muted); }
.search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-family: var(--f-ui);
  font-size: 13px;
  color: var(--ink);
  user-select: text;
}
.search input::placeholder { color: var(--muted); }
.search__clear {
  border: none;
  background: var(--surface-3);
  color: var(--ink-soft);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  flex: none;
}
.search__clear:hover {
  background: var(--border-strong);
  color: var(--ink);
}

/* Панель сортировки */
.drawer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.sort-seg {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.sort-seg button {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.sort-seg button:hover {
  color: var(--ink-soft);
}
.sort-seg button.is-active {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--ink);
}

.btn-collapse-all {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.btn-collapse-all:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}

/* Чип-бары фильтрации (Протоколы + Страны) */
.chip-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  overflow: visible;
  margin-bottom: 4px;
}
.chip-bar--countries {
  margin-bottom: 4px;
}

/* Карточка фильтрации узлов прямо во вкладке «Узлы» */
.node-filter-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nodes-compact-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nf-collapsible {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.nf-toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nf-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nf-block__lbl {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}
.nf-block__lbl small {
  font-weight: 400;
  color: var(--muted);
}

.nf-browser {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.server-list--embedded {
  min-height: 320px;
  max-height: 416px;
  overflow-y: auto;
  padding-right: 4px;
}

.f-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.f-chip .ic {
  width: 14px;
  height: 14px;
}
.f-chip:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}
.f-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.f-chip--alive.is-active {
  background: var(--emerald-soft);
  border-color: var(--emerald);
  color: var(--emerald);
}
.f-chip.is-excluded {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
  text-decoration: line-through;
}
.chip-flag {
  width: 16px;
  height: 16px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex: none;
}
.chip-count {
  font-style: normal;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.f-chip.is-active .chip-count {
  color: var(--accent);
}

/* Расширенная панель фильтрации мусора */
.adv-filter-box {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 8px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adv-filter__toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.mini-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}
.mini-chk input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.adv-filter__inputs {
  display: flex;
  gap: 8px;
}
.adv-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.adv-field--sm {
  width: 96px;
}
.adv-field span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.adv-field input {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-family: var(--f-ui);
  font-size: 12px;
  color: var(--ink);
  width: 100%;
  user-select: text;
}
.adv-field input:focus {
  border-color: var(--accent);
}
.adv-filter__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.adv-hint {
  font-size: 12px;
  color: var(--muted);
}

.server-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

/* Заголовок группы серверов (сворачиваемый) */
.server-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.server-group-head:first-child {
  margin-top: 0;
}
.server-group-head:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.server-group-head__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.server-group-head__flag {
  width: 20px;
  height: 20px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex: none;
}
.server-group-head__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-group-head__count {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.server-group-head__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.server-group-head__best {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
}
.server-group-head__best .ic {
  width: 12px;
  height: 12px;
}
.server-group-head__ping-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--ink-soft);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.server-group-head__ping-btn .ic {
  width: 12px;
  height: 12px;
}
.server-group-head__ping-btn:hover {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.server-group-head__chev {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 0.15s var(--ease-out);
  transform: rotate(90deg);
}
.server-group-head.is-collapsed .server-group-head__chev {
  transform: rotate(0deg);
}

.server-more-btn {
  margin: 4px 0 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--accent);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}
.server-more-btn:hover {
  background: var(--surface-2);
}

.proto-badge--reality,
.proto-badge--xhttp {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--border-strong);
}
.proto-badge--hy2, .proto-badge--awg {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--border-strong);
}

.server-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.server-item:hover {
  background: var(--surface-2);
  border-color: var(--border);
}
.server-item.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.server-item .flag-slot {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
}

.server__info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.server__country {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.server__city {
  flex: none;
}

.server__right {
  flex: none;
}
.server__ping {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.server__ping.is-good { color: var(--emerald); }
.server__ping.is-med { color: var(--amber); }
.server__ping.is-slow { color: var(--red); }

.server--empty {
  justify-content: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ============================================================
   4. АКТИВНЫЕ СОЕДИНЕНИЯ (CONNECTIONS VIEW)
   ============================================================ */
.conn-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.conn-tot {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-soft);
}
.conn-wrap {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.conn-list {
  list-style: none;
  flex: 1;
  max-height: 492px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-1);
  font-size: 12px;
  transition: background-color 0.15s var(--ease-out);
}
.conn-row:hover {
  background: var(--surface-2);
}
.conn-row__main {
  flex: 1;
  min-width: 0;
}
.conn-row__main b {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conn-row__main small {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}
.conn-b {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  flex: none;
}
.conn-b--vpn {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: var(--emerald);
}
.conn-b--desync {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber);
}
.conn-b--direct {
  color: var(--ink-soft);
  background: var(--surface-2);
}
.conn-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ============================================================
   5. ОПЦИИ (SETTINGS VIEW)
   ============================================================ */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.s-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.s-group__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding-left: 4px;
}

.s-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: visible;
}
.s-card--pad {
  padding: 12px 16px;
}

.s-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.s-row + .s-row,
.s-row + .toggle,
.toggle + .s-row {
  border-top: 1px solid var(--border);
}
.s-row__txt {
  min-width: 0;
  flex: 1;
}
.s-row__txt b {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.s-row__txt small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.mini-select {
  position: relative;
  flex: none;
}
.mini-select__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.mini-select__btn:hover {
  border-color: var(--border-strong);
}
.mini-select__menu {
  list-style: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 196px;
  z-index: 30;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  padding: 4px;
}
.mini-select__menu li {
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-soft);
}
.mini-select__menu li:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* Переключатели (Toggles) */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out);
}
.toggle + .toggle {
  border-top: 1px solid var(--border);
}
.toggle:hover {
  background: var(--surface-2);
}
.toggle b {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.toggle small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.toggle input {
  display: none;
}
.toggle .track {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  flex: none;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.toggle .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink-soft);
  transition: transform 0.15s var(--ease-out), background-color 0.15s var(--ease-out);
}
.toggle input:checked + .track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle input:checked + .track::after {
  transform: translateX(16px);
  background: var(--accent-ink);
}

/* Карточка обновления движка tachyon-core */
.core-upd-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.core-upd__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.core-upd__info {
  min-width: 0;
  flex: 1;
}
.core-upd__title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.core-upd__title b {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.core-ver-pill {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
}
.core-upd__info small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.core-upd__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.core-upd__prog {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.core-upd__bar {
  height: 100%;
  background: var(--accent);
}

/* Сетка сервисных кнопок 3x2 */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 560px) {
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.tool-btn .ic { width: 14px; height: 14px; color: var(--accent); }
.tool-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}

.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-soft);
}

.about-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.about-bar b {
  color: var(--ink-soft);
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.about-bar__links {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.link-btn .ic {
  width: 12px;
  height: 12px;
}
.link-btn:hover { text-decoration: underline; }

/* ============================================================
   УВЕДОМЛЕНИЯ (TOAST) И МОДАЛКИ
   ============================================================ */
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translate(-50%, 150%);
  z-index: 100;
  background: var(--surface-1);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  box-shadow: var(--sh-md);
  transition: transform 0.2s var(--ease-out);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  line-height: 1.4;
}
.toast.show {
  transform: translate(-50%, 0);
}
.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  flex: none;
}
.toast.is-err, .toast.err {
  border-color: var(--red);
  background: var(--surface-1);
}
.toast.is-err::before, .toast.err::before {
  background: var(--red);
}

.cmodal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cmodal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 13, 0.72);
}
.cmodal__box {
  position: relative;
  width: calc(100% - 32px);
  max-width: 360px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-lg);
}
.cmodal__box p {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.cmodal__input {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 12px;
  font-family: var(--f-ui);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  outline: none;
}
.cmodal__input:focus {
  border-color: var(--accent);
}
.cmodal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.cmodal__actions .btn {
  width: auto;
  min-width: 88px;
}

/* Модальное окно поддержки проекта (Донат) */
.cmodal__box--donate {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.donate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.donate-head__title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.donate-head__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}
.donate-head__title b {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.donate-head__title small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.donate-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.donate-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--f-ui);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.donate-link-card:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}
.donate-link-card__txt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.donate-link-card__txt b {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.donate-link-card__txt small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.donate-link-card .ic {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex: none;
}
.donate-crypto {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.donate-crypto__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.donate-crypto__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.donate-wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.donate-wallet:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--ink);
}
.donate-wallet__net {
  min-width: 44px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--border);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  flex: none;
}
.donate-wallet__addr {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink);
}
.donate-wallet .ic {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex: none;
}
.donate-wallet:hover .ic {
  color: var(--accent);
}
.donate-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   МАРШРУТЫ, DESYNC (DPI BYPASS) И TACHYON-LISTS
   ============================================================ */
.seg--routes {
  display: flex;
  width: 100%;
}
.seg--routes button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px;
  font-size: 12px;
  white-space: nowrap;
}

.route-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.route-summary__pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.r-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-soft);
}
.r-pill .ic {
  width: 12px;
  height: 12px;
}
.r-pill--desync {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber);
}
.r-pill--desync.is-off {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
}
.r-pill--lists {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--border-strong);
}

/* Карточка Desync */
.desync-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.desync-card.is-disabled .desync-body {
  opacity: 0.45;
  pointer-events: none;
}

.desync-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.desync-card__title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.desync-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--amber);
  display: grid;
  place-items: center;
  flex: none;
}

.desync-card__title-wrap h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.desync-card__title-wrap small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.toggle--inline {
  padding: 0;
}
.toggle--inline:hover {
  background: transparent;
}

.desync-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.18s var(--ease-out);
}

.desync-status-strip {
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.desync-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.desync-sec-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.desync-auto-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.desync-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
}
.desync-switch-row__txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.desync-switch-row__txt b {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.desync-switch-row__txt small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.desync-sni-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.sni-pool-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.sni-pool-lbl {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-right: 4px;
}
.sni-chip {
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-mono);
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.sni-chip:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.sni-chip.is-active {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}

.preset-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.p-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.p-chip .ic {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.p-chip:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.p-chip.is-active {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}

.desync-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

.desync-foot__summary {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desync-adv {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.desync-adv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.d-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.d-field span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.d-field select,
.d-field input {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--f-ui);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.d-field select:focus,
.d-field input:focus {
  border-color: var(--accent);
}

.desync-adv-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

/* ============================================================
   ВКЛАДКА МАРШРУТЫ — СЦЕНАРИИ + КАСКАД + TACHYON-LISTS
   ============================================================ */
.routing-top-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.routing-top__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.routing-top__title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.routing-top__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
}

.routing-top__title h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.routing-top__title small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.routing-top__controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.detour-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 0 12px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}
.detour-inline .ic {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.detour-inline__lbl {
  white-space: nowrap;
}
.c-select--sm {
  height: 28px !important;
  padding: 0 8px !important;
  font-size: 12px !important;
  border-radius: var(--r-sm) !important;
  background: var(--surface-1) !important;
}

.routing-presets-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.routing-presets__lbl {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-right: 4px;
}

.r-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.r-preset-btn .ic {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.r-preset-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--border-strong);
}
.r-preset-btn--ghost .ic {
  color: var(--muted);
}
.r-preset-btn--ghost:hover {
  color: var(--red);
  border-color: var(--red);
}
.r-preset-btn--ghost:hover .ic {
  color: var(--red);
}

/* Карточка точечной маршрутизации и списков tachyon-lists */
.routing-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.routing-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.routing-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rtab-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lists-toolbar {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 280px;
  justify-content: flex-end;
  gap: 8px;
}
.routing-search {
  max-width: 380px;
}
.search--sm {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
}
.search--sm input {
  font-size: 13px;
}

.community-lists {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 360px;
  max-height: 444px;
  overflow-y: auto;
  padding-right: 4px;
}

.list-cat-group {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-1);
  overflow: hidden;
  flex: none;
}

.list-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: background-color 0.15s var(--ease-out);
}
.list-cat-head:hover {
  background: var(--surface-3);
}
.list-cat-head__left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.list-cat-head__left .ic {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.list-cat-head__right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.list-cat-head__chev {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.15s var(--ease-out);
}
.list-cat-group.is-collapsed .list-cat-head__chev {
  transform: rotate(-90deg);
}
.list-cat-group.is-collapsed .list-cat-body {
  display: none;
}

.list-cat-body {
  display: flex;
  flex-direction: column;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  transition: background-color 0.15s var(--ease-out);
}
.list-row:hover {
  background: var(--surface-2);
}

.list-row__info {
  min-width: 0;
  flex: 1;
}
.list-row__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.list-row__title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  flex: none;
}
.list-row[data-state="vpn"] .list-row__title::before {
  background: var(--emerald);
}
.list-row[data-state="desync"] .list-row__title::before {
  background: var(--amber);
}
.list-row[data-state="direct"] .list-row__title::before {
  background: var(--accent);
}
.list-row[data-state="block"] .list-row__title::before {
  background: var(--red);
}

.list-row__tag {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
}
.list-row__desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Селектор действия для списка (Выкл | VPN | Desync | Прямой | Блок) */
.act-seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex: none;
}
.act-seg button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.act-seg button:hover {
  color: var(--ink);
}
.act-seg button.is-active[data-act="off"] {
  background: var(--surface-3);
  color: var(--ink-soft);
}
.act-seg button.is-active[data-act="vpn"] {
  background: var(--emerald-soft);
  border-color: var(--emerald);
  color: var(--emerald);
}
.act-seg button.is-active[data-act="desync"] {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}
.act-seg button.is-active[data-act="direct"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.act-seg button.is-active[data-act="block"] {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}
.act-seg button:disabled,
.act-seg button.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}
.act-seg button:disabled:hover,
.act-seg button.is-disabled:hover {
  color: var(--muted);
}
.sni-chip:disabled,
.sni-chip.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Свои правила */
.custom-rule-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.c-select {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.c-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 13px;
}
.c-input:focus,
.c-select:focus {
  border-color: var(--accent);
}

.custom-rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
}
.custom-rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.custom-rule-item.is-disabled-rule .custom-rule-item__left {
  opacity: 0.45;
}
.custom-rule-item__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.custom-rule-item__type {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink-soft);
  flex: none;
}
.custom-rule-item__val {
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.custom-rule-item__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* ============================================================
   БЫСТРЫЕ ПЛИТКИ ГЛАВНОГО ЭКРАНА (QUICK DOCK) И НИЖНИЙ СТАТУС-БАР
   ============================================================ */
.quick-dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: none;
}

.q-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.q-tile:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.q-tile__ic {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: none;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.q-tile__ic .ic {
  width: 16px;
  height: 16px;
}

.q-tile.is-on {
  border-color: var(--accent);
}
.q-tile.is-on .q-tile__ic {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
#quickDesyncTile.is-on {
  border-color: var(--amber);
}
#quickDesyncTile.is-on .q-tile__ic {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}
#quickKillTile.is-on {
  border-color: var(--emerald);
}
#quickKillTile.is-on .q-tile__ic {
  background: var(--emerald-soft);
  border-color: var(--emerald);
  color: var(--emerald);
}

.q-tile__txt {
  min-width: 0;
  flex: 1;
}
.q-tile__txt b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-tile__txt small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Нижний статус-бар окна (Footer Status Bar) */
.statusbar {
  flex: none;
  height: 32px;
  padding: 0 20px;
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.statusbar__left,
.statusbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.statusbar b {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-soft);
}
.statusbar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.statusbar__dot.is-on {
  background: var(--emerald);
}
.statusbar__sep {
  opacity: 0.45;
}
.statusbar__link {
  border: none;
  background: transparent;
  color: var(--accent);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.statusbar__link:hover {
  text-decoration: underline;
}

/* Вкладка Маршруты: Цепочка прокси (Detour) */
.detour-card {
  padding: 12px 16px;
}
.detour-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.detour-card__info {
  min-width: 0;
  flex: 1;
}
.detour-card__info b {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.detour-card__info small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.detour-select {
  min-width: 220px;
  max-width: 280px;
}

/* Вкладка Трафик и Диагностика: Подвкладки */
.conn-top-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
}
.conn-bar__right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ttab-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}

/* Карточки Диагностики (Матрица доступности и Спидтест) */
.diag-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.diag-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.diag-card__head b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.diag-card__head small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.diag-empty-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 4px;
}
.diag-matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 640px) {
  .diag-matrix-grid {
    grid-template-columns: 1fr;
  }
}
.diag-probe-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.diag-probe-item__left {
  min-width: 0;
}
.diag-probe-item__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.diag-probe-item__detail {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diag-probe-item__badge {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  flex: none;
}
.diag-probe-item__badge.is-ok {
  color: var(--emerald);
  background: var(--emerald-soft);
  border: 1px solid var(--emerald);
}
.diag-probe-item__badge.is-fail {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red);
}

/* Спидтест */
.sp-srv-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  vertical-align: middle;
}
.sp-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.sp-prov-select {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}
.sp-prov-select:hover,
.sp-prov-select:focus {
  border-color: var(--accent);
}
.sp-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.sp-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--muted);
}
.sp-progress-meta b {
  color: var(--accent);
  font-weight: 600;
}
.sp-progress-track {
  height: 4px;
  border-radius: 99px;
  background: var(--bg);
  overflow: hidden;
}
.sp-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
}
.btn-act--danger {
  background: var(--red-soft) !important;
  border-color: var(--red) !important;
  color: var(--red) !important;
}
.speedtest-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.speedtest-stats--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.sp-metric {
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sp-metric span {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-metric b {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Журнал ядра (Live Core Log Viewer) */
.core-log-viewer {
  flex: 1;
  min-height: 280px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-family: var(--f-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Вкладка Опции: DNS-бенчмарк */
.s-row--col {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
}
.s-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.dns-bench-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.dns-bench-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s var(--ease-out);
}
.dns-bench-item:hover {
  border-color: var(--accent);
}
.dns-bench-item__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.dns-bench-item__ip {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
}
.dns-bench-item__ms {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
}

/* Модалка QR-кода и Шаринга ключа */
.cmodal__box--qr {
  max-width: 360px !important;
  text-align: center;
}
.qr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.qr-canvas-wrap {
  margin: 8px auto 12px;
  width: 220px;
  height: 220px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: #FFFFFF;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}
#qrImage {
  width: 196px;
  height: 196px;
  image-rendering: pixelated;
}

/* Кнопки закрытия соединения в списке сокетов */
.conn-close-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.conn-close-btn .ic {
  width: 12px;
  height: 12px;
}
.conn-close-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

/* ==========================================================================
   АДАПТИВНЫЙ ДИЗАЙН (RESPONSIVE WORKSPACE LAYOUT)
   ========================================================================== */

.server-list--embedded {
  max-height: calc(100vh - 300px);
  min-height: 280px;
}

.community-lists {
  max-height: calc(100vh - 304px);
  min-height: 280px;
}

.custom-rules-list {
  max-height: calc(100vh - 248px);
}

.core-log-viewer {
  height: calc(100vh - 208px);
  min-height: 320px;
}

.conn-wrap {
  max-height: calc(100vh - 224px);
  overflow-y: auto;
}

/* Встроенная панель серверов на главном экране (при растягивании окна) */
.connect-servers-dock {
  display: none;
  flex-direction: column;
  padding: 12px 16px;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.csd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

.csd-head__title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.csd-head__tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
  min-width: 220px;
}

.csd-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex: 1;
  max-width: 232px;
  transition: border-color 0.15s var(--ease-out);
}
.csd-search:focus-within {
  border-color: var(--accent);
}
.csd-search .ic {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex: none;
}
.csd-search input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 12px;
  outline: none;
}
.csd-search input::placeholder {
  color: var(--muted);
}

.server-list--home-dock {
  flex: 1;
  min-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 919px) and (min-height: 760px) {
  .connect-servers-dock {
    display: flex;
    max-height: calc(100vh - 592px);
    min-height: 168px;
  }
}

/* 3. Широкие окна и полноэкранный режим (>= 920px) */
@media (min-width: 920px) {
  .view {
    max-width: 1240px;
    padding: 16px 24px 24px;
    gap: 12px;
  }

  .view[data-view="connect"].is-active {
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(440px, 1.35fr);
    grid-template-rows: auto auto auto minmax(180px, 1fr);
    gap: 12px;
    align-items: stretch;
    height: calc(100vh - 128px);
    min-height: 540px;
  }

  .view[data-view="connect"].is-active > .hero {
    grid-column: 1;
    grid-row: 1 / 5;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 408px;
    padding: 20px;
  }

  .view[data-view="connect"].is-active > .hero .orb-wrap {
    margin: auto 0;
    padding: 16px 0;
  }

  .view[data-view="connect"].is-active > .bento-row-2 {
    grid-column: 2;
    grid-row: 1;
  }

  .view[data-view="connect"].is-active > .route-card {
    grid-column: 2;
    grid-row: 2;
  }

  .view[data-view="connect"].is-active > .quick-dock {
    grid-column: 2;
    grid-row: 3;
    align-content: start;
  }

  .view[data-view="connect"].is-active > .connect-servers-dock {
    display: flex;
    grid-column: 2;
    grid-row: 4;
    min-height: 0;
    height: 100%;
  }

  .server-list--home-dock {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    align-content: start;
  }

  .server-list--home-dock > .server-group-head,
  .server-list--home-dock > .server-more-btn,
  .server-list--home-dock > .server--empty {
    grid-column: 1 / -1;
  }

  .view[data-view="desync"] .desync-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }

  .view[data-view="desync"] .desync-status-strip {
    grid-column: 1 / -1;
  }

  .view[data-view="desync"] .preset-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .view[data-view="desync"] .desync-adv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-cat-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 12px;
  }

  .list-cat-body .list-row {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 8px 12px;
    background: var(--surface-2);
  }

  .custom-rules-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
  }

  #subsList,
  #customNodesList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 8px;
  }

  .server-list--embedded {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
    align-content: start;
  }

  .server-list--embedded > .server-group-head,
  .server-list--embedded > .server-more-btn,
  .server-list--embedded > .server--empty {
    grid-column: 1 / -1;
  }

  .drawer__panel {
    max-width: 960px;
    margin: 0 auto;
    max-height: 84vh;
  }

  #serverList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 8px;
    align-content: start;
  }

  #serverList > .server-group-head,
  #serverList > .server-more-btn,
  #serverList > .server--empty {
    grid-column: 1 / -1;
  }

  #ttabDiag:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }

  .settings-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
}

/* 4. Ультраширокие мониторы (>= 1340px) */
@media (min-width: 1340px) {
  .view {
    max-width: 1520px;
    padding: 20px 36px 28px;
  }

  .view[data-view="connect"].is-active {
    grid-template-columns: minmax(440px, 1.05fr) minmax(560px, 1.35fr);
    gap: 16px;
  }

  .view[data-view="desync"] .desync-adv-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .list-cat-body {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .server-list--embedded {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 8px;
  }

  #connList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}

/* Светлая тема: активные сегменты и тумблеры */
html[data-theme="light"] .rail__item.is-active,
html[data-theme="light"] .seg button.is-active,
html[data-theme="light"] .sort-seg button.is-active {
  background: var(--surface-1);
  border-color: var(--border-strong);
  color: var(--ink);
}

html[data-theme="light"] .toggle .track::after {
  background: #FFFFFF;
}

/* ---------- Нативный балансировщик нагрузки (tachyon-core 0.3.9) ---------- */
.balancer-dock {
  width: 100%;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balancer-dock__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.balancer-dock__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.balancer-dock__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.c-select--sm {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: var(--r-sm);
}

.balancer-telemetry {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.balancer-telemetry__head {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) minmax(110px, 1fr) minmax(90px, 0.8fr);
  gap: 8px;
  padding: 0 8px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.balancer-node-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 156px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.balancer-node-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) minmax(110px, 1fr) minmax(90px, 0.8fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}

.balancer-node-row:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.balancer-node-row.is-now {
  border-color: var(--emerald);
  background: var(--emerald-soft);
}

.balancer-node-row.is-quarantined {
  opacity: 0.6;
  border-color: var(--red);
}

.balancer-node-row__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balancer-node-row__metrics,
.balancer-node-row__load {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.proto-badge--balancer {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-2);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}




