/* ====================================================================== */
/*  Stellar — оформление панели                                           */
/* ====================================================================== */
/*  Всё локально: ни шрифтов, ни скриптов со сторонних доменов — CSP можно
    держать закрытым наглухо.

    Три правила, которым подчинено всё остальное.

    1. Глубина делается фоном, а не рамками. Раньше каждый блок был обведён
       линией, и страница читалась как таблица в таблице. Теперь панель —
       это просто чуть более светлая поверхность; линия остаётся там, где
       действительно разделяет (строки таблицы, шапка), и нигде больше.

    2. Цвет означает одно и то же везде. Фиолетовый — интерфейс и действие.
       Золотой — только звёзды и деньги в них. Зелёный, жёлтый, красный —
       исход. Если цвет ничего не значит, его нет.

    3. Телефон — не «версия попроще». Главные разделы вынесены в нижнюю
       панель под большой палец, поля крупные, отступы дышат. Всё, что
       уменьшено ради узкого экрана, уменьшено осознанно и названо.        */

:root {
  /* --- поверхности --- */
  --bg: #0a0b12;
  --bg-elev: #12141d;
  --bg-elev-2: #171a25;
  --bg-hover: #1e2231;
  --border: #232838;
  --border-strong: #333a51;

  /* --- текст --- */
  --text: #e9ecf5;
  --text-dim: #9aa3bd;
  --text-faint: #666e8a;

  /* --- акцент: интерфейс и действие --- */
  --accent: #7c5cff;
  --accent-2: #a68bff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --accent-line: rgba(124, 92, 255, 0.42);
  --accent-glow: rgba(124, 92, 255, 0.35);

  /* --- золото: только звёзды и суммы в них --- */
  --gold: #ffc861;
  --gold-soft: rgba(255, 200, 97, 0.13);

  /* --- исход --- */
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --danger: #fb5f6d;
  --danger-soft: rgba(251, 95, 109, 0.13);
  --info: #58a6ff;
  --info-soft: rgba(88, 166, 255, 0.13);

  /* --- геометрия --- */
  --r-xs: 8px;
  --r-sm: 11px;
  --r: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.28), 0 12px 32px rgba(0, 0, 0, 0.22);
  --shadow-lift: 0 6px 16px rgba(0, 0, 0, 0.34), 0 20px 48px rgba(0, 0, 0, 0.28);

  --sidebar-w: 244px;
  --tabbar-h: 62px;

  --font: "Segoe UI Variable Display", "Segoe UI", -apple-system,
    BlinkMacSystemFont, "SF Pro Text", Roboto, Ubuntu, "Helvetica Neue",
    Arial, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", "SF Mono", ui-monospace, Menlo,
    Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.9, 0.3, 1);
}

[data-theme="light"] {
  --bg: #f5f6fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #f1f3fa;
  --bg-hover: #eaeef8;
  --border: #e4e8f2;
  --border-strong: #cdd4e4;

  --text: #101320;
  --text-dim: #545c74;
  --text-faint: #838ca6;

  --accent: #6244f5;
  --accent-2: #8b6dff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(98, 68, 245, 0.1);
  --accent-line: rgba(98, 68, 245, 0.34);
  --accent-glow: rgba(98, 68, 245, 0.28);

  --gold: #b07908;
  --gold-soft: rgba(176, 121, 8, 0.11);

  --ok: #0f9d69;
  --ok-soft: rgba(15, 157, 105, 0.1);
  --warn: #a97400;
  --warn-soft: rgba(169, 116, 0, 0.11);
  --danger: #e0374a;
  --danger-soft: rgba(224, 55, 74, 0.1);
  --info: #1f6fd0;
  --info-soft: rgba(31, 111, 208, 0.1);

  --shadow-sm: 0 1px 2px rgba(20, 30, 60, 0.06);
  --shadow: 0 1px 3px rgba(20, 30, 60, 0.07), 0 10px 28px rgba(20, 30, 60, 0.07);
  --shadow-lift: 0 4px 12px rgba(20, 30, 60, 0.1), 0 18px 44px rgba(20, 30, 60, 0.11);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 640;
  letter-spacing: -0.015em;
}

