/* ══════════════════════════════════════════════════════════════════════════
   SoundSight – app shell в стиле дашборда с /welcome (sidebar + main).
   Тёмная тема: #1a1a1c, карточки white/3% с ring white/6%,
   акценты: зелёный #28c840 (live), янтарный #febc2e, красный #ff5f57.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #161618;
  --panel: #1a1a1c;
  --sb-bg: #1e1e21;
  --card: rgba(255, 255, 255, 0.03);
  --card-hover: rgba(255, 255, 255, 0.055);
  --ring: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.06);
  --text: #f5f5f7;
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.38);
  --green: #28c840;
  --green-2: #8df0a0;
  --amber: #febc2e;
  --red: #ff5f57;
  --ring-strong: rgba(255, 255, 255, 0.22);
  --hover: rgba(255, 255, 255, 0.05);
  --hover-2: rgba(255, 255, 255, 0.09);
  --hover-3: rgba(255, 255, 255, 0.14);
  --green-text: rgba(140, 230, 155, 0.92);
  --green-bg: rgba(40, 200, 64, 0.09);
  --green-line: rgba(40, 200, 64, 0.26);
  --green-strong: rgba(40, 200, 64, 0.55);
  --indigo-text: rgba(178, 185, 250, 0.92);
  --indigo-bg: rgba(129, 140, 248, 0.1);
  --indigo-line: rgba(129, 140, 248, 0.28);
  --indigo-strong: rgba(129, 140, 248, 0.55);
  --amber-text: rgba(254, 210, 120, 0.92);
  --amber-bg: rgba(254, 188, 46, 0.09);
  --amber-line: rgba(254, 188, 46, 0.28);
  --red-bg: rgba(255, 95, 87, 0.09);
  --red-bg-strong: rgba(255, 95, 87, 0.18);
  --red-line: rgba(255, 95, 87, 0.3);
  --btn-bg: #fff;
  --btn-fg: #111;
  --chip-bg: rgba(0, 0, 0, 0.35);
  --overlay: rgba(0, 0, 0, 0.55);
  --card-shadow: none;
  --radius: 14px;
  --radius-sm: 9px;
}

/* ── светлая тема ─────────────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg: #eceef2;
  --panel: #f5f6f8;
  --sb-bg: #ffffff;
  --card: #ffffff;
  --card-hover: #f4f5f7;
  --ring: rgba(15, 23, 42, 0.09);
  --ring-strong: rgba(15, 23, 42, 0.22);
  --line: rgba(15, 23, 42, 0.07);
  --text: #171b22;
  --text-2: rgba(23, 27, 34, 0.66);
  --text-3: rgba(23, 27, 34, 0.44);
  --hover: rgba(15, 23, 42, 0.05);
  --hover-2: rgba(15, 23, 42, 0.08);
  --hover-3: rgba(15, 23, 42, 0.13);
  --green: #16a34a;
  --green-2: #4ade80;
  --amber: #d97706;
  --red: #dc2626;
  --green-text: #15803d;
  --green-bg: rgba(22, 163, 74, 0.09);
  --green-line: rgba(22, 163, 74, 0.32);
  --green-strong: rgba(22, 163, 74, 0.45);
  --indigo-text: #4f46e5;
  --indigo-bg: rgba(99, 102, 241, 0.08);
  --indigo-line: rgba(99, 102, 241, 0.3);
  --indigo-strong: rgba(79, 70, 229, 0.5);
  --amber-text: #b45309;
  --amber-bg: rgba(217, 119, 6, 0.09);
  --amber-line: rgba(217, 119, 6, 0.3);
  --red-bg: rgba(220, 38, 38, 0.07);
  --red-bg-strong: rgba(220, 38, 38, 0.13);
  --red-line: rgba(220, 38, 38, 0.3);
  --btn-bg: #171b22;
  --btn-fg: #fff;
  --chip-bg: rgba(255, 255, 255, 0.78);
  --overlay: rgba(15, 23, 42, 0.35);
  --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* мягкие тени карточек – видимы только в светлой теме */
.dash-hero,
.avatar-area, .subtitles-area, .summary-content, .summary-live-block,
.history-card, .history-stat-chip, .history-search {
  box-shadow: var(--card-shadow);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:root { --z: 1; }

@media (min-width: 1181px) {
  :root { --z: 1.2; }
  html { zoom: var(--z); }
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input, select {
  font-family: inherit;
  color: var(--text);
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--hover-3);
  border-radius: 6px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--ring-strong); }

::selection { background: var(--green-line); }

/* ══════════════════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  min-height: calc(100vh / var(--z));
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */

