/* VideoStat — базовые стили. Монохром: чёрный, белый, серые. Цвет — только для статусов. */
:root {
  --bg: #fff;
  --soft: #f5f5f4;
  --soft-2: #ededec;
  --line: #e4e4e2;
  --line-2: #d4d4d2;
  --ink: #111;
  --ink-2: #2b2b2b;
  --muted: #6b6b69;
  --faint: #9b9b98;
  --ok: #17803d;
  --warn: #9a6200;
  --bad: #c42b1c;
  --r: 10px;
  --r-sm: 7px;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 1px 0 rgb(0 0 0 / .04);
  --on-ink: #fff;
  --ink-hover: #2a2a2a;
  --hover: #fafaf9;
  --veil: rgb(245 245 244 / .85);
  --top-bg: rgb(245 245 244 / .92);
  --site-top-bg: rgb(255 255 255 / .92);
  --ok-bg: #f3faf5; --ok-line: #b9dcc4;
  --warn-bg: #fffaf0; --warn-line: #ecd6ae;
  --bad-bg: #fff6f5; --bad-line: #f0c2bd;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Тёмная тема: те же роли цветов, монохром сохраняется */
[data-theme='dark'] {
  --bg: #151515;
  --soft: #1c1c1c;
  --soft-2: #262626;
  --line: #2b2b2b;
  --line-2: #3b3b3b;
  --ink: #f1f1ef;
  --ink-2: #d4d4d2;
  --muted: #9d9d9a;
  --faint: #727270;
  --ok: #4fc27c;
  --warn: #e3ab4a;
  --bad: #ff6f61;
  --shadow: 0 1px 0 rgb(0 0 0 / .3);
  --on-ink: #111;
  --ink-hover: #d2d2d0;
  --hover: #1f1f1f;
  --veil: rgb(21 21 21 / .85);
  --top-bg: rgb(28 28 28 / .92);
  --site-top-bg: rgb(21 21 21 / .92);
  --ok-bg: #12251a; --ok-line: #24553a;
  --warn-bg: #2a2112; --warn-line: #5c4620;
  --bad-bg: #2c1513; --bad-line: #6b2d27;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23eee' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}
[data-theme='dark'] .brand img, [data-theme='dark'] .gate-brand img { filter: invert(1); }
[data-theme='dark'] .pixels, [data-theme='dark'] .gate::before, [data-theme='dark'] .gate::after { filter: invert(1); opacity: .25; }

/* Переключатель темы: видна иконка той темы, на которую переключит */
.theme-toggle .i-sun, [data-theme='dark'] .theme-toggle .i-moon { display: none; }
[data-theme='dark'] .theme-toggle .i-sun { display: block; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: var(--on-ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 6px; }
.stack-lg { display: grid; gap: 20px; }

/* ── Иконки из спрайта ─────────────────────────────────────────────────────── */
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-lg { width: 20px; height: 20px; }
.i-xl { width: 28px; height: 28px; }

/* ── Кнопки ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--ink);
  font-weight: 550; font-size: 13.5px; line-height: 1; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--soft); border-color: var(--faint); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--soft); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { min-height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; }

/* ── Поля ──────────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink); font-size: 14px; transition: border-color .12s;
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.45; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.input-sm { min-height: 30px; padding: 4px 8px; font-size: 13px; }
.select { appearance: none; padding-right: 28px; background: var(--bg) var(--select-arrow) no-repeat right 9px center; }
.input-color { width: 36px; height: 36px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); cursor: pointer; }
.input-range { width: 100%; accent-color: var(--ink); }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { margin: 2px 0 0; accent-color: var(--ink); width: 16px; height: 16px; flex: none; }

/* Переключатель */
.switch { position: relative; display: inline-flex; flex: none; width: 36px; height: 20px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--line-2); transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); transition: transform .15s; box-shadow: 0 1px 1px rgb(0 0 0 / .15); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Сегменты (радио-кнопки в ряд) */
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--soft); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 5px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--bg); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2); }

/* Выбор карточкой (как в референсе: выбранная — чёрная рамка) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choice { position: relative; display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); text-align: left; cursor: pointer; }
.choice:hover { border-color: var(--faint); }
.choice[aria-pressed='true'] { border: 1.5px solid var(--ink); background: var(--soft); padding: 9.5px 11.5px; }
.choice b { font-size: 13px; font-weight: 600; }
.choice small { color: var(--muted); font-size: 11.5px; }

/* ── Карточки, таблицы, бейджи ───────────────────────────────────────────── */
.card { border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px; }
.card-icon { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); flex: none; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 550; font-size: 12px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table .r { text-align: right; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 5px; font-size: 11.5px; font-weight: 550; color: var(--ink-2); background: var(--bg); white-space: nowrap; }
.badge-dark { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.badge-ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.badge-warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.badge-bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }

/* Ярлык-флажок как в референсе */
.tag-flag { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 5px 20px 5px 9px; background: var(--soft-2); color: var(--ink);
  font-size: 12.5px; font-weight: 600; line-height: 1.3; clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%); border-radius: 4px 0 0 4px; }
.tag-flag::before { content: ''; width: 12px; height: 12px; background: var(--ink); border-radius: 2px; }

/* Карточка тарифа (кабинет и лендинг) */
.plan { display: grid; gap: 10px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.plan[aria-current='true'] { border: 1.5px solid var(--ink); background: var(--soft); }
.plan .price { font: 600 24px/1 var(--mono); letter-spacing: -.03em; }
.plan ul { display: grid; gap: 5px; padding: 0; margin: 0; list-style: none; font-size: 12.5px; color: var(--ink-2); }
.plan li { display: flex; gap: 6px; align-items: flex-start; }
.plan li .i { width: 14px; height: 14px; margin-top: 2px; }
.plan li.off { color: var(--faint); }

/* ── Пустые состояния, уведомления, модальные окна ───────────────────────── */
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); }

.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 14px; border-radius: var(--r-sm); background: var(--ink); color: var(--on-ink); font-size: 13.5px; box-shadow: 0 6px 24px rgb(0 0 0 / .18); max-width: min(520px, 92vw); }
.toast-bad { background: var(--bad); color: #fff; }

.modal-back { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; background: rgb(17 17 17 / .45); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
.modal-wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.modal-body { padding: 18px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }

.code { display: block; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--soft); font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--ink-2); }

.progress { height: 6px; border-radius: 6px; background: var(--soft-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ink); transition: width .2s; }

.spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Пиксельная мозаика — декоративный фон */
.pixels { background-image: url(/assets/img/pixels.svg); background-repeat: no-repeat; pointer-events: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