/* Цифры в таблицах должны стоять столбиком — иначе взгляд не сравнивает суммы */
.num,
td.num,
th.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.9em;
  letter-spacing: -0.01em;
}

code {
  background: var(--bg-elev-2);
  border-radius: var(--r-xs);
  padding: 1px 6px;
}

/* Иконки. Один размер, один вес линии, цвет от текста. */
.ico {
  width: 18px;
  height: 18px;
  flex: none;
  display: block;
}

::selection {
  background: var(--accent-glow);
  color: var(--text);
}

/* --------------------------------------------------------------------- */
/*  Каркас                                                                */
/* --------------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 16px 14px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  flex: none;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.brand-name {
  font-weight: 680;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-env {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.nav {
  padding: 6px 10px 14px;
  flex: 1;
}

/* Здесь капслок остаётся: это не подпись к данным, а разделитель групп в
   меню, и его задача — быть тише пунктов, а не читаться наравне с ними. */
.nav-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 16px 12px 6px;
  font-weight: 620;
  opacity: 0.85;
}

.nav-label:first-child {
  padding-top: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-weight: 520;
  margin-bottom: 2px;
  position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav a .ico {
  opacity: 0.75;
  transition: opacity 0.15s var(--ease);
}

.nav a:hover .ico {
  opacity: 1;
}

/* Активный пункт: заливка плюс короткая полоска слева. Одной заливки мало
   — в длинном списке она читается как наведение мыши, а не как «вы здесь». */
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 620;
}

.nav a.active .ico {
  opacity: 1;
}

.nav a.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--bg-elev);
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  padding: 6px;
  border-radius: var(--r-sm);
  transition: background 0.15s var(--ease);
}

.who:hover {
  background: var(--bg-hover);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--bg-hover), var(--bg-elev-2));
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-dim);
  flex: none;
}

.who-text {
  min-width: 0;
  flex: 1;
}

.who-text b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who-text span {
  font-size: 11.5px;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------- */
/*  Шапка и содержимое                                                    */
/* --------------------------------------------------------------------- */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Шапка полупрозрачная с размытием: содержимое уезжает под неё, и видно,
   что страница длиннее экрана. Сплошная заливка это скрывала. */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 30px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
}

/* Браузерам без color-mix отдаём сплошной фон: прозрачная шапка без
   размытия — это нечитаемый текст поверх таблицы. */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .topbar {
    background: var(--bg);
  }
}

.topbar h1 {
  font-size: 21px;
  letter-spacing: -0.025em;
}

.topbar .sub {
  color: var(--text-faint);
  font-size: 13px;
  margin-top: 2px;
}

.topbar .sub a {
  color: var(--accent-2);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.content {
  padding: 10px 30px 72px;
  max-width: 1520px;
  width: 100%;
}

/* --------------------------------------------------------------------- */
/*  Карточки чисел                                                        */
/* --------------------------------------------------------------------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.metric {
  background: var(--bg-elev);
  border-radius: var(--r);
  padding: 16px 18px;
  display: block;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

/* Тонкая цветная черта сверху вместо цветной рамки вокруг: рамка
   превращает карточку в предупреждение, а это просто число. */
.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: transparent;
}

a.metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* Подписи обычным регистром, без разрядки. Капслок с трекингом — самая
   заметная примета типовой админки: он делает короткую подпись длинной,
   на телефоне она переносится на две строки, а читается всё равно хуже. */
.metric .label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 560;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.35;
}

