:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #14161a;
  --muted: #6b7280;
  --line: #e6e7eb;
  --line-soft: #f0f1f4;
  --accent: #2563eb;
  --accent-soft: #eef3ff;
  --accent-text: #ffffff;
  --ok-bg: #e9f7f0;
  --ok-text: #0f7a52;
  --warn-bg: #fdf3e3;
  --warn-text: #8a5a10;
  --bad-bg: #fdeceb;
  --bad-text: #b42318;
  --radius: 14px;
  /* график: две серии, проверены на контраст и дальтонизм для обеих тем */
  --s1: #2563eb;
  --s2: #eb6834;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e11;
    --surface: #16181d;
    --text: #e9eaee;
    --muted: #98a0ae;
    --line: #24272e;
    --line-soft: #1c1f25;
    --accent: #5b8cff;
    --accent-soft: #182238;
    --accent-text: #0d0e11;
    --ok-bg: #12271f;
    --ok-text: #4ed69f;
    --warn-bg: #2a2113;
    --warn-text: #e0b268;
    --bad-bg: #2b1514;
    --bad-text: #ff8a80;
    --s1: #5b8cff;
    --s2: #d95926;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 40px 20px 80px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
body.center { display: flex; align-items: center; justify-content: center; min-height: 88vh; padding-top: 20px; }

.wrap { max-width: 1060px; margin: 0 auto; }
.wrap.narrow { max-width: 660px; }
.hidden { display: none; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.nowrap { white-space: nowrap; }
.pad { padding: 24px 8px; }

h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
h3 { font-size: 14px; font-weight: 600; margin: 0; display: flex; align-items: flex-start; gap: 8px; }
p { margin: 6px 0 0; }
a { color: var(--accent); text-underline-offset: 2px; }

.page { margin-bottom: 22px; }
.page.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.lead { color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.panel h2 { margin-bottom: 14px; }
.login { width: min(380px, 100%); }
.login h1 { margin-bottom: 18px; }

/* ── «Заберите конфиг»: одна компактная полоса ────────────────────────────── */
.get { padding: 16px 20px; }
.get h2 { margin: 0; }
.getbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.platforms { display: flex; gap: 10px; margin-top: 12px; }
.getform { display: contents; }
.pill {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 600;
}
.pill:hover { background: var(--accent); color: var(--accent-text); }
.pill img { border-radius: 5px; flex: none; }
.pill:disabled { opacity: .5; }

.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--line-soft); color: var(--muted);
}
.chip.used { background: var(--ok-bg); color: var(--ok-text); }
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }

/* ── приложения ───────────────────────────────────────────────────────────── */
.apps { list-style: none; margin: 0; padding: 0; }
.apps li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 0; border-top: 1px solid var(--line-soft);
}
.apps li:first-child { border-top: none; padding-top: 0; }
.apps li:last-child { padding-bottom: 0; }
.applogo { border-radius: 9px; flex: none; display: block; }
.appinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.appinfo b { font-weight: 600; }
.appinfo .muted { font-size: 13px; }
.appbtns { display: flex; gap: 8px; }
.apps .hint { flex-basis: 100%; margin: 0; }

/* ── карточка конфига ─────────────────────────────────────────────────────── */
.cardhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.method { border-top: 1px solid var(--line-soft); padding-top: 16px; margin-top: 16px; }
.mark {
  flex: none;
  width: 20px; height: 20px; border-radius: 6px;
  display: inline-grid; place-items: center;
  background: var(--line-soft); color: var(--muted);
  font-size: 11px; font-weight: 700;
}
.usedbox {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 14px;
}
.usedbox > summary { margin: 0; font-size: 14px; color: var(--text); font-weight: 500; }
.usedbox[open] > summary { margin-bottom: 10px; }
.usedbox .card { border-color: var(--line-soft); margin-top: 12px; }

/* конфиг подключился при открытой странице: сначала это видно на карточке,
   потом она уезжает в «уже подключённые», и блок один раз подсвечивается */
.card.justused { border-color: var(--ok-text); }
.card.leaving { opacity: 0; transform: translateY(-8px); transition: opacity .3s, transform .3s; }
.usedbox.flash { border-color: var(--ok-text); background: var(--ok-bg); }
.usedbox { transition: background .6s, border-color .6s; }
@media (prefers-reduced-motion: reduce) {
  .card.leaving { transition: none; }
  .usedbox { transition: none; }
}

