/* Расшифровка BIRYULIN — стиль по брендбуку «канон 2026.10, ред. 2».
   День (по умолчанию) и ночь — data-theme на <html>, его ставит сервер по cookie txt_theme.
   Цвета — только из палитры бренда; производные тона помечены, из чего они получены.
   Контраст каждой пары «текст / фон» — от 4,5 : 1, проверка: node test/contrast.mjs. */

@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/static/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- токены: день ---------- */
:root,
[data-theme='day'] {
  color-scheme: light;
  --bg: #f6f7f9; /* Бумага — фон страниц */
  --surface: #ffffff; /* Белый — карточки, поля */
  --plate: #eceef0; /* Холст — плашки и разделы */
  --plate-2: #e3e7ec; /* Линия как заливка — плашка «ГОТОВО», активный сегмент на холсте */
  --hover: #f6f7f9; /* Бумага — строка списка под курсором и выбранная */
  --field: #ffffff; /* Белый — поля ввода */
  --seg-on: #ffffff; /* активный сегмент переключателя */
  --text: #131a24; /* Ночь */
  --text-2: #5c6878; /* Второй текст */
  --line: #e3e7ec; /* Линия */
  --line-2: #c1c8d0; /* Линия + 20 % графита — рамки полей и кнопок */
  --accent: #126c79; /* Петроль — метки, ссылки, таймкод */
  --icon: #3b4a5e; /* Графит — иконки */
  --focus: #126c79; /* Петроль — кольцо фокуса */
  --warn: #9a5b00; /* Внимание */
  --err: #d72e12; /* Ошибка — только формы и интерфейс */
  --signal: #fa3d1d; /* Сигнальный — только ЗАПИСЬ и ЭФИР */
  --rec-text: #131a24; /* ЗАПИСЬ днём: красный на белом < 4,5 — текст ночью, рамка и точка красные */
  --rec-bg: #ffffff;
  --btn: #131a24; /* основная кнопка днём — заливка «ночь», текст «иней» */
  --btn-text: #e8edf5;
  --btn-hover: #3b4a5e; /* Графит */
  --toast: #131a24;
  --toast-text: #e8edf5;
  --mark: #d2f9fe; /* Лёд 50 % на белом — найденное */
  --mark-cur: #a5f3fc; /* Лёд — текущее совпадение */
  --spk-0: #3b4a5e; /* Графит */
  --spk-1: #616190; /* Сирень-линия #7B78B4 + 25 % ночи */
  --spk-2: #126c79; /* Петроль */
  --spk-3: #131a24; /* Ночь */
  --shadow: 0 1px 2px rgba(19, 26, 36, 0.04), 0 10px 28px -18px rgba(19, 26, 36, 0.18);
  --aura-a: rgba(165, 243, 252, 0.7); /* Лёд */
  --aura-b: rgba(186, 185, 224, 0.3); /* Дымчатая сирень */
  --aura-c: rgba(146, 222, 221, 0.3); /* Аква — капля */
}

/* ---------- токены: ночь ---------- */
[data-theme='night'] {
  color-scheme: dark;
  --bg: #131a24; /* Ночь */
  --surface: #171f2a; /* Ночь + 10 % графита — карточки */
  --plate: #1d2632; /* Ночь + 24 % графита — плашки */
  --plate-2: #212b39; /* Ночь + 36 % графита */
  --hover: #1a222e; /* Ночь + 17 % графита */
  --field: #131a24; /* Ночь — поля ввода утоплены в карточку */
  --seg-on: #212b39;
  --text: #e8edf5; /* Иней */
  --text-2: #b4bcc8; /* Иней + 30 % графита */
  --line: rgba(232, 237, 245, 0.12); /* Иней, низкая плотность */
  --line-2: rgba(232, 237, 245, 0.24);
  --accent: #7fd6e3; /* Метка на тёмном */
  --icon: #e8edf5; /* Иней */
  --focus: #7fd6e3;
  --warn: #e2b56a; /* расширение для интерфейсов студии */
  --err: #ff8f7a; /* расширение для интерфейсов студии */
  --rec-text: #fa3d1d; /* ЗАПИСЬ ночью — красный текст на ночи (4,8 : 1) */
  --rec-bg: #131a24;
  --btn: #e8edf5; /* основная кнопка ночью — заливка «иней», текст «ночь» */
  --btn-text: #131a24;
  --btn-hover: #ffffff;
  --toast: #e8edf5;
  --toast-text: #131a24;
  --mark: rgba(127, 214, 227, 0.22);
  --mark-cur: rgba(127, 214, 227, 0.42);
  --spk-0: #e8edf5; /* Иней */
  --spk-1: #bab9e0; /* Дымчатая сирень */
  --spk-2: #92dedd; /* Аква */
  --spk-3: #a5f3fc; /* Лёд */
  --shadow: none;
}