.metric .value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 8px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.metric .foot {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

.metric.attn {
  background: linear-gradient(var(--danger-soft), var(--danger-soft)), var(--bg-elev);
}
.metric.attn::before { background: var(--danger); }
.metric.attn .value { color: var(--danger); }

.metric.good::before { background: var(--ok); }
.metric.good .value { color: var(--ok); }

.metric.gold::before { background: var(--gold); }
.metric.gold .value { color: var(--gold); }

/* Второй ряд чисел. Первые четыре карточки оператор открывает десятки раз
   в день, остальные — раз в неделю; одинаковый размер заставлял читать
   все десять одинаково внимательно и превращал сводку в стену цифр. */
.metrics.slim {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.metrics.slim .metric {
  padding: 13px 15px;
  background: var(--bg-elev-2);
  box-shadow: none;
}

.metrics.slim .metric .value {
  font-size: 20px;
  margin-top: 4px;
}

.metrics.slim .metric .label {
  font-size: 12.5px;
}

.metrics.slim .metric .foot {
  font-size: 12px;
  margin-top: 2px;
}

/* --------------------------------------------------------------------- */
/*  Панели                                                                */
/* --------------------------------------------------------------------- */
.panel {
  background: var(--bg-elev);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* Шапка панели без заливки и без нижней линии: заголовок и так отделён
   воздухом. Линия появляется только там, где под шапкой начинается
   таблица, — иначе первая строка липнет к заголовку. */
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
}

.panel-head h2 {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.panel-head .spacer {
  margin-left: auto;
}

.panel-head + .table-wrap {
  border-top: 1px solid var(--border);
}

.panel-body {
  padding: 4px 18px 18px;
}

.panel-head + .panel-body {
  padding-top: 0;
}

/* Панель, требующая внимания: подсвечена слева, а не обведена целиком. */
.panel.warn-panel,
.panel.danger-panel,
.panel.accent-panel {
  position: relative;
  padding-left: 3px;
}

.panel.warn-panel::before,
.panel.danger-panel::before,
.panel.accent-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.panel.warn-panel::before { background: var(--warn); }
.panel.danger-panel::before { background: var(--danger); }
.panel.accent-panel::before {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

/* --------------------------------------------------------------------- */
/*  Таблицы                                                               */
/* --------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 12.5px;
  color: var(--text-faint);
  font-weight: 560;
  padding: 11px 16px;
  background: var(--bg-elev);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody td {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.12s var(--ease);
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody tr.row-link {
  cursor: pointer;
}

.t-main {
  font-weight: 570;
}

.t-sub {
  color: var(--text-faint);
  font-size: 12.5px;
  margin-top: 1px;
}

.t-sub .uname + .uid::before {
  content: " · ";
}

.empty {
  padding: 52px 24px;
  text-align: center;
  color: var(--text-faint);
}

.empty .big {
  font-size: 34px;
  margin-bottom: 10px;
  opacity: 0.35;
}

/* --------------------------------------------------------------------- */
/*  Метки состояния                                                       */
/* --------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
  background: var(--bg-elev-2);
  color: var(--text-dim);
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill.awaiting_approval {
  color: var(--warn);
  background: var(--warn-soft);
}
.pill.queued,
.pill.processing,
.pill.premium {
  color: var(--info);
  background: var(--info-soft);
}
.pill.sent,
.pill.payout_sent,
.pill.paid,
.pill.trusted {
  color: var(--ok);
  background: var(--ok-soft);
}
.pill.rejected,
.pill.failed,
.pill.on_hold,
.pill.refunded,
.pill.blocked {
  color: var(--danger);
  background: var(--danger-soft);
}
.pill.draft,
.pill.expired,
.pill.cancelled,
.pill.awaiting_payment,
.pill.partially_paid,
.pill.payout_queued {
  color: var(--text-faint);
  background: var(--bg-elev-2);
}

/* --------------------------------------------------------------------- */
/*  Кнопки                                                                */
/* --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 590;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    transform 0.08s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-faint);
}

/* Нажатие видно телом, а не только цветом: на телефоне палец закрывает
   кнопку целиком, и сдвиг — единственный отклик, который остаётся виден. */
.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent-2), var(--accent));
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 650;
  box-shadow: 0 3px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(145deg, var(--accent-2), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 5px 18px var(--accent-glow);
}

.btn-ok {
  background: var(--ok);
  border-color: transparent;
  color: #04150d;
  font-weight: 650;
}

.btn-ok:hover {
  background: var(--ok);
  border-color: transparent;
  filter: brightness(1.08);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: var(--r-xs);
}

.btn-block {
  width: 100%;
}

/* Квадратная кнопка под одну иконку: тема, выход. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* --------------------------------------------------------------------- */
/*  Формы                                                                 */
/* --------------------------------------------------------------------- */
label.field {
  display: block;
  margin-bottom: 16px;
}

label.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}

label.field .hint,
.hint {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 12.5px;
  margin-top: 6px;
  display: block;
  line-height: 1.5;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease),
    background 0.15s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--text-faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-elev-2);
}