.sidebar {
  width: 236px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: calc(100vh / var(--z));
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  border-right: 1px solid var(--line);
  padding: 18px 12px 14px;
  overflow-y: auto;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 22px;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.15s;
}

.sb-brand:hover { opacity: 0.8; }

.sb-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: block;
}

.sb-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 26px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-link svg { flex-shrink: 0; opacity: 0.75; }

.nav-link:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-link.active {
  background: var(--hover-2);
  color: var(--text);
}

.nav-link.active svg { opacity: 1; }

.sb-section { flex: 1; min-height: 0; }

.sb-caption {
  padding: 0 10px;
  margin-bottom: 10px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.sb-recent {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-recent li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.sb-recent li:hover { background: var(--hover); }

.sb-dot {
  width: 5px;
  height: 5px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--green-strong);
  flex-shrink: 0;
}

.sb-recent-title {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sb-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sb-srv {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--ring);
}

.sb-srv-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  transition: background 0.2s;
}

.sb-srv.online .sb-srv-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-strong);
}

.sb-srv-text {
  font-size: 0.74rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main column ──────────────────────────────────────────────────────── */

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

/* ── Topbar ───────────────────────────────────────────────────────────── */

.topbar {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-sub {
  font-size: 0.76rem;
  color: var(--text-3);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.rec-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--red-bg);
  border: 1px solid var(--red-line);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--red);
}

.rec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: recBlink 1.1s ease-in-out infinite;
}

@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ui-lang-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--ring);
}

.ui-lang-btn {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}

.ui-lang-btn:hover { color: var(--text-2); }

.ui-lang-btn.active {
  background: var(--hover-2);
  color: var(--text);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ring);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.topbar-avatar:hover {
  border-color: var(--ring-strong);
  transform: scale(1.05);
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

/* ── Screens ──────────────────────────────────────────────────────────── */

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  background: var(--panel);
}

.screen.active { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS (общие)
   ══════════════════════════════════════════════════════════════════════════ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 11px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 6px 20px var(--chip-bg);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ring);
  background: var(--card);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-outline-sm:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--hover-3);
}

.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red-line);
  background: var(--red-bg);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--red);
  transition: background 0.15s;
}

.btn-danger-sm:hover { background: var(--red-bg-strong); }

.btn-logout {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ring);
  background: transparent;
  font-size: 0.78rem;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}

.btn-logout:hover {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-line);
}

.link-btn {
  font-size: 0.74rem;
  color: var(--text-3);
  transition: color 0.15s;
}

.link-btn:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN: HOME (dashboard)
   ══════════════════════════════════════════════════════════════════════════ */

.dash {
  max-width: 1060px;
  margin: 0 auto;
  padding: 30px 28px 44px;
}

/* ── Hero ─────────────────────────────────────────────────────────────── */

.dash-hero {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 36px;
  padding: 36px 40px;
  margin-bottom: 18px;
  border-radius: 20px;
  background:
    radial-gradient(520px 260px at 92% 0%, var(--green-bg), transparent 55%),
    var(--card);
  overflow: hidden;
}

.dash-hero-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}



.dash-h1 {
  font-family: "Unbounded", "Inter", system-ui, sans-serif;
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.18;
  margin: 16px 0 14px;
}

.home-title-accent {
  background: linear-gradient(92deg, var(--green), var(--green-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dash-desc {
  font-size: 0.89rem;
  line-height: 1.65;
  color: var(--text-2);
  max-width: 540px;
  margin-bottom: 22px;
}

.dash-hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: auto;
  padding-top: 22px;
}

.btn-hero {
  padding: 12px 24px;
  font-size: 0.9rem;
  border-radius: 12px;
}

/* живой жестовый аватар в hero */
.home-avatar {
  position: relative;
  flex-shrink: 0;
  width: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.home-avatar-frame {
  position: relative;
  width: 310px;
  height: 350px;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.35));
}

.home-avatar-frame .CWASAAvatar {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 46px), transparent);
  mask-image: linear-gradient(to bottom, black calc(100% - 46px), transparent);
}

.hero-srv {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-left: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--red);
}

.hero-srv-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  animation: recBlink 1.4s ease-in-out infinite;
}

/* ── Stats strip ──────────────────────────────────────────────────────── */

.dash-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 10px;
  margin-bottom: 14px;
}