:root {
  /* Аура: ось 150° в CSS = ось 60° в знаке */
  --aura: linear-gradient(150deg, #126c79 0%, #06b6d4 24%, #a5f3fc 48%, #bab9e0 80%, #92dedd 100%);
  --sans: 'Geist', Inter, Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, Menlo, Consolas, monospace;
  /* Шкала: не больше четырёх размеров на экране */
  --fs-h1: 46px;
  --fs-h2: 28px;
  --fs-lead: 18px;
  --fs-body: 16px;
  --fs-small: 14px;
  /* Логотип: m = высота / 8, охранное поле 2m */
  --logo-h: 32px;
  --m: calc(var(--logo-h) / 8);
  --radius: 12px;
  --radius-s: 8px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body) / 1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection {
  background: var(--mark-cur);
  color: var(--text);
}
[hidden] {
  display: none !important;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.15;
}
h1 {
  font-size: var(--fs-h1);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h2,
h3 {
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
}
p {
  margin: 0;
  text-wrap: pretty;
}
.muted {
  color: var(--text-2);
}
.mono {
  font-family: var(--mono);
}
.label {
  font: 500 var(--fs-small) / 1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.icon {
  color: var(--icon);
  flex: none;
}

/* ---------- фокус ---------- */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 0;
  border-color: var(--focus);
}

/* ---------- логотип и дескриптор ---------- */
.brand {
  display: inline-flex;
  align-items: flex-start;
  gap: calc(3 * var(--m)); /* дескриптор — за охранным полем 2m, с запасом в 1m */
  text-decoration: none;
  color: var(--text-2);
  border-radius: 4px;
  flex: none;
}
.brand-logo {
  display: block;
  height: var(--logo-h);
  width: auto;
  aspect-ratio: 920.8 / 200;
}
/* Центр дескриптора — на середине строчных букв надписи (y 78–166 из 200 = 0,611 высоты), а не на центре знака.
   --desc-cap — расстояние от верха строки высотой 1em до середины прописных Geist Mono (замерено по пикселям). */
.brand-desc {
  --desc-cap: 0.475em;
  font: 500 var(--fs-small) / 1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
  margin-top: calc(var(--logo-h) * 0.611 - var(--desc-cap));
}

/* ---------- переключатель «День / Ночь» ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: var(--plate);
  font: 500 var(--fs-small) / 1 var(--sans);
  cursor: pointer;
  flex: none;
}
.theme-toggle > span {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--text-2);
}
[data-theme='day'] .theme-toggle .tt-day,
[data-theme='night'] .theme-toggle .tt-night {
  background: var(--seg-on);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line);
}
.theme-toggle:hover > span {
  color: var(--text);
}

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: 500 var(--fs-body) / 1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.btn:hover {
  border-color: var(--icon);
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.primary {
  background: var(--btn);
  border-color: var(--btn);
  color: var(--btn-text);
}
.btn.primary:hover {
  background: var(--btn-hover);
  border-color: var(--btn-hover);
}
.btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: var(--fs-small);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.ghost:hover {
  background: var(--hover);
  border-color: var(--line);
}
.btn.danger {
  color: var(--err);
}
.btn.danger:hover {
  border-color: var(--err);
}
.btn.wide {
  width: 100%;
}
.linklike {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  border-radius: 4px;
}

label.field,
.field {
  display: grid;
  gap: 6px;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text);
}
input[type='text'],
input[type='email'],
input[type='password'],
input[type='url'],
input[type='search'],
input[type='number'],
input:not([type]),
select,
textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-2);
  background: var(--field);
  color: var(--text);
  font: 400 var(--fs-body) / 1.2 var(--sans);
  transition: border-color 0.15s;
}
input::placeholder {
  color: var(--text-2);
  opacity: 1;
}
input:hover,
select:hover {
  border-color: var(--icon);
}
select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--icon) 50%), linear-gradient(135deg, var(--icon) 50%, transparent 50%);
  background-position: calc(100% - 19px) 19px, calc(100% - 14px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input.code-input {
  font: 500 var(--fs-h2) / 1 var(--mono);
  letter-spacing: 0.16em;
  text-align: center;
  height: 56px;
}
input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.msg {
  font-size: var(--fs-small);
  min-height: 1.2em;
  color: var(--text-2);
}
.msg:empty {
  display: none;
}
.msg.err {
  color: var(--err);
}
.msg.ok {
  color: var(--accent);
}
.hint {
  font-size: var(--fs-small);
  color: var(--text-2);
  line-height: 1.45;
}
.field + .hint {
  margin-top: 8px;
}

/* ---------- верхняя панель ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
  padding: 0 32px;
  background: var(--bg); /* без стекла и размытия */
  box-shadow: inset 0 -1px 0 var(--line); /* линия без смещения логотипа на полпикселя */
}
.topbar.plain {
  position: static;
  background: transparent;
  box-shadow: none;
}
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.topnav a,
.topnav button {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  border: 0;
  background: none;
  color: var(--text);
  font: 500 var(--fs-body) / 1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.topnav a:hover,
.topnav button:hover {
  background: var(--plate);
}
.topnav a[aria-current='page'] {
  background: var(--plate);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.topbar-end {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}
.topnav + .topbar-end {
  margin-left: 0;
}
.who {
  font-size: var(--fs-small);
  color: var(--text-2);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

/* ---------- карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
/* Линия ауры — тонкая линия градиента по верхнему краю главной карточки экрана */
.card.aura-line {
  position: relative;
  overflow: hidden;
}
.card.aura-line::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--aura);
  pointer-events: none;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.card-head .muted {
  font-size: var(--fs-small);
}

/* ---------- рабочая область ---------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 64px;
  align-items: start;
}
.col-left {
  display: grid;
  gap: 24px;
  min-width: 0;
}
.col-right {
  min-width: 0;
  position: sticky;
  top: 96px;
}

/* сегменты: вкладки источника (Файл · Ссылка · позже Микрофон) и разделов админки */
.tabs {
  display: inline-flex;
  flex-wrap: nowrap;
  padding: 3px;
  gap: 2px;
  background: var(--plate);
  border-radius: 10px;
  margin-bottom: 20px;
  max-width: 100%;
}
.tabs [role='tab'] {
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font: 500 var(--fs-body) / 1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
}
.tabs [role='tab']:hover {
  color: var(--text);
}
.tabs [role='tab'][aria-selected='true'] {
  background: var(--seg-on);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line);
}

.drop {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.drop:hover {
  border-color: var(--icon);
}
.drop.over {
  border: 1px solid var(--accent);
  background: var(--hover);
}
.drop:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.drop-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 4px;
}
.drop-icon .icon {
  width: 22px;
  height: 22px;
}
.drop-title {
  font-weight: 500;
}
.drop-sub {
  font-size: var(--fs-small);
  color: var(--text-2);
}
.drop-sub u {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.picked-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picked-size {
  font-size: var(--fs-small);
  color: var(--text-2);
}
.picked .grow {
  min-width: 0;
  flex: 1;
}

.opts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.opts .span2 {
  grid-column: 1 / -1;
}
.range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.range input {
  font-family: var(--mono);
}
.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ---------- список задач ---------- */
.tasklist {
  list-style: none;
  margin: 0 -24px -24px;
  padding: 0;
  border-top: 1px solid var(--line);
}
.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.task:last-child {
  border-bottom: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}
.task:hover,
.task.selected {
  background: var(--hover);
}
.task.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.task-main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 8px 16px 24px;
  cursor: pointer;
  border-radius: 4px;
}
.task-main:focus-visible {
  outline-offset: -2px;
}
.task-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-s);
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
}
.task-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.task-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.task-title {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.task-stage {
  font-size: var(--fs-small);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-error {
  font-size: var(--fs-small);
  color: var(--err);
  line-height: 1.45;
}
.task-meta {
  font-size: var(--fs-small);
  color: var(--text-2);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.task-meta span + span::before {
  content: '·';
  margin-right: 10px;
}
/* автор — своей строкой, без разделителя в начале */
.task-meta .by {
  flex-basis: 100%;
}
.task-meta span.by::before {
  content: none;
}
.task-meta .mono {
  color: var(--text);
}
.task-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 12px 16px 12px 0;
}
.task-actions .btn {
  height: 30px;
  padding: 0 10px;
  color: var(--text-2);
}
.task-actions .btn:hover {
  color: var(--text);
}
.task-actions .btn.danger:hover {
  color: var(--err);
}
.empty {
  padding: 24px 0 4px;
  color: var(--text-2);
  font-size: var(--fs-small);
}

/* ---------- статусы: слово в Geist Mono капсом + форма (заливка, рамка, точка). Цвет — не единственный признак ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  height: 26px;
  padding: 0 calc(8px - 0.12em) 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  font: 500 var(--fs-small) / 1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip::before {
  content: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
/* В ОЧЕРЕДИ — рамка, полая точка */
.chip.queued::before {
  content: '';
  border: 1.5px solid currentColor;
}
/* ЖДЁТ ФАЙЛ — рамка и текст «внимание», полая точка */
.chip.waiting_upload {
  color: var(--warn);
  border-color: var(--warn);
}
.chip.waiting_upload::before {
  content: '';
  border: 1.5px solid currentColor;
}
/* В РАБОТЕ и ЗАГРУЗКА — рамка петроля, пульсирующая точка, рядом прогресс */
.chip.running,
.chip.uploading {
  color: var(--accent);
  border-color: var(--accent);
}
.chip.running::before,
.chip.uploading::before {
  content: '';
  background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}
/* ГОТОВО — заливка, без рамки и точки */
.chip.done {
  background: var(--plate-2);
  border-color: var(--plate-2);
  color: var(--text);
}
/* ОШИБКА — рамка и текст цвета ошибки */
.chip.error {
  color: var(--err);
  border-color: var(--err);
}
/* ОТМЕНЕНО — пунктирная рамка */
.chip.canceled {
  border-style: dashed;
}
/* ЗАПИСЬ (зарезервировано для расшифровки с микрофона): красная рамка и точка;
   ночью — красный текст на «ночи» (4,8 : 1), днём — текст «ночь» (красный на белом < 4,5). */
.chip.recording,
.chip.live {
  color: var(--rec-text);
  background: var(--rec-bg);
  border-color: var(--signal);
}
.chip.recording::before,
.chip.live::before {
  content: '';
  background: var(--signal);
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.progress {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  margin: 2px 0;
}
.progress-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  clip-path: inset(0 100% 0 0 round 2px);
  transition: clip-path 0.6s ease;
}
.progress.indeterminate .progress-fill {
  clip-path: none;
  inset: 0 auto 0 0;
  width: 30%;
  animation: slide 1.6s ease-in-out infinite;
}
@keyframes slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(340%);
  }
}

