/* ============================================================
   Speech2Text — общая дизайн-система
   Тёмная тема по умолчанию, светлая через [data-theme="light"].
   Шрифты: Unbounded (дисплей), Manrope (текст), JetBrains Mono (данные).
   ============================================================ */

:root {
  --bg: #0E0E11;
  --bg-deep: #0b0b0d;
  --surface: #15151A;
  --card: #16161B;
  --card-grad: linear-gradient(140deg, #17171d, #121216);
  --hair: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .14);
  --chip: rgba(255, 255, 255, .04);
  --chip-hover: rgba(255, 255, 255, .07);
  --grid: rgba(255, 255, 255, .035);

  --text: #F4F3F1;
  --muted: #A6A6AF;
  --faint: #74747d;

  --accent: #FF6A1A;
  --accent-2: #ff8a3d;
  --accent-deep: #C2470A;
  --accent-glow: rgba(255, 106, 26, .30);
  --accent-soft: rgba(255, 106, 26, .12);
  --on-accent: #0b0b0d;

  --ok: #27d07f;
  --ok-soft: rgba(39, 208, 127, .12);
  --err: #ff5c5c;
  --err-soft: rgba(255, 92, 92, .12);
  --warn: #ffb02e;
  --warn-soft: rgba(255, 176, 46, .12);
  --info: #4DA3FF;
  --info-soft: rgba(77, 163, 255, .12);

  /* палитра собеседников (диаризация) */
  --spk-1: #FF6A1A;
  --spk-2: #4DA3FF;
  --spk-3: #27d07f;
  --spk-4: #C77DFF;
  --spk-5: #FFD166;
  --spk-6: #FF7BAC;
  --spk-7: #35D0C4;
  --spk-8: #A3E635;

  --shadow-card: 0 16px 40px rgba(0, 0, 0, .40);
  --shadow-pop: 0 24px 70px rgba(0, 0, 0, .55);

  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --r-s: 8px;
  --r-m: 11px;
  --r-l: 14px;
  --r-xl: 20px;
}

[data-theme="light"] {
  --bg: #F4F2EE;
  --bg-deep: #ECE9E3;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --card-grad: linear-gradient(140deg, #ffffff, #faf8f5);
  --hair: rgba(20, 18, 16, .08);
  --line: rgba(20, 18, 16, .12);
  --line-2: rgba(20, 18, 16, .18);
  --chip: rgba(20, 18, 16, .04);
  --chip-hover: rgba(20, 18, 16, .07);
  --grid: rgba(20, 18, 16, .05);

  --text: #17161B;
  --muted: #5c5a63;
  --faint: #8b8892;

  --accent-glow: rgba(255, 106, 26, .22);
  --accent-soft: rgba(255, 106, 26, .10);

  --shadow-card: 0 14px 34px rgba(35, 25, 15, .10);
  --shadow-pop: 0 24px 60px rgba(35, 25, 15, .18);
}

/* ---------- база ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
::selection { background: rgba(255, 106, 26, .32); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 100px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@keyframes blinkDot { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
@keyframes glowPulse { 0%, 100% { opacity: .5; } 50% { opacity: .85; } }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes eqPlay {
  0%, 100% { transform: scaleY(.25); }
  50% { transform: scaleY(1); }
}
@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ---------- типографика ---------- */
.display { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }
.mono-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.mono-value { font-family: var(--font-mono); font-weight: 700; }

