/* ==========================================================================
   Quarvix Panel — дизайн-система «Журнал» (ui.css).

   Идея. Панель — рабочий журнал оператора, а не набор карточек. Структуру
   держат линии и типографика, а не рамки и фон. Цифры — главные объекты
   интерфейса: крупные, тонкие, табличные. Один акцент (известково-зелёный)
   используется только там, где нужно действие или состояние.

   Типографика: одна гарнитура для текста (системная, с Inter первым в списке)
   и одна моноширинная для адресов, ключей и значений. Шкала из шести размеров,
   без промежуточных. Веса: 400 — текст, 500 — подписи и кнопки, 600 — заголовки.

   Отступы кратны 4. Скругления: 6px у контролов, 10px у модальных окон,
   у остального 0. Тени только у модальных окон и плавающих подсказок.
   ========================================================================== */

:root {
  /* поверхности */
  --bg: #0e0f10;
  --bg-side: #0b0c0d;
  --surface: #131416;
  --surface-hi: #191b1e;
  --line: #1f2226;
  --line-2: #2b2f35;

  /* текст */
  --text: #ebe8e2;
  --text-2: #b5b2aa;
  --muted: #87847b;
  --faint: #5a5852;

  /* акцент и состояния */
  --accent: #8fd3c1;
  --accent-ink: #0e0f10;
  --accent-dim: rgba(143, 211, 193, 0.12);
  --ok: #9bd3a4;
  --warn: #dcb774;
  --danger: #dc8f7d;
  --info: #9ab8e8;

  /* шрифты */
  --font-ui: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;

  /* шкала текста */
  --t-2xs: 11px;
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 14px;
  --t-lg: 16px;
  --t-xl: 22px;
  --t-hero: 36px;

  --r-ctl: 6px;
  --r-modal: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- база ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--t-md);
  line-height: 1.55;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