/* Клавиатура — основной инструмент при ежедневной работе */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filters input[type="search"] {
  width: 250px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

/* --------------------------------------------------------------------- */
/*  Фильтры-таблетки                                                      */
/* --------------------------------------------------------------------- */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 560;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.chip.on {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 620;
}

.chip .n {
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

.chip.on .n {
  opacity: 0.8;
}

/* --------------------------------------------------------------------- */
/*  Сообщения                                                             */
/* --------------------------------------------------------------------- */
/* Цвет задаётся переменной, а не прямым правилом: сообщение без класса
   исхода не должно остаться со сломанным `var()` и невидимым знаком. */
.flash {
  --flash: var(--text-dim);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--r);
  margin-bottom: 18px;
  background: var(--bg-elev-2);
  font-weight: 520;
  line-height: 1.5;
}

.flash.ok   { --flash: var(--ok);     background: var(--ok-soft); }
.flash.err  { --flash: var(--danger); background: var(--danger-soft); }
.flash.warn { --flash: var(--warn);   background: var(--warn-soft); }

/* Цветом отмечен только знак слева. Текст остаётся основного цвета:
   цветной абзац на цветной подложке — ровно то, от чего страница
   начинает кричать, и читать его тяжелее, а не легче. */
.flash > span:first-child {
  flex: none;
  color: var(--flash);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.flash > span:last-child {
  color: var(--text);
  font-weight: 500;
}

.note {
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.55;
}

/* Длинное объяснение, которое нужно не каждый раз. Свёрнутое по
   умолчанию: смысл сохраняется, а страница перестаёт быть инструкцией. */
.why {
  margin-top: 14px;
  border-radius: var(--r-sm);
  background: var(--bg-elev-2);
  overflow: hidden;
}

.why > summary {
  cursor: pointer;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 580;
  color: var(--text-dim);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}

.why > summary::-webkit-details-marker {
  display: none;
}

.why > summary::before {
  content: "›";
  font-size: 15px;
  line-height: 1;
  transition: transform 0.18s var(--ease);
}

.why[open] > summary::before {
  transform: rotate(90deg);
}

.why > summary:hover {
  color: var(--text);
}

.why-body {
  padding: 0 14px 12px;
  font-size: 12.5px;
  color: var(--text-faint);
  line-height: 1.6;
}

.why-body p {
  margin: 0 0 8px;
}

.why-body p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------- */
/*  Раскладки и списки определений                                        */
/* --------------------------------------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1080px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dl {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0;
}

.dl dt {
  color: var(--text-faint);
  font-size: 12.5px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.dl dd {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}

.dl dt:last-of-type,
.dl dd:last-of-type {
  border-bottom: none;
}

.dl-tight {
  grid-template-columns: 130px minmax(0, 1fr);
}

.dl-wide {
  grid-template-columns: 165px minmax(0, 1fr);
}

/* Пара «признак — значение» в две строки: в узкой колонке карточки
   обычный dl расползается, а тут строк много и все короткие. */
.facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.fact .k {
  display: block;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-bottom: 2px;
  font-weight: 520;
}

.fact .v {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.fact.wide {
  grid-column: 1 / -1;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* --------------------------------------------------------------------- */
/*  Хронология                                                            */
/* --------------------------------------------------------------------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 18px 24px;
  border-left: 2px solid var(--border);
  margin-left: 5px;
}

.timeline li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--border-strong);
}

.timeline li.done::before {
  background: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.timeline li.bad::before {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.timeline .t {
  font-weight: 570;
}

.timeline .w {
  color: var(--text-faint);
  font-size: 12.5px;
}

.copy {
  cursor: pointer;
  border-bottom: 1px dashed var(--border-strong);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.copy:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}

/* --------------------------------------------------------------------- */
/*  Наблюдения антифрода                                                  */
/* --------------------------------------------------------------------- */
/* Цвет точки слева говорит о весе быстрее, чем чтение самой фразы:
   серый — просто факт, жёлтый — стоит посмотреть, красный — стоит
   разобраться. Ни один цвет ничего не запрещает. */
.notes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-row {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.note-row .marker {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}

.note-row.attn { color: var(--text); }
.note-row.attn .marker { background: var(--warn); }
.note-row.risk { color: var(--text); font-weight: 520; }
.note-row.risk .marker {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

/* --------------------------------------------------------------------- */
/*  График разлоков                                                       */
/* --------------------------------------------------------------------- */
/* Столбцы тянутся на всю высоту (align-items: stretch), а высота в
   процентах задаётся уже вложенному элементу. Если ставить проценты прямо
   на flex-элемент с align-items: flex-end, браузер не может разрешить
   процент и подставляет min-height — график схлопывается в полоску. */
.bars {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 146px;
  padding-top: 12px;
}

.bars .bar-col {
  flex: 1;
  min-width: 8px;
  height: 100%;
  position: relative;
}

/* Полоса позиционируется абсолютно, а не растёт как flex-элемент:
   процент от растянутой flex-высоты браузер не разрешает и подставляет
   min-height, из-за чего весь график схлопывается в тонкую линию. */
.bars .bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* Потолок ширины: когда разлок всего один, полоса на всю панель
     читается как заливка, а не как столбец диаграммы. */
  max-width: 44px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--gold), rgba(255, 200, 97, 0.35));
  border-radius: 5px 5px 2px 2px;
  min-height: 3px;
  transition: filter 0.15s var(--ease), transform 0.15s var(--ease);
}

.bars .bar:hover {
  filter: brightness(1.2);
  transform: scaleX(1.08);
}

.bars .bar span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  padding: 4px 8px;
  border-radius: var(--r-xs);
  font-size: 11.5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease);
  margin-bottom: 6px;
  z-index: 5;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.bars .bar:hover span {
  opacity: 1;
}

.bars-axis {
  display: flex;
  gap: 4px;
  margin-top: 7px;
}

.bars-axis div {
  flex: 1;
  min-width: 8px;
  text-align: center;
  font-size: 10px;
  color: var(--text-faint);
  overflow: hidden;
}

.bars .bar.h5 { height: 5%; }
.bars .bar.h10 { height: 10%; }
.bars .bar.h15 { height: 15%; }
.bars .bar.h20 { height: 20%; }
.bars .bar.h25 { height: 25%; }
.bars .bar.h30 { height: 30%; }
.bars .bar.h35 { height: 35%; }
.bars .bar.h40 { height: 40%; }
.bars .bar.h45 { height: 45%; }
.bars .bar.h50 { height: 50%; }
.bars .bar.h55 { height: 55%; }
.bars .bar.h60 { height: 60%; }
.bars .bar.h65 { height: 65%; }
.bars .bar.h70 { height: 70%; }
.bars .bar.h75 { height: 75%; }
.bars .bar.h80 { height: 80%; }
.bars .bar.h85 { height: 85%; }
.bars .bar.h90 { height: 90%; }
.bars .bar.h95 { height: 95%; }
.bars .bar.h100 { height: 100%; }

/* --------------------------------------------------------------------- */
/*  Пагинация                                                             */
/* --------------------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
}

.pager .info {
  color: var(--text-faint);
  font-size: 12.5px;
}

.pager .spacer {
  margin-left: auto;
}

/* --------------------------------------------------------------------- */
/*  Вход                                                                  */
/* --------------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

/* Пятно света за карточкой. Единственное украшение во всей панели, и оно
   здесь потому, что страница входа — единственная, где нет данных. */
.login-wrap::before {
  content: "";
  position: absolute;
  top: -30vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(120vw, 900px);
  height: 70vh;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 62%);
  opacity: 0.55;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-lift);
  position: relative;
}

