/* ============================================================================
   VOICER — компоненты направления «Студийная консоль»
   Порядок: app.css → tokens.css → voicer.css
   Правила: поверхности различаются тоном, рамки волосяные; один коралловый
   сигнал — на данных, волне, кольце баланса и единственной заливной кнопке.
   Тени — только у модалок и тостов.
   ============================================================================ */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ── База ─────────────────────────────────────────────────────────────────── */
html, body { height: 100%; }
body { overflow: hidden; user-select: none; letter-spacing: -0.004em; }
textarea, input, [contenteditable], .selectable { user-select: text; }
/* Сетка: сайдбар + холст, снизу общая строка плеера (появляется только при воспроизведении) */
.app { height: 100svh; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; }
.sidebar { height: auto; min-height: 0; grid-row: 1; }
.canvas { height: auto; min-height: 0; grid-row: 1; overflow: auto; display: flex; flex-direction: column; background: var(--ground); }
.player { grid-column: 1 / -1; grid-row: 2; }
.canvas.full { padding: 0; overflow: hidden; }
/* Смена экрана: короткий подъём содержимого, без смещения рамки окна. Под reduced-motion гасится в app.css */
.canvas > * { animation: view-enter var(--t-ui) var(--ease-out) both; }
@keyframes view-enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: var(--fs-small); }
.small { font-size: var(--fs-small); }
.accent { color: var(--accent); }
.row-gap { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.right { text-align: right; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.group-label, .eyebrow { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--control); border: 3px solid transparent; background-clip: padding-box; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Поля ─────────────────────────────────────────────────────────────────── */
.input, select.input, textarea.input { height: var(--control-height); width: 100%; border-radius: var(--radius-input); background: var(--surface); border-color: var(--control); transition: border-color var(--t-hover) ease; }
.input:hover, select.input:hover, textarea.input:hover { border-color: color-mix(in srgb, var(--control) 50%, var(--text)); }
.input:focus, textarea.input:focus, select.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-50); }
.input[readonly] { color: var(--muted); }
.input.sm { height: 30px; font-size: var(--fs-small); }
select.input { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
textarea.input { height: auto; padding: 10px 12px; line-height: 20px; resize: vertical; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.field { gap: 6px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: var(--fs-small); font-weight: 500; color: var(--muted); }
.field label .val { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.field .hint { color: var(--faint); font-size: var(--fs-small); }
input[type="range"] { appearance: none; width: 100%; height: 20px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: var(--control); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: var(--text); border: 0; transition: transform var(--t-press) var(--ease-out); }
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"].check { appearance: none; width: 16px; height: 16px; border: 1px solid var(--control); border-radius: 4px; background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; vertical-align: -3px; margin: 0 8px 0 0; transition: background-color var(--t-hover), border-color var(--t-hover); }
input[type="checkbox"].check:checked { background: var(--text); border-color: var(--text); }
input[type="checkbox"].check:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--ground); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
label.inline { display: inline-flex; align-items: center; cursor: pointer; font-size: var(--fs-body); }

/* ── Кнопки ───────────────────────────────────────────────────────────────── */
.btn { white-space: nowrap; border-color: var(--control); letter-spacing: 0; }
.btn:hover { border-color: color-mix(in srgb, var(--control) 50%, var(--text)); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { background: var(--surface); border-color: var(--control); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: transparent; }
.btn.primary:disabled, .btn.primary:disabled:hover { background: var(--raised); color: var(--faint); opacity: 1; border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); border-color: transparent; }
.btn.pill { border-radius: 999px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 15px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-small); border-radius: 6px; }
.btn.icon { width: var(--control-height); padding: 0; }
.btn.sm.icon { width: 28px; }
.btn.danger { color: var(--negative); }
.btn.danger:hover { border-color: var(--negative); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent; animation: spin .8s linear infinite; }
.btn.primary.busy::after { border-color: var(--primary-ink); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color var(--t-hover), color var(--t-hover), box-shadow var(--t-hover); }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn[aria-pressed="true"] { background: var(--active); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.segmented { background: var(--raised); border-radius: 8px; }
.segmented button { height: 28px; border-radius: 6px; font-weight: 500; transition: background-color var(--t-hover), color var(--t-hover), box-shadow var(--t-hover); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
/* Логотипы движков: монохром в цвет текста кнопки, в неактивной — приглушены вместе с подписью */
.engine-logo { display: inline-flex; align-items: center; justify-content: center; width: var(--logo-size, 14px); height: var(--logo-size, 14px); flex: none; }
.engine-logo svg { width: 100%; height: 100%; display: block; }
.engine-logo.elevenlabs svg { transform: scaleX(0.82); }
.segmented button { display: inline-flex; align-items: center; gap: 7px; }
.segmented button .engine-logo { opacity: 0.6; transition: opacity var(--t-hover); }
.segmented button[aria-pressed="true"] .engine-logo { opacity: 1; }
.segmented.engines button { padding: 0 12px 0 10px; }
.tabs .tab-group { display: flex; align-items: stretch; gap: 20px; }
.tabs .tab-group + .tab-group { margin-left: 16px; }
.tabs .group-label { display: inline-flex; align-items: center; gap: 7px; padding: 10px 0; color: var(--faint); font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.tabs .group-label .engine-logo { color: var(--muted); }
.hoverable { transition: border-color var(--t-ui) var(--ease-out), background-color var(--t-ui) var(--ease-out), box-shadow var(--t-ui) var(--ease-out); }
.hoverable:hover, .hoverable:focus-within { border-color: color-mix(in srgb, var(--control) 40%, var(--text)); }

/* ── Контурный свет (тёмная тема): при наведении контур карточки/кнопки подсвечивается тёплым янтарём,
   не утолщаясь — кольцо 1px плюс мягкий ореол. В светлой теме токены прозрачны → правило ничего не меняет.
   taste-skill-ignore: свечение запрошено явно, только как отклик на наведение. */
.hoverable:hover, .hoverable:focus-within,
.voice-card:hover, .plan-card:hover, .chip:not(.static):hover,
.btn:not(:disabled):not(.ghost):hover, .icon-btn:hover, .segmented > button:hover {
  box-shadow: 0 0 0 1px var(--glow-ring), 0 0 18px -2px var(--glow-halo); /* taste-skill-ignore: только :hover */
}
.hoverable:hover, .hoverable:focus-within, .voice-card:hover, .plan-card:hover, .chip:not(.static):hover { border-color: var(--hover-line); }
.btn.primary:not(:disabled):hover { box-shadow: 0 0 0 1px var(--glow-ring), 0 0 22px -2px var(--glow-halo); } /* taste-skill-ignore: только :hover */
.voice-card, .plan-card, .btn { transition: border-color var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out), transform var(--t-press) var(--ease-out); }

/* ── Свет студии: два мягких источника в цветах расцветки — тёплый «прибор» (--glow) сверху справа
   и отражённый сигнал (--seed) снизу слева. Слои на 60vmax шире окна, поэтому при дрейфе их края
   никогда не попадают в кадр; двигаются встречно и с разными периодами, так что картина не повторяется.
   Тёмная тема — screen (свет), светлая — multiply (тень тёплого стекла). Под reduced-motion замирают (app.css).
   taste-skill-ignore: запрошенная едва заметная анимация фона. */
body::before, body::after {
  content: ""; position: fixed; inset: -60vmax; z-index: 30; pointer-events: none;
  mix-blend-mode: var(--ambient-blend); opacity: var(--ambient-alpha);
  will-change: transform;
}
body::before {
  background: radial-gradient(42vmax 32vmax at calc(60vmax + 78vw) calc(60vmax + 22vh), var(--glow) 0%, color-mix(in srgb, var(--glow) 35%, transparent) 38%, transparent 70%); /* taste-skill-ignore: запрошенная фоновая подсветка */
  animation: ambient-key 64s ease-in-out infinite alternate;
}
body::after {
  background: radial-gradient(34vmax 26vmax at calc(60vmax + 24vw) calc(60vmax + 80vh), var(--seed) 0%, color-mix(in srgb, var(--seed) 30%, transparent) 40%, transparent 72%); /* taste-skill-ignore: запрошенная фоновая подсветка */
  opacity: calc(var(--ambient-alpha) * 0.7);
  animation: ambient-fill 86s ease-in-out infinite alternate-reverse;
}
@keyframes ambient-key {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-6vw, 7vh, 0) scale(1.08); }
  100% { transform: translate3d(-12vw, -3vh, 0) scale(0.97); }
}
@keyframes ambient-fill {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(7vw, -6vh, 0) scale(1.1); }
  100% { transform: translate3d(3vw, -11vh, 0) scale(1.02); }
}

