:root {
  color-scheme: light dark;
  --bg: #f5f5f2;
  --panel: #ffffff;
  --panel-soft: #fafaf8;
  --ink: #1b1b1a;
  --muted: #6d6d68;
  --line: #e2e2dd;
  --accent: #2f6f4e;
  --accent-soft: #e6f1ea;
  --accent-ink: #ffffff;
  --danger: #9e2f2f;
  --danger-soft: #f8e9e9;
  --warn: #8a5a10;
  --warn-soft: #f8efdd;
  --code-bg: #f0efec;
  --shadow: 0 1px 2px rgba(20, 20, 18, 0.06), 0 8px 24px rgba(20, 20, 18, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --panel: #1e2024;
    --panel-soft: #23262a;
    --ink: #ebe9e5;
    --muted: #9a9994;
    --line: #32353a;
    --accent: #5fbf8f;
    --accent-soft: #1d3b2d;
    --accent-ink: #0f2419;
    --danger: #ef8d8d;
    --danger-soft: #3a2424;
    --warn: #e3b872;
    --warn-soft: #3a2f1d;
    --code-bg: #15171a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

/* Elements toggled with the hidden attribute also carry a display rule below. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.005em;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand strong {
  display: block;
  font-size: 14px;
}

.brand em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.topbar-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.key-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.key-field input {
  width: 190px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12.5px;
}

.user-button {
  min-width: 0;
}

.user-button > span {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-btn {
  font: inherit;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.chunk-note {
  margin-top: 10px;
}

/* ---------- layout ---------- */

.layout {
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.counter {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- controls ---------- */

input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.dropzone:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 500;
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  font-weight: 500;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn.ghost:hover:not(:disabled),
.btn.danger:hover:not(:disabled) {
  background: var(--panel-soft);
}

.btn.wide {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

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

.fields {
  display: grid;
  /* Колонка карточки узкая: поля сами переходят в одну, вместо того чтобы вылезать за край. */
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 12px;
  margin-top: 14px;
}

/* Ячейка сетки по умолчанию не ужимается уже своего содержимого, и длинный пункт
   списка растягивает колонку вместе со всей карточкой. Отсюда и min-width. */
.fields > label {
  min-width: 0;
}

.fields .wide {
  grid-column: 1 / -1;
}

.field-note {
  font-size: 12px;
  color: var(--muted);
  /* Адреса движков длинные и без пробелов — переносим их, а не растягиваем поле. */
  overflow-wrap: anywhere;
}

.field-note.is-error {
  color: var(--danger);
}

@media (max-width: 520px) {
  .fields {
    grid-template-columns: 1fr;
  }
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- dropzone and uploads ---------- */

.dropzone {
  margin-top: 14px;
  border: 1.5px dashed var(--line);
  border-radius: 11px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone strong {
  display: block;
  font-size: 14px;
}

.dropzone span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.uploads {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.uploads li {
  font-size: 13px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
}

.uploads .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.uploads .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploads .state {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.uploads .state.is-error {
  color: var(--danger);
}

.bar {
  height: 3px;
  margin-top: 7px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}

/* ---------- filters and job list ---------- */

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  color: var(--ink);
}

.filters input[type="search"] {
  flex: 1 1 150px;
}

.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(58vh, 560px);
  overflow-y: auto;
}

.jobs .job {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
}

.jobs .job:hover {
  background: var(--panel-soft);
}

.jobs .job.is-selected {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.jobs .job-main {
  min-width: 0;
  flex: 1;
}

.jobs .job-name {
  display: block;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jobs .job-sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-list {
  padding: 18px 4px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- badges ---------- */

.badge {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.badge.done {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  color: color-mix(in srgb, var(--accent) 75%, var(--ink));
}

.badge.failed {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}

.badge.processing,
.badge.queued {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 30%, var(--line));
  color: var(--warn);
}

.badge.processing::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .badge.processing::before {
    animation: none;
  }
}

/* ---------- detail ---------- */

.detail {
  position: sticky;
  top: 77px;
}

@media (max-width: 940px) {
  .detail {
    position: static;
  }
}

.empty {
  padding: 40px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.empty p {
  margin: 0 0 6px;
}

.empty strong {
  color: var(--ink);
  font-size: 14.5px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#detail-title {
  font-size: 17px;
  word-break: break-word;
}

.meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.error-box {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--danger);
  font-size: 13px;
  word-break: break-word;
}

.player {
  margin-top: 14px;
}

.player audio {
  width: 100%;
  height: 34px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 12px;
  border-bottom: 1px solid var(--line);
}

.tab {
  font: inherit;
  font-size: 13px;
  padding: 7px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

#text {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  line-height: 1.6;
}

.segments {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.segments li {
  display: flex;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13.5px;
}

.segments li.is-active {
  background: var(--accent-soft);
}

.segments time {
  flex: none;
  font-size: 12px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding-top: 1px;
}

pre {
  margin: 0;
  padding: 12px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
}

.detail-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* ---------- settings dialog ---------- */

.engine-chip {
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
  cursor: pointer;
  max-width: min(320px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.engine-chip.is-ready {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 75%, var(--ink));
}

.settings {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.settings::backdrop {
  background: rgba(10, 10, 12, 0.45);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.settings-form header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-form h2 {
  font-size: 16px;
}

.icon-btn {
  font: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.settings fieldset {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* Иначе широкое содержимое — таблица машин, длинный адрес — раздвигает всё окно. */
  min-width: 0;
}

.settings legend {
  padding: 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.settings .grid {
  display: grid;
  /* min(): на узком экране колонка не требует своих 210 пикселей и просто сужается. */
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 12px;
  min-width: 0;
}

.settings .grid > label {
  min-width: 0;
}

.settings .grid .wide {
  grid-column: 1 / -1;
}

.settings textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

/* Указания модели пишут словами, а не кодом: обычный шрифт читается лучше. */
#s-summary-prompt {
  font-family: inherit;
}

.settings .inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
}

.settings .inline input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
  color: var(--warn);
  font-size: 12.5px;
}

.note code {
  font-size: 12px;
}

.engine-status {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 13px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  word-break: break-word;
}

.engine-status.is-ok {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.engine-status.is-error {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--danger);
}

.settings-form footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.settings-form footer .meta {
  margin-left: auto;
}

/* ---------- personal cabinet ---------- */

.profile {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
  font-size: 13.5px;
}

.profile dt {
  color: var(--muted);
}

.profile dd {
  margin: 0;
  word-break: break-word;
}

.settings label.narrow {
  max-width: 320px;
}

.settings fieldset > .meta {
  margin: 0;
}

.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.token-create {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.token-create .grow {
  flex: 1 1 240px;
}

.token-fresh {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  font-size: 13px;
}

.token-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.token-value code {
  flex: 1 1 260px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 12.5px;
  word-break: break-all;
}

.tokens {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tokens li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.tokens .token-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 13.5px;
}

.tokens .token-main .meta {
  margin: 0;
  overflow-wrap: anywhere;
}

.tokens .empty-tokens {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- sign-in ---------- */

.login {
  width: min(380px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.login::backdrop {
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(6px);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
}

.login-form h2 {
  font-size: 17px;
}

.login-form .meta {
  margin: -8px 0 0;
}

.login-form .error-box {
  margin: 0;
}

.login-error {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-error .error-reason {
  font-size: 12px;
  opacity: 0.85;
}

.password-field {
  position: relative;
  display: flex;
}

.password-field input {
  flex: 1;
  padding-right: 42px;
}

/* Edge draws its own eye in a password field; one is enough. */
.password-field input::-ms-reveal {
  display: none;
}

.reveal {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.reveal:hover {
  color: var(--ink);
  background: var(--panel);
}

.reveal:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.login-form .btn {
  justify-content: center;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 40;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13.5px;
}

.toast.is-error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
}

/* ---------- progress ---------- */

.progress-block {
  margin-top: 14px;
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.6s linear;
}

/* No number to show yet: a stripe that moves instead of a width that lies. */
.progress.is-indeterminate > i {
  width: 35%;
  animation: slide 1.6s ease-in-out infinite;
}

@keyframes slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(300%);
  }
}

.job-progress {
  height: 3px;
  margin-top: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .progress.is-indeterminate > i {
    animation: none;
    width: 100%;
    opacity: 0.4;
  }
  .progress > i {
    transition: none;
  }
}

/* ---------- speakers ---------- */

.speakers-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.speakers-block .meta {
  margin: 0;
}

.speakers-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.inline-label select {
  padding: 5px 8px;
}

.segments .speaker {
  flex: none;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid transparent;
  background: var(--panel-soft);
  color: var(--muted);
  white-space: nowrap;
}

/* Up to six voices get their own colour; beyond that they share the plain one. */
.segments .speaker[data-speaker="1"] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
}

.segments .speaker[data-speaker="2"] {
  background: color-mix(in srgb, #4b7bec 18%, transparent);
  color: color-mix(in srgb, #4b7bec 80%, var(--ink));
}

.segments .speaker[data-speaker="3"] {
  background: color-mix(in srgb, #b9770e 20%, transparent);
  color: color-mix(in srgb, #b9770e 85%, var(--ink));
}

.segments .speaker[data-speaker="4"] {
  background: color-mix(in srgb, #8e44ad 18%, transparent);
  color: color-mix(in srgb, #8e44ad 80%, var(--ink));
}

.segments .speaker[data-speaker="5"] {
  background: color-mix(in srgb, #16a085 18%, transparent);
  color: color-mix(in srgb, #16a085 80%, var(--ink));
}

.segments .speaker[data-speaker="6"] {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: color-mix(in srgb, var(--danger) 85%, var(--ink));
}

/* ---------- pieces of a split recording ---------- */

.parts-block {
  margin-top: 14px;
}

.parts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.part {
  font: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  padding: 4px 6px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
}

.part.done {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  color: color-mix(in srgb, var(--accent) 75%, var(--ink));
}

.part.failed {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}

.part.processing {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 30%, var(--line));
  color: var(--warn);
}

.part.is-current {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Машины, которые считают очередь: список в настройках, раздел «Воркеры». */
/* Шесть столбцов не влезают в узкое окно: прокручиваем таблицу, а не растягиваем диалог. */
.workers-scroll {
  min-width: 0;
  overflow-x: auto;
}

.workers {
  width: 100%;
  margin: 10px 0 0;
  border-collapse: collapse;
  font-size: 13px;
}

.workers th {
  padding: 4px 8px 4px 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.workers td {
  padding: 6px 8px 6px 0;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

/* Машина, которая перестала отвечать, остаётся в списке, но приглушена. */
.workers tr.offline td {
  color: var(--muted);
}

.workers .tag {
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Моделей бывает много: длинный список обрезается, целиком он во всплывающей подсказке. */
.workers .worker-models {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .workers .worker-models {
    max-width: 120px;
  }
}

/* Вкладка «Выводы»: что языковая модель вынесла из разговора. */
.summary-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.summary p {
  margin: 0;
}

.summary-topic {
  font-weight: 600;
}

.summary h4 {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.summary ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-due {
  color: var(--muted);
}