::selection { background: var(--accent-dim); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #22262c; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.012em; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; font-feature-settings: normal; }
small { font-size: var(--t-xs); color: var(--muted); font-weight: 400; }

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

/* ---------- контролы ---------- */

button, .btn {
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 500;
  line-height: 1;
  padding: 9px 14px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
  white-space: nowrap;
}
button:hover { background: #b4e6d8; }
button:active { background: #7fc3b0; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--text-2);
  border-color: var(--line-2);
}
button.secondary:hover { background: var(--surface-hi); color: var(--text); border-color: #3a414a; }
button.danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(230, 128, 110, 0.35);
}
button.danger:hover { background: rgba(230, 128, 110, 0.08); border-color: var(--danger); color: #f3a093; }

/* текстовые действия: ссылки-кнопки внутри таблиц и карточек */
.link-btn, .nd-btn {
  background: transparent;
  color: var(--text-2);
  border: 0;
  padding: 6px 8px;
  margin: 0;
  font-size: var(--t-sm);
  font-weight: 500;
  border-radius: 4px;
}
.link-btn:hover, .nd-btn:hover { background: var(--surface-hi); color: var(--text); }
.link-btn.danger, .nd-btn-danger { color: var(--danger); background: transparent; }
.link-btn.danger:hover, .nd-btn-danger:hover { background: rgba(230, 128, 110, 0.08); color: #f3a093; }
.nd-btn-primary { color: var(--accent); background: transparent; }
.nd-btn-primary:hover { background: var(--accent-dim); color: var(--accent); }
.nd-btn-ghost { color: var(--text-2); }
.nd-submit { background: var(--accent); color: var(--accent-ink); }

input, textarea, select {
  font: inherit;
  font-size: var(--t-md);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  padding: 8px 11px;
  min-width: 0;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover, select:hover { border-color: #3a414a; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #6d7a3a; background: var(--surface); }
input:disabled, select:disabled { opacity: 0.5; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"] { width: 15px; height: 15px; padding: 0; accent-color: var(--accent); }
select { cursor: pointer; }
textarea { font-family: var(--font-mono); font-size: var(--t-xs); line-height: 1.6; }

/* подпись поля: маленькая, без рамки */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span {
  font-size: var(--t-2xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select { width: 100%; }
.field-action { justify-content: flex-end; }
.field-action button { width: auto; }
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 16px 20px;
  margin-bottom: 20px;
}
.port-input { width: 96px; font-variant-numeric: tabular-nums; }

/* фильтры-вкладки (внутри раздела «Пользователи») — подчёркнутые */
.tab-btn {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  padding: 8px 2px;
  margin-right: 18px;
  font-weight: 500;
}
.tab-btn:hover { background: transparent; color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- подсказки, ошибки, заголовки блоков ---------- */

.hint { color: var(--muted); font-size: var(--t-sm); margin: 0 0 20px; max-width: 72ch; line-height: 1.6; }
.error { color: var(--danger); font-size: var(--t-sm); }
.nd-error { color: var(--danger); font-size: var(--t-sm); margin: 12px 0 0; }
.nd-error.hidden { display: none; }
code { background: var(--surface-hi); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }

.panel-title { font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.panel-sub { font-size: var(--t-xs); color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* ---------- оболочка ---------- */

#app { min-height: 100vh; }
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 16px 20px 20px;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 8px; }
.brand-mark { display: none; }
.brand-name { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; color: var(--text); }
.brand-sub { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--faint); letter-spacing: 0.04em; }

.side-label {
  font-size: var(--t-2xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 8px 10px;
}
.side-nav { display: flex; flex-direction: column; gap: 1px; counter-reset: navn; }
.side .tab-btn {
  counter-increment: navn;
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: var(--t-sm);
  font-weight: 500;
  text-align: left;
  position: relative;
}
.side .tab-btn svg { display: none; }
.side .tab-btn::before {
  content: counter(navn, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--faint);
  width: 16px;
  flex: none;
}
.side .tab-btn:hover { background: transparent; color: var(--text); }
.side .tab-btn.active { color: var(--text); background: transparent; }
.side .tab-btn.active::before { color: var(--accent); }
.side .tab-btn.active::after {
  content: "";
  position: absolute;
  left: -20px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--accent);
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.side-card { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.side-card .avatar-lg {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-hi);
  color: var(--text-2);
  font-size: var(--t-xs);
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none;
}
.side-card .who { font-size: var(--t-sm); font-weight: 500; }
.side-card .who-sub { font-size: var(--t-2xs); color: var(--faint); }
.side-foot button#logoutBtn {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 6px 8px;
  justify-content: flex-start;
  text-align: left;
  width: fit-content;
}
.side-foot button#logoutBtn:hover { color: var(--text); background: transparent; }

.main { min-width: 0; padding: 36px 48px 80px; }
.main .tab-panel { max-width: 1180px; margin: 0 auto; }

/* ---------- страница ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.page-sub { color: var(--muted); font-size: var(--t-sm); margin: 0; max-width: 64ch; }
.page-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.tab-panel > h2 {
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.tab-panel > h2 small { font-size: var(--t-xs); margin-left: 8px; }

/* разделы внутри страницы: линия сверху, заголовок мелким капсом */
.card, .panel, .nd-sites {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 24px 0 0;
  margin: 0 0 40px;
}
.card > h2, .panel > .panel-head + * { margin-top: 0; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}
.live-pill.is-on { color: var(--text-2); }
.live-pill.is-on i { background: var(--ok); box-shadow: 0 0 0 3px rgba(134, 208, 159, 0.14); }
.live-pill.is-off { color: var(--danger); }
.live-pill.is-off i { background: var(--danger); }

/* сегментированный переключатель периода — подчёркнутый */
.seg { display: inline-flex; gap: 16px; border-bottom: 1px solid var(--line); }
.seg button {
  background: transparent;
  color: var(--muted);
  padding: 0 0 9px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  font-weight: 500;
}
.seg button:hover { background: transparent; color: var(--text); }
.seg button.active { color: var(--text); border-bottom-color: var(--accent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); display: inline-block; }
.badge-ok .dot { background: var(--ok); }
.badge-bad .dot { background: var(--danger); }
.badge-warn .dot { background: var(--warn); }
.badge-accent .dot { background: var(--accent); }
.badge-muted .dot { background: var(--faint); }
.badge-ok { color: var(--ok); }
.badge-bad { color: var(--danger); }
.badge-accent { color: var(--accent); }
.badge-muted { color: var(--muted); }
.badge.off { color: var(--faint); }
.badge.off .dot { background: var(--faint); }
.badge:not(:has(.dot)) { color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- таблицы ---------- */

.table-wrap { overflow-x: auto; margin: 0 -2px; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td {
  text-align: left;
  vertical-align: middle;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-size: var(--t-2xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 0;
  padding-bottom: 10px;
  border-bottom-color: var(--line-2);
}
td { color: var(--text-2); font-variant-numeric: tabular-nums; }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }
tbody tr { transition: background 0.12s var(--ease); }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
td.mono { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--muted); }
.disabled-row td { color: var(--faint); }
.empty-cell { color: var(--faint); text-align: center; padding: 32px 12px !important; }
.actions-cell, .row-actions { text-align: right; }
.row-actions { display: inline-flex; gap: 2px; }
.table-wrap td .badge + .badge { margin-left: 10px; }

/* полоса трафика пользователя */
.traffic-bar {
  height: 2px;
  background: var(--line-2);
  margin-top: 8px;
  width: 140px;
  border-radius: 1px;
  overflow: hidden;
}
.traffic-bar > span { display: block; height: 100%; background: var(--accent); }
.traffic-bar.warn > span { background: var(--warn); }
.traffic-bar.danger > span { background: var(--danger); }

/* ---------- KPI: полоса с разделителями, без карточек ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}
.kpi {
  padding: 22px 24px 20px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-head { display: block; }
.kpi-label {
  font-size: var(--t-2xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.kpi-icon { display: none; }
.kpi-value {
  font-size: var(--t-hero);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.kpi-value small {
  font-size: var(--t-md);
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 6px;
}
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 26px; }
.kpi-note { font-size: var(--t-xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-spark { width: 88px; height: 26px; flex: none; }
.kpi-spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.node-bars { display: flex; gap: 3px; align-items: flex-end; height: 26px; }
.node-bars span { width: 6px; height: 100%; background: var(--ok); border-radius: 1px; opacity: 0.85; }
.node-bars span.off { background: var(--danger); }

/* ---------- обзор: график и сетка ---------- */

.grid-chart { padding-top: 0; border-top: 0; }
.grid-chart .panel-head { margin-bottom: 4px; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0 26px;
}
.stat { padding: 0 20px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat-label { font-size: var(--t-xs); color: var(--muted); }
.stat-value { font-size: var(--t-lg); font-weight: 500; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chart { position: relative; width: 100%; height: 300px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 1 4; }
.chart .axis text { fill: var(--faint); font-size: 11px; font-family: var(--font-mono); }
.chart .area { fill: url(#ovArea); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .cursor { stroke: var(--line-2); stroke-width: 1; }
.chart .dot { fill: var(--bg); stroke: var(--accent); stroke-width: 1.5; }
.ov-tip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  background: var(--surface-hi);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: var(--t-xs);
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s var(--ease);
  font-variant-numeric: tabular-nums;
}
.ov-tip b { display: block; color: var(--text); font-size: var(--t-sm); font-weight: 600; margin-bottom: 1px; }
.ov-tip.is-visible { opacity: 1; }
.ov-empty { min-height: 96px; display: grid; place-items: center; color: var(--faint); font-size: var(--t-sm); text-align: center; padding: 12px; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 0 56px;
  margin-bottom: 0;
  align-items: start;
}
.grid-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 56px;
  align-items: start;
}
.grid-2 > .panel, .grid-3 > .panel, .stack-col > .panel { margin-bottom: 40px; }
.stack-col { display: flex; flex-direction: column; min-width: 0; }
.stack-col > .panel { margin: 0 0 40px; }

/* онлайн: строки таблицы */
.online-list { display: flex; flex-direction: column; }
.online-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 96px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.online-row:last-child { border-bottom: 0; }
.online-row:hover .who-name { color: var(--accent); }
.online-row .who-name { font-size: var(--t-md); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); transition: color 0.12s; }
.online-row .who-id { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--faint); margin-top: 1px; }
.speed-cell { min-width: 0; }
.speed-val { font-size: var(--t-sm); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.speed-track { height: 2px; background: var(--line-2); margin-top: 8px; border-radius: 1px; overflow: hidden; }
.speed-fill { height: 100%; background: var(--accent); transition: width 0.5s var(--ease); }
.seen { font-size: var(--t-xs); color: var(--faint); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.seen.fresh { color: var(--ok); }
.online-foot { padding-top: 14px; }
.link-btn.wide { display: block; }
.node-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--t-2xs);
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ноды в обзоре: строки */
.node-list { display: flex; flex-direction: column; }
.node-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  background: none;
}
.node-card:last-child { border-bottom: 0; }
.node-card.is-off { opacity: 0.5; }
.node-ico { display: flex; align-items: center; gap: 10px; min-width: 0; grid-column: 1; }
.node-ico svg { display: none; }
.node-ico .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; position: static; border: 0; }
.node-ico .pulse.off { background: var(--danger); }
.node-card > div:nth-child(2) { min-width: 0; grid-column: 1; }
.node-name { font-size: var(--t-md); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.node-meta { font-size: var(--t-xs); color: var(--faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-right { text-align: right; grid-column: 2; grid-row: 1 / span 2; }
.node-speed { font-size: var(--t-md); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.node-sess { font-size: var(--t-xs); color: var(--faint); margin-top: 2px; white-space: nowrap; }

/* лента подключений */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
  color: var(--muted);
}
.feed-item:last-child { border-bottom: 0; }
.feed-dot { width: 6px; height: 6px; border-radius: 50%; transform: translateY(-1px); }
.feed-dot.in { background: var(--ok); }
.feed-dot.out { background: var(--faint); }
.feed-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-text b { color: var(--text); font-weight: 500; }
.feed-node { color: var(--text-2); font-family: var(--font-mono); font-size: var(--t-xs); }
.feed-time { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--faint); white-space: nowrap; }

/* топ: ранжированный список */
.top-list { display: flex; flex-direction: column; }
.top-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.top-row:last-child { border-bottom: 0; }
.top-rank { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--faint); font-variant-numeric: tabular-nums; }
.top-main { min-width: 0; }
.top-name { font-size: var(--t-md); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.top-track { height: 2px; background: var(--line-2); margin-top: 8px; border-radius: 1px; overflow: hidden; }
.top-fill { height: 100%; background: var(--accent); transition: width 0.5s var(--ease); }
.top-val { font-size: var(--t-sm); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }

/* доля нод: одна полоса вместо кольца */
.share-bar { display: flex; height: 6px; gap: 2px; margin-bottom: 22px; }
.share-bar span { height: 100%; transition: width 0.4s var(--ease); border-radius: 1px; }
.donut-wrap { display: flex; flex-direction: column; gap: 0; }
.donut { display: none; }
.donut-center { display: none; }
.legend { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.legend-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto 44px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
}
.legend-row:last-child { border-bottom: 0; }
.legend-row i { width: 8px; height: 8px; border-radius: 1px; }
.legend-row .ln { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.legend-row .lv { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-row .lp { color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; font-size: var(--t-xs); }

/* сводка пользователей */
.users-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}
.us-item { padding: 0 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.us-item:first-child { padding-left: 0; border-left: 0; }
.us-label { font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.us-value { font-size: var(--t-xl); font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.us-green { color: var(--ok); }
.us-track { height: 2px; background: var(--line-2); border-radius: 1px; overflow: hidden; }
.us-fill { height: 100%; background: var(--accent); transition: width 0.5s var(--ease); }
.us-foot { font-size: var(--t-xs); color: var(--faint); margin-top: 12px; }

/* ---------- ноды ---------- */

.nd-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}
.nd-stat { padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; }
.nd-stat + .nd-stat { border-left: 1px solid var(--line); }
.nd-stat-v { font-size: var(--t-xl); font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.nd-stat-v.ok { color: var(--ok); }
.nd-stat-v.warn { color: var(--warn); }
.nd-stat-l { font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* сервер — строка таблицы, не карточка */
.nd-grid { display: flex; flex-direction: column; }
.nd-empty {
  padding: 40px 0;
  color: var(--faint);
  font-size: var(--t-sm);
  line-height: 1.6;
  max-width: 56ch;
}
.nd-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 28px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  background: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  position: relative;
}
.nd-card:last-child { border-bottom: 0; }
.nd-card::before { display: none; }
.nd-card.is-off { opacity: 0.55; }
.nd-head { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.nd-ident { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.nd-id { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--faint); background: none; border: 0; padding: 0; }
.nd-name { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd-loc { font-size: var(--t-xs); color: var(--muted); margin-top: 2px; }
.nd-head .badge { margin-left: auto; }
.nd-facts { display: flex; gap: 28px; margin: 0; min-width: 0; }
.nd-facts div { display: flex; flex-direction: column; gap: 3px; min-width: 0; background: none; border: 0; padding: 0; }
.nd-facts dt { font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); font-weight: 500; }
.nd-facts dd { margin: 0; color: var(--text-2); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd-facts .mono { font-family: var(--font-mono); font-size: var(--t-xs); }
.nd-section, .nd-label, .nd-chips { display: none; }
.nd-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  margin: 0;
  flex-wrap: nowrap;
}
.nd-actions .nd-btn, .nd-actions .nd-btn-ghost { padding: 6px 8px; }

/* форма добавления и модалки */
.nd-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 22px;
  margin-bottom: 18px;
}
.nd-form-grid-1 { grid-template-columns: minmax(0, 1fr); }
.nd-form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.nd-submit { margin-left: auto; }

.nd-site-add { display: flex; gap: 10px; margin-bottom: 8px; }
.nd-site-add input { flex: 1; }
.site-list { display: flex; flex-direction: column; }
.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: none;
  border-radius: 0;
}
.site-row:last-child { border-bottom: 0; }
.site-row.is-off { opacity: 0.5; }
.site-host { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: var(--t-sm); color: var(--text); }
.site-lat { font-size: var(--t-xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.site-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }

/* переключатель */
.pm-switch { position: relative; display: inline-block; width: 30px; height: 16px; flex: none; }
.pm-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.pm-switch span {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--line-2);
  transition: background 0.2s var(--ease);
  cursor: pointer;
}
.pm-switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.pm-switch input:checked + span { background: var(--accent-dim); }
.pm-switch input:checked + span::after { transform: translateX(14px); background: var(--accent); }
.pm-switch input:focus-visible + span { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.pm-switch.sm { width: 26px; height: 14px; }
.pm-switch.sm span::after { width: 10px; height: 10px; }
.pm-switch.sm input:checked + span::after { transform: translateX(12px); }

/* ---------- протоколы ---------- */

.pr-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 40px; }
.pr-card { margin: 0 0 48px; padding-top: 24px; }
.pr-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pr-title { font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.pr-sub { font-size: var(--t-xs); color: var(--faint); margin-top: 4px; }
.pr-platforms { display: flex; gap: 20px; flex-wrap: wrap; }
.pr-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
  padding: 14px 0 0;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.pr-preview > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pr-label { font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.pr-none { font-size: var(--t-xs); color: var(--faint); }
.pr-dirty { font-size: var(--t-xs); color: var(--warn); margin-right: auto; }
.pr-dirty.hidden { display: none; }
.pr-card .pm-foot { align-items: center; margin-top: 16px; }

/* матрица протоколов: строки таблицы */
.pm-rows { display: flex; flex-direction: column; margin: 12px 0 0; }
.pm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px 56px;
  align-items: center;
  gap: 20px;
  padding: 16px 0 16px 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
  background: none;
  border-radius: 0;
}
.pm-row:last-child { border-bottom: 0; }
.pm-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: transparent;
}
.pm-row.is-on::before { background: var(--accent); }
.pm-title { font-size: var(--t-md); font-weight: 500; color: var(--text); }
.pm-meta { font-size: var(--t-xs); color: var(--faint); margin-top: 3px; }
.pm-port { display: flex; align-items: center; gap: 8px; }
.pm-port input { width: 88px; font-family: var(--font-mono); font-size: var(--t-sm); padding: 6px 9px; }
.pm-fixed { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--faint); white-space: nowrap; }
.pm-site { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pm-site select { min-width: 240px; font-size: var(--t-sm); padding: 6px 9px; }
.pm-toggle-cell { display: flex; justify-content: flex-end; }
.pm-keys { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--faint); margin: 14px 0 0; word-break: break-all; line-height: 1.6; }
.pm-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; align-items: center; }
.pm-foot button { min-width: 0; }

/* ---------- страницы: таблицы-формы (тарифы, пользователи, интеграции) ---------- */

.tariff-form input, .tariff-form select { width: 100%; }
#tab-users .form-row:first-of-type { align-items: flex-end; }
#tab-users .form-row input { min-width: 180px; }
#usersFilterRow { margin-bottom: 8px; border-bottom: 1px solid var(--line); gap: 0; }
.upd-enable-row { display: flex; align-items: center; gap: 10px; font-size: var(--t-sm); color: var(--text-2); margin-bottom: 24px; cursor: pointer; }
.btn-download, a.link-btn { color: var(--accent); text-decoration: none; }
.btn-download { display: inline-block; padding: 8px 0; font-size: var(--t-sm); }
.btn-download:hover { text-decoration: underline; }

/* ---------- модальные окна ---------- */

.modal, .pm-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 5, 7, 0.72);
  animation: ov-fade 0.14s var(--ease);
}
@keyframes ov-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-content, .pm-dialog {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-side);
  border: 1px solid var(--line-2);
  border-radius: var(--r-modal);
  padding: 28px 28px 24px;
  box-shadow: 0 28px 70px -24px rgba(0, 0, 0, 0.7);
  animation: ov-rise 0.18s var(--ease);
}
.pm-dialog.pm-narrow { width: min(560px, 100%); }
@keyframes ov-rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
body.pm-lock { overflow: hidden; }
.pm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.pm-close {
  background: transparent;
  color: var(--muted);
  border: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border-radius: 4px;
  flex: none;
}
.pm-close:hover { background: var(--surface-hi); color: var(--text); }
.modal-content h3 { font-size: var(--t-lg); margin-bottom: 16px; }
.modal-content textarea { width: 100%; margin-bottom: 8px; }
.modal-content > label { display: block; font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-close { margin-top: 12px; }

/* окно установки: команда */
.join-box {
  padding: 16px 18px;
  background: #07080a;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ctl);
  overflow-x: auto;
}
.join-cmd {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--accent);
  white-space: nowrap;
  user-select: all;
}
.join-steps { margin: 18px 0 0; padding-left: 18px; color: var(--muted); font-size: var(--t-sm); line-height: 1.8; }

/* ---------- вход ---------- */

.login-card {
  width: min(360px, calc(100% - 40px));
  margin: 18vh auto 0;
  padding: 0;
  background: none;
  border: 0;
}
.login-card h1 { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.02em; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: var(--t-sm); margin-bottom: 28px; }
.login-card input { width: 100%; margin-bottom: 10px; }
.login-card button { width: 100%; padding: 11px 14px; }
.login-card .error { margin-top: 12px; min-height: 18px; }

/* ---------- адаптив ---------- */

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .nd-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nd-stat:nth-child(3) { border-left: 0; }
  .nd-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .grid-2 > .stack-col { margin-top: 8px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .side-label, .side-foot { display: none; }
  .brand { flex: none; }
  .side-nav { flex-direction: row; gap: 4px; flex-wrap: nowrap; }
  .side .tab-btn { width: auto; white-space: nowrap; padding: 6px 10px; }
  .side .tab-btn::before { display: none; }
  .side .tab-btn.active::after { display: none; }
  .side .tab-btn.active { background: var(--surface); }
  .main { padding: 24px 20px 64px; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .nd-card { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .nd-head .badge { margin-left: 0; }
  .nd-actions { flex-wrap: wrap; }
  .pm-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pm-row .pm-port-cell { grid-column: 1 / -1; order: 3; }
  .pm-row .pm-toggle-cell { order: 2; }
  .pm-site select { min-width: 0; width: 100%; }
  .pr-preview { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .site-row { grid-template-columns: minmax(0, 1fr) auto; }
  .site-lat { grid-column: 1 / -1; }
  .nd-site-add { flex-direction: column; }
  .nd-form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .online-row { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .online-row .node-cell, .online-row .speed-cell { display: none; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi + .kpi { border-left: 0; }
  .kpi { padding: 18px 0; }
  .kpi + .kpi { border-top: 1px solid var(--line); }
  .kpi-value { font-size: 30px; }
  .nd-form-grid { grid-template-columns: minmax(0, 1fr); }
  .nd-submit { margin-left: 0; width: 100%; }
  .chart { height: 230px; }
  .nd-facts { flex-wrap: wrap; gap: 14px 24px; }
  .page-title { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* строка сервера: шапка и факты слева, действия справа в две строки */
.nd-card { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 32px; align-items: start; }
.nd-card > .nd-head { grid-column: 1; grid-row: 1; }
.nd-card > .nd-facts { grid-column: 1; grid-row: 2; }
.nd-card > .nd-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; justify-content: flex-end; flex-wrap: wrap; max-width: 380px; }
.nd-head { justify-content: space-between; }
.nd-ident { flex: 1; min-width: 0; }
.nd-loc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd-head .badge { flex: none; }
@media (max-width: 900px) {
  .nd-card { grid-template-columns: minmax(0, 1fr); }
  .nd-card > .nd-actions { grid-column: 1; grid-row: 3; justify-content: flex-start; max-width: none; }
}

/* предпросмотр подписки: plain text, не поля ввода */
.pr-preview .node-chip { border: 0; padding: 0; color: var(--text); font-size: var(--t-sm); }
.pr-preview .node-chip + .node-chip { margin-left: 0; }

/* отступ между формой и таблицей в разделах */
.form-grid + .table-wrap, .form-row + .table-wrap { margin-top: 36px; }
.form-grid + .form-row, .form-row + .form-row { margin-top: 4px; }
.field-action button { align-self: flex-end; }
/* модалки появляются сразу: без анимации входа */
.modal, .pm-overlay, .modal-content, .pm-dialog { animation: none; }

/* основная кнопка — светлая, акцент остаётся для данных и активных состояний */
button { background: #ebe8e2; color: #0e0f10; }
button:hover { background: #ffffff; }
button:active { background: #cfccc4; }
.nd-submit { background: #ebe8e2; color: #0e0f10; }
.nd-submit:hover { background: #ffffff; }
.nd-btn-primary { color: var(--accent); }

/* композиция: плотнее шапка и ритм между блоками обзора */
.page-head { padding-bottom: 18px; margin-bottom: 24px; }
.kpi-grid { margin-bottom: 32px; }
.grid-chart .panel-title { font-size: 15px; }
.grid-chart .stats-row { margin: 18px 0 22px; }

/* ---------- таблицы без сжатия: переносы внутри ячеек, никакого горизонтального скролла ---------- */
.main th, .main td { white-space: normal; }
.main .table-wrap { overflow-x: visible; }
.main table { min-width: 0; table-layout: auto; }
.main td .badge, .main td button, .main td select, .main td .link-btn, .main th { white-space: nowrap; }
.main td .u-meta { white-space: nowrap; }
.main td .mono { white-space: nowrap; }

/* пользователи: пять смысловых колонок вместо десяти */
.u-who, .u-sub { min-width: 0; }
.u-name { display: block; color: var(--text); font-weight: 500; font-size: var(--t-md); line-height: 1.35; }
.u-meta { display: block; margin-top: 3px; font-size: var(--t-xs); color: var(--faint); line-height: 1.4; }
.u-traffic { min-width: 150px; }
.u-traffic .traffic-bar { width: 130px; margin-top: 7px; }
.u-state { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.u-actions { min-width: 320px; }
.u-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.u-row + .u-row { margin-top: 7px; }
.u-row select { width: 176px; padding: 6px 8px; font-size: var(--t-sm); }
.u-row input[type="number"] { width: 76px; padding: 6px 8px; font-size: var(--t-sm); }
.u-row button { padding: 6px 11px; font-size: var(--t-xs); }
.u-row-quiet { gap: 2px; }
.u-row-quiet .link-btn { padding: 4px 7px; font-size: var(--t-xs); }
#tab-users td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; }

/* ширина: при 1024–1180 px сайдбар уже, поля меньше, таблица помещается без сжатия */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 208px minmax(0, 1fr); }
  .side { padding: 22px 12px 18px 16px; }
  .main { padding: 28px 28px 64px; }
  .u-row select { width: 150px; }
  .u-actions { min-width: 0; }
}
.u-actions { min-width: 0; }
.u-traffic { min-width: 0; }
#tab-users table th:nth-child(4), #tab-users table td:nth-child(4) { width: 96px; }
.side .tab-btn { white-space: normal; line-height: 1.35; }

/* тарифы: четыре колонки вместо восьми, условия в две строки */
#tab-tariffs .t-name { width: 34%; }
#tab-tariffs .t-terms { width: 38%; }
#tab-tariffs .t-actions { text-align: right; white-space: nowrap; }
#tab-tariffs tbody tr td { padding-top: 14px; padding-bottom: 14px; vertical-align: top; }
#tab-tariffs .t-actions .link-btn { padding: 4px 7px; }
.pr-autoflag { display: block; margin-top: 6px; font-size: var(--t-xs); color: var(--muted); }

/* ---------- внешние серверы ---------- */
.ext-summary { font-size: var(--t-sm); color: var(--muted); }
.ext-add { border-top: 1px solid var(--line); padding-top: 24px; margin-bottom: 32px; }
.ext-add-head { margin-bottom: 14px; }
.ext-add textarea { width: 100%; font-family: var(--font-mono); font-size: var(--t-sm); resize: vertical; min-height: 96px; }
.ext-add-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 12px; }
.ext-add-foot .nd-error { margin: 0; max-width: 60ch; }
.ext-order { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 32px; flex-wrap: wrap; }
.ext-seg { display: inline-flex; gap: 20px; }
.ext-seg button { background: transparent; color: var(--muted); border: 0; border-bottom: 1.5px solid transparent; border-radius: 0; padding: 6px 0; font-weight: 500; }
.ext-seg button:hover { background: transparent; color: var(--text); }
.ext-seg button.active { color: var(--text); border-bottom-color: var(--accent); }
.ext-toolbar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.ext-count { font-size: var(--t-sm); color: var(--muted); font-weight: 400; margin-left: 8px; }
.ext-list { display: flex; flex-direction: column; }
.ext-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 8px 24px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.ext-row.is-off { opacity: 0.55; }
.ext-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ext-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ext-name { font-size: var(--t-md); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ext-url { font-size: var(--t-xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ext-err { font-size: var(--t-xs); color: var(--danger); }
.ext-meta { display: flex; flex-direction: column; font-size: var(--t-xs); color: var(--muted); }
.ext-num { font-size: var(--t-lg); color: var(--text); font-variant-numeric: tabular-nums; font-weight: 300; }
.ext-when { color: var(--faint); margin-top: 2px; }
.ext-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; flex-wrap: wrap; }
.ext-servers { grid-column: 1 / -1; margin-top: 4px; padding: 6px 0 0 0; border-top: 1px dashed var(--line-2); }
.ext-srv { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.ext-srv:last-child { border-bottom: 0; }
.ext-proto { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ext-srv-name { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ext-srv-host { color: var(--faint); font-size: var(--t-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ext-loading { color: var(--faint); font-size: var(--t-sm); padding: 8px 0; }
@media (max-width: 900px) {
  .ext-row { grid-template-columns: minmax(0, 1fr); }
  .ext-meta { flex-direction: row; gap: 10px; }
  .ext-actions { justify-content: flex-start; }
  .ext-srv { grid-template-columns: 56px minmax(0, 1fr); }
  .ext-srv-host { grid-column: 2; }
}

/* ---------- пользователи: сегменты, таблица, карточка клиента ---------- */
.us-search { width: 280px; }
.us-create { display: none; border-top: 1px solid var(--line); padding: 20px 0 8px; margin-bottom: 20px; }
.us-create.is-open { display: block; }
.us-create .form-row { margin: 0; align-items: flex-end; }
.us-segments { display: flex; flex-wrap: wrap; gap: 4px 22px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.us-seg { background: transparent; color: var(--muted); border: 0; border-bottom: 1.5px solid transparent; border-radius: 0; padding: 10px 0 9px; font-weight: 500; }
.us-seg span { font-family: var(--font-mono); font-size: var(--t-2xs); color: var(--faint); margin-left: 4px; }
.us-seg:hover { background: transparent; color: var(--text); }
.us-seg.is-on { color: var(--text); border-bottom-color: var(--accent); }
.us-seg.is-on span { color: var(--accent); }
.us-table { width: 100%; }
.us-table th:first-child, .us-table td:first-child { padding-left: 0; }
.us-table th { padding-top: 14px; }
.us-row { cursor: pointer; }
.us-row td { padding: 14px 12px; vertical-align: middle; }
.us-row:hover td { background: rgba(255, 255, 255, 0.02); }
.us-row.is-open td { background: rgba(143, 211, 193, 0.05); }
.us-cell-name { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.us-letter { width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none; border: 1px solid var(--line-2); border-radius: 6px; font-weight: 600; font-size: var(--t-sm); color: var(--text-2); background: var(--surface-hi); }
.us-letter.big { width: 42px; height: 42px; font-size: var(--t-lg); }
.us-id { display: flex; flex-direction: column; min-width: 0; }
.us-id b { font-weight: 500; color: var(--text); }
.us-id small { color: var(--faint); font-size: var(--t-xs); margin-top: 1px; }
.us-online { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: middle; }
.us-cell-tariff { color: var(--text-2); }
.us-cell-traffic { min-width: 150px; }
.us-cell-traffic span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.us-cell-traffic em { font-style: normal; color: var(--faint); }
.us-bar { height: 2px; background: var(--line-2); margin-top: 8px; width: 120px; border-radius: 1px; overflow: hidden; }
.us-bar i { display: block; height: 100%; background: var(--accent); }
.us-bar.is-hot { background: var(--danger); }
.us-cell-term { min-width: 130px; }
.us-cell-term b { display: block; font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }
.us-cell-term small { display: block; color: var(--faint); font-size: var(--t-xs); margin-top: 2px; }
.us-cell-term small.is-warn { color: var(--warn); }
.us-cell-term small.is-bad { color: var(--danger); }
.us-status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-xs); color: var(--muted); white-space: nowrap; }
.us-status::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--faint); }
.us-status.s-active { color: var(--ok); } .us-status.s-active::before { background: var(--ok); }
.us-status.s-expiring { color: var(--warn); } .us-status.s-expiring::before { background: var(--warn); }
.us-status.s-expired, .us-status.s-limit { color: var(--danger); } .us-status.s-expired::before, .us-status.s-limit::before { background: var(--danger); }
.us-cell-go { color: var(--faint); font-size: var(--t-lg); text-align: right; width: 28px; }
.us-empty { padding: 36px 0; text-align: center; color: var(--faint); }
.us-table td.us-empty { padding: 36px 0; }

/* карточка клиента: выезжает справа */
.us-card { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--bg-side); border-left: 1px solid var(--line-2); transform: translateX(104%); transition: transform 0.22s var(--ease); z-index: 70; overflow-y: auto; }
.us-card.is-open { transform: none; }
.us-scrim { position: fixed; inset: 0; background: rgba(4, 5, 7, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease); z-index: 65; }
.us-scrim.is-open { opacity: 1; pointer-events: auto; }
#usCardBody { padding: 24px 26px 40px; }
.uc-head { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 20px; border-bottom: 1px solid var(--line); position: relative; }
.uc-title { min-width: 0; flex: 1; }
.uc-title h3 { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }
.uc-title p { margin: 0; font-size: var(--t-xs); color: var(--muted); }
.uc-note { margin-top: 6px !important; color: var(--text-2) !important; }
.uc-close { position: absolute; right: 0; top: 0; background: transparent; color: var(--muted); border: 0; font-size: 22px; line-height: 1; padding: 2px 6px; }
.uc-close:hover { color: var(--text); background: transparent; }
.uc-sec { padding: 20px 0; border-bottom: 1px solid var(--line); }
.uc-sec:last-child { border-bottom: 0; }
.uc-label { font-size: var(--t-2xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; font-weight: 500; }
.uc-term { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.uc-term b { font-size: var(--t-xl); font-weight: 400; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.uc-term span { color: var(--muted); font-size: var(--t-sm); }
.uc-extend { display: flex; flex-wrap: wrap; gap: 6px; }
.uc-extend button { background: transparent; color: var(--text-2); border: 1px solid var(--line-2); padding: 7px 11px; font-weight: 500; }
.uc-extend button:hover { color: var(--accent); border-color: var(--accent); background: transparent; }
.uc-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.uc-row:first-of-type { margin-top: 0; }
.uc-row select, .uc-row input { flex: 1; min-width: 150px; }
.uc-row button.ghost, .uc-danger button.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line-2); }
.uc-row button.ghost:hover { color: var(--text); background: transparent; }
.uc-danger button.danger { background: transparent; color: var(--danger); border: 1px solid rgba(220, 143, 125, 0.35); }
.uc-danger button.danger:hover { background: rgba(220, 143, 125, 0.08); }
.uc-traffic { margin: 14px 0 0; font-size: var(--t-sm); color: var(--text-2); }
.uc-traffic .us-bar { width: 100%; }
.uc-link { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 14px; }
.uc-link > span { font-size: var(--t-xs); color: var(--muted); }
.uc-link input { font-family: var(--font-mono); font-size: var(--t-xs); padding: 7px 9px; width: 100%; }
.uc-copy { justify-self: start; background: transparent; color: var(--accent); border: 0; padding: 0; font-weight: 500; font-size: var(--t-xs); }
.uc-copy:hover { background: transparent; text-decoration: underline; }
.uc-loading { color: var(--faint); font-size: var(--t-sm); }
@media (max-width: 900px) {
  .us-search { width: 100%; }
  .us-table thead { display: none; }
  .us-table td { display: block; padding: 6px 0 !important; }
  .us-cell-go { display: none; }
}