/* ---------- просмотр ---------- */
.card.viewer {
  min-height: 420px;
  padding: 0;
  overflow: hidden;
}
.viewer-empty {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 20px;
  min-height: 420px;
  padding: 48px 40px;
}
.viewer-empty p {
  color: var(--text-2);
  max-width: 34em;
}
/* Плашка со срезом 60° (приём бренда): высота фиксирована, вынос среза = высота / tg 60° */
.cut-plate {
  --h: 88px;
  display: grid;
  align-content: center;
  gap: 6px;
  height: var(--h);
  padding: 0 calc(var(--h) * 0.57735 + 24px) 0 24px;
  background: var(--plate);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--h) * 0.57735) 100%, 0 100%);
}
.cut-plate .tc-big {
  font: 500 var(--fs-h2) / 1 var(--mono);
  color: var(--text);
}
.v-head {
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
}
.v-title {
  font-size: var(--fs-h2);
  overflow-wrap: anywhere;
}
.v-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: var(--fs-small);
  color: var(--text-2);
}
.v-meta span + span::before {
  content: '·';
  margin-right: 12px;
}
.v-meta .mono {
  color: var(--text);
}
.v-speakers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.spk-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  background: var(--field);
}
.spk-field:focus-within {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
  outline-offset: 0;
}
.spk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.spk-field input {
  height: 32px;
  width: 132px;
  border: 0;
  padding: 0 8px 0 0;
  background: transparent;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text);
}
.spk-field input:focus-visible {
  outline: none;
}
.saved-note {
  font-size: var(--fs-small);
  color: var(--accent);
  align-self: center;
}
.v-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 240px;
  min-width: 0;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-box .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.search input {
  height: 36px;
  padding-left: 36px;
}
.search-count:empty {
  min-width: 0;
}
.search-count {
  font: 400 var(--fs-small) / 1 var(--mono);
  color: var(--text-2);
  min-width: 56px;
  text-align: center;
  white-space: nowrap;
}
.search .btn {
  width: 36px;
  height: 36px;
  padding: 0;
}
.export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.export-formats {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--surface);
}
.export-formats a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 calc(10px - 0.12em) 0 10px;
  font: 500 var(--fs-small) / 1 var(--mono);
  letter-spacing: 0.12em;
  color: var(--text);
  text-decoration: none;
  border-right: 1px solid var(--line);
}
.export-formats a:last-child {
  border-right: 0;
}
.export-formats a:hover {
  background: var(--hover);
  color: var(--accent);
}
.export-formats a:focus-visible {
  outline-offset: -2px;
}
.export-opts {
  display: inline-flex;
  gap: 16px;
  margin-right: 4px;
}
.v-text {
  padding: 28px 28px 40px;
  max-height: calc(100vh - 360px);
  min-height: 300px;
  overflow: auto;
  overscroll-behavior: contain;
}
.v-text:focus-visible {
  outline-offset: -2px;
}
/* Абзац: таймкод ЧЧ:ММ:СС:КК в своей колонке, справа — спикер и текст */
.para {
  display: grid;
  grid-template-columns: 6em minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 16px;
  margin: 0 0 18px;
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: break-word;
}
.para-body {
  max-width: 72ch;
}
.tc {
  font: 400 var(--fs-small) / 1 var(--mono);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.spk {
  font-weight: 600;
}
.spk-c0,
.spk-c4 {
  color: var(--spk-0);
}
.spk-c1,
.spk-c5 {
  color: var(--spk-1);
}
.spk-c2,
.spk-c6 {
  color: var(--spk-2);
}
.spk-c3,
.spk-c7 {
  color: var(--spk-3);
}
.para.cont .spk {
  color: var(--text-2);
  font-weight: 500;
}
.badge-en {
  display: inline-block;
  font: 500 var(--fs-small) / 1 var(--mono);
  letter-spacing: 0.12em;
  padding: 2px 3px 2px 5px;
  margin: 0 6px 0 1px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--text-2);
  vertical-align: 2px;
}
mark {
  background: var(--mark);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
mark.current {
  background: var(--mark-cur);
  outline: 1.5px solid var(--accent);
}
.v-error {
  padding: 28px;
  color: var(--err);
}
.v-state {
  padding: 40px 28px;
  display: grid;
  gap: 14px;
  color: var(--text-2);
}
.v-state .progress {
  max-width: 420px;
}

/* ---------- вход, выход, ошибка ---------- */
.auth-main {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  padding: 24px 16px 72px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px 32px;
}
.auth-card h1 {
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.auth-card .lead {
  color: var(--text-2);
  margin-bottom: 24px;
}
.auth-card .lead:empty {
  display: none;
}
.auth-card h1:has(+ .lead:empty) {
  margin-bottom: 24px;
}
.form {
  display: grid;
  gap: 16px;
}
.form .btn.primary {
  margin-top: 4px;
  height: 44px;
}
.step-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: var(--fs-small);
}
.secret-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-s);
  background: var(--plate);
}
.secret-box .hint {
  color: var(--text-2);
}
.secret-value {
  font: 500 var(--fs-body) / 1.5 var(--mono);
  letter-spacing: 0.06em;
  word-spacing: 0.25em;
  color: var(--text);
  overflow-wrap: anywhere;
  user-select: all;
}
.secret-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.steps-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}
.codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  padding: 16px;
  border-radius: var(--radius-s);
  background: var(--plate);
  font: 500 var(--fs-body) / 1.4 var(--mono);
  letter-spacing: 0.04em;
  margin: 0;
  list-style: none;
}