/* чип: компактная кнопка-состояние в транспортной панели */
.chip { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; max-width: 260px; transition: border-color var(--t-hover), background-color var(--t-hover), box-shadow var(--t-hover); }
.chip:hover { border-color: color-mix(in srgb, var(--control) 40%, var(--text)); }
.chip .k { color: var(--faint); font-size: var(--fs-small); }
.chip .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; min-width: 0; }
.chip svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.chip.static { cursor: default; }
.chip.static:hover { border-color: var(--border); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.chip.ok .dot { background: var(--signal); }
.chip.warn .dot { background: var(--warning); }

/* ── Сайдбар ──────────────────────────────────────────────────────────────── */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 14px 12px 12px; gap: 1px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.brand b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; display: block; line-height: 1.1; }
.brand .scope { font-size: var(--fs-small); color: var(--faint); display: block; margin-top: 2px; }
.sidebar .group-label { margin: 6px 8px 6px; }
.nav-item { cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font: inherit; font-weight: 500; border-radius: 8px; }
.nav-item svg { stroke-width: 1.6; }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item .count.live { color: var(--accent); font-weight: 600; }
.sidebar .bottom { display: grid; gap: 8px; }

/* баланс символов: кольцо — количество как видимая величина */
.balance { display: grid; gap: 10px; padding: 14px 8px 16px; border-top: 1px solid var(--rule); }
.balance .ring-wrap { display: flex; align-items: center; gap: 12px; }
.balance .ring-wrap > svg { width: 56px; height: 56px; flex: none; }
.balance .track { stroke: var(--raised); }
.balance .arc { stroke: var(--signal); stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease-out); }
.balance .nums { min-width: 0; line-height: 1.25; }
.balance .nums b { display: block; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.balance .nums small { display: block; color: var(--muted); font-size: var(--fs-small); }
.balance .plan { display: flex; align-items: center; gap: 8px; font-size: var(--fs-small); color: var(--muted); border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.balance .plan::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); }
.balance .plan:hover { color: var(--text); }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user-row .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-100); color: var(--accent-ink); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.user-row .who { line-height: 1.2; min-width: 0; }
.user-row .who b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.user-row .who small { display: block; color: var(--faint); font-size: var(--fs-small); }

