/*
 * RU: Дизайн-система макетов CallAudit. Один файл на все макеты — веб-панель и Android.
 *     Три темы переключаются атрибутом data-theme на <html>; семантические цвета
 *     (согласие/отказ/критично) НЕ меняются между темами: их запоминают наизусть,
 *     и перекрашивание из темы в тему ломает узнавание.
 * EN: CallAudit mockup design system. One file for both the web panel and the Android
 *     mockups. Three themes switch via the data-theme attribute on <html>; semantic
 *     colors (agreed/refused/critical) stay constant across themes, because people
 *     learn them by heart and recoloring them per theme breaks recognition.
 */

/* ── Токены тем / Theme tokens ─────────────────────────────────────────────── */

/*
 * RU: «Смена» — светлая рабочая тема, основная. Холодный светло-серый фон,
 *     глубокий бирюзовый акцент. Хорошо читается на проекторе на планёрке.
 * EN: "Shift" — the light working theme, the default. Cool light-grey ground with a
 *     deep teal accent. Stays legible on a meeting-room projector.
 */
:root,
:root[data-theme="shift"],
[data-theme="shift"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #edf1f6;
  --surface-3: #e3e9f0;
  --line: #dde3ea;
  --line-strong: #c6d0db;
  --ink: #131a24;
  --ink-2: #4a5768;
  --ink-3: #7c8899;
  --accent: #0e7c86;
  --accent-soft: #dceff1;
  --accent-ink: #ffffff;
  --track-agent: #0e7c86;
  --track-client: #46536a;
  --shadow: 0 1px 2px rgba(19, 26, 36, .06), 0 8px 24px -12px rgba(19, 26, 36, .18);
  --shadow-lg: 0 24px 60px -24px rgba(19, 26, 36, .35);
  color-scheme: light;
}

/*
 * RU: «Пульт» — тёмная аналитическая тема для тех, кто в системе весь день.
 *     Янтарный акцент взят у индикатора уровня на звуковом пульте — это язык предметной области.
 * EN: "Console" — the dark analytical theme for all-day users. The amber accent comes
 *     from a mixing desk's level meter, i.e. from the subject's own visual language.
 */
:root[data-theme="console"],
[data-theme="console"] {
  --bg: #12161d;
  --surface: #171c25;
  --surface-2: #1f2530;
  --surface-3: #28303d;
  --line: #2a3240;
  --line-strong: #3a4557;
  --ink: #e8ecf2;
  --ink-2: #a3aebf;
  --ink-3: #6c7889;
  --accent: #f2a93b;
  --accent-soft: #34291a;
  --accent-ink: #171008;
  --track-agent: #f2a93b;
  --track-client: #5c7ca8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/*
 * RU: «Приём» — мягкая тёплая тема для клиник и салонов, где слово «контроль»
 *     надо смягчить. Сливовый акцент вместо корпоративного синего.
 * EN: "Reception" — a soft, warm theme for clinics and salons, where the word "control"
 *     needs softening. A plum accent instead of corporate blue.
 */
:root[data-theme="reception"],
[data-theme="reception"] {
  --bg: #f7f5f3;
  --surface: #ffffff;
  --surface-2: #f0ece8;
  --surface-3: #e8e2dc;
  --line: #e3dcd5;
  --line-strong: #d0c5bb;
  --ink: #241f2b;
  --ink-2: #5c5266;
  --ink-3: #8b8194;
  --accent: #5b4b8a;
  --accent-soft: #ece8f5;
  --accent-ink: #ffffff;
  --track-agent: #5b4b8a;
  --track-client: #a08a70;
  --shadow: 0 1px 2px rgba(36, 31, 43, .06), 0 8px 24px -12px rgba(36, 31, 43, .18);
  --shadow-lg: 0 24px 60px -24px rgba(36, 31, 43, .3);
  color-scheme: light;
}

/*
 * RU: Семантика исходов — общая для всех тем. В тёмной теме подложки задаются
 *     через color-mix, чтобы не держать три набора вручную.
 * EN: Outcome semantics — shared across themes. On dark, the tinted backgrounds are
 *     derived with color-mix instead of maintaining three hand-written sets.
 */
:root {
  --ok: #167c4a;
  --bad: #c63d33;
  --warn: #b5741a;
  --crit: #c1121f;
  --calm: #6b7684;
  --ok-bg: color-mix(in srgb, var(--ok) 12%, var(--surface));
  --bad-bg: color-mix(in srgb, var(--bad) 12%, var(--surface));
  --warn-bg: color-mix(in srgb, var(--warn) 14%, var(--surface));
  --crit-bg: color-mix(in srgb, var(--crit) 12%, var(--surface));
  --calm-bg: color-mix(in srgb, var(--calm) 12%, var(--surface));

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* RU: Шаг сетки 4px; именованные размеры не даём — их всё равно не запоминают.
     EN: 4px spacing step; no named sizes, nobody memorizes them anyway. */
  --gap: 16px;

  --f-display: "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-body: "Golos Text", "Manrope", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

:root[data-theme="console"],
[data-theme="console"] {
  --ok: #4fb477;
  --bad: #e0685e;
  --warn: #f2a93b;
  --crit: #e5484d;
  --calm: #8a95a6;
}

/* ── База / Base ───────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; letter-spacing: -.02em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: inherit; }

.mono { font-family: var(--f-mono); font-size: .92em; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.tiny { font-size: 12px; }
.num { font-family: var(--f-display); font-variant-numeric: tabular-nums; }

/* RU: Фокус виден всегда — по системе с этим работают с клавиатуры каждый день.
   EN: Focus is always visible — this system is used from the keyboard daily. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Каркас панели / Panel shell ───────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.brand-name { font-family: var(--f-display); font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: -2px; }

.rail-label {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); padding: 16px 10px 6px; font-weight: 600;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); cursor: pointer; border: 0; background: none;
  width: 100%; text-align: left; font: 500 13.5px/1.3 var(--f-body);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
[data-theme="console"] .nav-item[aria-current="true"] { color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav-count { margin-left: auto; font: 600 11px var(--f-display); color: var(--crit); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.topbar .spacer { flex: 1; }

.page { padding: 24px 28px 64px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head p { color: var(--ink-2); font-size: 13px; margin-top: 4px; }

/* ── Компоненты / Components ───────────────────────────────────────────────── */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { flex: 1; }

.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--gap); }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }

/* RU: Показатель. Число крупно шрифтом Manrope, подпись мелко — читается за долю секунды.
   EN: A metric tile. Big Manrope number, small caption — readable at a glance. */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.stat-label { font-size: 12px; color: var(--ink-2); }
.stat-value { font: 800 30px/1.1 var(--f-display); letter-spacing: -.03em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: 12px; font-weight: 600; }
.up { color: var(--ok); }
.down { color: var(--bad); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font: 600 11.5px var(--f-body); white-space: nowrap;
  background: var(--calm-bg); color: var(--calm);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.crit { background: var(--crit-bg); color: var(--crit); }
.badge.plain { background: var(--surface-2); color: var(--ink-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font: 600 13px var(--f-body); cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.input, .select {
  padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: 400 13.5px var(--f-body); width: 100%;
}
.input::placeholder { color: var(--ink-3); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface);
  font: 500 12.5px var(--f-body); color: var(--ink-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font: 600 11px var(--f-body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 12px 10px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr.unread td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--surface-3); color: var(--ink-2);
  display: grid; place-items: center;
  font: 700 11px var(--f-display);
}

/* RU: Полоса исходов на главном экране. Ширины сегментов = доли, ничего больше.
   EN: The outcome bar on the overview. Segment widths are the shares, nothing else. */
.outcome-bar { display: flex; height: 12px; border-radius: var(--r-pill); overflow: hidden; gap: 2px; }
.outcome-bar span { display: block; }

.meter { height: 6px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* ── Лента разговора (сигнатурный элемент) / Call ribbon (signature element) ── */

/*
 * RU: Две дорожки времени: сотрудник сверху, клиент снизу. Ширина блока — длительность
 *     реплики, засечки сверху — события чек-листа, красная вертикаль — момент срыва.
 *     Строится из данных на HTML/CSS (см. assets/app.js): одна функция даёт и микро-версию
 *     в строке списка, и полную на экране разбора — это и делает элемент узнаваемым.
 * EN: Two time tracks: the employee on top, the client below. Block width is turn length,
 *     the ticks above are scorecard events, the red vertical is the moment it broke.
 *     Built from data in HTML/CSS (see assets/app.js): one function renders both the micro
 *     version in a list row and the full one on the call screen, which is what makes it
 *     recognizable across the product.
 */
.rb { position: relative; width: 100%; }
.rb-tracks { display: flex; flex-direction: column; gap: 2px; }
.rb-track { position: relative; height: 8px; background: var(--surface-3); border-radius: 3px; }
.rb-track i {
  position: absolute; top: 0; bottom: 0; border-radius: 2px;
  background: var(--track-client);
}
.rb-track.a i { background: var(--track-agent); }
.rb-track i.rude { background: var(--crit); }

/* RU: Полная версия крупнее и с осью — на экране разбора лента работает как навигация.
   EN: The full version is taller and has an axis — on the call screen the ribbon doubles
   as navigation. */
.rb.full .rb-track { height: 22px; border-radius: 5px; }
.rb.full .rb-track i { border-radius: 4px; }

.rb-events { position: relative; height: 16px; margin-bottom: 4px; }
.rb-ev {
  position: absolute; top: 0; transform: translateX(-50%);
  font: 700 10px var(--f-display); line-height: 16px;
  color: var(--ink-3); cursor: default; white-space: nowrap;
}
.rb-ev::after {
  content: ""; position: absolute; left: 50%; top: 15px; width: 1px; height: 5px;
  background: var(--line-strong);
}
.rb-ev.hit { color: var(--ok); }
.rb-ev.miss { color: var(--bad); }
.rb-ev.money { color: var(--warn); }

.rb-break {
  position: absolute; top: 16px; bottom: 16px; width: 2px; margin-left: -1px;
  background: var(--crit); border-radius: 1px;
}
.rb-break::after {
  content: attr(data-label); position: absolute; top: -16px; left: 4px;
  font: 700 10px var(--f-display); color: var(--crit); white-space: nowrap;
}

.rb-axis {
  display: flex; justify-content: space-between; margin-top: 5px;
  font: 400 10px var(--f-mono); color: var(--ink-3);
}

/* RU: Микро-версия для строки списка — без оси и событий, только форма разговора.
   EN: The micro version for a list row — no axis, no events, just the shape of the talk. */
.rb.micro { width: 128px; }
.rb.micro .rb-track { height: 5px; }

.ribbon-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-2); flex-wrap: wrap; }
.ribbon-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* ── Транскрипт / Transcript ──────────────────────────────────────────────── */

.turn { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); }
.turn:hover { background: var(--surface-2); }
.turn.active { background: var(--accent-soft); }
.turn-time { font: 400 11.5px var(--f-mono); color: var(--ink-3); padding-top: 2px; }
.turn-who { font: 700 11px var(--f-display); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.turn.agent .turn-who { color: var(--track-agent); }
.turn.client .turn-who { color: var(--track-client); }
.turn mark { background: var(--warn-bg); color: var(--warn); padding: 1px 3px; border-radius: 3px; font-weight: 600; }

/* ── Чек-лист / Scorecard ──────────────────────────────────────────────────── */

.crit-group { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.crit-group + .crit-group { margin-top: 10px; }
.crit-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); }
.crit-head h4 { flex: 1; font: 700 12.5px var(--f-display); margin: 0; }
.crit-item { display: flex; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.crit-mark { width: 16px; height: 16px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10px; color: #fff; margin-top: 1px; }
.crit-mark.pass { background: var(--ok); }
.crit-mark.fail { background: var(--bad); }
.crit-mark.part { background: var(--warn); }
.crit-mark.na { background: var(--line-strong); }
.evidence {
  margin-top: 5px; padding: 7px 10px; border-left: 2px solid var(--line-strong);
  background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 12.5px; color: var(--ink-2);
}
.evidence .mono { color: var(--ink-3); }

/* ── Телефон / Phone frame ────────────────────────────────────────────────── */

/*
 * RU: Рамка телефона для Android-макетов. 380×760 — близко к реальному 6.1", но
 *     компактнее, чтобы 8 экранов помещались на одной странице для сравнения.
 * EN: Phone frame for the Android mockups. 380x760 is close to a real 6.1" device but
 *     compact enough to fit eight screens on one page for comparison.
 */
.phones { display: flex; flex-wrap: wrap; gap: 30px; }
.phone-wrap { width: 300px; }
.phone-title { font: 700 13px var(--f-display); margin-bottom: 3px; }
.phone-note { font-size: 12px; color: var(--ink-2); margin-bottom: 10px; min-height: 32px; }
.phone {
  width: 300px; height: 620px; border-radius: 30px; overflow: hidden;
  background: var(--surface); border: 8px solid var(--ink);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  position: relative;
}
[data-theme="console"] .phone { border-color: #05070a; }
.phone-status {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px 4px;
  font: 600 10.5px var(--f-mono); color: var(--ink-2); background: var(--surface);
}
.phone-body { flex: 1; overflow: hidden; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.phone-nav {
  display: flex; border-top: 1px solid var(--line); background: var(--surface);
  padding: 7px 0 10px;
}
.phone-nav div { flex: 1; text-align: center; font-size: 9.5px; color: var(--ink-3); }
.phone-nav div.on { color: var(--accent); font-weight: 700; }
.phone-nav svg { display: block; margin: 0 auto 3px; width: 17px; height: 17px; }

.tile { background: var(--surface-2); border-radius: var(--r); padding: 11px 12px; }
.notif {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px; box-shadow: var(--shadow);
}

.hero-status {
  border-radius: var(--r-lg); padding: 18px 16px; text-align: center;
  background: var(--ok-bg); color: var(--ok);
}
.hero-status .big { font: 800 17px var(--f-display); margin-top: 8px; }
.hero-status.off { background: var(--warn-bg); color: var(--warn); }

.step { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; }
.step-n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font: 700 11px var(--f-display); background: var(--surface-3); color: var(--ink-2);
}
.step.done .step-n { background: var(--ok); color: #fff; }
.step.now .step-n { background: var(--accent); color: var(--accent-ink); }

/* ── Мелочи / Odds and ends ───────────────────────────────────────────────── */

.section-gap { margin-top: 24px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.pill-tabs { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.pill-tabs button {
  border: 0; background: none; padding: 6px 14px; border-radius: var(--r-pill);
  font: 600 12.5px var(--f-body); color: var(--ink-2); cursor: pointer;
}
.pill-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty h3 { margin-bottom: 6px; }

.sparkline { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.sparkline i { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .75; }
.sparkline i.hi { opacity: 1; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .split, .g4, .g3 { grid-template-columns: 1fr; }
}

/* RU: Вход — единственный экран без бокового меню; прячем рельс по активному экрану.
   EN: Login is the only screen without the side rail; hide it based on the active screen. */
body[data-active="login"] .rail,
body[data-active="login"] .topbar { display: none; }
body[data-active="login"] .shell { grid-template-columns: 1fr; }

.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 28px; box-shadow: var(--shadow);
}
.auth-side { max-width: 420px; }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; max-width: 900px; }
@media (max-width: 820px) { .auth-grid { grid-template-columns: 1fr; gap: 30px; } .auth-side { display: none; } }

/*
 * RU: Цвет текста наследуется, а не пересчитывается: у вложенного контейнера с другой
 *     темой потомки унаследовали бы цвет от body и стали нечитаемыми. Переобъявляем
 *     color на каждом носителе темы — тогда переменная резолвится заново.
 * EN: Text color is inherited, not re-resolved: inside a nested container with another
 *     theme, children would inherit body's color and turn unreadable. Re-declaring color
 *     on every theme holder makes the variable resolve again at that element.
 */
[data-theme] { color: var(--ink); }

/* ── Суть разговора / Call brief ──────────────────────────────────────────── */

/*
 * RU: Карточка сути: два столбца — «сделано верно» и «что не так». Столбцы равной
 *     ширины намеренно: визуальный паритет говорит, что система ищет и то, и другое.
 *     Если сделать «что не так» шире, разбор читается как обвинение ещё до чтения текста.
 * EN: The brief card: two columns — "done well" and "went wrong". Equal widths on purpose:
 *     visual parity says the system looks for both. Making "went wrong" wider would read
 *     as an accusation before a single word is read.
 */
.brief { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
@media (max-width: 780px) { .brief { grid-template-columns: 1fr; } }
.brief-col { background: var(--surface); padding: 13px 14px; }
.brief-col h4 { font: 700 12px var(--f-display); margin: 0 0 10px; display: flex; align-items: center; gap: 7px; }
.brief-col.good h4 { color: var(--ok); }
.brief-col.bad h4 { color: var(--bad); }

.brief-item { display: grid; grid-template-columns: 14px 1fr; gap: 8px; padding: 7px 0; }
.brief-item + .brief-item { border-top: 1px dashed var(--line); }
.brief-mark { font: 700 12px var(--f-display); line-height: 1.4; }
.brief-col.good .brief-mark { color: var(--ok); }
.brief-col.bad .brief-mark { color: var(--bad); }
.brief-text { font-size: 12.8px; line-height: 1.45; }

/* RU: Цитата с таймкодом — доказательство. Клик по таймкоду перематывает плеер.
   EN: Quote with a timecode — the evidence. Clicking the timecode seeks the player. */
.brief-quote { margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.brief-quote .tc {
  font-family: var(--f-mono); font-size: 11px; color: var(--accent);
  cursor: pointer; margin-right: 6px; font-weight: 500;
}
.brief-quote .tc:hover { text-decoration: underline; }

/* RU: «Как надо было» — обязательная часть каждого замечания: без альтернативы
   замечание не учит, а только сообщает о недовольстве.
   EN: "What to say instead" is mandatory on every criticism: without an alternative it
   teaches nothing and merely registers displeasure. */
.brief-fix {
  margin-top: 5px; padding: 6px 9px; border-radius: var(--r-sm);
  background: var(--ok-bg); color: var(--ok); font-size: 12px; line-height: 1.4;
}
.brief-fix b { font-weight: 700; }

.brief-head { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 4px 0 12px; }
.brief-head dt { font-size: 11.5px; color: var(--ink-3); font-weight: 600; padding-top: 1px; }
.brief-head dd { margin: 0; font-size: 13px; }

/* ── Ход разговора по разделам / Call outline ─────────────────────────────── */

/*
 * RU: Разделы разговора с длительностью — видно, на что ушло время. Полоса слева
 *     кодирует, была ли это проблемная часть.
 * EN: Conversation sections with durations — it shows where the time went. The left bar
 *     encodes whether that stretch was the problem.
 */
.outline-row { display: grid; grid-template-columns: 74px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.outline-row:first-child { border-top: 0; }
.outline-time { font: 400 11.5px var(--f-mono); color: var(--ink-3); }
.outline-body { border-left: 3px solid var(--line-strong); padding-left: 11px; }
.outline-body.warn { border-left-color: var(--warn); }
.outline-body.bad { border-left-color: var(--bad); }
.outline-body.ok { border-left-color: var(--ok); }
.outline-body b { font-size: 13px; display: block; }
.outline-body span { font-size: 12px; color: var(--ink-2); }

/* ── Вкладки / Tabs ───────────────────────────────────────────────────────── */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  border: 0; background: none; padding: 9px 15px; cursor: pointer;
  font: 600 13.5px var(--f-body); color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--ink); }

/* ── Теги / Tags ──────────────────────────────────────────────────────────── */

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  font: 500 11.5px var(--f-body); color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag b { color: var(--ink-3); font-weight: 600; }

/* ── Раскрытие строки списка / Expandable list row ────────────────────────── */

/*
 * RU: Раскрытие сути прямо в списке. Смысл: очередь из двадцати звонков разбирается
 *     без единого перехода на страницу — открывают целиком только те три, что стоят того.
 * EN: The brief expands inside the list. The point: a queue of twenty calls is triaged
 *     without a single page navigation — only the three worth it get opened in full.
 */
.expander {
  width: 20px; height: 20px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; font-size: 10px; padding: 0; flex: none;
}
.expander[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
tr.detail > td { background: var(--surface-2); padding: 14px 16px 18px; }
.summary-line { font-size: 13px; font-weight: 500; }
.summary-sub { font-size: 11.5px; color: var(--ink-3); font-family: var(--f-mono); margin-top: 2px; }

/* ── Комментарий на таймкоде / Timecoded comment ──────────────────────────── */

.tc-comment {
  display: grid; grid-template-columns: 28px 1fr; gap: 10px;
  padding: 10px 11px; border-radius: var(--r); background: var(--warn-bg);
  border-left: 3px solid var(--warn);
}
.tc-comment .who { font: 700 11.5px var(--f-display); }
.tc-comment .txt { font-size: 12.5px; margin-top: 3px; }

/* ── Дерево тем / Topic tree ──────────────────────────────────────────────── */

.topic { display: grid; grid-template-columns: 1fr 66px 92px 74px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.topic:first-child { border-top: 0; }
.topic.sub { padding-left: 22px; }
.topic.sub > :first-child { color: var(--ink-2); font-size: 12.5px; }

/* ── Лента обращений клиента / Client history ─────────────────────────────── */

.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 9px 0; }
.tl-item::before {
  content: ""; position: absolute; left: -23px; top: 15px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong);
}
.tl-item.ok::before { border-color: var(--ok); background: var(--ok); }
.tl-item.bad::before { border-color: var(--bad); background: var(--bad); }