/* ---------- бейдж-пилюля с точкой ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--chip);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: blinkDot 2.2s ease-in-out infinite;
  flex: none;
}
.pill .dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.pill .dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.pill .dot.err { background: var(--err); box-shadow: 0 0 10px var(--err); animation: none; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: var(--r-m);
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 24px var(--accent-glow);
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); background: var(--accent-2); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: var(--chip);
  color: var(--text);
  border: 1px solid var(--line-2);
  box-shadow: none;
  font-weight: 600;
}
.btn-ghost:hover { background: var(--chip-hover); transform: translateY(-1px); }

.btn-danger {
  background: var(--err-soft);
  color: var(--err);
  border: 1px solid rgba(255, 92, 92, .3);
  box-shadow: none;
}
.btn-danger:hover { background: rgba(255, 92, 92, .2); transform: translateY(-1px); }

.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: var(--r-s); }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-grid; place-items: center;
  background: var(--chip);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  box-shadow: none;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.btn-icon:hover { background: var(--chip-hover); color: var(--text); transform: none; }
.btn-icon.danger:hover { background: var(--err-soft); color: var(--err); border-color: rgba(255, 92, 92, .3); }
.btn-icon.accent:hover { background: var(--accent-soft); color: var(--accent); border-color: rgba(255, 106, 26, .3); }

/* ---------- карточки ---------- */
.card {
  background: var(--card-grad);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 22px;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  margin-bottom: 4px;
}
.card-sub { color: var(--muted); font-size: 13.5px; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -.02em;
  margin-top: 10px;
  line-height: 1;
}
.stat-card .stat-value .unit { font-size: 14px; color: var(--faint); font-weight: 600; }

/* ---------- поля форм ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  font-family: var(--font-body);
  font-size: 14.5px;
  transition: border-color .2s ease, box-shadow .2s ease;
  appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23A6A6AF' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
  cursor: pointer;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .hint { font-size: 12.5px; color: var(--faint); line-height: 1.45; }

/* ---------- переключатель (switch) ---------- */
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--chip);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
  user-select: none;
}
.switch-row:hover { background: var(--chip-hover); }
.switch-row.on { border-color: rgba(255, 106, 26, .4); background: var(--accent-soft); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  flex: none;
  width: 38px; height: 22px;
  border-radius: 100px;
  background: var(--line);
  position: relative;
  transition: background .2s ease;
  margin-top: 1px;
}
.switch-row.on .switch-track { background: var(--accent); }
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.switch-row.on .switch-track::after { transform: translateX(16px); }
.switch-row .switch-name { font-weight: 700; font-size: 14px; }
.switch-row .switch-hint { font-size: 12.5px; color: var(--faint); margin-top: 2px; line-height: 1.45; }

/* ---------- сегмент-контрол ---------- */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--chip);
}
.seg button {
  padding: 7px 13px;
  border: none;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent); color: var(--on-accent); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-l); }
table.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th {
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  background: var(--chip);
  white-space: nowrap;
}
.tbl td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--hair);
  font-size: 14px;
  vertical-align: middle;
}
.tbl tbody tr { transition: background .15s ease; }
.tbl tbody tr:hover { background: var(--chip); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- статус-чипы ---------- */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-err { background: var(--err-soft); color: var(--err); }
.status-warn { background: var(--warn-soft); color: var(--warn); }
.status-warn::before { animation: blinkDot 1.4s ease-in-out infinite; }
.status-info { background: var(--info-soft); color: var(--info); }
.status-mute { background: var(--chip); color: var(--faint); }

/* ---------- эквалайзер (сигнатура) ---------- */
.eq { display: inline-flex; align-items: center; gap: 3px; height: 22px; }
.eq i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transform-origin: center;
  animation: eqPlay 1.1s ease-in-out infinite;
}
.eq i:nth-child(2) { animation-delay: .12s; }
.eq i:nth-child(3) { animation-delay: .24s; }
.eq i:nth-child(4) { animation-delay: .36s; }
.eq i:nth-child(5) { animation-delay: .48s; }
.eq i:nth-child(6) { animation-delay: .60s; }
.eq i:nth-child(7) { animation-delay: .72s; }
.eq.idle i { animation-play-state: paused; transform: scaleY(.25); }