/* ── поля и кнопки ────────────────────────────────────────────────────────── */
.field { margin-bottom: 4px; }
.field.grow { flex: 1; min-width: 220px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, textarea, select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
select { height: 41px; }
textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.5; resize: vertical; margin-top: 10px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ── свой выпадающий список (тариф) ───────────────────────────────────────── */
/* .select ставит вокруг <select> скрипт: без него остаётся обычное поле */
.select { position: relative; }
.select > select { display: none; }
.selectbtn {
  width: 100%; height: 41px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-weight: 400;
  text-align: left;
}
.selectbtn:hover { border-color: var(--accent); }
.selectbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.select.open .selectbtn { border-color: var(--accent); }
/* шеврон: уголок из двух сторон рамки, повёрнутый на 45° */
.selectbtn .chev {
  flex: none; width: 7px; height: 7px; margin-top: -3px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s;
}
.select.open .selectbtn .chev { margin-top: 3px; transform: rotate(225deg); }

.options {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%;
  max-height: 268px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}
.select.up .options { top: auto; bottom: calc(100% + 6px); }
/* плоский список раздвигает разметку вместо того, чтобы всплывать поверх неё:
   в таблице ссылок всплывающий обрезала бы полоса горизонтальной прокрутки */
.select.flat .options {
  position: static; max-height: 208px; margin-top: 6px;
  box-shadow: none; border-radius: 10px;
}
.option {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 14px; white-space: nowrap; cursor: pointer;
}
.option:hover, .option:focus { background: var(--line-soft); outline: none; }
/* точка выбора: толстая рамка на маленьком кружке и есть заполнение */
.option .dot {
  flex: none; width: 15px; height: 15px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-width .1s, border-color .1s;
}
.option[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.option[aria-selected="true"] .dot { border-color: var(--accent); border-width: 4.5px; }

/* окошко «Своё число дней»: поверх страницы, по щелчку мимо и Esc закрывается */
.modal {
  position: fixed; z-index: 50; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .35);
}
.modalbox {
  width: 300px; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .2);
}
.modalbox h3 { margin: 0 0 12px; font-size: 16px; }
.modalbox input { width: 100%; }
.modalbox .error { margin: 6px 0 0; min-height: 0; }

button, .btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: border-color .15s, background .15s, color .15s;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.primary:hover { filter: brightness(1.06); }
.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--line); }
.danger:hover { color: var(--bad-text); border-color: var(--bad-text); }
.small { padding: 6px 12px; font-size: 13px; }
.wide { width: 100%; margin-top: 16px; }
.inline { display: inline; }
.method .btn { margin-top: 12px; }