.dash-strip-item {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.dash-strip-value {
  font-size: 1.28rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.dash-strip-label {
  font-size: 0.72rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-strip-sep {
  width: 1px;
  height: 26px;
  flex-shrink: 0;
  background: var(--line);
}

/* ── Feature cards ────────────────────────────────────────────────────── */

.dash-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.dash-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 6px 14px;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: border-color 0.2s;
}

.dash-card:hover {
  border-top-color: var(--green);
}

.dash-card:hover .dash-card-copy strong {
  color: var(--green-text);
}

.dash-card-num {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green-text);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}

.dash-card-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dash-card-copy strong {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.dash-card-copy span {
  font-size: 0.73rem;
  line-height: 1.45;
  color: var(--text-3);
}

/* ── Session queue table ──────────────────────────────────────────────── */

.dash-queue {
  overflow: hidden;
}

.dash-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 6px;
  border-bottom: 1px solid var(--line);
}

.dash-queue-title {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.dash-table-wrap { overflow-x: auto; }

.dash-table {
  width: 100%;
  border-collapse: collapse;
}

.dash-table tr[data-id] {
  cursor: pointer;
  transition: background 0.12s;
}

.dash-table tr[data-id]:hover { background: var(--hover); }

.dash-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  white-space: nowrap;
}

.dash-table tr:last-child td { border-bottom: 0; }

.dq-title {
  color: var(--text);
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dq-dim { color: var(--text-3); width: 1%; }

.dq-status { color: var(--green); width: 1%; opacity: 0.75; }

.dq-empty {
  color: var(--text-3);
  text-align: center;
  padding: 26px 16px !important;
  white-space: normal !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN: SUBTITLES
   ══════════════════════════════════════════════════════════════════════════ */

.subtitles-layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) 1fr;
  gap: 16px;
  padding: 20px 24px 24px;
  height: calc(100vh / var(--z) - 54px);
  max-width: 1380px;
  margin: 0 auto;
}

/* ── Avatar card ──────────────────────────────────────────────────────── */

.avatar-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--ring);
  overflow: hidden;
  min-height: 0;
}

.avatar-live-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--ring);
  backdrop-filter: blur(8px);
}

.live-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-2);
}

.avatar-live-badge.recording .live-label { color: var(--green); }

.eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  /* --vu (0..1) приходит из app.js – реальный уровень микрофона */
  transform: scaleY(calc(0.55 + var(--vu, 0) * 0.85));
  transform-origin: center bottom;
  transition: transform 0.25s ease;
}

.eq span {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-3);
  transition: background 0.2s;
}

.avatar-live-badge.recording .eq span {
  background: var(--green);
  animation: eqBounce 0.9s ease-in-out infinite;
}

.avatar-live-badge.recording .eq span:nth-child(2) { animation-delay: 0.15s; }
.avatar-live-badge.recording .eq span:nth-child(3) { animation-delay: 0.3s; }
.avatar-live-badge.recording .eq span:nth-child(4) { animation-delay: 0.45s; }

@keyframes eqBounce {
  0%, 100% { height: 4px; }
  50% { height: 12px; }
}

.avatar-corner-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--ring);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-3);
  backdrop-filter: blur(8px);
}

.avatar-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 6px;
}

/* мягкий световой фон, чтобы 3D-аватар читался на тёмном */
.avatar-stage::before {
  content: "";
  position: absolute;
  inset: 14% 10%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%,
    var(--hover), rgba(255, 255, 255, 0.015) 52%, transparent 68%);
  pointer-events: none;
}

.avatar-glow { display: none; }

html[data-theme="light"] .avatar-stage::before {
  background: radial-gradient(ellipse at 50% 40%,
    rgba(15, 23, 42, 0.025), transparent 62%);
}

.avatar-frame {
  position: relative;
  width: 100%;
  max-width: 380px;
  height: 100%;
  max-height: 560px;
  z-index: 2;
}

.CWASAAvatar {
  position: relative;
  background: transparent;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  padding: 0;
}

.avatar-caption {
  font-size: 0.82rem;
  color: var(--text-3);
  font-style: italic;
  text-align: center;
  min-height: 1.5em;
  max-width: 90%;
  padding-bottom: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── Subtitles card ───────────────────────────────────────────────────── */

.subtitles-area {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--ring);
  overflow: hidden;
}

.subtitles-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.subtitles-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.subtitles-label-icon {
  display: flex;
  align-items: center;
  color: var(--green);
}

.keywords {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.keyword-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid var(--green-line);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--green-text);
}

.subtitle-box {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.subtitle-chunk {
  font-weight: 450;
  line-height: 1.55;
  color: var(--text);
  animation: chunkIn 0.25s ease both;
}

@keyframes chunkIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.subtitle-partial {
  color: var(--text-3);
  font-style: italic;
}

/* размеры субтитров (настройка) */
.subtitle-box.sub-s .subtitle-chunk { font-size: 1rem; }
.subtitle-box.sub-m .subtitle-chunk { font-size: 1.3rem; }
.subtitle-box.sub-l .subtitle-chunk { font-size: 1.65rem; }

/* ── Empty state ──────────────────────────────────────────────────────── */

.subtitle-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 30px;
}