/* большой эквалайзер процесса распознавания */
.eq-big { display: flex; align-items: center; justify-content: center; gap: 4px; height: 54px; }
.eq-big i {
  display: block;
  width: 5px; height: 100%;
  border-radius: 100px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-deep));
  transform-origin: center;
  animation: eqPlay 1s ease-in-out infinite;
}
.eq-big i:nth-child(odd) { opacity: .85; }
.eq-big i:nth-child(1) { animation-delay: 0s; }
.eq-big i:nth-child(2) { animation-delay: .09s; }
.eq-big i:nth-child(3) { animation-delay: .18s; }
.eq-big i:nth-child(4) { animation-delay: .27s; }
.eq-big i:nth-child(5) { animation-delay: .36s; }
.eq-big i:nth-child(6) { animation-delay: .45s; }
.eq-big i:nth-child(7) { animation-delay: .54s; }
.eq-big i:nth-child(8) { animation-delay: .63s; }
.eq-big i:nth-child(9) { animation-delay: .72s; }
.eq-big i:nth-child(10) { animation-delay: .81s; }
.eq-big i:nth-child(11) { animation-delay: .72s; }
.eq-big i:nth-child(12) { animation-delay: .63s; }
.eq-big i:nth-child(13) { animation-delay: .54s; }
.eq-big i:nth-child(14) { animation-delay: .45s; }
.eq-big i:nth-child(15) { animation-delay: .36s; }
.eq-big i:nth-child(16) { animation-delay: .27s; }
.eq-big i:nth-child(17) { animation-delay: .18s; }
.eq-big i:nth-child(18) { animation-delay: .09s; }
.eq-big i:nth-child(19) { animation-delay: 0s; }

/* ---------- прогресс ---------- */
.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 100px;
  background: var(--chip);
  border: 1px solid var(--hair);
  overflow: hidden;
}
.progress-track > span {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width .3s ease;
}

/* ---------- диалог (диаризация) ---------- */
.dialog-block {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--hair);
  border-radius: var(--r-l);
  background: var(--chip);
  margin-bottom: 10px;
}
.dialog-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--on-accent);
}
.dialog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.dialog-name { font-weight: 800; font-size: 13.5px; }
.dialog-time { font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.dialog-text { font-size: 14.5px; line-height: 1.65; color: var(--text); }

.speaker-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--chip);
  font-size: 13px;
  font-weight: 700;
}
.speaker-chip .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.speaker-chip .tt { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--faint); }

/* ---------- зона загрузки ---------- */
.upload-zone {
  position: relative;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-xl);
  padding: 44px 24px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 90% at 50% 110%, var(--accent-soft), transparent 70%),
    var(--chip);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.upload-zone:hover { border-color: var(--accent); }
.upload-zone.drag-over { border-color: var(--accent); transform: scale(1.008); background: radial-gradient(ellipse 60% 90% at 50% 110%, var(--accent-glow), transparent 70%), var(--chip); }
.upload-zone.disabled { opacity: .55; cursor: not-allowed; }

/* ---------- модалы ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 8, 10, .66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 4vh 16px;
}
.modal.open { display: block; }
.modal-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  max-width: 860px;
  margin: 0 auto;
  padding: 26px;
  box-shadow: var(--shadow-pop);
}
.modal-content.narrow { max-width: 480px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.01em;
}
.modal-close {
  width: 34px; height: 34px;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.modal-close:hover { background: var(--chip-hover); color: var(--text); }

/* ---------- тосты ---------- */
#toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 44px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--r-l);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  font-size: 14px;
  animation: toastIn .25s ease-out;
}
.toast .t-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.toast.success .t-dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.toast.error .t-dot { background: var(--err); box-shadow: 0 0 10px var(--err); }
.toast.info .t-dot { background: var(--info); box-shadow: 0 0 10px var(--info); }
.toast.warning .t-dot { background: var(--warn); box-shadow: 0 0 10px var(--warn); }

/* ---------- спиннер ---------- */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---------- логотип-плитка ---------- */
.logo-tile {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--r-m);
  background: radial-gradient(circle at 50% 130%, var(--accent-deep), #161318);
  flex: none;
}

/* ---------- фоновая сетка ---------- */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 72% 64% at 50% 30%, #000, transparent 76%);
  mask-image: radial-gradient(ellipse 72% 64% at 50% 30%, #000, transparent 76%);
  pointer-events: none;
}

