/* alovpn theme styles */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  /* `--font-serif` оставляем как алиас для совместимости со старыми классами,
     но указывает на тот же sans, что и тело текста. Чтобы заголовок выделялся,
     используем --weight + tighter letter-spacing, а не другой шрифт. */
  --font-serif: var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --bg: #ffffff;
  --bg-elev: #ffffff;
  /* Шелл — еле уловимый прохладно-серый, чтобы белые карточки на нём
     "жили" без жёстких border'ов. Достаточно тонко, чтобы не читался
     как "серый фон". */
  --bg-subtle: oklch(0.984 0.003 250);
  --bg-muted: oklch(0.965 0.005 250);
  --border: oklch(0.92 0.005 250);
  --border-strong: oklch(0.84 0.008 250);
  --text: oklch(0.22 0.01 250);
  --text-muted: oklch(0.50 0.01 250);
  --text-soft: oklch(0.65 0.008 250);
  --accent: oklch(0.55 0.14 235);
  --accent-soft: oklch(0.96 0.025 235);
  --accent-contrast: #ffffff;
  --positive: oklch(0.60 0.13 160);
  --warning: oklch(0.70 0.14 75);
  --danger: oklch(0.60 0.17 25);

  --shadow-xs: 0 1px 2px oklch(0.20 0.01 250 / 0.04);
  --shadow-sm: 0 1px 2px oklch(0.20 0.01 250 / 0.05), 0 2px 6px oklch(0.20 0.01 250 / 0.04);
  --shadow-md: 0 4px 12px oklch(0.20 0.01 250 / 0.06), 0 2px 4px oklch(0.20 0.01 250 / 0.04);
  --shadow-lg: 0 20px 40px oklch(0.20 0.01 250 / 0.08), 0 4px 12px oklch(0.20 0.01 250 / 0.04);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: oklch(0.155 0.008 250);
  --bg-elev: oklch(0.195 0.009 250);
  --bg-subtle: oklch(0.175 0.008 250);
  --bg-muted: oklch(0.225 0.010 250);
  --border: oklch(0.27 0.010 250);
  --border-strong: oklch(0.33 0.012 250);
  --text: oklch(0.96 0.004 250);
  --text-muted: oklch(0.70 0.008 250);
  --text-soft: oklch(0.55 0.010 250);
  --accent: oklch(0.72 0.14 230);
  --accent-soft: oklch(0.27 0.04 235);
  --accent-contrast: oklch(0.15 0.01 250);
  --positive: oklch(0.72 0.14 160);
  --warning: oklch(0.78 0.14 75);
  --danger: oklch(0.70 0.17 25);

  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.35), 0 2px 6px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.35), 0 2px 4px oklch(0 0 0 / 0.25);
  --shadow-lg: 0 20px 40px oklch(0 0 0 / 0.45), 0 4px 12px oklch(0 0 0 / 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 180ms ease, color 180ms ease;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* App shell — чистый белый. Sidebar выделяется border'ом, карточки
   "плавают" на soft-shadow без линий. В тёмной — приглушённый тон. */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  gap: 18px;
  padding: 16px;
  background: var(--bg);
}
[data-theme="dark"] .app { background: var(--bg-subtle); }

/* Sidebar — внешний rail (без фона). Внутри — лого вверху + карточка. */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
}
.sidebar__logo {
  display: flex; align-items: center; justify-content: center;
  padding: 4px 0 8px;
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: -0.01em;
  position: relative;
}
.sidebar__card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 16px);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  min-height: 0;
}
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-height: 0;
}
.sidebar__logo-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font-serif);
  font-size: 17px;
  font-style: normal;
  line-height: 1;
  padding-bottom: 2px;
  flex-shrink: 0;
}
.sidebar__group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  padding: 14px 12px 6px;
  font-weight: 500;
}
.sidebar__item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 450;
  transition: background 120ms, color 120ms;
  width: 100%;
}
.sidebar__item:hover { background: var(--bg-muted); color: var(--text); }
.sidebar__item--active {
  background: var(--bg-elev); color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}