/* ---------- аура: свет, а не заливка (заставка и вход) ---------- */
body.aura::before {
  content: '';
  position: fixed;
  z-index: -1;
  pointer-events: none;
  inset: 0;
}
[data-theme='day'] body.aura::before {
  /* лёд и дымчатая сирень с каплей аквы — мягкий свет справа сверху, ось 150° */
  background: linear-gradient(150deg, var(--aura-a) 0%, var(--aura-a) 22%, var(--aura-b) 52%, var(--aura-c) 78%, transparent 100%);
  -webkit-mask-image: radial-gradient(70% 90% at 100% 0%, #000 0%, #000 25%, rgba(0, 0, 0, 0.6) 55%, transparent 100%);
  mask-image: radial-gradient(70% 90% at 100% 0%, #000 0%, #000 25%, rgba(0, 0, 0, 0.6) 55%, transparent 100%);
}
[data-theme='night'] body.aura::before {
  /* петроль слева сверху, сирень справа сверху */
  background:
    linear-gradient(150deg, rgba(18, 108, 121, 0.6) 0%, rgba(18, 108, 121, 0.28) 28%, rgba(18, 108, 121, 0) 55%),
    radial-gradient(45% 55% at 100% 0%, rgba(186, 185, 224, 0.2) 0%, rgba(186, 185, 224, 0) 100%);
}

/* ---------- заставка ---------- */
.landing {
  display: flex;
  flex-direction: column;
}
.landing > .topbar {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}
.landing-main {
  flex: 1;
  display: grid;
  align-content: center;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 32px 64px;
}
.landing-main > * {
  max-width: 760px;
}
.landing-main h1 {
  margin: 16px 0 20px;
}
.landing-text {
  max-width: 36em;
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-2);
}
.landing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 36px;
}
.soon {
  --h: 40px;
  display: inline-flex;
  align-items: center;
  height: var(--h);
  padding: 0 calc(var(--h) * 0.57735 + 16px) 0 16px;
  background: var(--plate);
  color: var(--text);
  font: 500 var(--fs-small) / 1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--h) * 0.57735) 100%, 0 100%);
}
.link-arrow {
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.link-arrow:hover {
  text-decoration-thickness: 2px;
}
.landing-foot {
  width: calc(100% - 64px);
  max-width: 1116px;
  margin: 0 auto;
  padding: 20px 0 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: var(--fs-small);
  color: var(--text-2);
  border-top: 1px solid var(--line);
}

/* ---------- админка и аккаунт ---------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 32px 72px;
}
.page.narrow {
  max-width: 720px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-head p {
  color: var(--text-2);
  margin-top: 8px;
}
.page-head .tabs {
  margin-bottom: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.stack {
  display: grid;
  gap: 20px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.row > .field {
  flex: 1 1 200px;
}
.onetime {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-s);
  border: 1px solid var(--accent);
  background: var(--surface);
}
.onetime .secret-value {
  font-size: var(--fs-h2);
  line-height: 1.2;
}
.table-wrap {
  overflow-x: auto;
  margin: 0 -24px -24px;
}
table.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font: 500 var(--fs-small) / 1.2 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table th:first-child,
.table td:first-child {
  padding-left: 24px;
}
.table th:last-child,
.table td:last-child {
  padding-right: 24px;
}
.table .cell-sub {
  font-size: var(--fs-small);
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.table .acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.table.users td:first-child {
  min-width: 15em;
}
.table.users td:first-child .cell-sub {
  overflow-wrap: normal;
}
.table.audit td {
  font-size: var(--fs-small);
}
.table.audit td.mono {
  color: var(--text-2);
  white-space: nowrap;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.tile {
  padding: 14px 16px;
  border-radius: var(--radius-s);
  background: var(--bg);
  border: 1px solid var(--line);
  min-width: 0;
}
.tile-label {
  font: 500 var(--fs-small) / 1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}
.tile-value {
  margin-top: 6px;
  font: 500 var(--fs-body) / 1.35 var(--mono);
  overflow-wrap: anywhere;
}
.tile-value.ok {
  color: var(--accent);
}
.tile-value.bad {
  color: var(--err);
}
.bench {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.bench-result strong {
  font: 600 var(--fs-h2) / 1.2 var(--mono);
}
.section-title {
  margin-bottom: 20px;
}
.hint.mb {
  margin-bottom: 16px;
}
/* статус пользователя: слово + форма точки */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--accent);
  vertical-align: 1px;
}
.status-dot.off {
  background: transparent;
  border: 1.5px solid var(--text-2);
}
.status-dot.bad {
  background: var(--err);
  border-radius: 1px;
}