/* ---------- вкладки результата ---------- */
.tabs-inline {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--chip);
}
.tabs-inline button {
  padding: 8px 16px;
  border: none;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tabs-inline button:hover { color: var(--text); }
.tabs-inline button.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* ---------- audio ---------- */
audio { width: 100%; height: 40px; }
audio::-webkit-media-controls-panel { background: var(--surface); }

/* ---------- кастомный плеер ---------- */
.player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--card-grad);
}
.player audio { display: none; }
.player .p-btn {
  width: 40px; height: 40px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--accent-glow);
  transition: background .15s ease, transform .12s ease;
}
.player .p-btn:hover { background: var(--accent-2); transform: scale(1.04); }
.player .p-btn:disabled { opacity: .4; cursor: default; transform: none; }
.player .p-skip {
  width: 32px; height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--chip);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.player .p-skip:hover { background: var(--chip-hover); color: var(--text); }
.player .p-time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  flex: none;
  display: inline-flex;
  gap: 5px;
}
.player .p-time b { color: var(--text); font-weight: 600; min-width: 42px; text-align: right; }
.player .p-track {
  position: relative;
  flex: 1;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  min-width: 80px;
}
.player .p-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  border-radius: 100px;
  background: var(--chip);
  border: 1px solid var(--hair);
}
.player .p-fill {
  position: relative;
  height: 6px;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  width: 0%;
  pointer-events: none;
}
.player .p-thumb {
  position: absolute;
  right: -6px; top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .4);
  transition: transform .12s ease;
}
.player .p-track:hover .p-thumb,
.player .p-track.dragging .p-thumb { transform: translateY(-50%) scale(1); }
.player .p-rate {
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--chip);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 9px;
  cursor: pointer;
  min-width: 44px;
  transition: background .15s ease, color .15s ease;
}
.player .p-rate:hover { background: var(--chip-hover); color: var(--text); }
.player .p-loading {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 13px;
}
@media (max-width: 560px) {
  .player { gap: 8px; padding: 8px 10px; }
  .player .p-skip, .player .p-rate { display: none; }
}

/* ---------- панель над транскриптом ---------- */
.tr-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tr-toolbar input[type="search"] {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-family: var(--font-body);
  font-size: 13.5px;
}
.tr-toolbar input[type="search"]:focus { outline: none; border-color: var(--accent); }
.tr-toolbar .tr-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}
.tr-follow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.tr-follow input { accent-color: var(--accent); }

/* ---------- синхронизация текста с аудио ---------- */
.sync-seg {
  cursor: pointer;
  border-radius: 6px;
  padding: 1px 3px;
  transition: background .15s ease, box-shadow .15s ease;
}
.sync-seg:hover { background: var(--chip-hover); }
.sync-seg.active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 106, 26, .35);
}
.seg-row[data-ts-start] { cursor: pointer; transition: background .15s ease; }
.seg-row[data-ts-start]:hover { background: var(--chip); }
.seg-row.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.seg-row.active .s-time { color: var(--accent); font-weight: 700; }
.seg-row.hidden, .dialog-block.hidden { display: none; }
.dialog-block { transition: border-color .2s ease; }
.dialog-block[data-ts-block] { cursor: pointer; }
.dialog-block[data-ts-block]:hover { background: var(--chip-hover); }
.dialog-block.active { border-color: rgba(255, 106, 26, .45); box-shadow: inset 3px 0 0 var(--accent); }
.dialog-text mark {
  background: var(--warn-soft);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
.sync-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.sync-hint::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .7;
}

/* ---------- утилиты ---------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--font-mono); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.divider { height: 1px; background: var(--hair); border: none; margin: 18px 0; }
.hidden { display: none !important; }
code.inline {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(255, 106, 26, .2);
  border-radius: 5px;
  padding: 2px 7px;
}
.key-box {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 14px;
  line-height: 1.6;
}