.sidebar__item-icon { width: 16px; height: 16px; display: grid; place-items: center; color: currentColor; flex: 0 0 auto; }
.sidebar__item-badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 500;
}
.sidebar__badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: #e5484d;
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--bg-base);
}
.sidebar__footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.sidebar__user:hover { background: var(--bg-muted); }
.sidebar__avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: linear-gradient(135deg, oklch(0.60 0.10 235), oklch(0.70 0.12 200));
  color: #fff; display: grid; place-items: center;
  font-weight: 500; font-size: 12px; flex-shrink: 0;
}
.sidebar__user-info { line-height: 1.2; min-width: 0; flex: 1; }
.sidebar__user-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-plan { font-size: 11.5px; color: var(--text-muted); }

/* Main */
.main {
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  align-self: start;
  min-height: calc(100vh - 32px);
}
.topbar {
  display: flex; align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  gap: 16px;
}
.topbar__titles { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
.topbar__title { font-family: var(--font-serif); font-size: 22px; font-style: normal; letter-spacing: -0.01em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__subtitle { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar__menu-btn {
  display: none; width: 40px; height: 40px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--border); color: var(--text);
  cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0;
  padding: 0;
}
.topbar__menu-btn:hover { background: var(--bg-muted); }
.sidebar__close {
  display: none; margin-left: auto;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; align-items: center; justify-content: center; padding: 0;
}
.sidebar__close:hover { background: var(--bg-muted); color: var(--text); }
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: color-mix(in oklch, oklch(0 0 0), transparent 40%);
  z-index: 49;
  animation: fade-in 140ms ease;
}

.page { padding: 32px; max-width: 1240px; width: 100%; margin: 0; flex: 1; }

/* Cards — без border'ов в светлой теме, держатся на soft-shadow + tonal
   contrast от шелла. В тёмной возвращаем border, потому что shadow на
   тёмном фоне почти не виден. */
.card { background: var(--bg-elev); border: 1px solid transparent; border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card--flat { box-shadow: none; }
.card--ghost { background: var(--bg-subtle); box-shadow: none; }
[data-theme="dark"] .card { border-color: var(--border); box-shadow: var(--shadow-xs); }
[data-theme="dark"] .sidebar__card { border-color: var(--border); box-shadow: var(--shadow-xs); }
.card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.card__title { font-size: 13px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.02em; text-transform: uppercase; }
.card__title--plain { text-transform: none; font-size: 15px; color: var(--text); letter-spacing: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-muted); border-color: var(--border-strong); }
.btn--primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--primary:hover { background: color-mix(in oklch, var(--text), var(--bg) 22%); border-color: color-mix(in oklch, var(--text), var(--bg) 22%); color: var(--bg); }
.btn--accent { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn--accent:hover { background: color-mix(in oklch, var(--accent), var(--text) 15%); border-color: color-mix(in oklch, var(--accent), var(--text) 15%); color: var(--accent-contrast); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--bg-muted); color: var(--text); }
.btn--danger { color: var(--danger); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn--lg { height: 44px; padding: 0 20px; font-size: 14px; }
.btn--icon { width: 36px; padding: 0; }
.btn--icon.btn--sm { width: 30px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: var(--bg-muted); color: var(--text-muted);
  border: 1px solid var(--border);
  letter-spacing: 0.01em;
}
.chip--positive { background: color-mix(in oklch, var(--positive), transparent 88%); color: var(--positive); border-color: color-mix(in oklch, var(--positive), transparent 75%); }
.chip--warning  { background: color-mix(in oklch, var(--warning),  transparent 88%); color: var(--warning);  border-color: color-mix(in oklch, var(--warning),  transparent 75%); }
.chip--danger   { background: color-mix(in oklch, var(--danger),   transparent 88%); color: var(--danger);   border-color: color-mix(in oklch, var(--danger),   transparent 75%); }
.chip--accent   { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in oklch, var(--accent), transparent 75%); }
.chip__dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* Ping */
.ping { position: relative; display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--positive); }
.ping::after { content: ''; position: absolute; inset: 0; border-radius: 999px; background: var(--positive); animation: ping 1.8s cubic-bezier(0,0,0.2,1) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.6; } 80%, 100% { transform: scale(2.6); opacity: 0; } }

