/* VPN control plane — тёмная тема, без внешних зависимостей. */
:root {
  --bg: #0b0e13;
  --bg-soft: #10151c;
  --card: #141a22;
  --card-hi: #182029;
  --border: #233040;
  --border-soft: #1b232d;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #3ba55d;
  --accent-hi: #46bd6b;
  --accent-soft: #16301f;
  --warn: #e0a336;
  --warn-soft: #32280f;
  --bad: #e5534b;
  --bad-soft: #351818;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 12% -12%, #16241c 0%, transparent 62%),
    radial-gradient(900px 500px at 100% 0%, #131c2a 0%, transparent 55%),
    var(--bg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: .01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }

.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.inline { display: inline; }
.error-text { color: var(--bad); }

/* ------------------------------------------------------------------ каркас */
.app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
  background: linear-gradient(180deg, rgba(20, 26, 34, .92), rgba(11, 14, 19, .92));
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  border: 1px solid #244a32;
}
.brand em {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #c3ccd7;
  font-size: 14px;
  border: 1px solid transparent;
}
.nav-link:hover { background: #161d26; color: var(--text); text-decoration: none; }
.nav-link.active {
  background: var(--accent-soft);
  border-color: #23482f;
  color: #d8f3e0;
}
.nav-ico { width: 16px; text-align: center; color: var(--muted); }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 10px;
  border-radius: 10px;
  background: #101720;
  border: 1px solid var(--border-soft);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-hi);
  animation: pulse 2.4s infinite;
}
.live-dot.paused { background: var(--muted); animation: none; }
.live-dot.error { background: var(--bad); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(70, 189, 107, .55); }
  70% { box-shadow: 0 0 0 8px rgba(70, 189, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(70, 189, 107, 0); }
}