.empty-illustration {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--ring);
  color: var(--text-3);
  margin-bottom: 4px;
}

.empty-title {
  font-size: 1rem;
  font-weight: 600;
}

.empty-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  max-width: 380px;
  line-height: 1.55;
}

/* ── Session controls ─────────────────────────────────────────────────── */

.session-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.btn-session-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.82rem;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.btn-session-start:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.btn-session-start:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-session-stop {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--red-bg);
  border: 1px solid var(--red-line);
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
}

.btn-session-stop:hover:not(:disabled) { background: var(--red-bg-strong); }

.btn-session-stop:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.session-spacer { flex: 1; }

.rec-timer {
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid var(--green-line);
}

.rec-stats {
  font-size: 0.72rem;
  color: var(--text-3);
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--text-3);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.copy-btn .ic-check { display: none; color: var(--green); }
.copy-btn.copied .ic-copy { display: none; }
.copy-btn.copied .ic-check { display: block; }

.scroll-down {
  position: absolute;
  right: 18px;
  bottom: 76px;
  z-index: 6;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--hover-2);
  border: 1px solid var(--hover-3);
  color: var(--text);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: background 0.15s, transform 0.15s;
  animation: fadeInUp 0.2s ease;
}

.scroll-down:hover {
  background: var(--hover-3);
  transform: translateY(-2px);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.session-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-3);
}

.session-meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}

#sessionMetaText.srv-offline { color: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN: SUMMARY
   ══════════════════════════════════════════════════════════════════════════ */

.summary-layout {
  max-width: 880px;
  margin: 0 auto;
  padding: 30px 28px 44px;
}

.summary-header-block { margin-bottom: 22px; }

.summary-eyebrow {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 8px;
}

.summary-title {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.summary-subtitle {
  font-size: 0.84rem;
  color: var(--text-3);
  line-height: 1.55;
}

.summary-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.sm-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--ring);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.sm-chip-lang {
  background: var(--green-bg);
  border-color: var(--green-line);
  color: var(--green-text);
}

.summary-keywords {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.summary-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.summary-content {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--ring);
  padding: 26px;
  margin-bottom: 16px;
}

.summary-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 26px 10px;
}

.summary-empty-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--ring);
  color: var(--text-3);
  margin-bottom: 6px;
}

.summary-empty-title {
  font-size: 1rem;
  font-weight: 600;
}

.summary-empty-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  max-width: 400px;
  line-height: 1.55;
  margin-bottom: 10px;
}

.summary-section-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--green-bg);
  border: 1px solid var(--green-line);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-text);
  margin-bottom: 16px;
}

.summary-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
}

/* ── Live transcript block ────────────────────────────────────────────── */

.summary-live-block {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--ring);
  overflow: hidden;
}

.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.live-header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.live-dot-sm {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: recBlink 1.6s ease-in-out infinite;
}

.live-header-right {
  font-size: 0.68rem;
  color: var(--text-3);
}

.summary-live-text {
  padding: 16px;
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--text-2);
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN: HISTORY
   ══════════════════════════════════════════════════════════════════════════ */

.history-container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 30px 28px 44px;
}

.history-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.history-eyebrow {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 8px;
}

.history-title {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.history-subtitle {
  font-size: 0.84rem;
  color: var(--text-3);
}

.history-header-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.history-stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 76px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--ring);
}

.stat-chip-num {
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.15;
}

.stat-chip-lbl {
  font-size: 0.64rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Toolbar: поиск + фильтр языка ────────────────────────────────────── */

.history-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.history-search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--ring);
  color: var(--text-3);
  transition: border-color 0.15s;
}

.history-search:focus-within {
  border-color: var(--ring-strong);
}

.history-search input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  background: none;
  border: 0;
  outline: none;
  font-size: 0.82rem;
  color: var(--text);
}

.history-search input::placeholder { color: var(--text-3); }
.history-search input::-webkit-search-cancel-button { filter: invert(0.6); }

.history-filter {
  display: flex;
  gap: 4px;
}

.hf-btn {
  flex: none;
  min-width: 44px;
}

/* skeleton при загрузке */
.hist-skel {
  height: 118px;
  border-radius: var(--radius);
  background: linear-gradient(100deg,
    var(--card) 40%, var(--hover) 50%, var(--card) 60%);
  background-size: 200% 100%;
  border: 1px solid var(--ring);
  animation: skelShimmer 1.2s linear infinite;
}

@keyframes skelShimmer {
  to { background-position: -200% 0; }
}

/* ── Cards ────────────────────────────────────────────────────────────── */

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.history-card {
  position: relative;
  display: flex;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--ring);
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.history-card:hover {
  background: var(--card-hover);
  border-color: var(--ring-strong);
  transform: translateY(-2px);
}

