/* ==========================================================================
   PlanV — дизайн-система продукта / product design system
   RU: Перенесена из mockups/assets/planv.css без изменений. Источник токенов один:
       если правится здесь — правится и там, иначе макет перестаёт описывать продукт.
   EN: Carried over from mockups/assets/planv.css unchanged. There is one source of tokens:
       an edit here is an edit there too, otherwise the mockup stops describing the product.
   RU: Один файл на все три варианта интерфейса. Варианты отличаются только
       компоновкой, а токены, типографика и атомы общие — иначе сравнивать
       варианты бессмысленно: разница будет в оформлении, а не в структуре.
   EN: One file shared by all three interface variants. The variants differ in
       layout only; tokens, type and atoms are shared — otherwise comparing them
       would be meaningless, the difference would be styling rather than structure.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Токены / Tokens
   RU: Светлая тема задана на голом :root, тёмная переопределяет только цвета.
       Так ни один цвет не существует исключительно внутри media-запроса.
   EN: The light theme is defined on bare :root; dark redefines colours only.
       This way no colour has its single definition inside a media query.
   -------------------------------------------------------------------------- */
:root {
  /* RU: Индиго — единственный «активный» цвет интерфейса, чтобы красный остался
         эксклюзивно за записью и считывался боковым зрением.
     EN: Indigo is the only "active" UI colour, so red stays exclusive to recording
         and remains readable in peripheral vision. */
  --brand-600: #5B4BE8;
  --brand-500: #6E5FF2;
  --brand-050: #EEEBFF;
  --rec:       #E2544F;   /* RU: только запись / EN: recording only */
  --amber:     #E0912F;
  --ok:        #2FA37A;

  /* RU: Тёплая бумага вместо белого: стенограммы читают часами, тёплый фон
         снижает утомление и отделяет «документ» от «стола».
     EN: Warm paper instead of white: transcripts are read for hours, a warm ground
         reduces fatigue and separates the "document" from the "desk". */
  --bg:        #F7F6F3;
  --surface:   #FFFFFF;
  --surface-2: #F1EFEA;
  --surface-3: #E9E6DF;
  --line:      #E4E0D8;
  --line-soft: #EFECE5;
  --text:      #16161A;
  --text-2:    #5C5A63;
  --text-3:    #8B8892;
  --shadow-1: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-2: 0 2px 6px rgba(0,0,0,.06), 0 24px 60px rgba(0,0,0,.10);

  /* RU: Восемь цветов говорящих, различимых при дальтонизме и на обеих темах.
         Назначаются по порядку появления голоса в записи.
     EN: Eight speaker colours, distinguishable under colour blindness and in both
         themes. Assigned in order of a voice's first appearance. */
  --spk-1: #6E5FF2; --spk-2: #17A2A2; --spk-3: #E0912F; --spk-4: #E05C7E;
  --spk-5: #46A35A; --spk-6: #3C87E0; --spk-7: #A05CE0; --spk-8: #B0764A;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-full: 999px;
  --t-fast: 120ms ease-out;
  --t-mid: 220ms cubic-bezier(.22,.61,.36,1);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  --brand-050: #211E45;
  --bg:        #0E0E12;
  --surface:   #16161C;
  --surface-2: #1E1E26;
  --surface-3: #262630;
  --line:      #2A2A34;
  --line-soft: #22222B;
  --text:      #F2F1EF;
  --text-2:    #A5A3AE;
  --text-3:    #6E6C78;
  /* RU: В тёмной теме тени не читаются — заменяем их подсветкой границы.
     EN: Shadows do not read on dark — replace them with a lit border instead. */
  --shadow-1: 0 0 0 1px rgba(255,255,255,.05);
  --shadow-2: 0 0 0 1px rgba(255,255,255,.07), 0 24px 60px rgba(0,0,0,.55);
}

/* --------------------------------------------------------------------------
   2. База / Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 620; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 12px; }
button { font: inherit; color: inherit; }
a { color: var(--brand-600); text-decoration: none; }

/* RU: Таймкоды только табличными цифрами: иначе колонка «прыгает» при
       воспроизведении и глаз теряет строку.
   EN: Timecodes use tabular figures only: otherwise the column jitters during
       playback and the eye loses the line. */
.tc { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 500; color: var(--text-3); }

.muted { color: var(--text-2); }
.dim   { color: var(--text-3); }
.label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }

/* --------------------------------------------------------------------------
   3. Атомы / Atoms
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn--primary:hover { background: var(--brand-500); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn--icon { width: 36px; padding: 0; justify-content: center; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid transparent;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip--on { background: var(--brand-050); color: var(--brand-600); }
/* RU: Пунктир = поставлено автоматикой и не подтверждено человеком. Единый
       признак для автотегов, автоимён и автопапок — пользователь всегда
       отличает своё от машинного.
   EN: Dashed = produced by automation and not confirmed by a human. One shared
       signal for auto tags, auto names and auto folders, so the user can always
       tell their own decisions from the machine's. */