/* ── Заголовок экрана ─────────────────────────────────────────────────────── */
.title-row { margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); letter-spacing: -0.015em; }
.title-row .actions { display: flex; gap: 8px; align-items: center; }
.panel { border-color: var(--border); }
.panel h2 { letter-spacing: -0.005em; }

/* ── Студия: шапка проектов, документ, инспектор, транспорт ───────────────── */
.studio { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; min-height: 0; min-width: 0; background: var(--surface); }
.studio-bar { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--surface); min-width: 0; overflow: hidden; }
.studio-bar > * { flex: none; }
.studio-bar .project-tabs { flex: 0 1 auto; }
.studio-bar .spacer { flex: 1; }
.project-tabs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; overflow-y: hidden; padding: 12px 2px; scrollbar-width: thin; }
.project-tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font: inherit; font-weight: 500; max-width: 200px; transition: background-color var(--t-hover), color var(--t-hover), border-color var(--t-hover); }
.project-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-tab:hover { background: var(--raised); color: var(--text); }
.project-tab[aria-selected="true"] { background: var(--active); color: var(--text); border-color: var(--hover-line); }
.project-tab .x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; color: var(--faint); }
.project-tab .x:hover { background: var(--surface); color: var(--text); }
.project-tab.add { padding: 0 7px; }
.studio-bar .sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }
.studio-bar .saved { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: var(--fs-small); }
.studio-bar .saved::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
.studio-bar .saved.dirty::before { background: var(--faint); }