.history-card-accent {
  width: 3px;
  flex-shrink: 0;
  background: var(--green-strong);
}

.history-card[data-accent="indigo"] .history-card-accent {
  background: var(--indigo-strong);
}

.history-card-body {
  flex: 1;
  min-width: 0;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.history-card-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--hover);
  border: 1px solid var(--ring);
  color: var(--text-2);
}

.history-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.history-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card-date {
  font-size: 0.7rem;
  color: var(--text-3);
}

.history-card-badges {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.badge-kz {
  background: var(--green-bg);
  border: 1px solid var(--green-line);
  color: var(--green-text);
}

.badge-ru {
  background: var(--indigo-bg);
  border: 1px solid var(--indigo-line);
  color: var(--indigo-text);
}

.badge-dur {
  background: var(--hover);
  border: 1px solid var(--ring);
  color: var(--text-2);
}

.history-card-preview {
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.history-stats-row {
  display: flex;
  gap: 10px;
}

.history-stat {
  font-size: 0.7rem;
  color: var(--text-3);
}

.history-stat-keywords {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.kw-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--ring);
  font-size: 0.64rem;
  color: var(--text-2);
}

.history-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px dashed var(--ring-strong);
}

.history-empty-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.history-empty-sub {
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ══════════════════════════════════════════════════════════════════════════
   SCREEN: ADMIN
   ══════════════════════════════════════════════════════════════════════════ */

.admin-block { margin-bottom: 16px; }

.adm-stats-head { flex-wrap: wrap; gap: 8px; }
.adm-dl { display: flex; flex-wrap: wrap; gap: 8px; }

.adm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 18px 24px;
  padding: 20px 20px 8px;
}

.adm-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.adm-stat-num {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.adm-stat-lbl { font-size: 0.72rem; color: var(--text-3); line-height: 1.3; }

.adm-charts {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  padding: 18px 20px 22px;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  zoom: calc(1 / var(--z, 1));
}
@media (max-width: 860px) { .adm-charts { grid-template-columns: 1fr; } }

.adm-chart-main, .adm-chart-side { min-width: 0; }
.adm-chart-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 10px;
}

.adm-canvas {
  position: relative;
  height: calc(210px * var(--z, 1));
  min-width: 0;
  overflow: hidden;
}
.adm-canvas canvas { max-width: 100%; }
.adm-canvas-side { height: calc(190px * var(--z, 1)); }

#admLangsEmpty {
  height: calc(190px * var(--z, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(0.72rem * var(--z, 1));
}
#admLangsEmpty.hidden { display: none; }

.admin-table td { white-space: normal; }
.admin-table .dq-dim { white-space: nowrap; }

.adm-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.adm-ava {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 650;
  user-select: none;
}

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

.adm-mail {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.adm-name {
  font-size: 0.7rem;
  color: var(--text-3);
}

.abadge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.abadge-ok {
  background: var(--green-bg);
  border: 1px solid var(--green-line);
  color: var(--green-text);
}

.abadge-wait {
  background: var(--amber-bg);
  border: 1px solid var(--amber-line);
  color: var(--amber);
}

.abadge-admin {
  background: var(--indigo-bg);
  border: 1px solid var(--indigo-line);
  color: var(--indigo-text);
}

.adm-act-cell { text-align: right; }

.adm-act { white-space: nowrap; }

.adm-act-ok {
  border-color: var(--green-line);
  background: var(--green-bg);
  color: var(--green-text);
}

.adm-act-ok:hover {
  background: rgba(40, 200, 64, 0.16);
  border-color: var(--green-strong);
  color: #d3f5da;
}

.admin-admins-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-admins {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--ring);
  font-size: 0.76rem;
  color: var(--text-2);
}

.adm-chip-star { color: var(--amber); font-size: 0.7rem; }

.adm-chip-x {
  color: var(--text-3);
  font-size: 0.7rem;
  padding: 0 2px;
  transition: color 0.15s;
}

.adm-chip-x:hover { color: var(--red); }

.admin-add-row {
  display: flex;
  gap: 8px;
  max-width: 420px;
}

.admin-add-row .auth-input { flex: 1; min-width: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   HISTORY MODAL
   ══════════════════════════════════════════════════════════════════════════ */

.history-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 40px));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--sb-bg);
  border: 1px solid var(--ring);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  z-index: 60;
  overflow: hidden;
}

.history-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.history-modal-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px;
}

.history-modal-summary {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre-wrap;
}

.hm-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.hm-tag { margin-top: 4px; }

#historyModalSummary,
#historyModalTranscript {
  margin-bottom: 18px;
}