.login-card .brand {
  padding: 0 0 22px;
  justify-content: center;
}

.login-card h1 {
  font-size: 19px;
  text-align: center;
  margin-bottom: 5px;
}

.login-card .lead {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  margin: 0 0 22px;
}

.login-aside {
  width: 100%;
  max-width: 390px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  position: relative;
}

.login-aside a {
  color: var(--text-dim);
}

.login-aside a:hover {
  color: var(--accent-2);
}

/* --------------------------------------------------------------------- */
/*  Второй фактор                                                         */
/* --------------------------------------------------------------------- */
/* Поле для шестизначного кода. Крупный моноширинный текст с разрядкой:
   цифры сверяют с экраном телефона, и слипшиеся 1 и 7 тут не нужны. */
.code-input {
  font-family: var(--mono);
  font-size: 25px !important;
  letter-spacing: 0.32em;
  text-align: center;
  padding-left: 0.32em !important;
  font-weight: 600;
}

/* Белая подложка обязательна: в тёмной теме QR иначе оказался бы чёрным
   по тёмному, и камера его не увидела бы. */
.qr-box {
  display: flex;
  justify-content: center;
  padding: 14px;
  margin: 16px 0;
  background: #fff;
  border-radius: var(--r);
}

.qr-box .qr {
  width: 100%;
  max-width: 208px;
  height: auto;
  display: block;
}