.studio-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: 0; }
.stage { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.doc-scroll { flex: 1; min-height: 0; overflow: auto; padding: 28px 40px 24px; }
.doc { position: relative; max-width: 860px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.doc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.doc-head .stats { color: var(--faint); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.doc textarea { flex: 1; width: 100%; min-height: 360px; resize: none; padding: 0; border: 0; background: transparent; color: var(--text); font-size: var(--fs-doc); line-height: var(--lh-doc); letter-spacing: -0.002em; outline: none; }
.doc textarea::placeholder { color: var(--faint); }
.drop-overlay { position: absolute; inset: -12px; display: none; place-items: center; border: 1px dashed var(--accent); border-radius: 12px; background: var(--accent-50); color: var(--accent-ink); font-weight: 500; pointer-events: none; }
.doc.dragging .drop-overlay { display: grid; }
.chunk-ruler { display: flex; align-items: center; gap: 12px; padding: 10px 40px; border-top: 1px solid var(--rule); color: var(--faint); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.chunk-ruler .segs { flex: 1; display: flex; gap: 3px; height: 4px; }
.chunk-ruler .segs i { flex: 1; border-radius: 2px; background: var(--chart-muted); }
.chunk-ruler.ready .segs i { background: var(--accent-200); }
.chunk-ruler .segs i.last { background: var(--signal); }

/* инспектор: закреплён справа, закрывается кнопкой в шапке */
.inspector { width: var(--inspector-width); max-width: var(--inspector-width); min-width: 0; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inspector header { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 10px 0 18px; border-bottom: 1px solid var(--rule); }
.inspector header h2 { font-size: 13px; font-weight: 600; }
.inspector .body { flex: 1; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 6px 18px 18px; }
.settings-stack { display: grid; gap: 14px; }
.inspector .group { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 12px; }
.inspector .group:last-child { border-bottom: 0; }
.inspector .group > .eyebrow { margin-bottom: -2px; }
/* длинные подписи (de/fr/es): панель не растягивается, контролы ужимаются и переносятся */
.inspector .group, .inspector .field { min-width: 0; }
.inspector .field > .input, .inspector .field > select, .inspector .field > input { width: 100%; min-width: 0; box-sizing: border-box; }
.inspector .segmented { display: flex; width: 100%; flex-wrap: wrap; gap: 2px; padding: 2px; }
.inspector .segmented button { flex: 1 1 auto; padding: 0 10px; white-space: nowrap; }
.settings-stack details { border-top: 1px solid var(--rule); padding-top: 12px; }
.settings-stack summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.settings-stack summary::-webkit-details-marker { display: none; }
.settings-stack summary::after { content: ""; width: 12px; height: 12px; background: currentColor; -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat; transform: rotate(90deg); transition: transform var(--t-ui) var(--ease-out); color: var(--muted); }
.settings-stack details[open] summary::after { transform: rotate(-90deg); }
.settings-stack details > :not(summary) { margin-top: 12px; }
.voice-row { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border: 1px solid var(--border); border-radius: 10px; min-height: 52px; background: var(--ground); min-width: 0; max-width: 100%; width: 100%; box-sizing: border-box; }
.voice-row .play, .voice-card .play { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--control); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--text); transition: border-color var(--t-hover), color var(--t-hover), background-color var(--t-hover); }
.voice-row .play:hover:not(:disabled):not([aria-disabled="true"]), .voice-card .play:hover:not(:disabled):not([aria-disabled="true"]) { border-color: var(--accent); color: var(--accent); }
.voice-row .play:disabled, .voice-card .play:disabled, .voice-row .play[aria-disabled="true"], .voice-card .play[aria-disabled="true"] { opacity: .4; cursor: default; }
.voice-row .play.playing, .voice-card .play.playing { background: var(--signal); border-color: var(--signal); color: var(--primary-ink); }
.voice-row .play svg, .voice-card .play svg { width: 12px; height: 12px; }
.voice-row .name, .voice-card .name { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-row .sub, .voice-card .sub { display: block; font-size: var(--fs-small); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-id { display: block; width: 100%; max-width: 100%; margin: 0; padding: 0; border: 0; background: none; color: var(--faint); font: inherit; font-size: var(--fs-small); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.voice-id:hover { color: var(--text); } /* taste-skill-ignore: только :hover */
.voice-row .change { margin-left: auto; flex: none; }
.voice-row .meta { flex: 1 1 0; min-width: 0; overflow: hidden; }
.voice-row.pick { cursor: pointer; }
/* Диалог: говорящие в инспекторе — те же строки голоса, стопкой */
.speakers { display: grid; gap: 6px; }
.speakers .speaker .name::before { content: '['; color: var(--muted); }
.speakers .speaker .name::after { content: ']'; color: var(--muted); }
.studio.dialogue .project-tab { cursor: default; }
.cost-line { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-small); }
.cost-line b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* транспорт: статус, голос, параметры, волна, одна заливная кнопка */
.transport { display: flex; align-items: center; gap: 10px; height: 68px; padding: 0 16px 0 20px; border-top: 1px solid var(--border); background: var(--surface); min-width: 0; }
.transport > * { flex: none; }
.transport .chip.voice { flex: 0 1 auto; min-width: 120px; }
.transport .wave-strip { flex: 1 1 40px; min-width: 40px; display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 8px; overflow: hidden; }
.transport .wave-strip i { flex: 1; min-width: 1px; max-width: 3px; border-radius: 1px; background: var(--chart-muted); transition: background-color var(--t-ui) ease; }
.transport .wave-strip.ready i { background: var(--signal); opacity: .85; }
.transport .wave-strip.busy i { animation: pulse 1.2s ease-in-out infinite; animation-delay: calc(var(--i) * 18ms); background: var(--signal); }
.transport .wave-strip.has-track:not(.synced) { cursor: pointer; }
.transport .wave-strip.has-track:not(.synced):hover i { background: var(--signal); opacity: .6; }
.transport .wave-strip.synced { gap: 0; padding: 0; }
.transport .wave-strip.synced .wave-seek { height: 32px; min-width: 0; }
.transport .listen { width: 30px; height: 30px; }
@keyframes pulse { 0%, 100% { transform: scaleY(.45); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }
.transport .drafts { color: var(--muted); }
.btn-generate { min-width: 150px; }

/* ── Очередь ──────────────────────────────────────────────────────────────── */
.progress { height: 4px; border-radius: 999px; background: var(--raised); overflow: hidden; min-width: 80px; }
.progress i { display: block; height: 100%; background: var(--signal); border-radius: 999px; transition: width var(--t-ui) var(--ease-out); }
.progress.indeterminate i { width: 30%; animation: slide 1.4s var(--ease-out) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(400%); } }
.task-name { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36ch; }
.task-sub { display: block; font-size: var(--fs-small); color: var(--muted); }
.task-voice { display: block; max-width: 18ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-err { color: var(--negative); font-size: var(--fs-small); display: block; max-width: 40ch; }
.wave { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 2px; height: 20px; }
.wave i { display: block; width: 2px; border-radius: 1px; background: var(--chart-muted); }
.wave.ready i { background: var(--signal); }
td .actions { display: flex; gap: 6px; justify-content: flex-end; }
/* Дорожки дубляжа: список на всю ширину строки, оригинал сверху. Готовая — слушать и открыть. */
.queue tr.has-tracks td { border-bottom: none; }
.queue tr.track-row td { padding-top: 0; padding-bottom: 12px; }
.tracks { display: grid; gap: 4px; min-width: 0; max-width: 560px; }
.track { display: flex; align-items: center; gap: 8px; min-width: 0; height: 32px; padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--ground); position: relative; overflow: hidden; }
.track.origin { background: var(--surface); }
.track .flag { width: 18px; height: 13px; }
.track .lang { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track .sublang { margin-left: 6px; color: var(--muted); font-weight: 400; font-size: var(--fs-small); }
.track .st { color: var(--faint); font-size: var(--fs-small); flex: none; margin-left: auto; }
.track .acts { display: flex; align-items: center; gap: 2px; flex: none; }
.track.failed { border-color: color-mix(in srgb, var(--negative) 40%, var(--border)); }
.track.failed .st { color: var(--negative); }
.track .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--signal); transition: width var(--t-ui) var(--ease-out); }
.flag { display: inline-block; width: 18px; height: 13px; border-radius: 2px; object-fit: cover; vertical-align: -2px; outline: 1px solid var(--rule); outline-offset: -1px; flex: none; }
.flag-text { width: auto; min-width: 18px; padding: 0 3px; font-size: 9px; font-weight: 600; letter-spacing: 0.04em; line-height: 13px; text-align: center; background: var(--raised); color: var(--muted); }
.pill .flag { width: 15px; height: 11px; margin-right: 2px; }
.dub-langs { display: grid; gap: 8px; min-width: 0; }
.dub-langs > .lang-pick { justify-self: start; }
.dub-lang { display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--ground); min-width: 0; }
.dub-lang-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dub-lang-head .lang { flex: 1 1 0; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dub-voice { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; height: 32px; padding: 0 8px 0 10px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); color: var(--muted); font: inherit; text-align: left; cursor: pointer; }
.dub-voice.has { color: var(--text); }
.dub-voice > span:first-child { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dub-voice .x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; color: var(--faint); flex: none; }
.dub-voice:hover { border-color: var(--hover-line); } /* taste-skill-ignore: только :hover */
.dub-voice svg { width: 12px; height: 12px; color: var(--faint); flex: none; }
.track-list { display: grid; gap: 4px; }
.track-list label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.track-list label:hover { background: var(--active); }
.track-list .check { margin: 0; }
.track-list .path { color: var(--faint); font-size: var(--fs-small); margin-left: auto; max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-panel { padding: 0 var(--card-pad); }
.table-panel table { min-width: 720px; }
.queue tr.draft td { color: var(--muted); }
.music .panel { display: grid; gap: 14px; }
.music textarea.input { min-height: 120px; resize: vertical; }
.music .row-end { display: flex; justify-content: flex-end; }
.music-lib { display: grid; gap: 12px; }
.music-lib-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
/* Кнопка «слушать» в строке: тот же круглый play, что у голосов; .playing — сигнальный цвет */
.queue .play, .player .play, .transport .play, .music .play { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--control); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--text); transition: border-color var(--t-hover), color var(--t-hover), background-color var(--t-hover); }
.queue .play:hover, .player .play:hover, .transport .play:hover, .music .play:hover { border-color: var(--accent); color: var(--accent); }
.queue .play.playing, .player .play.playing, .transport .play.playing, .music .play.playing { background: var(--signal); border-color: var(--signal); color: var(--primary-ink); }
.queue .play svg, .player .play svg, .transport .play svg, .music .play svg { width: 12px; height: 12px; }
.queue .play.loading, .player .play.loading, .transport .play.loading, .music .play.loading { color: transparent; position: relative; pointer-events: none; }
.queue .play.loading::after, .player .play.loading::after, .transport .play.loading::after, .music .play.loading::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent; animation: spin .8s linear infinite; }
.queue .tracks .play { width: 24px; height: 24px; }
.queue .tracks .play svg { width: 10px; height: 10px; }
.queue .tracks .play.loading::after { inset: 5px; }

/* ── Плеер: строка под всем окном, как транспорт студии — появляется при первом воспроизведении ── */
.player { display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 16px 0 14px; border-top: 1px solid var(--border); background: var(--surface); min-width: 0; animation: player-enter var(--t-ui) var(--ease-out) both; }
@keyframes player-enter { from { transform: translateY(100%); } to { transform: none; } }
.player .play { width: 34px; height: 34px; }
.player .play svg { width: 13px; height: 13px; }
.player .meta { display: grid; min-width: 0; width: 240px; flex: none; }
.player .meta .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .meta .sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .meta .sub .flag { width: 15px; height: 11px; }
.player .timeline { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 120px; }
.player .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-small); min-width: 5ch; }
.player .time.total { text-align: right; }
/* Волна дорожки как перемотка: два слоя столбиков, цветной обрезан по --pos; прозрачный range сверху даёт клик, drag и клавиатуру */
.wave-seek { position: relative; flex: 1; height: 36px; min-width: 80px; --pos: 0%; }
.wave-seek .layer { position: absolute; inset: 0; display: flex; align-items: center; gap: 1px; padding: 0; pointer-events: none; }
.wave-seek .layer i { flex: 1; min-width: 0; border-radius: 1px; background: var(--chart-muted); }
.wave-seek .fill { clip-path: inset(0 calc(100% - var(--pos)) 0 0); transition: clip-path .25s linear; }
.wave-seek .fill i { background: var(--signal); }
.wave-seek.pending .layer i { opacity: .45; }
.wave-seek input.seek { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.wave-seek:has(.seek:focus-visible) { outline: 1px solid var(--accent-200); outline-offset: 2px; border-radius: 4px; }
.player .timeline .wave-seek { height: 34px; }
.player .vol { display: flex; align-items: center; gap: 6px; width: 110px; flex: none; color: var(--muted); }
.player .vol input { width: 80px; }
.player .vol input::-webkit-slider-thumb { width: 10px; height: 10px; margin-top: -3.5px; }
.player .rate { min-width: 48px; height: 26px; padding: 0 6px; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.player .tail { display: flex; align-items: center; gap: 2px; flex: none; }
.player.loading .timeline { opacity: .5; }
th { font-size: var(--fs-label); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; color: var(--faint); }

/* ── Голоса ───────────────────────────────────────────────────────────────── */
.voices-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.voice-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.voice-card .head { display: flex; align-items: center; gap: 10px; }
.voice-card .head .meta { flex: 1; min-width: 0; }
.voice-card.pickable { cursor: pointer; }
.voice-card[aria-selected="true"] { border-color: var(--accent); background: var(--accent-50); }
.voice-card .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.voice-card .tags .pill { height: 20px; padding: 0 7px; font-weight: 500; }
.voice-card .desc { color: var(--muted); font-size: var(--fs-small); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.voice-card .foot { display: flex; gap: 6px; justify-content: flex-end; margin-top: auto; }
.voice-card .fav { width: 26px; height: 26px; flex: none; align-self: flex-start; color: var(--faint); }
.voice-card .fav:hover { color: var(--text); }
.voice-card .fav[aria-pressed="true"] { color: var(--accent); background: transparent; }
.voice-card .fav[aria-pressed="true"] svg { fill: currentColor; }
.voice-card .fav svg { width: 14px; height: 14px; }
.filters .input { width: 220px; }
.filters select.input, .filters .lang-pick { width: auto; min-width: 150px; }

/* ── Выпадающий список языков с флагами: кнопка в облике .input + меню поверх всего ── */
.lang-pick { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.lang-pick .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-pick .ph { color: var(--muted); }
.lang-pick > svg { color: var(--muted); flex: none; }
.lang-pick.sm { width: auto; height: 24px; padding: 0 9px; gap: 6px; font-size: var(--fs-small); border-radius: 999px; }
.lang-pick.sm .ph { color: var(--text); font-weight: 500; }
.lang-menu { position: fixed; z-index: 70; min-width: 200px; max-height: 320px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, .28); overflow: hidden; }
.lang-menu .search { padding: 6px; border-bottom: 1px solid var(--rule); flex: none; }
.lang-menu .search .input { height: 30px; font-size: var(--fs-small); }
.lang-menu .list { overflow: auto; padding: 4px; min-height: 0; }
.lang-menu .item { display: flex; align-items: center; gap: 9px; width: 100%; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.lang-menu .item:hover, .lang-menu .item:focus-visible { background: var(--active); outline: none; }
.lang-menu .item[aria-selected="true"] { color: var(--accent); font-weight: 500; }
.lang-menu .item .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quota { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-small); }
.load-more { display: flex; justify-content: center; padding: 12px 0; }
.tabs { gap: 20px; flex-wrap: wrap; row-gap: 0; }
.tabs a { font-weight: 500; }
.tabs a[aria-selected="true"]::after { background: var(--accent); }

/* ── Тариф ────────────────────────────────────────────────────────────────── */
.kpis { border-color: var(--border); }
.kpi-value { font-weight: 600; letter-spacing: -0.02em; }
.plan-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: grid; gap: 6px; background: var(--surface); }
.plan-card.current { border-color: var(--accent); }
.plan-card h3 { font-size: var(--fs-body); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.plan-card .lim { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-small); color: var(--muted); }
.plan-card .lim b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pill.accent { background: var(--accent-100); color: var(--accent-ink); }

/* ── Настройки ────────────────────────────────────────────────────────────── */
.settings { display: grid; gap: 16px; align-content: start; }
.settings .title-row { margin-bottom: 4px; }
.settings .panel h2 { margin: 0 0 4px; }
.settings .panel h2 + .settings-grid { border-top: 0; }
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 24px; align-items: start; padding: 16px 0; border-top: 1px solid var(--rule); }
.settings-grid:first-of-type { border-top: 0; }
.settings-grid .lbl { font-weight: 500; }
.settings-grid .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-small); margin-top: 2px; }
.settings-grid .ctl { display: grid; gap: 8px; max-width: 420px; }