/* Stat tile */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat__label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 500; }
.stat__value { font-family: var(--font-serif); font-size: 40px; line-height: 1; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.stat__value small { font-size: 16px; color: var(--text-muted); font-family: var(--font-sans); font-weight: 400; margin-left: 4px; letter-spacing: 0; }
.stat__delta { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); }
.stat__delta--up { color: var(--positive); }
.stat__delta--down { color: var(--danger); }

/* Grids */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-subtle); }
.table--boxed { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--bg-elev); }

/* Forms */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 13px; color: var(--text);
  outline: none; transition: border-color 120ms, box-shadow 120ms;
}
.textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent), transparent 80%); }
.label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.field { margin-bottom: 14px; }

/* Toggle */
.toggle { width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background 160ms; flex-shrink: 0; border: none; padding: 0; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 999px; transition: transform 160ms; box-shadow: var(--shadow-sm); }
.toggle--on { background: var(--accent); }
.toggle--on::after { transform: translateX(14px); }

/* Chart */
.chart { width: 100%; height: 240px; position: relative; }
.chart__svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart__tooltip { position: absolute; background: var(--text); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow-md); opacity: 0; transition: opacity 120ms; z-index: 2; }
.chart__tooltip--visible { opacity: 1; }
.chart__tooltip-title { font-weight: 500; margin-bottom: 2px; }
.chart__tooltip-row { display: flex; align-items: center; gap: 6px; opacity: 0.85; }
.chart__legend { display: flex; gap: 18px; font-size: 12px; color: var(--text-muted); }
.chart__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart__legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* Server row */
.server-row { display: grid; grid-template-columns: 36px 1fr auto auto auto auto; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); transition: background 120ms; }
.server-row:hover { background: var(--bg-subtle); }
.server-row:last-child { border-bottom: none; }
.server-row--active { background: var(--accent-soft); }
[data-theme="dark"] .server-row--active { background: color-mix(in oklch, var(--accent), transparent 85%); }
.server-flag { width: 36px; height: 26px; border-radius: 4px; background: var(--bg-muted); display: grid; place-items: center; font-size: 18px; line-height: 1; overflow: hidden; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; border: 1px solid var(--border); }
.server-name { font-weight: 500; font-size: 14px; }
.server-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 10px; }
.load-bar { width: 80px; height: 4px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; position: relative; }
.load-bar__fill { position: absolute; top: 0; left: 0; bottom: 0; background: var(--positive); border-radius: 999px; }
.load-bar__fill--mid { background: var(--warning); }
.load-bar__fill--high { background: var(--danger); }

/* Device card */
.device-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elev); display: flex; flex-direction: column; gap: 10px; transition: border-color 120ms; }
.device-card:hover { border-color: var(--border-strong); }
.device-card__head { display: flex; align-items: center; gap: 12px; }
.device-card__icon { width: 38px; height: 38px; border-radius: 10px; background: var(--bg-muted); display: grid; place-items: center; color: var(--text); }
.device-card__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.device-card__name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-card__sub { font-size: 12px; color: var(--text-muted); }
.device-card__footer { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

/* Plans */
.plan { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px 24px; background: var(--bg-elev); display: flex; flex-direction: column; gap: 20px; position: relative; transition: all 180ms; }
.plan:hover { box-shadow: var(--shadow-md); }
.plan--featured { border: 1px solid var(--text); background: var(--text); color: var(--bg); }
.plan--featured .plan__price-currency,
.plan--featured .plan__period,
.plan--featured .plan__feat,
.plan--featured .plan__name,
.plan--featured .plan__price-amount,
.plan--featured .text-muted,
.plan--featured .text-sm { color: var(--bg) !important; opacity: 0.85; }
.plan--featured .plan__feat-check { color: var(--bg); opacity: 1; }
.plan--featured .btn--primary { background: var(--bg); color: var(--text); border-color: var(--bg); }
.plan--featured .btn--default { background: transparent; color: var(--bg); border-color: color-mix(in oklch, var(--bg), transparent 70%); }
.plan__badge { position: absolute; top: 14px; right: 14px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--bg); background: var(--accent); padding: 3px 8px; border-radius: 999px; font-weight: 500; }
.plan__name { font-family: var(--font-serif); font-style: normal; font-size: 22px; letter-spacing: -0.01em; font-weight: 600; }
.plan__price { display: flex; align-items: baseline; gap: 4px; }
.plan__price-currency { font-size: 18px; color: var(--text-muted); margin-right: 2px; }
.plan__price-amount { font-family: var(--font-serif); font-size: 44px; line-height: 1; letter-spacing: -0.03em; font-weight: 700; }
.plan__period { font-size: 13px; color: var(--text-muted); }
.plan__features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.plan__feat { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-muted); }
.plan__feat-check { flex-shrink: 0; margin-top: 2px; }
.plan__save { font-size: 12px; color: var(--positive); font-weight: 500; }
.plan--featured .plan__save { color: oklch(0.85 0.14 160); }

