/* VPN кабинет — единый файл стилей, без внешних зависимостей */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e2e5ea;
  --text: #1b1f27;
  --muted: #667085;
  --accent: #2459d6;
  --accent-hover: #1d4ab4;
  --accent-soft: #e8eefc;
  --ok: #1a7f4b;
  --ok-soft: #e6f4ec;
  --warn: #b26a00;
  --warn-soft: #fdf3e2;
  --danger: #c4322b;
  --danger-soft: #fbe9e8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1d222c;
    --border: #2a303c;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --accent: #6d95f3;
    --accent-hover: #8aaaf6;
    --accent-soft: #1d2a47;
    --ok: #4cc584;
    --ok-soft: #15301f;
    --warn: #f0b04a;
    --warn-soft: #34270f;
    --danger: #f0716a;
    --danger-soft: #3a1a19;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 16px; font-weight: 650; }
h2 { font-size: 17px; margin: 0 0 14px; font-weight: 650; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.inline { display: inline; margin: 0; }
.h-center { text-align: center; }

/* Шапка */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand--center { justify-content: center; width: 100%; margin-bottom: 18px; }
.brand__mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #12a37a);
  box-shadow: inset 0 0 0 5px var(--surface);
  outline: 2px solid var(--accent);
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.is-active { color: var(--accent); background: var(--accent-soft); }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who__name { font-weight: 600; }

/* Страница */
.page { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
.section { margin-top: 24px; }
.section__title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}
.crumbs { margin-bottom: 6px; font-size: 14px; }

/* Карточки */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card--narrow { max-width: 380px; margin: 0 auto; }
.card--form { max-width: 460px; }
.card--danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* Показатели */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.stats + p { margin-top: 12px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.stat__head { display: flex; align-items: center; gap: 8px; }
.stat__label { color: var(--muted); font-size: 13px; }
.stat__value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot--up { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot--warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot--down { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* Таблицы */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; }
.table tr.is-muted td { color: var(--muted); }

/* Бейджи */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge--superadmin { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; }
.form--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: start; }
.form__actions { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.field > span { font-weight: 550; }
.field small { color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=password], select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  min-height: 38px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  padding: 8px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 38px;
  text-decoration: none;
  align-self: flex-start;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(.92); }
.btn--sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn--block { width: 100%; align-self: stretch; }

/* Сообщения */
.alert {
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert--ok { background: var(--ok-soft); color: var(--ok); }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }

/* Заголовок страницы с кнопкой */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Фильтры и вкладки */
.filters { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.filters__fields { display: flex; gap: 8px; flex-wrap: wrap; }
.filters__fields input[type=search] { width: 240px; }
.filters__fields select { width: auto; min-width: 160px; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.tabs a { padding: 5px 12px; border-radius: 7px; color: var(--muted); font-size: 14px; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
}

/* Метки статуса */
.pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.mono { font-family: var(--mono); font-size: 13.5px; }
.strong { font-weight: 600; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.stat__value--sm { font-size: 18px; }
.table--compact { font-size: 13.5px; }
.table--compact th, .table--compact td { padding: 6px 8px; }
.bar-col { width: 30%; }
.bar { display: block; width: 100%; height: 8px; background: var(--surface-2); border-radius: 4px; }
.bar__fill { fill: var(--accent); }

/* Действия на карточке клиента */
.action-list { display: flex; flex-direction: column; }
.action {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.action:first-child { border-top: 0; padding-top: 0; }
.action > div { display: flex; flex-direction: column; gap: 4px; }
.action select { max-width: 280px; margin-top: 4px; }
.action .btn { flex: none; }
.action--danger strong { color: var(--danger); }

/* Конфигурация и QR */
.config-grid { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; gap: 16px; align-items: start; }
.qr-box { display: flex; justify-content: center; padding: 8px 0 12px; }
.qr { width: 280px; height: 280px; max-width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; background: #fff; border-radius: 8px; padding: 6px; }
.steps { padding-left: 20px; margin: 0; color: var(--muted); }
.steps li { margin-bottom: 4px; }
pre.config {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre;
  margin: 0 0 14px;
}
input[type=search], input[type=date] {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%;
}
input[type=search]:focus, input[type=date]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .config-grid { grid-template-columns: 1fr; }
  .action { flex-direction: column; align-items: stretch; }
  .filters__fields input[type=search] { width: 100%; }
}

/* Страница входа */
.bare__main { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.bare__main > .card { width: 100%; }

@media (max-width: 640px) {
  .topbar__inner { gap: 10px; }
  .who { margin-left: 0; width: 100%; }
  .who form { margin-left: auto; }
  .page { padding-top: 16px; }
  h1 { font-size: 21px; }
}
