:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #6b7385;
  --line: #e3e7ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --good: #15803d;
  --good-bg: #e3f4e1;
  --warn: #a16207;
  --warn-bg: #fdf3d7;
  --bad: #b91c1c;
  --bad-bg: #fde4e4;
  --info: #1e40af;
  --info-bg: #e0e9fd;
  --muted-bg: #eef0f4;
  --radius: 10px;
}

* { box-sizing: border-box; }
/* hidden прячет и кнопки: у .btn свой display */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
code { background: var(--muted-bg); padding: 1px 6px; border-radius: 5px; font-size: 14px; }

.topbar { background: #1c2333; color: #fff; }
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 20px; min-height: 54px; flex-wrap: wrap;
}
.brand { color: #fff; font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #c9cfdd; padding: 6px 12px; border-radius: 8px; }
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topbar nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.topbar .link { color: #c9cfdd; }

.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h1, .card-head h2 { margin: 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; }
.flash-ok { background: var(--good-bg); color: var(--good); }
.flash-info { background: var(--info-bg); color: var(--info); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.alert {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--bad-bg); color: var(--bad); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.alert-warn { background: var(--warn-bg); color: var(--warn); }

.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 8px;
  padding: 8px 14px; font: inherit; cursor: pointer; line-height: 1.3; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-light { background: #fff; color: var(--text); border-color: var(--line); }
.btn-light:hover { background: var(--muted-bg); }
.btn-danger { background: #fff; color: var(--bad); border-color: #f1b5b5; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-big { padding: 12px 22px; font-size: 17px; font-weight: 600; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.wide { width: 100%; }
button.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; }

.hero { display: grid; grid-template-columns: 1.4fr auto 1fr; gap: 20px; align-items: center; }
.hero-status { display: flex; gap: 14px; align-items: center; }
.hero-queue { text-align: right; }
.hero-queue .btn { margin-top: 6px; }
.big-number { font-size: 34px; font-weight: 700; line-height: 1.1; }
.dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.dot-on { background: #22c55e; box-shadow: 0 0 0 5px rgba(34,197,94,.18); }
.dot-off { background: #9aa3b5; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.grid3 .card { margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 0 0 10px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 2px 0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; }

.line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.line:last-of-type { border-bottom: 0; }
.line-number { font-weight: 600; }
.line-call { text-align: right; }
.state-online { color: var(--good); }
.state-offline, .state-error { color: var(--bad); font-weight: 600; }
.state-unknown { color: var(--muted); }

.good { color: var(--good); }
.bad { color: var(--bad); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.tone-good { background: var(--good-bg); color: var(--good); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-bad { background: var(--bad-bg); color: var(--bad); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-muted { background: var(--muted-bg); color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); padding: 8px 10px; }
td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8f9fc; }
.summary-cell { max-width: 460px; color: #3b4356; }
.actions form { display: inline; }
.actions .btn { white-space: nowrap; }
table.compact { width: auto; margin-bottom: 12px; }
table.compact td, table.compact th { padding: 6px 16px 6px 0; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 6px 12px; border-radius: 8px; background: var(--muted-bg); color: var(--text); font-size: 14px; }
.tab:hover { text-decoration: none; background: #e3e7ef; }
.tab.active { background: var(--primary); color: #fff; }
.tab .count { opacity: .7; margin-left: 2px; }

.search { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
input[type=text], input[type=search], input[type=password], input[type=tel],
input[type=number], input[type=time], select {
  font: inherit; padding: 8px 10px; border: 1px solid #cfd5e1; border-radius: 8px; background: #fff; color: var(--text);
  min-width: 0;
}
.search input[type=search] { flex: 1; max-width: 420px; }
input:focus, select:focus { outline: 2px solid rgba(37,99,235,.25); border-color: var(--primary); }

.upload { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.file-label { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.inline-form input, .inline-form select { flex: 1; min-width: 220px; max-width: 420px; }
.stack-form { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.grid-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.grid-form .days { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.grid-form .days legend { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; color: var(--text) !important; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.wide-field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }

.agent-check { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: #fbfcfe; max-width: 760px; }
.agent-check-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.check-group { font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--line); }
.checks li:first-child { border-top: 0; }
.check-icon { width: 20px; height: 20px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-top: 1px; }
.check-ok .check-icon { background: var(--good-bg); color: var(--good); }
.check-warn .check-icon { background: var(--warn-bg); color: var(--warn); }
.check-bad .check-icon { background: var(--bad-bg); color: var(--bad); }
.check-info .check-icon { background: var(--muted-bg); color: var(--muted); }

.step { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--info-bg); color: var(--info); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.step-body { flex: 1; min-width: 0; }

.details { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 12px; }
.msg-agent { background: var(--info-bg); align-self: flex-start; }
.msg-user { background: var(--muted-bg); align-self: flex-end; }
.msg-who { font-size: 12px; color: var(--muted); }
.msg-lat { font-size: 12px; color: var(--muted); margin-top: 2px; }
/* Что сделал агент (инструменты) и почему закончился звонок — по центру, без «пузыря» */
.msg-event {
  align-self: center; max-width: 92%; display: flex; gap: 8px; align-items: baseline;
  font-size: 13px; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px;
  padding: 5px 10px; overflow-wrap: anywhere;
}
.msg-event-bad { color: var(--bad); border-color: #f1b5b5; background: var(--bad-bg); }
.msg-time { font-variant-numeric: tabular-nums; flex: none; }
.audio { margin-top: 14px; }
.audio audio { width: 100%; max-width: 520px; }
details.tech summary { cursor: pointer; color: var(--muted); }
details.tech .details { margin-top: 10px; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.danger-zone h2 { font-size: 16px; }

.login-box { max-width: 380px; margin: 12vh auto 0; }
.login-box h1 { margin-bottom: 16px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; color: var(--muted); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-queue { text-align: left; }
  .grid3, .grid2 { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar-inner { gap: 4px 10px; padding: 8px 12px; }
  .topbar nav { order: 3; flex-basis: 100%; }
  .logout { margin-left: auto; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.stack td { border: 0; padding: 2px 0; max-width: none; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; }
  table.stack td.actions { padding-top: 6px; }
}
@media (max-width: 560px) {
  .page { padding: 14px 10px 40px; }
  .card { padding: 14px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 8px; }
  .msg { max-width: 92%; }
  .topbar-inner { gap: 8px; padding: 8px 10px; }
}

/* Страница «Агент» */
textarea {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #cfd5e1; border-radius: 8px;
  background: #fff; color: var(--text); resize: vertical; line-height: 1.55;
}
textarea:focus { outline: 2px solid rgba(37,99,235,.25); border-color: var(--primary); }
.agent-form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.agent-form .field > label { font-size: 14px; color: var(--muted); }
.agent-form .field input[type=text] { width: 100%; max-width: 520px; }
#prompt { min-height: 460px; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.insert-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.insert-label { font-size: 13px; color: var(--muted); width: 120px; flex: none; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px;
  font: inherit; font-size: 13px; cursor: pointer; color: var(--text); line-height: 1.4;
}
.chip:hover { background: var(--info-bg); border-color: #c7d5fb; }
.chip small { color: var(--muted); font-size: 12px; }
.chip-tag { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chip-tag small { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 14px; align-items: center;
  flex-wrap: wrap; padding: 10px 0 12px; margin-bottom: 16px; background: rgba(244,246,250,.96);
}
.dirty-note { color: var(--warn); font-weight: 600; }
.fix-all { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; }
.check-text { flex: 1; min-width: 0; }
.check-fix { flex: none; margin-left: auto; }
.agent-edit-link { margin: 12px 0 0; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { border-top: 1px solid var(--line); padding: 10px 0; }
.history li:first-child { border-top: 0; }
.history-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.history-head form { margin-left: auto; }
.history summary { cursor: pointer; color: var(--muted); }
.prompt-text {
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--muted-bg); padding: 10px 12px;
  border-radius: 8px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 420px; overflow: auto; margin: 8px 0 0;
}
select { max-width: 100%; }
@media (max-width: 640px) {
  .checks li { flex-wrap: wrap; }
  .check-text { flex: 1 1 calc(100% - 30px); }
  .check-fix { margin-left: 30px; }
  .insert-label { width: 100%; }
  #prompt { min-height: 360px; }
}
#asr_keywords { min-height: 70px; }
.tech-table td { font-size: 13px; padding: 3px 18px 3px 0; overflow-wrap: anywhere; }
.tech-table td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }
@media (max-width: 640px) { .tech-table td:first-child { white-space: normal; } }

/* Живое начало */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.opening-flow { list-style: none; margin: 4px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.opening-flow li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.who { display: inline-block; min-width: 64px; text-align: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--muted-bg); color: var(--muted); }
.who.rec { background: var(--good-bg); color: var(--good); }
.who.ai { background: var(--info-bg); color: var(--info); }
.wide-form { max-width: 760px; }
.takes { list-style: none; margin: 12px 0 0; padding: 0; }
.takes li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.takes li:first-child { border-top: 0; }
#greeting audio, #hello audio, .takes audio { width: 100%; max-width: 420px; }
input[type=file] { font: inherit; max-width: 100%; }
.opening-flow li { flex-wrap: nowrap; }
.opening-flow .who { flex: none; }
.opening-flow .what { flex: 1; min-width: 0; }
.inline-form input[type=checkbox] { flex: none; min-width: 0; }
.inline-form input[type=file] { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.inline-form label.check { flex: none; }

/* Тумблер: включено / выключено одним нажатием */
.switch-form { margin: 0; }
.switch {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 4px; margin: 0;
  background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer;
}
.switch-track {
  position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px;
  background: #cfd5e1; transition: background .15s;
}
.switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch-on { color: var(--good); }
.switch-on .switch-track { background: var(--good); }
.switch-on .switch-thumb { transform: translateX(20px); }
.switch:hover .switch-track { filter: brightness(.95); }
.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.switch-state { font-weight: 600; min-width: 92px; text-align: left; }
/* Строка «Живое начало» на странице «Агент» */
.opening-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap;
  max-width: 760px; margin-top: 14px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fbfcfe;
}
.opening-row-on { border-color: #b7dfb1; background: var(--good-bg); }
.opening-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* Тумблеры в проверке агента и громкость фона */
.check-toggle { flex: none; margin-left: auto; align-self: flex-start; }
.check-fix + .check-toggle { margin-left: 0; }
.switch-sm { padding: 0 2px; gap: 6px; }
.switch-sm .switch-track { width: 38px; height: 22px; }
.switch-sm .switch-thumb { width: 16px; height: 16px; }
.switch-sm.switch-on .switch-thumb { transform: translateX(16px); }
.switch-sm .switch-state { min-width: 36px; font-size: 13px; }
.volume-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.volume-form input[type=range] { width: 200px; max-width: 100%; accent-color: var(--good); }
.volume-value { font-weight: 600; min-width: 40px; font-variant-numeric: tabular-nums; }
.volume-hint { flex-basis: 100%; }
@media (max-width: 640px) {
  .check-toggle { margin-left: 30px; }
  .volume-form input[type=range] { width: 100%; }
}

/* «Мой голос» */
.inline { display: inline-block; margin: 0; }
.voice-tips { margin: 6px 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; max-width: 760px; }
.voice-total { max-width: 760px; }
.voice-total-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.voice-bar { position: relative; height: 10px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.voice-bar-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 999px; }
.voice-bar-fill.tone-good { background: var(--good); }
.voice-bar-fill.tone-warn { background: #d4a017; }
.voice-bar-fill.tone-bad { background: var(--bad); }
.voice-bar-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.voice-bar-scale { position: relative; height: 18px; margin-top: 3px; }
.voice-bar-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.voice-bar-scale span:first-child { left: 0; transform: none; }
.voice-bar-scale span:last-child { right: 0; transform: none; }
.voice-takes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.voice-take { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: #fff; scroll-margin-top: 80px; min-width: 0; }
.voice-take-done { border-color: #b7dfb1; }
.voice-take.recording { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.voice-take-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.voice-client { font-weight: 600; color: var(--info); }
.voice-script { margin: 0; padding: 8px 12px; border-left: 3px solid var(--primary); background: #f6f8fd; border-radius: 0 8px 8px 0; font-size: 16px; line-height: 1.5; }
.voice-client + .voice-script { margin-top: 2px; }
.voice-take-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.voice-take-actions audio { height: 34px; flex: 1 1 180px; min-width: 0; max-width: 100%; }
.rec-state { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-state[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: rec-blink 1s infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-meter { width: 90px; height: 8px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.rec-meter span { display: block; height: 100%; width: 0; background: var(--good); transition: width .08s; }
.rec-meter span.loud { background: var(--bad); }
.rec-meter span.quiet { background: #d4a017; }
.rec-status { margin: 0; }
.voice-upload summary { cursor: pointer; color: var(--muted); }
.voice-upload form { margin: 6px 0 0; }
.voice-note { color: var(--warn); }
.voice-transcript { background: var(--muted-bg); border-radius: 8px; padding: 6px 8px; }
.btn.btn-danger-solid, .btn.btn-danger-solid:hover:not(:disabled) { background: var(--bad); border-color: var(--bad); color: #fff; }
#create h3 { margin-top: 18px; }
.voice-list { list-style: none; margin: 8px 0 12px; padding: 0; max-width: 760px; }
.voice-list li { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.voice-list-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#style-text { min-height: 260px; }
@media (max-width: 900px) {
  .voice-takes { grid-template-columns: minmax(0, 1fr); }
}
.voice-edit summary { cursor: pointer; color: var(--muted); }
.voice-edited { color: var(--info); font-weight: 600; }
.voice-edit-form { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.voice-edit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.voice-edit-form input, .voice-edit-form textarea { font-size: 15px; color: var(--text); }
.voice-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#add-slot { margin-top: 12px; max-width: 760px; }
#add-slot > summary { display: inline-block; list-style: none; }
#add-slot > summary::-webkit-details-marker { display: none; }
#add-slot[open] > summary { margin-bottom: 4px; }
.voice-take-tools { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.voice-remove {
  border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px;
  line-height: 1; padding: 4px 6px; border-radius: 6px;
}
.voice-remove:hover { color: var(--bad); background: var(--bad-bg); }
.voice-restore { margin: 12px 8px 0 0; }

/* Тренажёр */
.trainer-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.trainer-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 12px 0 14px; max-width: 900px; }
.trainer-mode { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.trainer-mode input { margin-top: 4px; }
.trainer-mode > span { display: flex; flex-direction: column; gap: 2px; }
.trainer-mode:has(input:checked) { border-color: var(--primary); background: var(--info-bg); }
.trainer-mode:has(input:disabled) { cursor: default; opacity: .7; }
.monologue-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.monologue-kind { font-weight: 700; color: var(--primary); }
.monologue-text { font-size: 22px; line-height: 1.45; margin: 12px 0 6px; max-width: 900px; }
.monologue-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.trainer-scenario { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.trainer-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--bad); font-variant-numeric: tabular-nums; align-self: center; }
.trainer-state[hidden] { display: none; }
.trainer-client { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--info-bg); color: var(--info); }
.trainer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.trainer-grid .card { margin-bottom: 0; }
.trainer-chat { max-height: 520px; overflow-y: auto; }
.prompter { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; }
.prompter-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; transition: background .2s, border-color .2s; }
.prompter-item.active { border-color: var(--primary); background: #eef3ff; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.prompter-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.prompter-text { font-size: 16px; line-height: 1.5; }
.trainer-sessions { list-style: none; margin: 12px 0; padding: 0; }
.trainer-sessions li { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.trainer-session-head { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: baseline; }
.trainer-session-head form { margin-left: auto; }
.trainer-sessions audio { width: 100%; max-width: 520px; }
.trainer-export { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
#trainer .card-head, #voice-lab .card-head { align-items: center; }
@media (max-width: 900px) {
  .trainer-grid { grid-template-columns: minmax(0, 1fr); }
  .prompter, .trainer-chat { max-height: none; }
}