/* Invoice */
.invoice-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.invoice-status--paid { color: var(--positive); }
.invoice-status--pending { color: var(--warning); }
.invoice-status--failed { color: var(--danger); }

/* Referral hero */
.ref-hero { padding: 40px; background: var(--text); color: var(--bg); border-radius: var(--r-xl); position: relative; overflow: hidden; }
.ref-hero .text-muted, .ref-hero .text-sm { color: var(--bg) !important; opacity: 0.75; }
.ref-hero__title { font-family: var(--font-serif); font-style: normal; font-size: 40px; letter-spacing: -0.02em; line-height: 1.1; max-width: 520px; margin: 0 0 14px; color: var(--bg); font-weight: 700; }
.ref-hero__sub { opacity: 0.8; max-width: 480px; font-size: 14px; line-height: 1.55; color: var(--bg); }
.ref-hero__invite { margin-top: 28px; display: flex; gap: 8px; align-items: center; background: color-mix(in oklch, var(--bg), transparent 88%); border: 1px solid color-mix(in oklch, var(--bg), transparent 80%); padding: 6px 6px 6px 16px; border-radius: 999px; max-width: 520px; }
.ref-hero__invite input { background: transparent; border: 0; outline: 0; color: var(--bg); font-family: var(--font-mono); font-size: 13px; flex: 1; }
.ref-hero__ornament { position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; border: 1px solid color-mix(in oklch, var(--bg), transparent 88%); opacity: 0.5; }
.ref-hero__ornament--2 { right: -20px; top: -20px; width: 220px; height: 220px; border: 1px solid color-mix(in oklch, var(--bg), transparent 80%); opacity: 0.4; }

/* Code block */
.code-block { font-family: var(--font-mono); font-size: 12px; line-height: 1.6; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px 16px; color: var(--text); white-space: pre-wrap; word-break: break-all; position: relative; }

/* QR wrap */
.qr-wrap { position: relative; background: #fff; border-radius: var(--r-md); padding: 10px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: inline-block; }

/* Segmented */
.segmented { display: inline-flex; padding: 3px; background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--r-sm); gap: 2px; }
.segmented__opt { height: 28px; padding: 0 12px; border-radius: 6px; border: 0; background: transparent; cursor: pointer; font-size: 12.5px; color: var(--text-muted); font-weight: 500; transition: all 120ms; }
.segmented__opt--active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-xs); }

