/* LIFT AI — оформление «Пульт».
   Тёмная приборная панель: слева список сайтов с сигнальными лампами,
   справа рабочая область. Цифры — моноширинным шрифтом, чтобы колонки
   выстраивались одна под другой и число читалось с одного взгляда.

   Размеры и контраст подняты под работу с большого экрана: основной
   текст 16px, подписи не мельче 12px, серые тона осветлены — на тёмном
   фоне тусклый серый читается заметно хуже, чем на белом.

   Без внешних библиотек: шрифты лежат в /static/fonts, из интернета
   не тянется ничего. Интерфейс открывается одинаково быстро и не
   ломается, если внешний CDN недоступен. */

@import url("/static/css/fonts.css");

:root {
  /* Основание */
  --bg:      #101419;
  --panel:   #171c23;
  --raise:   #1e242c;
  --sunk:    #0c1014;
  --line:    #313b47;
  --line-lo: #262e38;

  /* Текст. Три ступени яркости — дальше уже неразличимо. */
  --ink:     #f4f7fa;   /* основной текст */
  --ink-hi:  #ffffff;   /* заголовки и крупные числа */
  --dim:     #c6cfd9;   /* пояснения под полями */
  --dim-lo:  #b3bfcb;   /* подписи капсом над полями */

  /* Сигнальные цвета */
  --lamp:    #f0ad47;   /* работает, внимание, акцент */
  --lamp-lo: #3a2e1c;
  --ok:      #5ec894;
  --ok-lo:   #16302a;
  --bad:     #e8695c;
  --bad-lo:  #351f1f;
  --wait:    #82a9cf;
  --wait-lo: #1c2833;

  --rail:    258px;
  --shell:   1660px;    /* дальше растягивать нечего: строки станут нечитаемо длинными */
  --r:       4px;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono,
code,
.num {
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--sunk);
  border: 1px solid var(--line-lo);
  border-radius: var(--r);
  padding: 1px 6px;
  font-size: 14px;
  color: var(--ink);
}

a { color: var(--lamp); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 2px;
}

.muted { color: var(--dim); font-size: 14px; }
.warnish { color: var(--lamp); }
.badish  { color: var(--bad); }

/* ══════════════════════════════════════════════════════════
   КАРКАС: рейка слева, рабочая область справа
   ══════════════════════════════════════════════════════════ */

/* На широком мониторе интерфейс не растягивается во всю ширину и не
   липнет к левому краю, а стоит по центру — как приборная панель. */
.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
  max-width: var(--shell);
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* ---- рейка ---- */

.rail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 0 22px;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-brand {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .12em;
  color: var(--lamp);
  padding: 0 18px 16px;
  display: block;
}

.rail-brand:hover { text-decoration: none; color: var(--lamp); }

.rail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--dim-lo);
  padding: 16px 18px 7px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: var(--ink);
  border-left: 3px solid transparent;
  min-width: 0;
}

.rail-item:hover { background: var(--raise); text-decoration: none; }

.rail-item.on {
  background: var(--raise);
  border-left-color: var(--lamp);
}