.content { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: rgba(11, 14, 19, .82);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(10px);
}
.topbar-title p { margin-top: 3px; font-size: 13px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page { padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 22px; }

/* ------------------------------------------------------------------ кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #2f6b45;
  background: linear-gradient(180deg, #3fae63, #328c4f);
  color: #06120a;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }

.btn.ghost {
  background: #17202b;
  border-color: var(--border);
  color: #cfd8e3;
}
.btn.ghost:hover { background: #1d2733; }
.btn.danger {
  background: linear-gradient(180deg, #e2554d, #b8413b);
  border-color: #8f322d;
  color: #1b0808;
}
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.tiny { padding: 4px 9px; font-size: 12px; border-radius: 8px; font-weight: 500; }
.btn.big { padding: 11px 22px; font-size: 15px; }

/* ------------------------------------------------------------------ карточки */
.card {
  background: linear-gradient(180deg, var(--card), #121821);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 14px 40px -32px #000;
}

.section { display: flex; flex-direction: column; gap: 14px; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head p { margin-top: 2px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }

/* ------------------------------------------------------------------ KPI */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi {
  position: relative;
  padding: 15px 17px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--card-hi), #121821);
  border: 1px solid var(--border);
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(59, 165, 93, .18), transparent 70%);
}
.kpi.warn::after { background: radial-gradient(circle, rgba(224, 163, 54, .18), transparent 70%); }
.kpi.bad::after { background: radial-gradient(circle, rgba(229, 83, 75, .18), transparent 70%); }
.kpi-label { display: block; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi-value { margin-top: 6px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.kpi-sub { margin-left: 6px; font-size: 15px; font-weight: 500; color: var(--muted); }

/* ------------------------------------------------------------------ серверы */
.servers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.server-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-hi), #111821);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
}
.server-card.tone-ok { border-left-color: var(--accent); }
.server-card.tone-warn { border-left-color: var(--warn); }
.server-card.tone-bad { border-left-color: var(--bad); }

.server-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.server-head h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 34px;
  padding: 6px 8px;
  border-radius: 9px;
  background: #0d1319;
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.spark .bar {
  flex: 1 1 6px;
  max-width: 12px;
  min-height: 4px;
  height: 100%;
  border-radius: 3px;
  background: #2a3442;
}
.spark .bar.ok { background: linear-gradient(180deg, #46bd6b, #2f7a49); }
.spark .bar.warn { background: linear-gradient(180deg, #e0a336, #8a6420); }
.spark .bar.bad { background: linear-gradient(180deg, #e5534b, #7d2c27); }

.server-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
}
.server-meta div { display: flex; flex-direction: column; }
.server-meta dt { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.server-meta dd { margin: 0; font-size: 14px; }

.server-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-note { font-size: 12px; color: var(--muted); }
.action-note.ok { color: var(--accent-hi); }
.action-note.error { color: var(--bad); }

/* ------------------------------------------------------------------ таблицы */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  background: linear-gradient(180deg, var(--card), #111821);
}
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  background: #121922;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #151d26; }
.table .actions { white-space: nowrap; }
.table .actions .btn { margin-left: 4px; }
.table-wrap.compact .table td { padding: 9px 12px; }

.empty { padding: 26px 18px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------------ бейджи */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #131b24;
  color: #c3ccd7;
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: #7ee2a0; background: var(--accent-soft); border-color: #244a32; }
.pill.warn { color: #f0c46a; background: var(--warn-soft); border-color: #4d3b16; }
.pill.bad { color: #f18b85; background: var(--bad-soft); border-color: #5a2420; }
.pill.muted { color: var(--muted); }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-family: var(--mono);
  color: #a9b6c5;
  background: #121a23;
  border: 1px solid var(--border-soft);
}

.flag { font-size: 12px; font-weight: 600; }
.flag.ok { color: #7ee2a0; }
.flag.bad { color: #f18b85; }

/* ------------------------------------------------------------------ формы */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: #b9c4d0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0e141b;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #2f6b45;
  box-shadow: 0 0 0 3px rgba(59, 165, 93, .14);
}
textarea { resize: vertical; font-family: var(--mono); font-size: 12.5px; }
select { cursor: pointer; }

.search { width: auto; min-width: 210px; padding: 7px 11px; font-size: 13px; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.form { display: flex; flex-direction: column; gap: 16px; }
.form .btn.big { align-self: flex-start; }

.settings { display: flex; flex-direction: column; gap: 22px; }
.sticky-actions {
  position: sticky;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: rgba(17, 23, 31, .94);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

/* ------------------------------------------------------------------ прочее */
.alert {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 13.5px;
  background: #121a23;
}
.alert.ok { border-color: #244a32; background: var(--accent-soft); color: #cdf3da; }
.alert.error { border-color: #5a2420; background: var(--bad-soft); color: #f7c9c6; }

.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
.steps li { counter-increment: step; display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #06120a;
  background: var(--accent-hi);
}
.steps.compact li { font-size: 12.5px; color: #c3ccd7; }

/* ------------------------------------------------------------------ тосты */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 36px));
}
.toast {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #17202b;
  color: var(--text);
  font-size: 13.5px;
  box-shadow: 0 18px 40px -22px #000;
  animation: toast-in .16s ease-out;
}
.toast.ok { border-color: #244a32; background: #14251c; }
.toast.error { border-color: #5a2420; background: #2a1616; }
.toast strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 3px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ модалка */
.modal-root[hidden] { display: none; }
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 11, .68);
  backdrop-filter: blur(3px);
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card-hi), #10161e);
  border: 1px solid var(--border);
  box-shadow: 0 40px 90px -40px #000;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal .qr { margin: 0 auto; }

/* ------------------------------------------------------------------ публичка */
.public-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 0 42px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
}
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  flex-wrap: wrap;
}
.public-nav { display: flex; gap: 18px; font-size: 13.5px; }
.public-nav a { color: var(--muted); }
.public-nav a:hover { color: var(--text); }
.public-main { display: flex; flex-direction: column; gap: 18px; padding: 8px 22px; }
.public-footer { margin-top: auto; padding: 0 22px; font-size: 12px; }

.hero h1 { font-size: 30px; letter-spacing: -.02em; }
.hero p { margin-top: 8px; max-width: 62ch; }

.qr {
  display: inline-grid;
  place-items: center;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  width: max-content;
}
.qr svg { display: block; width: 190px; height: 190px; }

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.result-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.result-side { display: flex; flex-direction: column; gap: 12px; }
.result .field { margin: 0; }

/* ------------------------------------------------------------------ адаптив */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-link { padding: 6px 9px; font-size: 13px; }
  .sidebar-foot { margin-left: auto; }
  .topbar { position: static; padding: 14px 18px; flex-wrap: wrap; }
  .page { padding: 18px 18px 48px; gap: 18px; }
  .result-body { grid-template-columns: 1fr; }
  .public-header, .public-main, .public-footer { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 640px) {
  .grid.two { grid-template-columns: 1fr; }
  .servers { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .topbar-actions { width: 100%; }
  .table td, .table th { padding: 9px 10px; }
  .hero h1 { font-size: 24px; }
  .qr svg { width: 160px; height: 160px; }
}