/* Ticket */
.ticket { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border); }
.ticket:last-child { border-bottom: none; }
.ticket:hover { background: var(--bg-subtle); cursor: pointer; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* Utils */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-serif { font-family: var(--font-serif); font-style: normal; letter-spacing: -0.01em; font-weight: 600; }
.text-mono { font-family: var(--font-mono); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.w-full { width: 100%; }
.grow { flex-grow: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 40px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
  font-family: var(--font-serif);
  font-size: 28px;
  font-style: normal;
}
.login-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.login-tab { padding: 8px 0; margin-right: 20px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 120ms; }
.login-tab--active { color: var(--text); border-bottom-color: var(--text); }
.login-error { background: color-mix(in oklch, var(--danger), transparent 88%); color: var(--danger); padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid color-mix(in oklch, var(--danger), transparent 75%); }
.login-success { background: color-mix(in oklch, var(--positive), transparent 88%); color: var(--positive); padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid color-mix(in oklch, var(--positive), transparent 75%); }

/* Loading spinner */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 60px; }

/* Notice banner */
.notice-banner { background: var(--accent-soft); border: 1px solid color-mix(in oklch, var(--accent), transparent 65%); border-radius: var(--r-md); padding: 12px 16px; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }

/* Next-step banner — guides new users to the next required action */
.next-step-banner {
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.next-step-banner::after {
  content: ''; position: absolute; top: -40%; right: -10%;
  width: 280px; height: 280px; border-radius: 50%;
  background: color-mix(in oklch, var(--accent-contrast), transparent 92%);
  pointer-events: none;
}
.next-step-banner__step {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; opacity: 0.78;
  position: relative; z-index: 1;
}
.next-step-banner__title {
  font-size: 24px; font-weight: 600; letter-spacing: -0.01em;
  margin-top: 2px;
  position: relative; z-index: 1;
}
.next-step-banner__text {
  font-size: 14px; opacity: 0.9; line-height: 1.5;
  margin-bottom: 12px; max-width: 560px;
  position: relative; z-index: 1;
}
.next-step-banner__btn {
  align-self: flex-start;
  appearance: none; border: none; cursor: pointer;
  background: var(--accent-contrast); color: var(--accent);
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: opacity 120ms, transform 100ms;
  position: relative; z-index: 1;
}
.next-step-banner__btn:hover { opacity: 0.92; }
.next-step-banner__btn:active { transform: scale(0.985); }

/* Device row — rename button (whole name area is clickable) */
.device-row__name-btn {
  appearance: none; border: none; background: none;
  padding: 0; margin: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; text-align: left;
  width: 100%; min-width: 0;
  border-radius: 6px;
  transition: background 120ms;
}
.device-row__name-btn:hover { background: color-mix(in oklch, var(--text), transparent 96%); }
.device-row__name-btn:hover .device-row__rename-hint { opacity: 1; }
.device-row__name {
  font-weight: 500; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.device-row__rename-hint {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted);
  opacity: 0.65; transition: opacity 120ms;
  flex-shrink: 0;
}

/* Progress bar */
.progress { height: 6px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; }
.progress__fill { height: 100%; border-radius: 999px; transition: width 500ms ease; }

/* Topbar balance pill */
.topbar__balance { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--bg-subtle); border: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.topbar__balance > svg { color: var(--text-muted); }

/* Ticket list hover */
.ticket { transition: background 120ms; }
.ticket:hover { background: var(--bg-subtle); }

/* Server flag img wrap (overrides emoji style) */
.server-flag img { border-radius: 3px; }

/* Avatar fallback */
.sidebar__avatar img { border-radius: 8px; }

/* Improve chip contrast in dark theme */
[data-theme="dark"] .chip { color: var(--text); }
[data-theme="dark"] .chip--positive { color: oklch(0.85 0.14 160); }
[data-theme="dark"] .chip--warning { color: oklch(0.85 0.14 75); }
[data-theme="dark"] .chip--accent { color: var(--accent); }

/* Ensure white-background inverted cards (plan--featured, ref-hero) always keep dark text, regardless of theme */
.plan--featured, .plan--featured * { color-scheme: light; }

/* Brand logo (uses SVG, swaps by theme) */
.brand-logo {
  display: inline-block;
  background-image: url('/theme/ALOVPN_THEME/logo-black.svg');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: left center;
  height: 36px;
  width: 118px;
  vertical-align: middle;
}
[data-theme="dark"] .brand-logo {
  background-image: url('/theme/ALOVPN_THEME/logo-white.svg');
}
.brand-logo--lg { height: 54px; width: 176px; }

/* Brand logo halo (только для большого логотипа в сайдбаре) */
.brand-logo--lg {
  filter: drop-shadow(0 0 14px rgba(0, 0, 0, 0.10)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.06));
  transition: filter 220ms ease;
}
[data-theme="dark"] .brand-logo--lg {
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.18)) drop-shadow(0 0 32px rgba(255, 255, 255, 0.06));
}
.brand-logo--lg:hover {
  filter: drop-shadow(0 0 22px rgba(0, 0, 0, 0.16)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.10));
}
[data-theme="dark"] .brand-logo--lg:hover {
  filter: drop-shadow(0 0 22px rgba(255, 255, 255, 0.28)) drop-shadow(0 0 40px rgba(255, 255, 255, 0.10));
}