.copyrow { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.copyrow textarea { margin-top: 0; }
.copyrow button { white-space: nowrap; }

/* ссылка в админке: кнопка под полем, а не сбоку — поле получает всю ширину */
.copycol { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 6px; }
/* Полей стало два — страница и бот, — и столбиком они вытягивали строку таблицы
   вдвое. Поэтому вдвоём они выстраиваются в строку: подпись, поле, кнопка.
   Подпись появляется только в этом случае: у одного поля подписывать нечего. */
.copyline { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.copyline .colname { flex: none; width: 68px; }
.copyline input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  padding: 7px 10px; min-width: 196px; }
.copyline button { white-space: nowrap; }
.colname { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* ссылке нужно место: обрезанный адрес не проверить глазами перед отправкой */
.copycol input { font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 7px 10px; min-width: 232px; }
.copycol button { white-space: nowrap; }

/* QR: у segno нет width/height, только viewBox — размер задаём здесь */
.qr {
  margin-top: 12px;
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
}
/* модуль QR должен быть заметно крупнее пикселя, иначе камера не берёт код */
.qr svg { display: block; width: 340px; max-width: 100%; height: auto; }

summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 18px; }
details[open] summary { margin-bottom: 4px; }

/* ── админка ──────────────────────────────────────────────────────────────── */
.newlink { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
/* отступ равняет «Создать» по нижнему краю полей; кнопки внутри полей не трогаем */
.newlink > button { margin-top: 25px; }

/* Только что созданная ссылка. Она нужна здесь и сейчас — переслать человеку, —
   поэтому лежит под формой, а не только первой строкой таблицы экраном ниже.
   Через пять минут поле пропадает: постоянное место ссылки — всё та же таблица. */
.fresh {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  transition: opacity .3s, transform .3s;
}
.fresh.leaving { opacity: 0; transform: translateY(-6px); }
.freshtop {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
/* остаток не должен дёргать строку каждую секунду */
.freshleft { font-size: 13px; font-variant-numeric: tabular-nums; }
/* поле и кнопка в строку: места здесь, в отличие от ячейки таблицы, хватает */
.fresh .copycol { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
.fresh .copycol input, .fresh .copyline input { flex: 1; background: var(--surface); }

/* Всплывающее сообщение: копирование в буфер ничем себя не выдаёт, а когда
   ссылку кладёт туда сам портал — тем более. Сообщения не перехватывают
   нажатия: под ними живая страница. */
.toasts {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  padding: 10px 16px; border-radius: 999px;
  background: var(--text); color: var(--surface);
  font-size: 14px; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  animation: toastin .2s ease-out;
  transition: opacity .3s, transform .3s;
}
/* тревожное сообщение красное, а буквы — цвета страницы: в тёмной теме красный
   светлый, и белым по нему не прочитать */
.toast.bad { background: var(--bad-text); color: var(--bg); }
.toast.leaving { opacity: 0; transform: translateY(6px); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .fresh, .toast { transition: none; animation: none; }
}

/* кнопки в шапке: переходы по разделам и выход стоят рядом */
.headbtns { display: flex; align-items: center; gap: 8px; flex: none; }

/* Разделы админки — значками: их четыре, а рядом ещё плашка сервера и таймер
   оплаты, и подписями шапка занимала всю строку. Подпись никуда не делась — она
   в подсказке и в aria-label, так что и мышью, и с экрана раздел узнаётся. */
.iconbtns { display: flex; align-items: center; gap: 4px; flex: none; }
.iconbtn {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
}
.iconbtn:hover { color: var(--text); border-color: var(--line); background: var(--surface); }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* открытый раздел отмечен, иначе четыре значка подряд читаются как ребус */
.iconbtn.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.ico { width: 21px; height: 21px; display: block; }

/* ── оплата сервера ───────────────────────────────────────────────────────── */
/* Таймер оплаты VPS стоит в шапке рядом с кнопками, а не отдельной полосой:
   пока всё оплачено, это просто зелёная плашка с остатком. За две недели она
   желтеет, за неделю краснеет — цвет замечают раньше, чем читают текст.
   Полная дата и поле ввода лежат в окошке, которое плашка раскрывает. */
.billing { position: relative; }
.billchip {
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  border-color: transparent; white-space: nowrap;
}
.billing.ok .billchip { background: var(--ok-bg); color: var(--ok-text); }
.billing.warn .billchip { background: var(--warn-bg); color: var(--warn-text); }
.billing.bad .billchip { background: var(--bad-bg); color: var(--bad-text); }
/* даты нет — напоминать не о чем: плашка молчит серым */
.billing.none .billchip { background: var(--line-soft); color: var(--muted); }
.billchip:hover { border-color: currentColor; }

/* окошко под плашкой в шапке: и у оплаты сервера, и у списка серверов */
.billform, .serverbox {
  position: absolute; z-index: 30; top: calc(100% + 6px); right: 0;
  width: 264px; max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
  text-align: left;
}
.billform .hint { margin: 0 0 10px; }
.billbtns { display: flex; gap: 8px; margin-top: 10px; }
.billbtns button { flex: 1; }

/* ── переключатель серверов ───────────────────────────────────────────────── */
/* Серверов у админа несколько, а админка на каждом своя: плашка с именем
   текущего раскрывает список остальных. Переход — обычная ссылка: портал сам
   берёт у соседа одноразовый пропуск и приводит браузер уже внутрь. */
.servers { position: relative; }
.serverchip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  max-width: 200px; white-space: nowrap;
}
.serverchip .servername { overflow: hidden; text-overflow: ellipsis; }
.serverchip .chev {
  flex: none; width: 7px; height: 7px; margin-top: -3px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s;
}
.serverchip[aria-expanded="true"] .chev { margin-top: 3px; transform: rotate(225deg); }
.serverbox { width: 288px; padding: 8px; }

.serverlist { list-style: none; margin: 0; padding: 0; }
.serverlist li { display: flex; align-items: center; gap: 4px; }
.serverlist li > form { flex: none; }
/* имя сверху, адрес под ним: по адресу видно, на какой сервер уходишь */
.serverlist .current, .serverto {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px;
  font-size: 14px; text-decoration: none; color: inherit;
}
.serverlist .servername { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.serverlist .muted { font-size: 12px; max-width: 46%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.serverlist .current { font-weight: 600; color: var(--accent); }
.serverto:hover { background: var(--line-soft); }
.serverlist li > form button { padding: 4px 9px; line-height: 1.2; }

.addserver {
  width: 100%; display: flex; align-items: center; gap: 8px;
  margin-top: 4px; border-color: transparent; background: transparent;
  color: var(--muted); font-size: 13px; padding: 8px 10px; text-align: left;
}
.addserver:hover { color: var(--text); border-color: var(--line); }
/* плюс из двух полосок: своей иконки в проекте нет, а символ «+» в шрифте
   мелкий и висит выше строки */
.addserver .plus {
  flex: none; position: relative; width: 11px; height: 11px;
}
.addserver .plus::before, .addserver .plus::after {
  content: ""; position: absolute; background: currentColor;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.addserver .plus::before { width: 11px; height: 1.5px; }
.addserver .plus::after { width: 1.5px; height: 11px; }

.serveradd { padding: 4px 10px 6px; }
.serveradd label { display: block; margin-top: 8px; }
.serveradd .hint { margin: 10px 0 0; }

/* про исправную связь с Amnezia не пишем — строка появляется только при беде */
.status { display: inline-block; margin-top: 8px; font-size: 13px; padding: 5px 11px; border-radius: 999px; }
.status.bad { background: var(--bad-bg); color: var(--bad-text); }
.error { color: var(--bad-text); font-size: 13px; margin: 0 0 12px; min-height: 18px; }

.scroll { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td.actions { text-align: right; white-space: nowrap; }
/* строку таблицы ссылок задаёт самый высокий столбец (имя со ссылкой либо
   раскрытый список конфигов), остальные без этого висят у верхнего края */
.links td { vertical-align: middle; }
/* действия столбиком: строка таблицы и так высокая, а кнопки в ряд её растягивают */
.actionbtns { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.actionbtns button { width: 100%; }
.renewbtn.on { color: var(--text); border-color: var(--line); }

/* раскрытая форма расширяет столбец действий и поджимает остальные — поэтому
   она ровно такой ширины, чтобы уместился самый длинный тариф */
.renewform { min-width: 176px; margin-top: 8px; text-align: left; white-space: normal; }
.renewform label { margin-bottom: 4px; }
.renewform .field { margin: 10px 0 0; }
.renewform .wide { margin-top: 10px; }
.renewform .hint { font-size: 12px; }

.linkname { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* тариф и срок — по строке каждый: перенос посреди «5 минут (тест) · 349 ₽» нечитаем */
.plancell { min-width: 168px; }
.plancell > div, .plancell .hint { white-space: nowrap; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tag.on { background: var(--ok-bg); color: var(--ok-text); }
.tag.off { background: var(--line-soft); color: var(--muted); }
.tag.bad { background: var(--bad-bg); color: var(--bad-text); }
/* ссылка с вышедшим сроком видна во всём списке сразу */
tr.expired td { background: var(--bad-bg); }
tr.expired .linkname { color: var(--bad-text); }
.hint.over { color: var(--bad-text); }
/* пункт из двух строк, а родной маркер прилипает к первой — поэтому свой,
   выровненный по середине пункта */
.issued { list-style: none; margin: 8px 0 0; padding-left: 0; font-size: 13px; color: var(--muted); }
.issued li { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.issued li::before {
  content: "";
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
.issued .used { color: var(--ok-text); }
.issued .unused { color: var(--muted); }
.issued .revoked { color: var(--bad-text); }

/* ── администраторы ───────────────────────────────────────────────────────── */
/* имя и пароль рядом: поля короткие, а вместе они читаются как одна запись */
.staffcols { display: flex; gap: 16px; flex-wrap: wrap; }
.newstaff > label { display: block; margin-top: 14px; }
.newstaff > button { margin-top: 16px; }

/* галочки серверов: строка на сервер, имя сверху, адрес под ним */
.checks { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.check {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 9px; cursor: pointer;
  font-weight: 400; margin: 0; line-height: 1.3;
}
.check:hover { background: var(--line-soft); }
.check input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.check .muted { font-size: 12px; }
.renewform .checks { margin-bottom: 4px; }
.renewform .check { padding: 6px 8px; font-size: 13px; }

/* отключённый администратор — не беда, а состояние: серый, а не красный, как
   у ссылки с вышедшим сроком */
tr.offrow td { background: var(--line-soft); }
tr.offrow .linkname { color: var(--muted); }

/* пароль лежит открытым текстом в поле, но показывается по просьбе: список
   админов открывают и при людях, а пароль там не один */
.pwcell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pwcell input {
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  padding: 7px 10px; width: 168px; letter-spacing: .02em;
}
.pwcell button { white-space: nowrap; }

/* ── настройки: телеграм-боты ─────────────────────────────────────────────── */
/* Бот — не строка таблицы: у него есть состояние, ссылка, список пришедших и
   своя форма. Поэтому карточка, а не ячейки: на телефоне таблица всё равно
   превращается в такие же карточки, только без права на собственную вёрстку. */
.botlist { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.bot { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.bot.offbot { background: var(--line-soft); }
.bothead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.botname { min-width: 0; }
/* в карточке кнопки идут в ряд: столбиком, как в таблице, они растянули бы
   шапку карточки на три строки и оставили под ней пустоту */
.bothead .actionbtns { flex: none; flex-direction: row; gap: 6px; }
/* подпись строкой выше, поле и кнопка — рядом: ширины карточки хватает */
.bot .copycol { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
.bot .copycol .colname { flex-basis: 100%; }
.bot .copycol input { flex: 1; min-width: 0; }
.bot .issued { margin-top: 6px; }
.bot summary { margin-top: 12px; }
/* форма бота раскрывается на всю карточку: она не в таблице, теснить её нечем */
.botform { min-width: 0; width: 100%; margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
/* приветствие пишут словами, а не конфигом: моноширинный шрифт тут ни к чему */
.botform textarea { font-family: inherit; font-size: 14px; margin-top: 0; }
.botform .pwcell { margin-top: 4px; }
.botform .pwcell input { flex: 1; min-width: 0; width: auto; }

.newbot { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.newbot > button { margin-top: 25px; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.steps b { color: var(--text); font-weight: 600; }

/* строка про бота на странице получателя: предложение, а не кнопка — кнопки
   здесь заняты платформами, и третья сбила бы выбор */
.tgline { margin-top: 12px; font-size: 14px; }

/* ── статистика ───────────────────────────────────────────────────────────── */
.charthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.charthead h2 { margin-bottom: 0; }
.subhead { display: block; font-size: 14px; font-weight: 600; margin: 26px 0 2px; }
/* заголовок-раскрывашка: выглядит как подзаголовок, ведёт себя как кнопка */
.subhead.fold {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0; border-color: transparent; background: transparent;
  color: var(--text); text-align: left;
}
.subhead.fold:hover { color: var(--accent); border-color: transparent; }
.subhead.fold .chev {
  width: 7px; height: 7px; margin-top: -3px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .15s;
}
.subhead.fold[aria-expanded="true"] .chev { margin-top: 3px; transform: rotate(225deg); }
.chart .figure { margin: 0; }
.chart figcaption { font-size: 13px; color: var(--muted); margin-top: 22px; }
/* пока грузятся новые данные, старые держим на месте — без прыжков вёрстки */
.chart.busy .stats, .chart.busy .plot, .chart.busy .top, .chart.busy .more { opacity: .5; }
.stats, .plot, .top { transition: opacity .15s; }

.ranges { display: flex; gap: 2px; background: var(--line-soft); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.range { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 13px; font-size: 13px; white-space: nowrap; }
.range:hover { color: var(--text); border-color: transparent; }
.range.on { background: var(--surface); color: var(--text); border-color: var(--line); }

.stats { display: flex; gap: 30px; flex-wrap: wrap; margin-top: 16px; }
.stat { min-width: 140px; }
.statname { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.statvalue { font-size: 25px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.key { flex: none; width: 14px; height: 3px; border-radius: 2px; background: var(--muted); }
.key.s1 { background: var(--s1); }
.key.s2 { background: var(--s2); }

.plot { position: relative; margin-top: 8px; }
.center-text { text-align: center; }

.chartsvg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chartsvg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chartsvg .grid { stroke: var(--line-soft); }
.chartsvg .axis { stroke: var(--line); }
.chartsvg .rule { stroke: var(--muted); opacity: .45; }
.chartsvg.tipping .peak { opacity: 0; }
.chartsvg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chartsvg .peak { fill: var(--muted); font-size: 11px; font-weight: 600; }
.chartsvg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chartsvg .fill { stroke: none; opacity: .1; }
/* кольцо цвета подложки: точка остаётся читаемой поверх чужой линии */
.chartsvg .dot { stroke: var(--surface); stroke-width: 2; }
.chartsvg .overlay { fill: transparent; }
.chartsvg .line.s1 { stroke: var(--s1); }
.chartsvg .line.s2 { stroke: var(--s2); }
.chartsvg .fill.s1 { fill: var(--s1); }
.chartsvg .fill.s2 { fill: var(--s2); }
.chartsvg .dot.s1 { fill: var(--s1); }
.chartsvg .dot.s2 { fill: var(--s2); }

/* ── бухгалтерия ──────────────────────────────────────────────────────────── */
/* оплаты — события, а не поток: на графике доходов столбики, а не линия */
.chartsvg .col { fill: var(--s1); opacity: .82; transition: opacity .1s; }
.chartsvg .col.on { opacity: 1; }

/* сортировка списка клиентов той же плашкой, что и периоды. Кнопки, а не
   заголовки столбцов: на телефоне таблица превращается в карточки, и шапка,
   вместе с которой уехала бы сортировка, не показывается вовсе */
.sortbar { align-self: flex-start; width: fit-content; max-width: 100%; margin: 12px 0 2px; }
.sortbar .range.on::after { content: " ↓"; }
.sortbar .range.on.up::after { content: " ↑"; }

.tip {
  position: absolute; top: 0; left: 0; pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .10);
  white-space: nowrap;
}
.tiptime { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.tiprow { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tiprow b { min-width: 84px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tiprow .muted { font-size: 12px; }

/* топ по трафику */
.top { margin-top: 4px; }
.top td { font-variant-numeric: tabular-nums; }
.top .hint { margin-top: 2px; }
.sharecell { white-space: nowrap; }
.sharecell .bar {
  display: inline-block; vertical-align: middle; margin-right: 9px;
  width: 84px; height: 6px; border-radius: 999px;
  background: var(--line-soft); overflow: hidden;
}
.sharecell .bar i { display: block; height: 100%; border-radius: 999px; background: var(--s1); }
.more {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 10px; padding: 8px 14px; font-size: 13px;
  background: transparent; border-color: transparent; color: var(--muted);
  transition: opacity .15s, border-color .15s, color .15s;
}
.more:hover { color: var(--text); border-color: var(--line); }
/* .more объявлен ниже .hidden и своим display перебивал бы его: кнопку
   «показать ещё» прячут скриптом, и без этой строки она висела бы всегда */
.more.hidden { display: none; }
/* шеврон: уголок из двух сторон рамки, повёрнутый на 45° */
.more .chev {
  width: 7px; height: 7px; margin-top: -3px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .15s;
}
.more.open .chev { margin-top: 3px; transform: rotate(225deg); }

/* ── телефон ──────────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  body { padding: 22px 12px 56px; }
  body.center { padding-top: 12px; align-items: flex-start; }
  h1 { font-size: 21px; }
  .page { margin-bottom: 16px; }
  .panel { padding: 16px 14px; border-radius: 12px; }
  .get { padding: 14px; }
  .usedbox { padding: 12px 14px; }

  /* поля от 16px — иначе iOS зумит страницу при фокусе */
  input, select { font-size: 16px; }
  /* в кнопку списка не печатают, зум ей не грозит — можно спокойнее */
  .selectbtn { font-size: 15px; }
  /* список остаётся списком под полем, а не системным экраном на весь телефон:
     тарифов много, поэтому строки компактные и прокручиваются */
  .options { max-height: 45vh; }
  .option { font-size: 14px; padding: 8px 10px; }

  .platforms { flex-direction: column; gap: 8px; }
  .pill { width: 100%; }
  .method .btn { width: 100%; }
  .apps li { row-gap: 8px; }
  .appbtns, .apps .btn { flex: 1 1 100%; }

  /* «подключён 09.08.2026 11:36» съедал ширину у названия конфига, и оно
     ужималось в столбик. Название занимает всю строку рядом с иконкой, метка
     переносится под него и остаётся плашкой по себе, а не полосой во всю ширину */
  .cardhead { row-gap: 8px; }
  .cardhead .appinfo { flex-basis: calc(100% - 48px); }
  .cardhead .chip { flex: none; }

  .copyrow { flex-direction: column; }
  .copyrow button { width: 100%; }
  .copyrow.tight input { font-size: 12px; }
  .qr { padding: 10px; }
  .qr svg { width: 100%; }

  /* в шапке телефона кнопки идут столбиком — плашки тянутся вместе с ними */
  .billchip { width: 100%; }
  .serverchip { width: 100%; max-width: none; justify-content: space-between; }

  .staffcols { display: block; }
  .staffcols .field { margin-bottom: 14px; }
  .newstaff > button { width: 100%; }
  .pwcell input { flex: 1; width: auto; min-width: 0; }

  .newlink, .newbot { display: block; }
  .newlink .field, .newbot .field { margin-bottom: 14px; }
  .newlink > button, .newbot > button { margin-top: 0; width: 100%; }
  /* карточка бота: кнопки под именем, а не сбоку — ширины на два столбца нет */
  .bothead { flex-direction: column; gap: 10px; }
  .bothead .actionbtns { width: 100%; }
  .page.row { flex-direction: row; align-items: center; }
  /* в шапке телефона кнопки встают столбиком: рядом им уже не хватает ширины */
  .headbtns { flex-direction: column; align-items: stretch; }
  /* а значки разделов остаются строкой — столбиком из трёх квадратов они заняли
     бы пол-экрана. Тянутся во всю ширину: так в них проще попасть пальцем */
  .iconbtns { gap: 6px; }
  .iconbtn { flex: 1; height: 40px; border-color: var(--line); }
  .sortbar { width: 100%; }

  /* таблица ссылок превращается в карточки */
  .scroll { overflow-x: visible; margin: 0; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
  }
  tr:last-child { margin-bottom: 0; }
  tr.expired { background: var(--bad-bg); border-color: var(--bad-text); }
  tr.expired td { background: transparent; }
  tr.offrow { background: var(--line-soft); }
  tr.offrow td { background: transparent; }
  td { border: none; padding: 5px 0; }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: 3px;
  }
  td.actions { text-align: left; padding-top: 12px; }
  td.actions button { padding: 8px 14px; }
  /* в карточке места хватает: кнопки идут в ряд и жмутся краем к краю */
  .actionbtns { flex-direction: row; gap: 6px; }
  .actionbtns > * { flex: 1; }
  .actionbtns button { padding: 8px 10px; }
  .renewform { min-width: 0; }
  /* в карточке ширину задаёт экран: длинным строкам разрешаем переноситься */
  .plancell { min-width: 0; }
  .plancell > div, .plancell .hint { white-space: normal; }
  .copycol input { min-width: 0; }
  /* в карточке строка не помещается: поле занимает её целиком, кнопка встаёт под ним */
  .copyline { flex-wrap: wrap; gap: 6px; }
  .copyline input { flex-basis: 100%; min-width: 0; }
  .copyline button { flex: 1; }
  td.empty::before { content: none; }

  /* график */
  .charthead { flex-direction: column; gap: 12px; }
  .ranges { width: 100%; }
  .range { flex: 1 1 auto; padding: 7px 10px; }
  .stats { gap: 14px 18px; }
  .stat { flex: 1 1 44%; min-width: 0; }
  .statvalue { font-size: 22px; }
  .tip { padding: 7px 9px; }
  .tiprow b { min-width: 74px; }
}