.history-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}

/* ══════════════════════════════════════════════════════════════════════════
   AUTH OVERLAY
   ══════════════════════════════════════════════════════════════════════════ */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(40, 200, 64, 0.06), transparent 55%),
    radial-gradient(ellipse at 75% 80%, rgba(129, 140, 248, 0.05), transparent 55%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 32px 28px 26px;
  border-radius: 20px;
  background: var(--sb-bg);
  border: 1px solid var(--ring);
  box-shadow: 0 30px 90px var(--overlay);
  text-align: center;
}

.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  margin: 0 auto 4px;
  display: block;
}

.auth-title {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.auth-sub {
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: 8px;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--ring);
  background: var(--card);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.auth-input::placeholder { color: var(--text-3); }

.auth-input:focus {
  border-color: var(--ring-strong);
  background: var(--hover);
}

.auth-error {
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red-line);
  border-radius: 9px;
  padding: 8px 12px;
}

/* сплэш при восстановлении сессии (вместо мигания формы входа) */
.boot-overlay {
  background: var(--bg);
  z-index: 110;
}

.boot-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  animation: bootPulse 1.4s ease-in-out infinite;
}

@keyframes bootPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1); }
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.7rem;
  color: var(--text-3);
  margin: 2px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* успешные сообщения формы (напр. «письмо для сброса отправлено») */
.auth-error.ok {
  color: var(--green-text);
  background: var(--green-bg);
  border-color: var(--green-line);
}

/* ── Pending access ───────────────────────────────────────────────────── */

.pending-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-line);
  color: var(--amber);
  margin: 0 auto 4px;
}

.pending-email {
  flex: none;
  text-align: center;
  margin: 2px 0 6px;
}

.verify-msg {
  text-align: center;
  min-height: 1.2em;
}

.verify-spam {
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--amber-bg);
  border: 1px solid var(--amber-line);
  color: var(--amber-text);
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: center;
}

.auth-btn-primary {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
}

.auth-btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.auth-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.auth-btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--ring);
  background: var(--card);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s;
}

.auth-btn-google:hover:not(:disabled) { background: var(--card-hover); }
.auth-btn-google:disabled { opacity: 0.4; cursor: not-allowed; }

.auth-link {
  font-size: 0.76rem;
  color: var(--text-2);
  padding: 4px;
  transition: color 0.15s;
}

.auth-link:hover { color: var(--text); }

.auth-link-dim { color: var(--text-3); }

/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS / ACCOUNT PANELS
   ══════════════════════════════════════════════════════════════════════════ */

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--overlay);
  backdrop-filter: blur(3px);
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  width: min(360px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.45);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.settings-title {
  font-size: 1rem;
  font-weight: 650;
}

.settings-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-3);
  font-size: 0.85rem;
  transition: background 0.15s, color 0.15s;
}

.settings-close:hover {
  background: var(--hover);
  color: var(--text);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-label {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.settings-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ring);
  background: var(--card);
  font-size: 0.82rem;
  outline: none;
}

.settings-select option { background: var(--sb-bg); }

/* ── тест микрофона ───────────────────────────────────────────────────── */

.mic-test {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.mic-test .btn-outline-sm { flex-shrink: 0; }

#micTestBtn.testing {
  border-color: var(--green-line);
  background: var(--green-bg);
  color: var(--green-text);
}

.mic-level {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--ring);
  overflow: hidden;
}

.mic-level-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--green-2));
  transition: width 0.08s linear;
}

/* ── превью субтитров ─────────────────────────────────────────────────── */

.sub-preview {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--ring);
  color: var(--text);
  line-height: 1.45;
}

.sub-preview.sub-s { font-size: 1rem; }
.sub-preview.sub-m { font-size: 1.3rem; }
.sub-preview.sub-l { font-size: 1.65rem; }
.sub-preview.sub-bold,
.subtitle-box.sub-bold .subtitle-chunk { font-weight: 700; }