@media (prefers-reduced-motion: reduce) {
  .brand-logo--lg { transition: none; }
}

/* Topbar balance pill — clickable */
.topbar__balance { cursor: pointer; transition: background 120ms, border-color 120ms; }
.topbar__balance:hover { background: var(--bg-muted); border-color: var(--border-strong); }

/* Sidebar user footer — clickable */
.sidebar__user { transition: background 120ms; }
.sidebar__user:hover { background: var(--bg-muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: color-mix(in oklch, oklch(0 0 0), transparent 40%);
  backdrop-filter: none;
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fade-in 120ms ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal__title { font-size: 18px; font-weight: 500; }
.modal__close {
  width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; display: grid; place-items: center; font-size: 20px; line-height: 1;
}
.modal__close:hover { background: var(--bg-muted); color: var(--text); }

/* Pay method list */
.paymethod-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.paymethod-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-subtle); cursor: pointer; transition: all 120ms;
}
.paymethod-item:hover { border-color: var(--border-strong); }
.paymethod-item--active { border-color: var(--accent); background: var(--accent-soft); }
.paymethod-item__radio {
  width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--border-strong); flex-shrink: 0;
  display: grid; place-items: center; background: var(--bg-elev);
}
.paymethod-item--active .paymethod-item__radio { border-color: var(--accent); }
.paymethod-item--active .paymethod-item__radio::after {
  content: ''; width: 8px; height: 8px; border-radius: 999px; background: var(--accent);
}
.paymethod-item__body { flex: 1; }
.paymethod-item__name { font-weight: 500; font-size: 14px; }
.paymethod-item__fee { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Order summary box */
.order-summary {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.order-summary__row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.order-summary__row--total { font-weight: 500; font-size: 15px; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 10px; }
.order-summary__row--discount { color: var(--positive); }

/* Dark theme — inverted cards (.plan--featured, .ref-hero) should NOT be blinding white.
   In dark mode we repaint them with a muted dark surface + accent highlights. */
[data-theme="dark"] .plan--featured {
  background: oklch(0.24 0.035 235) !important;
  color: var(--text) !important;
  border-color: var(--accent) !important;
}
[data-theme="dark"] .plan--featured .plan__name,
[data-theme="dark"] .plan--featured .plan__price-amount,
[data-theme="dark"] .plan--featured .plan__price-currency,
[data-theme="dark"] .plan--featured .plan__period,
[data-theme="dark"] .plan--featured .plan__feat,
[data-theme="dark"] .plan--featured .text-muted,
[data-theme="dark"] .plan--featured .text-sm { color: var(--text) !important; opacity: 1 !important; }
[data-theme="dark"] .plan--featured .plan__period,
[data-theme="dark"] .plan--featured .plan__price-currency,
[data-theme="dark"] .plan--featured .plan__feat,
[data-theme="dark"] .plan--featured .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .plan--featured .plan__feat-check { color: var(--accent) !important; }
[data-theme="dark"] .plan--featured .plan__badge { background: var(--accent) !important; color: var(--accent-contrast) !important; }
[data-theme="dark"] .plan--featured .btn--primary { background: var(--accent) !important; color: var(--accent-contrast) !important; border-color: var(--accent) !important; }
[data-theme="dark"] .plan--featured .btn--default { background: transparent !important; color: var(--text) !important; border-color: var(--border-strong) !important; }

[data-theme="dark"] .ref-hero {
  background: oklch(0.24 0.035 235) !important;
  color: var(--text) !important;
  border: 1px solid var(--accent);
}
[data-theme="dark"] .ref-hero__title,
[data-theme="dark"] .ref-hero__sub,
[data-theme="dark"] .ref-hero .text-muted,
[data-theme="dark"] .ref-hero .text-sm { color: var(--text) !important; opacity: 1 !important; }
[data-theme="dark"] .ref-hero__sub { color: var(--text-muted) !important; }
[data-theme="dark"] .ref-hero__ornament { border-color: color-mix(in oklch, var(--accent), transparent 70%) !important; opacity: 0.4 !important; }
[data-theme="dark"] .ref-hero__invite { background: color-mix(in oklch, var(--bg-elev), transparent 40%) !important; border-color: var(--border-strong) !important; }
[data-theme="dark"] .ref-hero__invite input { color: var(--text) !important; }

/* Dark theme — ensure all `.text-muted`, `.text-soft`, `small` inside normal cards stay readable */
[data-theme="dark"] .text-muted { color: oklch(0.72 0.008 250) !important; }
[data-theme="dark"] .text-soft { color: oklch(0.58 0.010 250) !important; }

/* Configs page: QR + info row */
.configs-qr-row { display: flex; gap: 24px; align-items: flex-start; }
@media (max-width: 860px) {
  .configs-qr-row { flex-direction: column; gap: 16px; align-items: stretch; }
  .configs-qr-row .qr-wrap { align-self: center; }
}

/* Support hero 2-col grid */
.support-hero-grid { grid-template-columns: 1.2fr 1fr; }
@media (max-width: 860px) {
  .support-hero-grid { grid-template-columns: 1fr; }
}

/* Ticket list row (support page) */
.ticket-row {
  width: 100%; background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  text-align: left; cursor: pointer;
  padding: 14px 20px;
  display: grid; grid-template-columns: 36px 1fr auto 16px;
  gap: 14px; align-items: center;
  color: inherit; font: inherit;
  transition: background 120ms;
}
.ticket-row:hover { background: var(--bg-subtle); }
.ticket-row:last-child { border-bottom: none; }
@media (max-width: 860px) {
  .ticket-row {
    grid-template-columns: 36px 1fr auto;
    padding: 12px 14px;
  }
  .ticket-row > :last-child { display: none; }
}

/* Search box inside card header (used on servers page) */
.servers-search { position: relative; max-width: 260px; width: 100%; }
@media (max-width: 860px) {
  .servers-search { max-width: none; flex: 1 1 100%; }
}

/* Dashboard hero: responsive two-column → stack */
.dashboard-hero__row { display: flex; gap: 40px; align-items: flex-end; flex-wrap: wrap; }
.dashboard-hero__plan { flex: 0 0 auto; min-width: 0; }
.dashboard-hero__plan-name { font-size: 52px; line-height: 1; letter-spacing: -0.02em; word-break: break-word; }
.dashboard-hero__progress { flex: 1 1 240px; min-width: 0; }
@media (max-width: 860px) {
  .dashboard-hero__row { gap: 20px; }
  .dashboard-hero__plan-name { font-size: 36px; }
  .dashboard-hero__progress { flex-basis: 100%; }
  .dashboard-hero { grid-column: auto !important; }
}

/* ===== Tablet ≤ 1024px: denser spacing, collapse some grids ===== */
@media (max-width: 1024px) {
  .app { grid-template-columns: 232px 1fr; gap: 14px; padding: 12px; }
  .page { padding: 24px; }
  .topbar { padding: 16px 24px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Mobile ≤ 860px: sidebar becomes slide-in drawer ===== */
@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
  }
  .main {
    min-height: 100vh;
  }
  .topbar__menu-btn { display: inline-flex; }
  .sidebar__close { display: inline-flex; }

  .sidebar {
    position: fixed; top: 0; left: 0;
    width: min(300px, 86vw);
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    background: var(--bg-subtle);
    box-shadow: var(--shadow-lg);
    padding: 16px 12px;
    gap: 0;
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar-backdrop { display: block; }

  /* В drawer'е возвращаем «плоский» вид: лого внутри панели + сплошной нав без карточки */
  .sidebar__card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-top: 8px;
  }
  .sidebar__logo {
    justify-content: flex-start;
    padding: 4px 10px 8px;
  }

  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar__title { font-size: 18px; }
  .topbar__subtitle { display: none; }
  .topbar__balance { padding: 5px 10px; font-size: 12.5px; }
  .topbar__balance > svg { display: none; }

  .page { padding: 16px; }

  /* Grids collapse on phones */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 14px; }

  /* Cards tighter */
  .card { padding: 16px; border-radius: var(--r-md); }

  /* Dashboard hero: stack plan name + progress */
  .card__header { flex-wrap: wrap; }

  /* Stat size */
  .stat__value { font-size: 34px; }
  .stat__value small { font-size: 14px; }

  /* Server rows: fewer columns */
  .server-row {
    grid-template-columns: 36px 1fr auto !important;
    gap: 12px;
    padding: 12px 14px;
  }
  .server-row .server-row__meta-extra { display: none; }

  /* Tables → scroll horizontally rather than break layout */
  .card > .table,
  .card table.table { font-size: 12.5px; }
  .table th, .table td { padding: 10px 10px; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Plans */
  .plan { padding: 22px 20px; gap: 16px; }
  .plan__price-amount { font-size: 42px; }
  .plan__name { font-size: 22px; }

  /* Referral hero */
  .ref-hero { padding: 24px; border-radius: var(--r-lg); }
  .ref-hero__title { font-size: 30px; max-width: none; }
  .ref-hero__sub { font-size: 13px; }
  .ref-hero__invite { flex-wrap: wrap; padding: 10px; max-width: none; border-radius: var(--r-md); }
  .ref-hero__invite input { min-width: 100%; padding: 4px 0; }
  .ref-hero__ornament, .ref-hero__ornament--2 { display: none; }

  /* Ticket grid collapses */
  .ticket {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "subject status"
      "meta    date";
    gap: 6px 10px;
    padding: 14px 12px;
  }
  .ticket__subject { grid-area: subject; }
  .ticket__status  { grid-area: status; justify-self: end; }
  .ticket__meta    { grid-area: meta; font-size: 12px; color: var(--text-muted); }
  .ticket__date    { grid-area: date; font-size: 12px; color: var(--text-muted); justify-self: end; }

  /* Modals */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 20px;
  }

  /* Login card edge-to-edge */
  .login-wrap { padding: 0; align-items: stretch; display: flex; }
  .login-card {
    max-width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding: 28px 20px;
    min-height: 100vh;
  }

  /* Chart shorter on phones */
  .chart { height: 200px; }

  /* Segmented control shrinks nicely */
  .segmented__opt { padding: 0 10px; font-size: 12px; }

  /* Device grid single column + icon consistent */
  .device-card { padding: 14px; }
}

/* ===== Small phones ≤ 480px ===== */
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar__right { gap: 6px; }
  .topbar__title { font-size: 16px; }
  .topbar__balance > span { font-variant-numeric: tabular-nums; }
  .page { padding: 12px; }
  .card { padding: 14px; }
  .btn { height: 34px; padding: 0 12px; font-size: 12.5px; }
  .btn--lg { height: 40px; padding: 0 16px; font-size: 13px; }
  .stat__value { font-size: 28px; }
  .card__title { font-size: 11.5px; }
  .sidebar { width: min(280px, 92vw); }
  .ref-hero { padding: 20px; }
  .ref-hero__title { font-size: 24px; }
  .plan__price-amount { font-size: 36px; }
  .login-card { padding: 24px 16px; }
  .modal { padding: 16px; }
}

/* ───── Setup wizard (page-configs) ───── */
.setup-platform-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 12px);
  color: var(--text);
  font-family: inherit; font-size: 14px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 80ms;
  text-align: left;
}
.setup-platform-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}
.setup-platform-btn:active { transform: scale(0.99); }
.setup-platform-btn[data-recommended="1"] {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent), transparent 92%);
}