.rail-item .name {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.rail-item .tail {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--lamp);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.rail-foot {
  margin-top: auto;
  padding: 18px 18px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail-foot .who {
  font-size: 14px;
  color: var(--dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- сигнальная лампа ---- */

.lamp {
  display: inline-block;
  vertical-align: middle;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #5a6675;
}

.lamp-work   { background: var(--lamp); box-shadow: 0 0 9px var(--lamp); }
.lamp-queued { background: var(--wait); }
.lamp-good   { background: var(--ok); }
.lamp-off    { background: #5a6675; }
.lamp-bad    { background: var(--bad); }

@media (prefers-reduced-motion: no-preference) {
  .lamp-work { animation: pulse 2.4s ease-in-out infinite; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 9px var(--lamp); }
  50%      { box-shadow: 0 0 2px var(--lamp); }
}

/* ---- рабочая область ---- */

.main {
  padding: 24px 32px 64px;
  min-width: 0;
}

.topline {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 22px;
}

.topline h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink-hi);
}

.topline .sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: var(--dim);
  margin-top: 4px;
}

.topline .grow { flex: 1; min-width: 220px; }
.topline .acts { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- вкладки сайта ---- */

.tabs {
  display: flex;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.tabs a {
  background: var(--panel);
  color: var(--dim);
  padding: 11px 18px;
  font-size: 16px;
  font-weight: 500;
  flex: 1;
  text-align: center;
  min-width: 130px;
}

.tabs a:hover { background: var(--raise); color: var(--ink-hi); text-decoration: none; }
.tabs a.on { background: var(--raise); color: var(--lamp); box-shadow: inset 0 -3px 0 var(--lamp); }

/* ══════════════════════════════════════════════════════════
   ПОЛОСА ПОКАЗАНИЙ
   ══════════════════════════════════════════════════════════ */

.strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 22px;
  overflow: hidden;
}

.cell { background: var(--panel); padding: 14px 18px 16px; }

.cell .k {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--dim-lo);
  font-weight: 500;
}

.cell .v {
  font-family: "IBM Plex Mono", monospace;
  font-size: 30px;
  font-weight: 500;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--ink-hi);
}

.cell .v.amber { color: var(--lamp); }
.cell .v.green { color: var(--ok); }
.cell .v.red   { color: var(--bad); }
.cell .v small { font-size: 19px; color: var(--dim); font-weight: 400; }
.cell .n { font-size: 13.5px; color: var(--dim); margin-top: 3px; }

/* ══════════════════════════════════════════════════════════
   ПАНЕЛИ
   ══════════════════════════════════════════════════════════ */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px 22px;
  margin-bottom: 20px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--dim-lo);
  font-weight: 600;
}

.panel h2 .badge {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0;
  color: var(--lamp);
  margin-left: 8px;
  text-transform: none;
  font-size: 14px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-head .grow { flex: 1; min-width: 240px; }

.panel-head h3 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-hi);
}

.hint {
  color: var(--dim);
  font-size: 14px;
  margin: 14px 0 0;
  line-height: 1.5;
  max-width: 92ch;
}

.hint:first-child { margin-top: 0; }

.row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.grow { flex: 1; min-width: 240px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }

/* ══════════════════════════════════════════════════════════
   ФОРМЫ
   ══════════════════════════════════════════════════════════ */

label {
  display: block;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--dim-lo);
  margin-bottom: 6px;
  font-weight: 600;
}

input[type=text],
input[type=password],
input[type=number],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--sunk);
  color: var(--ink);
  font: inherit;
  font-family: "IBM Plex Mono", monospace;
  font-size: 15.5px;
  line-height: 22px;
}

/* Одна высота на поле ввода, выпадающий список и кнопку. Задана числом,
   потому что список считает высоту по-своему и высоту строки игнорирует,
   а в ряду разница даже в два пикселя выглядит как перекос. */
input[type=text],
input[type=password],
input[type=number],
select {
  height: 44px;
}

input::placeholder { color: var(--dim-lo); opacity: .75; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--lamp);
  box-shadow: 0 0 0 2px var(--lamp-lo);
}

select {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 16px;
}

/* Флажки — крупные, с подписью обычным текстом, а не капсом. */

.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 12px;
}

.check input {
  width: 19px;
  height: 19px;
  margin: 3px 0 0;
  accent-color: var(--lamp);
  flex: 0 0 auto;
}

.check label {
  margin: 0;
  font-size: 16px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 400;
}

.check label .note {
  display: block;
  font-size: 14px;
  color: var(--dim);
  margin-top: 2px;
  line-height: 1.45;
}

/* ---- кнопки ---- */

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--lamp);
  border-radius: var(--r);
  background: var(--lamp);
  color: #17120a;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: #f7bd63; border-color: #f7bd63; text-decoration: none; color: #17120a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover { background: var(--raise); color: var(--ink-hi); border-color: var(--dim-lo); }

.btn-plain {
  background: transparent;
  color: var(--dim);
  border-color: var(--line);
  font-weight: 400;
  padding: 8px 15px;
  font-size: 15px;
}

.btn-plain:hover { background: var(--raise); color: var(--ink-hi); border-color: var(--dim-lo); }

.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-lo); color: var(--bad); border-color: var(--bad); }

.btn-sm { padding: 7px 14px; font-size: 15px; }

/* ══════════════════════════════════════════════════════════
   СООБЩЕНИЯ
   ══════════════════════════════════════════════════════════ */