.sub-preview.sub-c-yellow,
.subtitle-box.sub-c-yellow .subtitle-chunk { color: #ffd60a; }
.sub-preview.sub-c-green,
.subtitle-box.sub-c-green .subtitle-chunk { color: #4ade80; }

.sub-preview.sub-contrast,
.subtitle-box.sub-contrast { background: #000; }
.sub-preview.sub-contrast,
.subtitle-box.sub-contrast .subtitle-chunk { color: #ffd60a; }
.subtitle-box.sub-contrast .subtitle-partial { color: rgba(255, 214, 10, 0.55); }

.subtitles-layout.no-avatar { grid-template-columns: 1fr; }
.subtitles-layout.no-avatar .avatar-area { display: none; }

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
}

.settings-footer {
  margin-top: auto;
  font-size: 0.7rem;
  color: var(--text-3);
}

.settings-footer a {
  color: var(--text-2);
  text-decoration: none;
}

.settings-footer a:hover { color: var(--text); }

.lang-switcher {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: 10px;
  background: var(--card);
}

.lang-btn {
  flex: 1;
  min-width: 52px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}

.lang-btn:hover:not(:disabled) { color: var(--text); }

.lang-btn.active {
  background: var(--hover-3);
  color: var(--text);
}

.lang-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.session-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-2);
}

.set-wrap {
  max-width: 1020px;
  margin: 0 auto;
  padding: 28px 32px 44px;
}

.set-h1 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.set-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 56px;
  align-items: start;
}

.set-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 0 28px;
  border-top: 1px solid var(--line);
}

.set-card-title {
  font-size: 0.92rem;
  font-weight: 650;
}

.set-hint {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-3);
}

.sb-footer .nav-link {
  width: 100%;
  margin-bottom: 8px;
}

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

.dot-idle { background: var(--text-3); }

.dot-active {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-strong);
  animation: recBlink 1.4s ease-in-out infinite;
}

.status-msg {
  font-size: 0.78rem;
  color: var(--text-2);
  min-height: 1.2em;
}

.set-wrap-narrow { max-width: 840px; }

.set-view { display: none; }
.set-view.on { display: block; animation: setSlideIn 0.26s ease; }
#setHome.on { animation-name: setSlideBack; }

@keyframes setSlideIn {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: none; }
}
@keyframes setSlideBack {
  from { opacity: 0; transform: translateX(-22px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .set-view.on { animation: none; }
}

.set-menu {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.set-row {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 16px 19px;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: background 0.13s;
}
.set-row:hover { background: var(--hover); }
.set-row + .set-row { border-top: 1px solid var(--line); }

.set-row-ico {
  flex: none;
  width: 24px;
  display: grid;
  place-items: center;
  color: var(--text-2);
}
.set-row-red .set-row-ico { color: var(--red); }

.set-row-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.set-row-name { font-size: 1rem; font-weight: 550; }
.set-row-red .set-row-name { color: var(--red); }
.set-row-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-chevron {
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 1.6px solid var(--text-3);
  border-top: 1.6px solid var(--text-3);
  transform: rotate(45deg);
  margin-right: 3px;
}

.set-ext { flex: none; color: var(--text-3); display: grid; place-items: center; }
.set-row:hover .set-ext { color: var(--text-2); }

.set-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  padding: 4px 8px 4px 2px;
  margin: -2px 0 12px -2px;
  border-radius: 7px;
  transition: color 0.13s, background 0.13s;
}
.set-back:hover { color: var(--text); background: var(--hover); }

.set-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 560px;
}

.home-av-name {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text);
  background: var(--chip-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--ring);
  border-radius: 999px;
  padding: 4px 13px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.home-av-name.fading { opacity: 0; transform: translateY(-4px); }

.home-caption {
  position: relative;
  z-index: 1;
  margin-top: -14px;
  width: min(330px, 100%);
  min-height: 2.9em;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 550;
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--text-2);
  text-wrap: balance;
}

.cap-word {
  display: inline;
  opacity: 0;
  animation: capWordIn 0.4s ease forwards;
}
@keyframes capWordIn {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: blur(0); }
}

.home-avatar-frame .CWASAAvatar {
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.home-avatar-frame.switching .CWASAAvatar {
  opacity: 0;
  transform: scale(0.97) translateY(4px);
}

.av-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.av-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 4px;
  position: relative;
  transition: transform 0.18s ease;
}
.av-card:hover { transform: translateY(-2px); }
.av-card img {
  width: 96px;
  height: 112px;
  object-fit: cover;
  object-position: top;
  border-radius: 16px;
  background: #26262a;
  transition: box-shadow 0.18s ease, opacity 0.18s ease;
  opacity: 0.82;
}
.av-card:hover img { opacity: 1; }
.av-card span {
  font-size: 0.84rem;
  font-weight: 550;
  color: var(--text-3);
  transition: color 0.18s;
}
.av-card.active img {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4.5px var(--green);
}
.av-card.active span { color: var(--text); font-weight: 600; }
.av-card.active::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  background: var(--green) url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3.4" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpolyline points="20 6 9 17 4 12"/%3E%3C/svg%3E') center / 10px no-repeat;
}
@media (max-width: 560px) {
  .av-cards { gap: 6px; }
  .av-card img { width: 82px; height: 96px; }
}