.chip--auto { border: 1px dashed var(--line); background: transparent; }
.chip--auto::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff;
  font-size: 11px; font-weight: 650; letter-spacing: -.02em;
}
.avatar--lg { width: 40px; height: 40px; font-size: 15px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
}

.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px;
  border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-2); color: var(--text-2);
}
.badge--work { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.badge--done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge--rec  { background: color-mix(in srgb, var(--rec) 16%, transparent); color: var(--rec); }

/* --------------------------------------------------------------------------
   4. Кнопка записи и осциллограмма / Record button and waveform
   RU: Единственная непрерывная анимация в продукте — пульс записи. Всё
       остальное реагирует на действие и останавливается.
   EN: The recording pulse is the only continuous animation in the product.
       Everything else reacts to an action and then stops.
   -------------------------------------------------------------------------- */
.rec-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--rec); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--rec) 40%, transparent);
  transition: transform var(--t-fast);
}
.rec-btn:active { transform: scale(.94); }
.rec-btn--lg { width: 92px; height: 92px; }
.rec-btn--on { animation: recPulse 1600ms ease-in-out infinite; }
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rec) 45%, transparent); }
  50%      { box-shadow: 0 0 0 14px color-mix(in srgb, var(--rec) 0%, transparent); }
}

.wave { display: flex; align-items: center; gap: 3px; height: 44px; }
.wave i {
  display: block; width: 3px; border-radius: 2px; flex: none;
  background: var(--text-3); opacity: .45;
}
/* RU: Проигранная часть окрашивается брендовым — это и прогресс, и подсказка,
       что по волне можно кликать для перемотки.
   EN: The played part turns brand-coloured — it is both progress and a hint that
       the waveform is clickable for seeking. */
.wave i.played { background: var(--brand-600); opacity: 1; }
.wave--live i { background: var(--rec); opacity: .85; animation: waveLive 900ms ease-in-out infinite; }
@keyframes waveLive { 0%,100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
  /* RU: При отключённой анимации волна становится статичной шкалой уровня —
         информация сохраняется, движение исчезает.
     EN: With reduced motion the waveform becomes a static level scale — the
         information is kept, the movement is dropped. */
  .rec-btn--on, .wave--live i { animation: none; }
}

/* --------------------------------------------------------------------------
   5. Стенограмма / Transcript
   -------------------------------------------------------------------------- */
.seg {
  display: grid; grid-template-columns: 52px 1fr; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t-fast);
}
.seg:hover { background: var(--surface-2); }
/* RU: Активная реплика подсвечивается фоном и цветной полосой слева — заливать
       весь текст цветом говорящего нельзя, стенограмма превращается в лоскуты.
   EN: The active line is marked by a tint plus a coloured left rule — filling the
       whole line with the speaker colour would turn the transcript into patchwork. */
.seg--active { background: var(--brand-050); box-shadow: inset 3px 0 0 var(--brand-600); }
.seg__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-top: 2px; }
.seg__who { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; font-size: 13px; font-weight: 600; }
.seg__who .conf { font-size: 11px; font-weight: 500; color: var(--text-3); }
.seg__text { font-size: 16px; line-height: 1.75; max-width: 64ch; }
.seg__text mark { background: color-mix(in srgb, var(--amber) 28%, transparent); border-radius: 3px; padding: 0 2px; }

/* RU: Слово, распознанное неуверенно. Пунктир под текстом, а не цветная заливка:
       сомнение нужно показать, но не превратить стенограмму в предупреждение —
       иначе пользователь перестанет замечать разметку вообще.
   EN: A low-confidence word. A dotted underline rather than a colour fill: doubt must be
       visible without turning the transcript into a warning sign, otherwise the user stops
       noticing the markup altogether. */
.lowconf {
  text-decoration: underline dotted var(--amber);
  text-underline-offset: 3px;
  cursor: help;
}

/* RU: Провал по речи. Показывается явно, потому что молчание, не отмеченное в тексте,
       читается как потерянный кусок записи.
   EN: A speech gap. Shown explicitly, because silence left unmarked in the text reads as a
       lost chunk of the recording. */
.gap-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; margin: 4px 0;
  font-size: 12.5px; color: var(--text-3);
}
.gap-row::before, .gap-row::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* RU: Пометка пользователя, сделанная во время записи. Жёлтая полоса слева отличает
       написанное человеком от всего, что произвела машина.
   EN: A note the user typed while recording. The amber left rule separates what a human
       wrote from everything the machine produced. */