/* Расцветки: точка цвета + имя; выбранная — с волосяным кольцом в цвет. Цвет точки берём из
   токенов самой расцветки, поэтому свотчи честно показывают то, что включат. */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { display: inline-flex; align-items: center; gap: 8px; height: var(--control-height); padding: 0 12px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--muted); font-size: var(--fs-small); font-weight: 500; transition: border-color var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out); }
.swatch .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--sw); }
.swatch:hover { color: var(--text); border-color: var(--hover-line); box-shadow: 0 0 0 1px var(--glow-ring), 0 0 18px -2px var(--glow-halo); } /* taste-skill-ignore: только :hover */
.swatch[aria-checked="true"] { color: var(--text); border-color: var(--sw); background: color-mix(in srgb, var(--sw) 10%, var(--surface)); }
.swatch[data-accent="coral"]  { --sw: #FF6A3D; }
.swatch[data-accent="ember"]  { --sw: #FF383F; }
.swatch[data-accent="amber"]  { --sw: #FF9B25; }
.swatch[data-accent="gold"]   { --sw: #FFC53D; }
.swatch[data-accent="violet"] { --sw: #8E4DFF; }
.swatch[data-accent="sky"]    { --sw: #268BFF; }

/* ── Экран лицензии ───────────────────────────────────────────────────────── */
.gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--ground); }
.gate .card { width: min(420px, 92vw); display: grid; gap: 16px; }
.gate .brand { padding: 0; }
.gate .status { color: var(--muted); }
.gate .err { color: var(--negative); font-size: var(--fs-small); }
.gate .ok { color: var(--positive); font-size: var(--fs-small); }
.gate .lang { position: fixed; top: 16px; right: 16px; width: auto; }

/* ── Модалки и тосты: единственные тени ───────────────────────────────────── */
.modal-root { position: fixed; inset: 0; z-index: 40; display: none; }
.modal-root.open { display: block; }
.modal-back { position: absolute; inset: 0; background: rgba(8, 9, 11, .55); }
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(var(--w, 560px), 94vw); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.modal > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.modal > header h2 { font-size: var(--fs-section); font-weight: 600; }
.modal > .body { padding: 16px 20px; overflow: auto; display: grid; gap: 14px; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 16px; }
.modal.wide { --w: 1040px; height: min(760px, 90vh); }
.modal.wide > .body { flex: 1; }
.toasts { position: fixed; right: 16px; bottom: 84px; z-index: 60; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--text); color: var(--ground); font-size: var(--fs-body); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: toast-in var(--t-ui) var(--ease-out); max-width: 420px; }
.toast.err { background: var(--negative); color: #fff; }
.toast.ok { background: var(--positive); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.empty { grid-column: 1 / -1; border-radius: var(--radius-card); gap: 12px; align-content: center; padding: 32px 16px; }
.empty p { margin: 0; }
.chunks { display: grid; gap: 10px; }
.chunk { display: grid; gap: 6px; }
.chunk .hd { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-small); }

/* ── Ширины ───────────────────────────────────────────────────────────────── */
@media (max-width: 1360px) {
  :root { --inspector-width: 300px; }
  .transport .chip.model { display: none; }
  .transport .btn.ghost .lbl { display: none; }
  .transport .btn.ghost { padding: 0 8px; }
}
@media (max-width: 1180px) { :root { --inspector-width: 288px; } .doc-scroll { padding: 24px 28px 20px; } .chunk-ruler { padding: 10px 28px; } .transport .chip.status .v { display: none; } .transport .chip.status { padding: 0 8px; } }
@media (max-width: 1000px) {
  .studio-body { grid-template-columns: minmax(0, 1fr); }
  .inspector { position: absolute; right: 0; top: 52px; bottom: 68px; z-index: 5; box-shadow: -16px 0 40px rgba(0, 0, 0, .25); }
  .studio { position: relative; }
}
@media (max-width: 860px) {
  .canvas { height: auto; }
  .settings-grid { grid-template-columns: 1fr; }
  .modal.wide { height: 90vh; }
}