.secret-box {
  padding: 11px 13px;
  background: var(--bg-elev-2);
  border-radius: var(--r-sm);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.recovery-codes span {
  padding: 10px;
  text-align: center;
  background: var(--bg-elev-2);
  border-radius: var(--r-sm);
  font-size: 14px;
  letter-spacing: 0.04em;
  user-select: all; /* двойной клик выделяет код целиком */
}

/* --------------------------------------------------------------------- */
/*  Казначейство                                                          */
/* --------------------------------------------------------------------- */
.quote-box {
  padding: 18px;
  margin-bottom: 16px;
  border-radius: var(--r);
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%),
    var(--bg-elev-2);
}

.quote-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 19px;
  text-align: center;
  letter-spacing: -0.02em;
}

.quote-head .arrow {
  color: var(--accent-2);
  font-size: 17px;
}

/* Карточка одного счёта цепочки на странице заказа. Возврат делается по
   каждому отдельно, поэтому счета разделены визуально, а не строками
   таблицы: у каждого своя форма со своей кнопкой. */
.part-card {
  padding: 16px;
  border-radius: var(--r-sm);
  background: var(--bg-elev-2);
}

.part-card + .part-card {
  margin-top: 12px;
}

.part-card.is-refunded {
  opacity: 0.6;
}