.alert {
  border-radius: var(--r);
  padding: 14px 18px;
  margin-bottom: 20px;
  border: 1px solid;
  border-left-width: 4px;
  font-size: 16px;
}

.alert ul { margin: 8px 0 0; padding-left: 22px; }
.alert-warn { background: var(--lamp-lo); border-color: var(--lamp); color: #f6d19a; }
.alert-err  { background: var(--bad-lo);  border-color: var(--bad);  color: #f5b8b1; }
.alert-ok   { background: var(--ok-lo);   border-color: var(--ok);   color: #a5e0c2; }
.alert code { background: rgba(0,0,0,.3); border-color: transparent; }

/* ══════════════════════════════════════════════════════════
   ТАБЛИЦЫ
   ══════════════════════════════════════════════════════════ */

.scroll-x { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-lo);
  vertical-align: middle;
  font-size: 15.5px;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--dim-lo);
  font-weight: 600;
  border-bottom-color: var(--line);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--raise); }

td .muted { font-size: 14px; }
.nowrap { white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   СОСТОЯНИЯ И ПРОГРЕСС
   ══════════════════════════════════════════════════════════ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.status-queued    { background: var(--wait-lo); color: var(--wait); border-color: #35485b; }
.status-running   { background: var(--lamp-lo); color: var(--lamp); border-color: #5c4826; }
.status-done      { background: var(--ok-lo);   color: var(--ok);   border-color: #2a5347; }
.status-failed    { background: var(--bad-lo);  color: var(--bad);  border-color: #5a3532; }
.status-cancelled { background: var(--raise);   color: var(--dim);  border-color: var(--line); }

.bar {
  height: 8px;
  background: var(--sunk);
  border: 1px solid var(--line-lo);
  border-radius: 3px;
  overflow: hidden;
  min-width: 130px;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--lamp);
  transition: width .5s ease;
}

.bar-lg { height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .bar > span { transition: none; }
}

/* ══════════════════════════════════════════════════════════
   ЛОГ
   ══════════════════════════════════════════════════════════ */

.log {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: #e6edf4;
  padding: 14px 16px;
  height: 540px;
  overflow: auto;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.log .sep { color: #a8b5c3; }

/* ══════════════════════════════════════════════════════════
   СПИСОК КАТЕГОРИЙ
   ══════════════════════════════════════════════════════════ */

.cats {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  background: var(--sunk);
}

.cats .check { margin-bottom: 7px; }
.cats .check label { font-size: 15.5px; }
.cats .lvl-1 { padding-left: 24px; }
.cats .lvl-2 { padding-left: 48px; }
.cats .lvl-3 { padding-left: 72px; }

/* ══════════════════════════════════════════════════════════
   ПЛИТКИ САЙТОВ
   ══════════════════════════════════════════════════════════ */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

.tile {
  display: block;
  background: var(--panel);
  padding: 16px 18px 17px;
  color: var(--ink);
  min-width: 0;
}

.tile:hover { background: var(--raise); text-decoration: none; }

.tile .t {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 17px;
  color: var(--ink-hi);
  margin-bottom: 3px;
}

.tile .t span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .d {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13.5px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .f { margin-top: 9px; font-size: 14px; color: var(--dim); }

/* ══════════════════════════════════════════════════════════
   ПАМЯТКА «ЧТО ЭТО ДЕЛАЕТ»
   ══════════════════════════════════════════════════════════ */

.legend {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--sunk);
  padding: 16px 18px;
  margin-top: 20px;
}

.legend h4 {
  margin: 0 0 10px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--dim-lo);
  font-weight: 600;
}

.legend dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; }
.legend dt { color: var(--ink-hi); font-weight: 500; font-size: 15px; }
.legend dd { margin: 0; color: var(--dim); font-size: 15px; }

/* ══════════════════════════════════════════════════════════
   ВХОД
   ══════════════════════════════════════════════════════════ */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(700px 380px at 50% 0%, #171f29 0%, transparent 70%),
    var(--bg);
}

.login-box { width: 100%; max-width: 410px; }

.login-box .brand {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 23px;
  letter-spacing: .16em;
  color: var(--lamp);
  text-align: center;
  margin: 0 0 10px;
}

.login-box .panel { padding: 28px; }
.login-box .field { margin-bottom: 18px; }
.login-box .btn { width: 100%; text-align: center; margin-top: 6px; }

/* ══════════════════════════════════════════════════════════
   ШАПКА ДЛЯ ТЕЛЕФОНА
   На большом экране её нет: рейка и так на виду.
   ══════════════════════════════════════════════════════════ */

.topbar { display: none; }

.burger {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--raise);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}

.burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.topbar-brand {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: .12em;
  color: var(--lamp);
  flex: 1;
  min-width: 0;
}

.topbar-brand:hover { text-decoration: none; }

.topbar-state {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  color: var(--lamp);
  flex: 0 0 auto;
}

.topbar-state[hidden] { display: none; }

.rail-veil {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 12, .72);
  z-index: 40;
}

.rail-veil[hidden] { display: none; }

/* ══════════════════════════════════════════════════════════
   УЗКИЙ ЭКРАН
   ══════════════════════════════════════════════════════════ */

@media (max-width: 960px) {

  /* ---- шапка и выдвижная рейка ---- */

  .topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .shell {
    grid-template-columns: 1fr;
    border-left: none;
    border-right: none;
  }

  .rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 284px;
    max-width: 86vw;
    max-height: none;
    z-index: 50;
    transform: translateX(-102%);
    transition: transform .22s ease;
    border-right: 1px solid var(--line);
    box-shadow: 0 0 40px rgba(0, 0, 0, .55);
    padding-top: calc(18px + env(safe-area-inset-top));
    overscroll-behavior: contain;
  }

  .rail.open { transform: translateX(0); }

  /* Пока рейка задвинута — она не должна ловить фокус клавиатурой. */
  .rail:not(.open) { visibility: hidden; }
  .rail.open { visibility: visible; }

  body.rail-open { overflow: hidden; }

  .rail-item { padding: 11px 18px; }        /* палец, а не курсор */
  .rail-foot { padding-bottom: env(safe-area-inset-bottom); }

  /* ---- рабочая область ---- */

  .main { padding: 18px 14px 56px; }
  .main { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }

  .topline { align-items: flex-start; flex-direction: column; gap: 12px; }
  .topline h1 { font-size: 23px; }
  .topline .grow { min-width: 0; width: 100%; }
  .topline .acts { width: 100%; }
  .topline .acts .btn { flex: 1; text-align: center; }

  /* Вкладки — лентой с прокруткой, а не в две строки. */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: 0 0 auto; min-width: 0; padding: 13px 20px; }

  .row { flex-direction: column; align-items: stretch; gap: 14px; }
  .grow { min-width: 0; }
  .cols { grid-template-columns: 1fr; }

  .strip { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .cell .v { font-size: 26px; }

  .panel { padding: 16px 15px 18px; }
  .hint { max-width: none; }

  /* ---- под палец ---- */

  .btn { min-height: 44px; padding: 11px 18px; }
  .btn-sm, .btn-plain { min-height: 40px; }
  .main form .row > div > .btn { width: 100%; text-align: center; }

  .check { margin-bottom: 15px; }
  .check input { width: 22px; height: 22px; }

  /* 16px — иначе Safari сам наезжает на поле при наборе. */
  input[type=text],
  input[type=password],
  input[type=number],
  select,
  textarea { font-size: 16px; padding: 12px 13px; }

  input[type=text],
  input[type=password],
  input[type=number],
  select { height: 48px; }

  .legend dl { grid-template-columns: 1fr; gap: 2px; }
  .legend dd { margin-bottom: 9px; }

  .log { height: 62vh; font-size: 13.5px; }
}

/* ---- широкие таблицы превращаются в карточки ---- */

@media (max-width: 700px) {

  table.stack thead { display: none; }

  table.stack tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: 10px;
    padding: 6px 0;
    background: var(--sunk);
  }

  table.stack tr:last-child { margin-bottom: 0; }
  table.stack tbody tr:hover td { background: transparent; }

  table.stack td {
    display: flex;
    align-items: baseline;
    gap: 12px;
    border: none;
    padding: 5px 13px;
    font-size: 15px;
  }

  table.stack td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    color: var(--dim-lo);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 600;
  }

  table.stack td > .bar { flex: 1; }
}

@media (max-width: 420px) {
  .strip { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: 1fr; }
  table.stack td { flex-direction: column; gap: 1px; }
  table.stack td::before { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rail { transition: none; }
}