/* ---------- уведомления ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  transform: translate(-50%, 20px);
  opacity: 0;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-s);
  border: 1px solid var(--toast);
  background: var(--toast);
  color: var(--toast-text);
  font-size: var(--fs-small);
  box-shadow: 0 10px 30px -12px rgba(19, 26, 36, 0.4);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
/* ошибка — другой формой: светлая плашка с рамкой цвета ошибки */
.toast.err {
  background: var(--surface);
  color: var(--err);
  border-color: var(--err);
}

/* ---------- адаптивность ---------- */
@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
    padding: 24px 20px 56px;
    gap: 20px;
  }
  .who {
    display: none;
  }
}
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .col-right {
    position: static;
  }
  .v-text {
    max-height: none;
  }
}
@media (max-width: 640px) {
  :root {
    --fs-h1: 38px;
    --fs-h2: 31px;
    --fs-lead: 17px;
    --logo-h: 22px; /* 101 px по ширине — не меньше экранного минимума 96 px */
  }
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 60px;
    gap: 0 12px;
    padding: 0 16px;
  }
  .topbar > .brand {
    height: 60px;
    align-items: center;
  }
  .topbar > .brand .brand-desc {
    align-self: flex-start;
    margin-top: calc((60px - var(--logo-h)) / 2 + var(--logo-h) * 0.611 - var(--desc-cap));
  }
  .topbar-end,
  .topnav + .topbar-end {
    margin-left: auto;
    height: 60px;
  }
  .topnav {
    order: 3;
    flex-basis: 100%;
    margin: 0 -8px;
    padding: 0 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topnav a,
  .topnav button {
    padding: 0 10px;
  }
  .theme-toggle > span {
    padding: 0 8px;
  }
  .workspace {
    padding: 16px 12px 48px;
    gap: 16px;
  }
  .card {
    padding: 20px 16px;
  }
  .tasklist,
  .table-wrap {
    margin: 0 -16px -20px;
  }
  .task-main {
    padding: 14px 4px 14px 16px;
    gap: 10px;
  }
  .task-actions {
    padding: 10px 10px 10px 0;
  }
  .page-head .tabs [role='tab'] {
    padding: 0 10px;
  }
  .search {
    flex-basis: 100%;
  }
  .export-opts {
    flex-basis: 100%;
  }
  .v-head {
    padding: 22px 16px 16px;
  }
  .v-tools {
    padding: 12px 16px;
  }
  .v-text {
    padding: 20px 16px 32px;
  }
  .para {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  /* на узком экране строки метаданных переносятся — без «·» в начале строки, разделяет отступ */
  .v-meta {
    gap: 4px 16px;
  }
  .v-meta span + span::before {
    content: none;
  }
  .viewer-empty {
    padding: 32px 16px;
  }
  .spk-field input {
    width: 104px;
  }
  .page {
    padding: 24px 12px 56px;
  }
  /* «Администрирование» в 38 px шире экрана — переносим по слогам, а не прокручиваем */
  .page-head h1 {
    hyphens: auto;
    overflow-wrap: break-word;
  }
  .auth-main {
    place-items: start center;
    padding-top: 12px;
  }
  .auth-card {
    padding: 28px 20px 24px;
  }
  .landing-main {
    padding: 32px 16px 48px;
  }
  .landing-foot {
    width: calc(100% - 32px);
    padding: 16px 0 24px;
  }
  .table th:first-child,
  .table td:first-child {
    padding-left: 16px;
  }
  .table th:last-child,
  .table td:last-child {
    padding-right: 16px;
  }
  table.users thead {
    display: none;
  }
  table.users,
  table.users tbody,
  table.users tr,
  table.users td {
    display: block;
    width: 100%;
  }
  table.users tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  table.users tr:last-child {
    border-bottom: 0;
  }
  table.users td {
    padding: 2px 0 !important;
    border: 0;
  }
  table.users td[data-label]::before {
    content: attr(data-label) ': ';
    color: var(--text-2);
    font-size: var(--fs-small);
  }
  table.users .acts {
    justify-content: flex-start;
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- живая расшифровка с микрофона ---------- */
[hidden] {
  display: none !important;
}
.mic-intro {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: var(--plate);
  border-radius: var(--radius-s);
}
.mic-intro p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}
#panel-mic .hint {
  margin-top: 12px;
}
/* статус записи: плашка ЗАПИСЬ, таймкод ЧЧ:ММ:СС:КК, уровень звука */
.live-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 16px;
}
.live-tc {
  font-size: var(--fs-lead);
  color: var(--text);
}
.level {
  position: relative;
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: var(--plate-2);
  overflow: hidden;
}
.level-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0.02);
  transition: transform 0.12s linear;
}
.live-conn {
  margin: 10px 0 0;
  font-size: var(--fs-small);
  color: var(--text-2);
}
.live-conn.warn {
  color: var(--warn);
}
.live-conn.err {
  color: var(--err);
}
.live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.live-text {
  max-height: min(62vh, 640px);
  overflow-y: auto;
}
/* черновик фразы: распознаётся, пока человек говорит, — тише основного текста */
.live-partial {
  color: var(--text-2);
}
.refine {
  margin-top: 16px;
}
.refine .hint {
  margin: 0 0 10px;
}
.refine-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.refine-row select {
  height: 34px;
  max-width: 100%;
}
.refine-note {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--accent);
}