/* --------------------------------------------------------------------- */
/*  Мелочи                                                                */
/* --------------------------------------------------------------------- */
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gap-sm { gap: 6px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.spacer { margin-left: auto; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 14px; }
.mt-0 { margin-top: 0; }
.break { word-break: break-all; }
.center { text-align: center; }
.justify-center { justify-content: center; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-faint); }
.strong { font-weight: 620; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.gold-text { color: var(--gold); }
.w-narrow { width: 220px; }
.w-select { width: 210px; }
.w-check { width: 36px; }
.check { width: auto; }
.truncate {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------- */
/*  Движение                                                              */
/* --------------------------------------------------------------------- */
/* Короткое появление блоков при загрузке. Оно решает одну задачу: показать
   порядок чтения — сначала числа, потом списки. Длиннее 260 мс это уже не
   подсказка, а ожидание, поэтому ступенька мелкая и всего на четыре шага. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.content > .metrics,
.content > .panel,
.content > .grid-2,
.content > .flash {
  animation: rise 0.26s var(--ease) both;
}

.content > *:nth-child(2) { animation-delay: 0.03s; }
.content > *:nth-child(3) { animation-delay: 0.06s; }
.content > *:nth-child(4) { animation-delay: 0.09s; }

/* ====================================================================== */
/*  Телефон и планшет                                                      */
/* ====================================================================== */
/*  Панель открывают с телефона, и это не «версия попроще», а тот же
    инструмент в другой руке. Отсюда четыре решения.

    Главные разделы вынесены в нижнюю панель под большой палец. Раньше
    любое действие начиналось с гамбургера и поиска пункта среди
    четырнадцати; четыре из них открывают в день десятки раз.

    Остальное меню — по-прежнему шторка, а не переезд наверх страницы:
    четырнадцать пунктов над содержимым означают, что до любой цифры
    нужно сначала пролистать всё меню.

    Поля ввода получают шрифт 16px. Это не про читаемость: Safari на iOS
    приближает страницу при фокусе на поле меньшего размера, и после ввода
    суммы вёрстка остаётся увеличенной.

    Таблицы остаются таблицами и прокручиваются вбок. Превращать их в
    карточки заманчиво, но в выплатах и заказах важны именно колонки рядом:
    сумма, статус, дата взглядом сравниваются, а в столбике карточек — нет. */

/* Кнопки меню, подложка и нижняя панель существуют только на узком экране. */
.nav-toggle,
.nav-close,
.scrim,
.tabbar {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  /* --- Выдвижное меню --- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 300px);
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.26s var(--ease);
    will-change: transform;
    box-shadow: none;
  }

  body.nav-open .sidebar {
    transform: none;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  }

  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(3, 5, 12, 0.66);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s var(--ease);
  }

  body.nav-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }

  /* Фон не должен прокручиваться под открытым меню. */
  body.nav-open {
    overflow: hidden;
  }

  /* Пункты меню под палец, а не под курсор. */
  .nav a {
    padding: 12px 12px;
    font-size: 15px;
  }

  .brand {
    padding: 16px 14px 12px;
    padding-top: calc(16px + env(safe-area-inset-top));
  }

  /* Гамбургер в шапке на телефоне не нужен: ту же шторку открывает «Ещё»
     в нижней панели, и она под пальцем, а не в верхнем углу. Два элемента
     для одного действия — это лишний элемент. Разметка остаётся: на
     планшете в альбомной ориентации кнопка ещё может пригодиться. */
  .nav-toggle {
    display: none;
  }

  /* Крестик внутри самой шторки. Превращать гамбургер в крестик было бы
     красиво, но бессмысленно: открытая шторка его закрывает. */
  .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 34px;
    height: 34px;
    flex: none;
    border: none;
    border-radius: var(--r-sm);
    background: var(--bg-elev-2);
    color: var(--text-dim);
    font-size: 14px;
    cursor: pointer;
  }

  /* --- Нижняя панель вкладок --- */
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
    backdrop-filter: saturate(150%) blur(16px);
    -webkit-backdrop-filter: saturate(150%) blur(16px);
    border-top: 1px solid var(--border);
  }

  @supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .tabbar {
      background: var(--bg-elev);
    }
  }

  .tabbar a,
  .tabbar button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: var(--tabbar-h);
    border: none;
    background: none;
    color: var(--text-faint);
    font: inherit;
    font-size: 10.5px;
    font-weight: 560;
    cursor: pointer;
    transition: color 0.15s var(--ease);
    -webkit-tap-highlight-color: transparent;
  }

  .tabbar .ico {
    width: 21px;
    height: 21px;
  }

  .tabbar a:active,
  .tabbar button:active {
    color: var(--text-dim);
  }

  .tabbar a.on {
    color: var(--accent-2);
  }

  /* Полоска над активной вкладкой: подписи мелкие, и одного цвета мало,
     чтобы понять, где находишься, боковым зрением. */
  .tabbar a.on::before {
    content: "";
    position: absolute;
    top: 0;
    width: 26px;
    height: 2.5px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
  }

  .tabbar .dot {
    position: absolute;
    top: 7px;
    left: 50%;
    margin-left: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--r-pill);
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    line-height: 16px;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }

  /* --- Шапка --- */
  .topbar {
    gap: 10px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar h1 {
    font-size: 18px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .sub {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* --- Содержимое --- */
  /* Нижний отступ считает и панель вкладок, и вырез телефона: без этого
     последняя кнопка страницы оказывается под панелью и не нажимается. */
  .content {
    padding: 6px 14px;
    padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }

  .metric {
    padding: 14px;
  }

  .metric .value {
    font-size: 23px;
  }

  .metric .label {
    font-size: 10.5px;
  }

  .panel {
    margin-bottom: 12px;
    border-radius: var(--r);
  }

  .panel-head {
    padding: 14px 15px 10px;
  }

  .panel-body {
    padding: 4px 15px 16px;
  }

  /* Определения в одну колонку: узкая подпись слева съедает половину
     ширины и переносит каждое значение по слогам. */
  .dl,
  .dl-wide,
  .dl-tight {
    grid-template-columns: minmax(0, 1fr);
  }

  .dl dt {
    padding-bottom: 0;
    border-bottom: none;
  }

  .dl dd {
    padding-top: 2px;
  }

  /* --- Таблицы --- */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  thead th,
  tbody td {
    padding-left: 13px;
    padding-right: 13px;
    white-space: nowrap;
  }

  td .t-main,
  td .t-sub {
    white-space: nowrap;
  }

  /* --- Формы --- */
  /* 16px — порог, ниже которого Safari приближает страницу при фокусе. */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* Шапка панели — ряд из вкладок, распорки и поиска. На узком экране
     распорка бессмысленна, а ряд должен разложиться в столбик, иначе
     поиску остаётся треть ширины и в него не видно, что набрано. */
  .panel-head {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  /* Распорка остаётся: она уводит кнопку к правому краю. Вкладки и поиск
     занимают всю ширину и потому и так переносятся на свою строку. */
  .panel-head .chips,
  .panel-head .filters {
    width: 100%;
  }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: none;
  }

  .filters input[type="search"] {
    flex: 1 1 140px;
    width: auto;
    min-width: 0;
  }

  .btn {
    min-height: 40px;
  }

  .btn-block {
    min-height: 48px;
  }

  .btn-sm {
    min-height: 36px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .pager {
    flex-wrap: wrap;
    gap: 8px;
    padding: 13px 15px;
  }

  .pager .spacer {
    display: none;
  }

  .facts-grid {
    gap: 12px 14px;
  }

  .quote-head {
    font-size: 17px;
  }
}

/* Совсем узкие экраны. */
@media (max-width: 560px) {
  .facts-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metrics {
    gap: 8px;
  }

  .truncate {
    max-width: 180px;
  }
}

/* Экран лежит на боку и низкий: незачем тратить высоту на воздух. */
@media (max-width: 900px) and (max-height: 480px) {
  .topbar {
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  .tabbar a,
  .tabbar button {
    height: 48px;
  }

  :root {
    --tabbar-h: 48px;
  }
}

/* Уважение к настройке системы: анимации отключены полностью, а не
   ускорены. Половинчатое «поменьше» здесь никому не помогает. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Кнопка, по которой уже нажали: форма ушла, второй раз отправлять нечего.
   Класс, а не инлайновый стиль — CSP запрещает атрибут style. */
.btn.is-busy {
  opacity: 0.5;
}

/* --------------------------------------------------------------------- */
/*  Необязательные колонки                                                */
/* --------------------------------------------------------------------- */
/* Таблица на телефоне прокручивается вбок — и первым за край уезжает
   статус, то есть ровно то, ради чего в список и заходят. Колонка с
   пометкой `opt` на узком экране просто исчезает: номер выплаты, адрес
   кошелька и кнопка «открыть» на телефоне не нужны — строка и так
   нажимается целиком, а подробности есть на карточке.

   Что именно необязательно, решает каждая таблица сама: угадывать это
   правилом вида «спрятать третью колонку» — верный способ однажды
   спрятать сумму. */
@media (max-width: 720px) {
  th.opt,
  td.opt {
    display: none;
  }

  /* Числовой id рядом с @username: на телефоне лишний, без username —
     единственная зацепка, поэтому прячется только в паре. */
  .t-sub .uname + .uid {
    display: none;
  }

  /* Строки чуть плотнее, чтобы статус не уезжал за край. */
  thead th,
  tbody td {
    padding-left: 11px;
    padding-right: 11px;
  }

  .pill {
    font-size: 11.5px;
    padding: 3px 9px 3px 7px;
  }

  td .t-sub {
    font-size: 12px;
  }
}