.memo-item {
  border-left: 3px solid var(--amber);
  background: color-mix(in srgb, var(--amber) 7%, transparent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 8px 11px; margin-bottom: 6px; font-size: 14px; line-height: 1.5;
}

/* RU: Полоса прогресса шага обработки. Тонкая и без анимации: она информирует,
       а не развлекает, и не должна конкурировать с живой волной записи.
   EN: A processing-step progress bar. Thin and unanimated: it informs rather than entertains
       and must not compete with the live recording waveform. */
.bar { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand-600); }
.bar > i.err { background: var(--rec); }
.bar > i.ok { background: var(--ok); }

/* RU: Сегментированный переключатель слоёв «Дословно / Читаемо / Структура».
   EN: Segmented control for the "Verbatim / Readable / Structured" layers. */
.layers { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r-sm); }
.layers button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.layers button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* RU: Блок структуры. Иконка типа слева, ссылка-таймкод справа: без обратной
       ссылки в аудио переработанному тексту не верят — это ядро доверия.
   EN: A structured block. Type icon on the left, timecode link on the right:
       without a link back into audio the rewritten text is not trusted — this is
       the core of the trust model. */
.block { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; }
.block__icon { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; background: var(--surface-2); }
.block__src { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 11.5px; color: var(--brand-600); cursor: pointer; vertical-align: 1px; }
.block__src:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   6. Списки и карточки заметок / Lists and note cards
   -------------------------------------------------------------------------- */
.note-row {
  padding: 12px 14px; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid transparent; transition: background var(--t-fast), border-color var(--t-fast);
}
.note-row:hover { background: var(--surface-2); }
.note-row--active { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1); }
.note-row__title { font-weight: 600; font-size: 14.5px; margin-bottom: 3px; }
.note-row__excerpt {
  font-size: 13px; color: var(--text-2); line-height: 1.45;
  /* RU: Ровно две строки сути: одной мало, чтобы узнать запись, три ломают ритм списка.
     EN: Exactly two lines of gist: one is not enough to recognise a note, three break the rhythm. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-row__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.nav-item {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px;
  border-radius: var(--r-sm); font-size: 14px; color: var(--text-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item--active { background: var(--surface-2); color: var(--text); font-weight: 550; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* --------------------------------------------------------------------------
   7. Поиск / Search
   -------------------------------------------------------------------------- */
.search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search:focus-within { border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-050); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }
.search input::placeholder { color: var(--text-3); }

/* RU: Разобранный голосовой запрос показывается чипами — единственный способ
       сделать смысловой поиск предсказуемым: видно, как система поняла.
   EN: A parsed voice query is shown as chips — the only way to make semantic
       search predictable: the user sees how the system understood them. */
.parsed { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   8. Плашки, модалки, тосты / Banners, modals, toasts
   -------------------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--text); color: var(--bg); border-radius: var(--r-sm);
  box-shadow: var(--shadow-2); font-size: 13.5px; z-index: 90;
  animation: toastIn 220ms cubic-bezier(.22,.61,.36,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.toast button { border: 0; background: transparent; color: var(--brand-400, #8B7DFF); font-weight: 600; cursor: pointer; }

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(10,10,14,.45);
  display: grid; place-items: center; z-index: 100; padding: 24px;
  animation: fade 160ms ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(520px, 100%); background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); padding: 22px; animation: sheetIn 220ms cubic-bezier(.22,.61,.36,1);
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* --------------------------------------------------------------------------
   9. Оболочки устройств для витрины макетов / Device frames for the mockup board
   RU: Рамки нужны, чтобы вариант «Поток» честно оценивался в мобильных
       пропорциях, а не растянутым на монитор.
   EN: Frames exist so the "Flow" variant is judged in real phone proportions
       rather than stretched across a monitor.
   -------------------------------------------------------------------------- */
.phone {
  width: 390px; height: 780px; border-radius: 42px; padding: 10px;
  background: #101014; box-shadow: var(--shadow-2); flex: none;
}
.phone__screen { width: 100%; height: 100%; border-radius: 33px; overflow: hidden; background: var(--bg); position: relative; display: flex; flex-direction: column; }
.phone__notch { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 108px; height: 26px; border-radius: var(--r-full); background: #101014; z-index: 20; }

.browser { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-2); background: var(--surface); border: 1px solid var(--line); }
.browser__bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.browser__dots { display: flex; gap: 6px; }
.browser__dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); display: block; }
.browser__url { flex: 1; height: 24px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; padding: 0 10px; font-size: 12px; color: var(--text-3); }

/* --------------------------------------------------------------------------
   10. Утилиты / Utilities
   -------------------------------------------------------------------------- */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.scroll { overflow-y: auto; scrollbar-width: thin; }
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.hidden { display: none !important; }
.stack > * + * { margin-top: var(--gap, 12px); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