.about-app {
  display: flex;
  align-items: center;
  gap: 14px;
}
.about-app img { width: 52px; height: 52px; border-radius: 13px; }
.about-name { font-size: 1.05rem; font-weight: 650; }
.about-ver { font-size: 0.78rem; color: var(--text-3); }

.cookie-note {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 60;
  max-width: 400px;
  margin-left: auto;
  background: var(--panel);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: cookieIn 0.35s ease;
}
@keyframes cookieIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.cookie-note-txt {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-2);
}
.cookie-note-txt a {
  color: var(--text);
  text-underline-offset: 3px;
  margin-left: 4px;
}
.cookie-note .btn-outline-sm { align-self: flex-end; }

.user-chip {
  font-size: 0.78rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--ring);
  flex: 1;
  min-width: 0;
}

/* ── Account panel bits ───────────────────────────────────────────────── */

.acc-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

#accAvatarBig {
  flex-shrink: 0;
  display: flex;
}

.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 650;
  user-select: none;
  flex-shrink: 0;
}

.avatar-presets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.avatar-preset {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transition: transform 0.15s, box-shadow 0.15s;
}

.avatar-preset:hover { transform: scale(1.12); }

.avatar-preset.active {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text);
}

.acc-email-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.acc-email-row .user-chip { flex: 1; min-width: 0; }

.acc-since {
  font-size: 0.72rem;
  color: var(--text-3);
  padding: 2px 2px 0;
}

.acc-stats {
  font-size: 0.8rem;
  color: var(--text-2);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--ring);
  font-variant-numeric: tabular-nums;
}

.acc-danger {
  margin-top: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.acc-danger-title {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}

.acc-warn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--amber-bg);
  border: 1px solid var(--amber-line);
}

.acc-warn p {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--amber-text);
}

.acc-name-row {
  display: flex;
  gap: 8px;
}

.acc-name-row .auth-input { flex: 1; min-width: 0; }

.acc-msg {
  font-size: 0.76rem;
  color: var(--green);
  min-height: 1.2em;
}

.acc-msg.error { color: var(--red); }

.acc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dev-count {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--hover-2);
  color: var(--text-2);
  font-size: 0.64rem;
  text-align: center;
  letter-spacing: 0;
}

.dev-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.dev-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.dev-item:last-child { border-bottom: none; }

.dev-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--hover);
  color: var(--text-2);
  flex-shrink: 0;
}

.dev-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.dev-name {
  font-size: 0.8rem;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dev-meta {
  font-size: 0.7rem;
  color: var(--text-3);
}

.dev-x {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--text-3);
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.dev-x:hover {
  background: var(--red-bg);
  color: var(--red);
}

.dev-pass {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--ring);
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1180px) {
  .subtitles-layout {
    grid-template-columns: minmax(300px, 360px) 1fr;
  }
}

@media (max-width: 980px) {
  .sidebar { width: 208px; }
  .dash-strip { flex-wrap: wrap; justify-content: flex-start; row-gap: 12px; }
  .dash-stat:nth-child(2) { border-right: 0; }
  .dash-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dash-cards { grid-template-columns: 1fr; }
  .subtitles-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .avatar-area { min-height: 440px; }
  .subtitles-area { min-height: 480px; }
  .subtitle-box { min-height: 260px; }
}

@media (max-width: 820px) {
  .sidebar {
    width: 62px;
    padding: 16px 8px 12px;
    align-items: center;
  }
  .sb-name,
  .sb-section,
  .sb-srv-text { display: none; }
  .sb-brand {
    padding: 0;
    justify-content: center;
    margin-bottom: 18px;
  }
  .sb-nav { width: 100%; }
  .nav-link {
    justify-content: center;
    padding: 10px 0;
  }
  .nav-link span { display: none; }
  .sb-footer {
    width: 100%;
    margin-top: auto;
  }
  .sb-srv {
    justify-content: center;
    padding: 8px 0;
  }
  .topbar { padding: 0 14px; }
  .topbar-sub { display: none; }
}

@media (max-width: 980px) {
  .home-avatar { display: none; }
  .dash-hero { padding: 28px; }
  .set-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dash { padding: 20px 16px 32px; }
  .dash-h1 { font-size: 1.6rem; }
  .summary-layout,
  .history-container { padding: 20px 16px 32px; }
  .set-wrap { padding: 20px 16px 32px; }
  .subtitles-layout { padding: 14px 12px 18px; }
  .dash-head { gap: 10px; }
  .btn-primary { padding: 9px 14px; font-size: 0.8rem; }
  .dash-strip { padding: 13px 18px; }
  .dash-strip-value { font-size: 1.1rem; }
  .history-list { grid-template-columns: 1fr; }
  .history-header { align-items: flex-start; flex-direction: column; }
  .ui-lang-switch { display: none; }
}

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