:root {
  color-scheme: dark light;
  --bg: #0f172a;
  --bg-alt: #111c30;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(148, 163, 184, 0.12);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.12), transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(244, 114, 182, 0.08), transparent 45%),
    var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.notice {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: rgba(14, 165, 233, 0.18);
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: 0 12px 30px rgba(8, 15, 32, 0.22);
}

.notice--success {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(34, 197, 94, 0.18);
}

.notice--error {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(248, 113, 113, 0.18);
}

.top-bar {
  backdrop-filter: blur(20px);
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.7));
  padding: 1.25rem 3rem;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand__mark {
  font-size: 1.75rem;
}

.brand__name {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand__tagline {
  color: var(--muted);
  font-size: 0.9rem;
  font-family: "Georgia", "Times New Roman", serif;
  font-style: italic;
}

.top-actions .btn {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.top-actions .btn:hover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
}

.top-actions .btn.is-active {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.18);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.main {
  flex: 1;
  padding: 2.5rem 3rem 3.5rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

.footer {
  padding: 1.5rem 3rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.8);
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(8, 15, 32, 0.35);
  position: relative;
  overflow: hidden;
  z-index: 0;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.15), transparent 55%);
  pointer-events: none;
  z-index: -1;
}

.card--workflow {
  display: grid;
  gap: 1.25rem;
}

.upload-card__dropzone {
  border: 1.5px dashed rgba(148, 163, 184, 0.3);
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.28);
  padding: 2.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.upload-card__dropzone:hover,
.upload-card__dropzone:focus-visible {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.upload-card__dropzone.is-dragging {
  border-color: rgba(56, 189, 248, 0.85);
  background: rgba(15, 23, 42, 0.45);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.upload-card__dropzone-content {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  max-width: 420px;
}

.upload-card__icon {
  font-size: 2rem;
  line-height: 1;
  padding: 0.55rem 0.7rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}

.upload-card__headline {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.upload-card__hint {
  margin: 0;
  color: var(--muted);
}

.upload-card__filename {
  margin: 0;
  color: var(--accent);
  font-weight: 500;
}

.upload-card__filename[data-state="error"] {
  color: var(--danger);
}

.upload-card__dropzone .button {
  margin-top: 0.25rem;
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card__actions .button {
  padding: 0.7rem 1.1rem;
  font-size: 0.95rem;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.18);
}

.card__actions .button:hover {
  box-shadow: 0 12px 26px rgba(14, 165, 233, 0.24);
}

.card--modal {
  padding: 0;
  border-radius: 28px;
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  padding: 2rem;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  overflow-y: auto;
}

.modal[data-open="true"] {
  display: flex;
}

.modal[hidden] {
  display: none !important;
}

/* Ensure the HTML hidden attribute always wins over component display rules. */
[hidden] {
  display: none !important;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.74);
  backdrop-filter: blur(8px);
}

.modal__content {
  position: relative;
  width: min(95vw, 1120px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 70px rgba(7, 14, 32, 0.55);
  border-radius: 24px;
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.75rem 2rem 0;
}

.modal__heading {
  display: grid;
  gap: 0.5rem;
}

.modal__eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
}

.modal__title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
}

.modal__body {
  padding: 1.5rem 2rem 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1 1 auto;
  min-height: 0;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 2rem 2.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.3));
}

.modal-open {
  overflow: hidden;
}

.modal__content.voice-browser {
  padding: 0;
  border-radius: 28px;
}

.modal__content.folder-picker-modal {
  width: min(600px, 95vw);
}

.folder-picker {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.folder-picker__controls {
  display: flex;
  align-items: center;
}

.folder-picker__controls input {
  width: 100%;
}

.folder-picker__status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.folder-picker__status[data-state="loading"] {
  color: var(--muted);
}

.folder-picker__status[data-state="error"] {
  color: var(--danger);
}

.folder-picker__status[data-state="info"],
.folder-picker__status[data-state="success"] {
  color: var(--accent);
}

.folder-picker__list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 20rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.folder-picker__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.8rem 1rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.folder-picker__item:hover,
.folder-picker__item:focus-visible {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.folder-picker__item-name {
  font-weight: 600;
  font-size: 1rem;
}

.folder-picker__item-path {
  font-size: 0.85rem;
  color: var(--muted);
}

.folder-picker__item-id {
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.18);
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.folder-picker__empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.reader-modal {
  width: min(960px, 95vw);
  height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.find-books__body {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 960px) {
  .find-books__body {
    grid-template-columns: 1fr 320px;
    align-items: start;
  }
}

.find-books__resources {
  display: grid;
  gap: 1.5rem;
}

.resource-tile {
  background: rgba(15, 23, 42, 0.32);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 1.5rem;
  display: grid;
  gap: 0.85rem;
  box-shadow: 0 18px 40px rgba(8, 15, 32, 0.28);
}

.resource-tile h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.resource-tile p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.resource-tile .button {
  align-self: start;
}

.resource-tile .hint {
  font-size: 0.85rem;
}

.find-books__opds {
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 20px;
  padding: 1.5rem;
  display: grid;
  gap: 0.9rem;
  background: rgba(15, 23, 42, 0.22);
}

.find-books__opds h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.find-books__opds .hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.find-books__opds .button {
  justify-self: start;
}

.opds-modal {
  width: min(1020px, 95vw);
  max-height: 88vh;
}

.opds-modal__header {
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.opds-modal__search {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.opds-search__field {
  position: relative;
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 0.65rem 0.85rem;
}

.opds-search__field input[type="search"] {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

.opds-search__field input[type="search"]::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.opds-search__icon {
  width: 18px;
  height: 18px;
  fill: rgba(148, 163, 184, 0.7);
}

.opds-search__actions {
  display: flex;
  gap: 0.5rem;
}

.opds-modal__close {
  align-self: flex-start;
}

.opds-modal__tabs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 2rem 0.75rem;
}

.opds-modal__tabs.is-empty {
  display: none;
}

.opds-tab {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.opds-tab:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
}

.opds-tab.is-active {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.18);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.opds-tab--search {
  background: rgba(79, 70, 229, 0.16);
  border-color: rgba(129, 140, 248, 0.45);
}

.opds-modal__body {
  gap: 1rem;
  padding-top: 0;
}

.opds-modal__status {
  font-size: 0.92rem;
  min-height: 1.25rem;
  color: var(--muted);
}

.opds-modal__status[data-state="loading"] {
  color: var(--accent);
}

.opds-modal__status[data-state="success"] {
  color: var(--success);
}

.opds-modal__status[data-state="error"] {
  color: var(--danger);
}

.opds-modal__status[data-state="info"] {
  color: var(--muted);
}

.opds-modal__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.opds-modal__alpha {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0.75rem 0 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.opds-modal__nav--bottom {
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--panel-border);
  justify-content: center;
}

.opds-alpha-picker__button {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  color: rgba(226, 232, 240, 0.88);
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.opds-alpha-picker__button:hover {
  border-color: rgba(148, 163, 184, 0.55);
  color: #f8fafc;
}

.opds-alpha-picker__button.is-active {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.65);
  color: #f0f9ff;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.25);
}

.opds-alpha-picker__button:disabled,
.opds-alpha-picker__button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

.opds-alpha-picker__button[data-empty="true"] {
  opacity: 0.6;
}

.opds-modal__results-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.opds-modal__results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.opds-browser__entry {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  padding: 1.25rem 1.5rem;
  background: rgba(15, 23, 42, 0.35);
  display: grid;
  gap: 0.85rem;
  box-shadow: 0 14px 30px rgba(7, 14, 32, 0.32);
}

.opds-browser__entry--navigation {
  border-style: dashed;
  background: rgba(56, 189, 248, 0.08);
}

.opds-browser__entry-head {
  display: grid;
  gap: 0.35rem;
}

.opds-browser__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.opds-browser__meta {
  margin: 0;
  color: rgba(148, 163, 184, 0.85);
  font-size: 0.9rem;
}

.opds-browser__summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.opds-browser__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.opds-browser__hint {
  color: rgba(148, 163, 184, 0.75);
  font-size: 0.85rem;
}

.opds-browser__empty {
  border: 1px dashed rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  padding: 1.2rem;
  text-align: center;
  color: rgba(148, 163, 184, 0.85);
}

.reader-modal__body {
  padding: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.75);
}

.reader-modal__frame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 18px;
  background: #0f172a;
}

.voice-browser__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem 1.75rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.voice-browser__body {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem 1.75rem;
  overflow-y: auto;
  max-height: calc(90vh - 150px);
  flex: 1 1 auto;
}

.voice-browser__filters,
.voice-browser__catalog,
.voice-browser__mix {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.voice-browser__filters .field {
  gap: 0.35rem;
}

.voice-browser__filters .button {
  width: 100%;
}

.voice-browser__gender {
  display: grid;
  gap: 0.5rem;
}

.voice-browser__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.voice-browser__entry {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.35);
  color: inherit;
  text-align: left;
}

.voice-browser__entry:hover,
.voice-browser__entry[aria-current="true"],
.voice-browser__entry[data-in-mix="true"] {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

.voice-browser__entry-name {
  font-weight: 600;
}

.voice-browser__entry-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.voice-browser__mix {
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.25);
  gap: 1.25rem;
}

.voice-browser__mix-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-browser__mix-list {
  display: grid;
  gap: 1rem;
}

.voice-browser__mix-item {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.3);
}

.voice-browser__mix-header h3,
.voice-browser__mix-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.voice-browser__mix-remove {
  appearance: none;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
}

.voice-browser__mix-remove:hover {
  color: var(--danger);
}

.voice-browser__mix-weight {
  font-size: 0.85rem;
  color: var(--muted);
}

.voice-browser__preview {
  display: grid;
  gap: 1rem;
}

.voice-browser__samples {
  display: grid;
  gap: 0.75rem;
}

.voice-browser__sample {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.28);
}

.voice-browser__actions {
  display: flex;
  justify-content: flex-end;
}

.voice-browser__empty {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .voice-browser__body {
    grid-template-columns: 1fr;
  }

  .voice-browser__mix {
    order: 3;
  }
}

@media (max-width: 768px) {
  .modal {
    padding: 1rem;
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

  .wizard-page {
    display: flex;
    justify-content: center;
    padding: 3rem 0 5rem;
  }

    .wizard-page--modal {
      padding: 0;
      min-height: 100vh;
    }

  .wizard-card {
    width: min(1100px, calc(100% - 2.5rem));
    margin: 0 auto;
  }

  .wizard-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
  }

  .wizard-card__aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-end;
    text-align: right;
    max-width: 320px;
  }

  .wizard-card__links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .wizard-card__filename {
    font-size: 0.85rem;
    color: var(--muted);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .wizard-card__body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .wizard-card__stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
  }

  .wizard-card__stage > form[data-wizard-form="true"] {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  .wizard-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .wizard-card__footer-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
  }

  .wizard-hidden-inputs {
    display: none;
  }

  [data-role="new-job-modal"][data-submitting="true"] .wizard-card__stage::after,
  [data-role="new-job-modal"][data-submitting="true"] .wizard-card__stage::before {
    content: "";
    position: absolute;
  }

  [data-role="new-job-modal"][data-submitting="true"] .wizard-card__stage::after {
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    border-radius: 24px;
    pointer-events: auto;
  }

  [data-role="new-job-modal"][data-submitting="true"] .wizard-card__stage::before {
    left: 50%;
    top: 50%;
    width: 2.75rem;
    height: 2.75rem;
    margin: -1.375rem;
    border-radius: 50%;
    border: 3px solid rgba(56, 189, 248, 0.25);
    border-top-color: rgba(56, 189, 248, 0.85);
    animation: spin 0.85s linear infinite;
    pointer-events: none;
  }

  [data-role="new-job-modal"][data-submitting="true"] .wizard-card__stage > * {
    pointer-events: none;
    user-select: none;
    opacity: 0.75;
  }

  @media (max-width: 900px) {
    .wizard-card__header {
      flex-direction: column;
      align-items: stretch;
    }

    .wizard-card__aside {
      align-items: flex-start;
      text-align: left;
    }

    .wizard-card__links {
      justify-content: flex-start;
    }
  }

.step-indicator {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.step-indicator__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

button.step-indicator__item {
  cursor: pointer;
  font: inherit;
}

button.step-indicator__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.step-indicator__index {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
}

.step-indicator__label {
  font-weight: 500;
  letter-spacing: 0.02em;
}

.step-indicator__item.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.35);
}

.step-indicator__item.is-active .step-indicator__index {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: #fff;
}

.step-indicator__item.is-complete {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.25);
}

.step-indicator__item.is-complete .step-indicator__index {
  border-color: rgba(56, 189, 248, 0.35);
}

.step-indicator__item[data-state="clickable"] {
  cursor: pointer;
  color: rgba(148, 163, 184, 0.95);
}

.step-indicator__item[data-state="clickable"]:hover {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
}

.card__title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.card__title-row .card__title {
  margin: 0;
}

.card__title-row .button {
  margin-left: auto;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid--two {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.form-grid {
  align-items: start;
}

.form-grid {
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  align-items: start;
  gap: 2rem;
}

.form-grid > .grid {
  align-items: start;
  max-width: none;
  width: 100%;
  justify-self: stretch;
}

.form-grid > .grid:last-child {
  width: min(100%, 540px);
}

.button {
  appearance: none;
  border: none;
  border-radius: 16px;
  padding: 0.85rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.2);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(14, 165, 233, 0.28);
}

.button--ghost {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  box-shadow: none;
}

.button--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.button[data-loading="true"]:not([data-role="preview-button"]) {
  position: relative;
  padding-left: 2.75rem;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.88);
  opacity: 0.92;
}

.button[data-loading="true"]:not([data-role="preview-button"])::after {
  content: "";
  position: absolute;
  left: 1.15rem;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: -0.55rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-right-color: rgba(255, 255, 255, 0.9);
  animation: spin 0.85s linear infinite;
}

.log-copy {
  margin-top: 1.5rem;
}

.log-copy > summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.log-copy__textarea {
  display: block;
  width: 100%;
  min-height: 240px;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.35);
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
}

.log-copy__textarea:focus {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

.upload-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.upload-form__sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1 1 auto;
  min-height: 0;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.45);
}

.form-section__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.form-section__layout {
  display: grid;
  gap: 1.25rem;
}

.form-section__layout--split {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.form-section__group {
  display: grid;
  gap: 1.25rem;
}

.field-grid {
  display: grid;
  gap: 1.25rem;
}

.field-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.field-grid--compact .field {
  max-width: none;
}

.field-grid--two {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.field-grid--two > .field {
  max-width: none;
}

.field--span-2 {
  grid-column: span 2;
}

.field-grid--two input[type="text"],
.field-grid--two input[type="number"],
.field-grid--two input[type="file"],
.field-grid--two input[type="range"],
.field-grid--two select,
.field-grid--two textarea {
  max-width: 100%;
}

.field--stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.field--with-action .field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field__label-row .field__label,
.field__label-row label {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.9rem;
}

.field__status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.field__status[data-state="loading"] {
  color: var(--accent);
}

.field__status[data-state="error"] {
  color: var(--danger);
}

.field__status[data-state="success"] {
  color: var(--success);
}

.voice-preview__audio {
  width: min(100%, 360px);
  margin-top: 0.75rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field__caption {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.9rem;
}

.field[hidden],
.field[data-state="hidden"] {
  display: none !important;
}

.field--full {
  max-width: none;
}

.field--full textarea {
  min-height: 260px;
}

.field--actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.field label {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.9rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.45);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.field input[type="text"],
.field input[type="file"],
.field input[type="number"],
.field select {
  max-width: 420px;
  width: min(100%, 420px);
}

.field input[type="range"] {
  max-width: 420px;
  width: min(100%, 420px);
  padding: 0;
  margin-inline: 0;
  align-self: flex-start;
}

.field input[type="number"] {
  max-width: 200px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge--pending {
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.badge--running {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}

.badge--completed {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.badge--failed,
.badge--cancelled {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.badge--info {
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent);
}

.badge--muted {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
  max-height: 260px;
  overflow-y: auto;
}

.log-item {
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.3);
  font-size: 0.9rem;
  line-height: 1.4;
}

.log-item--success {
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--success);
}

.log-item--error {
  border-color: rgba(248, 113, 113, 0.45);
  color: var(--danger);
}

.log-item--warning {
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--warning);
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 20px;
}

.jobs-table thead {
  background: rgba(148, 163, 184, 0.12);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.jobs-table th,
.jobs-table td {
  padding: 0.9rem 1.15rem;
  text-align: left;
}

.jobs-table tbody tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.jobs-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.08);
}


.entity-table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.entity-table-tools__filter {
  flex: 1 1 240px;
  max-width: 360px;
}

.entity-table-tools__filter input {
  max-width: none;
}

.entity-table-tools__clear {
  align-self: center;
}

.entity-create {
  gap: 1.25rem;
}

.entity-create__description {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.entity-create__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.entity-preview {
  display: grid;
  gap: 0.6rem;
  align-items: flex-start;
}

.entity-preview__controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.entity-preview__audio {
  width: min(100%, 220px);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.45);
}

.entity-preview__status {
  font-size: 0.85rem;
  color: var(--muted);
}

.entity-preview__status[data-state="success"] {
  color: var(--success);
}

.entity-preview__status[data-state="error"] {
  color: var(--danger);
}

.overrides-table__token {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.overrides-table__input,
.overrides-table__select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.45);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.overrides-table__input:focus,
.overrides-table__select:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.overrides-table__select {
  appearance: none;
}

.overrides-table__actions-heading {
  text-align: right;
}

.overrides-table__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.overrides-table__form {
  margin: 0;
}

.button[data-loading="true"][data-role="preview-button"] {
  position: relative;
  padding-left: 2.3rem;
  pointer-events: none;
}

.button[data-loading="true"][data-role="preview-button"]::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-right-color: rgba(56, 189, 248, 0.8);
  animation: spin 0.85s linear infinite;
}

.progress-bar {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
  --progress: 0%;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: inherit;
  transition: width 0.35s ease;
  width: var(--progress);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 1rem 1.25rem;
  background: rgba(15, 23, 42, 0.35);
  gap: 1rem;
}

.queue-section {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.queue-section:last-of-type {
  margin-bottom: 0;
}

.queue-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.queue-section__header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.job-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.job-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  padding: 1rem 1.25rem;
  background: rgba(15, 23, 42, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 0.75rem;
}

.job-card[data-status="paused"] {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.08);
}

.job-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.job-card__title a {
  color: inherit;
  text-decoration: none;
}

.job-card__title a:hover {
  color: var(--accent);
}

.job-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.job-card__meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.job-card__meta--warning {
  color: var(--warning);
}

.job-card__progress {
  display: grid;
  gap: 0.4rem;
}

.job-card__progress small {
  color: var(--muted);
}

.job-card__progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.job-card__eta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.job-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.job-card__footer .button--ghost {
  padding: 0.6rem 0.95rem;
}

.job-cards--compact .job-card {
  background: rgba(15, 23, 42, 0.28);
}

.job-cards--compact .job-card__meta {
  margin-top: 0.25rem;
}

.job-card--info {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.2);
  text-align: center;
}

.job-card--info .job-card__meta {
  margin-top: 0;
}

.queue-empty {
  color: var(--muted);
}

.field--file input[type="file"] {
  width: min(100%, 420px);
  max-width: 420px;
  align-self: flex-start;
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.45);
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field--file input[type="file"]:hover,
.field--file input[type="file"]:focus {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.field--file input[type="file"]::file-selector-button,
.field--file input[type="file"]::-webkit-file-upload-button {
  border: none;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent);
  font-weight: 600;
  padding: 0.55rem 1.05rem;
  margin-right: 1rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.prepare-wizard[data-speaker-step="disabled"] [data-step-key="speakers"] {
  display: none;
}
.prepare-wizard[data-speaker-step="disabled"] [data-speaker-panel="true"] {
  display: none !important;
}
.prepare-wizard[data-speaker-step="enabled"] [data-chapter-action="finalize"] {
  display: none;
}
.prepare-wizard[data-speaker-step="disabled"] [data-chapter-action="continue"] {
  display: none;
}
.prepare-wizard[data-speaker-step="disabled"] [data-chapter-action="finalize"] {
  display: inline-flex;
}

.field--file input[type="file"]:hover::file-selector-button,
.field--file input[type="file"]:focus::file-selector-button,
.field--file input[type="file"]:hover::-webkit-file-upload-button,
.field--file input[type="file"]:focus::-webkit-file-upload-button {
  background: rgba(56, 189, 248, 0.35);
  color: #fff;
}

.alert {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.95rem;
}

.alert--success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--success);
}

.alert--error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
}

.button--danger {
  background: rgba(248, 113, 113, 0.16);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.45);
  box-shadow: 0 10px 24px rgba(248, 113, 113, 0.18);
}

.button--danger:hover {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.85), #ef4444);
  color: #fff;
  border-color: rgba(248, 113, 113, 0.65);
  box-shadow: 0 16px 36px rgba(248, 113, 113, 0.32);
}


.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: sticky;
  top: 100px;
}

.settings-nav__item {
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.55);
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: border 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.settings-nav__item:hover,
.settings-nav__item:focus-visible {
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.settings-nav__item.is-active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.28);
  color: #fff;
  box-shadow: 0 10px 20px rgba(56, 189, 248, 0.18);
}

.settings-nav__item.is-disabled {
  opacity: 0.6;
  cursor: pointer;
}

.settings__form {
  display: grid;
  gap: 1.75rem;
}

.settings-panels {
  display: grid;
}

.settings-panel {
  display: none;
  gap: 1.75rem;
}

.settings-panel.is-active {
  display: grid;
  gap: 1.75rem;
}

.settings__section {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  display: grid;
  gap: 1.1rem 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.settings__section legend {
  font-weight: 600;
  padding: 0 0.5rem;
  color: var(--muted);
  grid-column: 1 / -1;
}

.settings__section .field {
  align-items: flex-start;
}

.settings__section .field input,
.settings__section .field select,
.settings__section .field textarea {
  max-width: 100%;
}

.settings__section .field input[type="text"],
.settings__section .field input[type="file"],
.settings__section .field select {
  max-width: 100%;
}

.settings__section .field--wide {
  grid-column: 1 / -1;
}

.settings__section .field--wide input,
.settings__section .field--wide select,
.settings__section .field--wide textarea {
  max-width: 100%;
}

.field--choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.toggle-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.toggle-pill input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.toggle-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0.65rem 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.45);
  color: var(--muted);
  transition: border 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.toggle-pill:hover span {
  border-color: var(--accent);
  color: var(--accent);
}

.toggle-pill input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choices--inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.radio-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.4);
  color: var(--muted);
  transition: border 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.radio-pill:hover span {
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--accent);
}

.radio-pill input:checked + span {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.16);
  color: #fff;
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.18);
}

.radio-pill input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}

.field__group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field__input-with-button {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.field__input-with-button > input {
  flex: 1 1 16rem;
  min-width: 12rem;
}

.preview-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: rgba(15, 23, 42, 0.52);
  display: grid;
  gap: 0.75rem;
}

.preview-card__actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.preview-card__status {
  font-size: 0.85rem;
  color: var(--muted);
}

.preview-card__status[data-state="error"] {
  color: var(--danger);
}

.preview-card__status[data-state="success"] {
  color: var(--success);
}

.preview-card__output {
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.9rem 1rem;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  min-height: 3.5rem;
  white-space: pre-wrap;
}

.preview-card__output:empty {
  display: none;
}

.preview-card__audio {
  width: 100%;
  margin-top: 0.25rem;
}

.hint--warning {
  color: var(--warning);
}

@media (max-width: 860px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .settings-nav__item {
    flex: 1 1 calc(50% - 0.65rem);
    justify-content: center;
    text-align: center;
  }
}

.prepare-summary {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: start;
}
.form-section__title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.form-section__title-row .form-section__title {
  margin-bottom: 0;
}

.prepare-summary__stats dl {
  margin: 0;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.prepare-summary__stats dt {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.prepare-summary__stats dd {
  margin: 0;
  font-weight: 500;
}

.prepare-summary__insights {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.prepare-summary__stats dl > div {
  display: grid;
  gap: 0.25rem;
}

.prepare-summary__insights > .prepare-analysis,
.prepare-summary__insights > .prepare-metadata {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.35);
  border-radius: 18px;
  padding: 1rem 1.25rem;
}

.prepare-speakers {
  margin-top: 2rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prepare-speaker-config {
  margin-top: 2rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.5rem;
  display: grid;
  gap: 1rem;
}

.prepare-speaker-config__header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.prepare-speaker-config__grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  align-items: center;
}

.prepare-speaker-config__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.prepare-speaker-config__actions .button {
  white-space: nowrap;
}

.prepare-speaker-config__field .hint {
  margin-top: 0.2rem;
}

@media (max-width: 900px) {
  .prepare-speaker-config__grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }
  .prepare-speaker-config__actions {
    justify-content: flex-start;
  }
}

.entity-tabs {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.entity-tabs__notice {
  margin-bottom: 0.5rem;
}

.entity-tabs__nav {
  display: flex;
  gap: 0.75rem;
  padding: 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
  position: sticky;
  top: max(env(safe-area-inset-top), 0.5rem);
  z-index: 25;
}

.entity-tabs__tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem 0.65rem 2.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  position: relative;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.entity-tabs__tab::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.5);
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.16);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.entity-tabs__tab[data-panel="people"]::before {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.7), rgba(56, 189, 248, 0.85));
}

.entity-tabs__tab[data-panel="entities"]::before {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.45), rgba(244, 114, 182, 0.75));
}

.entity-tabs__tab[data-panel="manual"]::before {
  background: linear-gradient(135deg, rgba(248, 189, 32, 0.55), rgba(248, 113, 113, 0.7));
}

.entity-tabs__tab:hover,
.entity-tabs__tab:focus-visible {
  color: #fff;
  border-color: rgba(56, 189, 248, 0.45);
}

.entity-tabs__tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

.entity-tabs__tab.is-active {
  color: #fff;
  border-color: rgba(56, 189, 248, 0.6);
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.3), rgba(56, 189, 248, 0.4));
  box-shadow: 0 20px 34px rgba(14, 165, 233, 0.35);
}

.entity-tabs__tab.is-active::before {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.28);
}

.entity-tabs__panels {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 28px;
  padding: 1.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(6px);
}

.entity-tabs__panel {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.entity-summary {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.entity-summary__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.entity-summary__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.entity-summary__filters .field,
.entity-summary__filters .button {
  margin: 0;
}

.field--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.entity-summary__titles h2 {
  margin: 0;
}

.entity-summary__titles .hint {
  margin-top: 0.35rem;
}

.entity-summary__stats {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.entity-summary__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.1rem;
}

.entity-summary__empty {
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 18px;
  padding: 1.1rem;
  text-align: center;
  color: rgba(148, 163, 184, 0.9);
  background: rgba(15, 23, 42, 0.4);
}

.entity-summary__item {
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 22px 40px rgba(15, 23, 42, 0.4);
}

.entity-summary__item-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.entity-summary__label {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.entity-summary__kind {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.entity-summary__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.entity-summary__samples {
  margin-top: 1rem;
  display: grid;
  gap: 0.6rem;
}

.entity-summary__samples p {
  margin: 0;
  color: rgba(226, 232, 240, 0.9);
  line-height: 1.55;
}

.manual-overrides__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.manual-overrides__copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.manual-overrides__header h2 {
  margin: 0;
}

.manual-overrides__header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.manual-overrides__status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

.manual-overrides__status[data-state="success"] {
  color: var(--success);
}

.manual-overrides__status[data-state="error"] {
  color: var(--danger);
}

.manual-overrides__status[data-state="pending"] {
  color: var(--accent);
}

.manual-overrides__search {
  display: grid;
  gap: 1.25rem;
}

.manual-overrides__search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.manual-overrides__results,
.manual-overrides__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.entity-tabs [hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .field--span-2 {
    grid-column: span 1;
  }

  .manual-overrides__header {
    flex-direction: column;
    align-items: stretch;
  }

  .manual-overrides__header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .entity-tabs__nav {
    flex-direction: column;
    padding: 0.35rem;
  }

  .entity-tabs__tab {
    width: 100%;
    justify-content: flex-start;
    padding: 0.6rem 1rem 0.6rem 2.3rem;
  }
}

.speaker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.speaker-list__item {
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.speaker-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.speaker-list__name {
  font-weight: 600;
  font-size: 1rem;
}

.speaker-list__preview {
  font-size: 1.1rem;
  line-height: 1;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.speaker-list__preview:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
  transform: translateY(-1px);
}

.speaker-list__preview .spinner {
  display: none;
}

.speaker-list__preview[data-loading="true"] .spinner {
  display: inline-block;
}

.speaker-list__preview[data-loading="true"] .icon-button__glyph {
  display: none;
}

.speaker-list__preview[data-loading="true"] {
  cursor: progress;
  box-shadow: none;
  color: transparent;
}

.speaker-list__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.speaker-list__field input {
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.6rem 0.8rem;
  color: var(--text);
  font-size: 0.95rem;
}

.speaker-list__field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.speaker-list__field select {
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.55rem 0.75rem;
  color: var(--text);
}

.speaker-list__field select[multiple] {
  min-height: 6rem;
}

.speaker-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  align-items: center;
}

.speaker-gender {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.speaker-gender__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.32rem 0.8rem;
  min-width: 8.5rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.speaker-gender__pill:hover,
.speaker-gender__pill.is-open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.speaker-gender__menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 40;
  min-width: 220px;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 18px 40px rgba(7, 14, 32, 0.55);
}

.speaker-gender__menu[hidden] {
  display: none !important;
}

.speaker-gender__options {
  display: grid;
  gap: 0.35rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.speaker-gender__options .chip {
  width: 100%;
  justify-content: center;
}

.speaker-list__controls {
  display: grid;
  gap: 1rem;
}

.speaker-list__inline {
  display: flex;
  align-items: center;
}

.speaker-list__recommendations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.chip {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.speaker-list__stats {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.prepare-metadata h2 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
  color: var(--muted);
}

.prepare-metadata ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.prepare-form {
  display: grid;
  gap: 2rem;
}

.prepare-step {
  display: grid;
  gap: 2rem;
}

.prepare-step__header {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.chapter-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.prepare-options {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.75rem;
}

@media (min-width: 880px) {
  .prepare-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .prepare-options .field {
    max-width: none;
  }
}

.prepare-step__actions {
  margin-top: 0;
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.chapter-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  padding: 1.25rem 1.5rem;
  background: rgba(15, 23, 42, 0.32);
  display: grid;
  gap: 1.1rem;
}

.chapter-card[data-disabled="true"] {
  opacity: 0.5;
}

.chapter-card__summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
}

.chapter-card__summary:focus-within {
  outline: none;
}

.chapter-card__toggle {
  border: none;
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.chapter-card__toggle:hover,
.chapter-card__toggle:focus-visible {
  background: rgba(148, 163, 184, 0.2);
  color: #fff;
}

.chapter-card__toggle[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.chapter-card__toggle:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.45);
  outline-offset: 2px;
}

.chapter-card__toggle-icon {
  display: inline-flex;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.chapter-card[data-expanded="true"] .chapter-card__toggle-icon {
  transform: rotate(180deg);
}

.chapter-card__details {
  display: grid;
  gap: 1rem;
}

.chapter-card__snippet {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

.chapter-card__title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.chapter-card__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.chapter-card__checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.speaker-configs__layout {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  align-items: start;
}

.speaker-configs__sidebar {
  display: grid;
  gap: 1rem;
}

.speaker-configs__sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.speaker-configs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.speaker-configs__entry {
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  background: rgba(15, 23, 42, 0.35);
  display: grid;
  gap: 0.35rem;
}

.speaker-configs__entry.is-active {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}

.speaker-configs__entry a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.speaker-configs__entry a:hover {
  color: var(--accent);
}

.speaker-configs__meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.speaker-configs__delete {
  margin: 0;
  justify-self: flex-start;
}

.speaker-configs__empty {
  padding: 0.75rem 0;
  color: var(--muted);
  font-style: italic;
}

.speaker-config-form__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.speaker-config-form .field--full {
  grid-column: 1 / -1;
}

.speaker-config-rows {
  margin-top: 2rem;
  display: grid;
  gap: 1rem;
}

.speaker-config-rows__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.speaker-config-rows__list {
  display: grid;
  gap: 1rem;
}

.speaker-config-rows__empty {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  padding: 1rem;
  color: var(--muted);
  font-style: italic;
}

.speaker-config-row {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.4);
  padding: 1rem 1.25rem;
  display: grid;
  gap: 1rem;
}

.speaker-config-row__grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.speaker-config-row__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.speaker-configs__actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.button--small {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

.chapter-card__field label {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chapter-card__field input,
.chapter-card__field select {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.45);
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-size: 0.95rem;
}

.chapter-card__preview summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}

.chapter-card__preview pre {
  margin: 0.35rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.55);
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chapter-card__formula {
  max-width: 420px;
}

.prepare-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding-top: 1.25rem;
}

.prepare-actions .button {
  min-width: 200px;
  padding-left: 1.75rem;
  padding-right: 1.75rem;
}

.prepare-actions .button--ghost {
  border-color: rgba(148, 163, 184, 0.35);
}

.toggle-pill input:checked + span {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent);
}

@media (max-width: 1024px) {
  .prepare-summary {
    grid-template-columns: 1fr;
  }

  .prepare-summary__stats dl {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

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

  .voice-preview {
    width: 100%;
  }
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.settings__actions {
  display: flex;
  justify-content: flex-end;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.4);
}

.text-preview {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.35);
  padding: 1.1rem 1.25rem;
  display: grid;
  gap: 0.85rem;
  min-height: 220px;
}

.text-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.text-preview__header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.text-preview__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.text-preview__body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.text-preview[data-state="empty"] .text-preview__body {
  color: var(--muted);
}

progress.progress {
  width: 100%;
  height: 0.6rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.15);
}

progress.progress::-webkit-progress-bar {
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
}

progress.progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
}

progress.progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
}

.voice-mixer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.voice-mixer__header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.voice-mixer__layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) 1fr;
  gap: 2.25rem;
  align-items: start;
}

.voice-mixer__profiles {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-right: 1px solid var(--panel-border);
  padding-right: 1.5rem;
}

.voice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.voice-list__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-list__item {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.35);
  transition: border 0.2s ease, background 0.2s ease;
}

.voice-list__item.is-selected {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
}

.voice-list__select {
  all: unset;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
}

.voice-list__select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.voice-list__name {
  font-weight: 600;
}

.voice-list__meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.voice-list__actions {
  display: flex;
  gap: 0.5rem;
}

.voice-list__action {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.voice-list__action:hover {
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent);
}

.voice-list__action--danger:hover {
  background: rgba(248, 113, 113, 0.2);
  color: var(--danger);
}

.voice-editor {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.voice-editor__meta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.voice-editor__identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem 1rem;
  align-items: end;
}

.voice-editor__name-field {
  min-width: 200px;
}

.voice-editor__toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  min-height: 2.6rem;
}

.voice-editor__language {
  max-width: 260px;
  width: min(100%, 260px);
}

.voice-editor__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.voice-editor__canvas {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(320px, 1fr);
  gap: 2rem;
  align-items: start;
}

.voice-available,
.voice-mix {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.voice-available__header,
.voice-mix__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.voice-available__title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.voice-filter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
}

.voice-filter__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.voice-filter__controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.voice-filter select {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.55);
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-size: 0.95rem;
  min-width: 0;
  flex: 1 1 200px;
}

.voice-filter select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.voice-gender-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.voice-gender-filter__button {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.45);
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.voice-gender-filter__button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.voice-gender-filter__button[aria-pressed="true"] {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.voice-available__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.voice-available__empty {
  margin: 0;
  padding: 1.25rem 1rem;
  text-align: center;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.3);
}

.voice-available__card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.33);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: grab;
  transition: border 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.voice-available__card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.voice-available__card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.voice-available__card.is-active {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.12);
  cursor: default;
}

.voice-available__info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.voice-available__name {
  font-weight: 600;
}

.voice-available__meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.voice-available__add {
  border: none;
  border-radius: 12px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.voice-available__add:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

.voice-available__add:disabled {
  cursor: default;
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

.voice-mix__dropzone {
  border: 2px dashed rgba(148, 163, 184, 0.25);
  border-radius: 20px;
  padding: 1.5rem;
  min-height: 320px;
  background: rgba(15, 23, 42, 0.25);
  transition: border 0.2s ease, background 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.voice-mix__dropzone.is-hovered {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
}

.voice-mix__empty {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.voice-mix__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mix-voice {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.4);
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.mix-voice__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mix-voice__info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mix-voice__title {
  font-weight: 600;
}

.mix-voice__meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.mix-voice__weight {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.mix-voice__remove {
  border: none;
  border-radius: 12px;
  width: 28px;
  height: 28px;
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.mix-voice__remove:hover {
  background: rgba(248, 113, 113, 0.35);
  color: #fff;
}

.mix-slider {
  width: 100%;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  outline: none;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.mix-slider:focus-visible {
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.mix-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 6px 15px rgba(14, 165, 233, 0.4);
  border: none;
}

.mix-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  box-shadow: 0 6px 15px rgba(14, 165, 233, 0.4);
}

.voice-editor__actions {
  display: grid;
  gap: 1.25rem;
}

.voice-preview {
  display: grid;
  gap: 0.9rem;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.6);
  box-shadow: 0 16px 40px rgba(8, 15, 32, 0.45);
  width: min(100%, 520px);
}

.field--slider {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-start;
  width: min(100%, 420px);
}

.field--slider label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#preview-speed {
  width: 100%;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  outline: none;
  transition: box-shadow 0.2s ease;
}

#preview-speed:focus-visible {
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

#preview-speed::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  box-shadow: 0 6px 15px rgba(14, 165, 233, 0.4);
}

#preview-speed::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  box-shadow: 0 6px 15px rgba(14, 165, 233, 0.4);
}

.voice-preview__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
  width: min(100%, 420px);
}

.voice-preview audio {
  width: min(100%, 420px);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.voice-preview textarea {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(11, 18, 34, 0.85);
  min-height: 140px;
  width: min(100%, 420px);
  max-width: 420px;
  align-self: flex-start;
}

.voice-status {
  min-height: 1.2rem;
  font-size: 0.9rem;
}

.voice-status--info {
  color: var(--accent);
}

.voice-status--success {
  color: var(--success);
}

.voice-status--warning {
  color: var(--warning);
}

.voice-status--danger {
  color: var(--danger);
}

.voice-mixer[data-state="loading"] .voice-editor {
  opacity: 0.6;
  pointer-events: none;
}

[data-state="locked"] {
  cursor: not-allowed;
}

select[data-state="locked"],
input[data-state="locked"] {
  background: rgba(15, 23, 42, 0.35);
  color: rgba(148, 163, 184, 0.8);
  border-color: rgba(148, 163, 184, 0.2);
}

.icon-button {
  appearance: none;
  border-radius: 16px;
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.4);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.voice-editor__identity > .voice-editor__toolbar {
  align-self: end;
}

.icon-button svg {
  width: 1.15rem;
  height: 1.15rem;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-button--borderless {
  background: transparent;
  border-color: transparent;
}

.icon-button--borderless:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.3);
}

.icon-button--borderless:focus-visible {
  border-color: var(--accent);
}

.icon-button--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  color: #fff;
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.32);
}

.icon-button--primary:hover {
  box-shadow: 0 14px 28px rgba(14, 165, 233, 0.4);
}

.icon-button--danger {
  background: linear-gradient(135deg, var(--danger), #ef4444);
  border: none;
  color: #fff;
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.28);
}

.icon-button--danger:hover {
  box-shadow: 0 14px 30px rgba(248, 113, 113, 0.35);
}

.icon-button--danger:disabled {
  background: rgba(248, 113, 113, 0.2);
  color: rgba(248, 113, 113, 0.65);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.icon-button--primary:disabled {
  background: rgba(56, 189, 248, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: rgba(255, 255, 255, 0.8);
  box-shadow: none;
}

.spinner {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.28);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner--sm {
  width: 0.85rem;
  height: 0.85rem;
}

.spinner--lg {
  width: 1.5rem;
  height: 1.5rem;
  border-width: 3px;
}

.spinner--muted {
  border-color: rgba(148, 163, 184, 0.2);
  border-top-color: rgba(148, 163, 184, 0.6);
}

.button[data-role="preview-button"] {
  position: relative;
}

.button[data-role="preview-button"][data-loading="true"] {
  padding-left: 2.8rem;
  color: rgba(255, 255, 255, 0.8);
}

.button[data-role="preview-button"][data-loading="true"]::after {
  content: "";
  position: absolute;
  left: 1.1rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-right-color: rgba(255, 255, 255, 0.85);
  animation: spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .button[data-role="preview-button"][data-loading="true"]::after,
  .button[data-loading="true"]:not([data-role="preview-button"])::after,
  [data-role="new-job-modal"][data-submitting="true"] .wizard-card__stage::before,
  .spinner {
    animation-duration: 1.6s;
  }
}

@media (max-width: 980px) {
  .voice-mixer__layout {
    grid-template-columns: 1fr;
  }

  .voice-mixer__profiles {
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    padding-right: 0;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .voice-editor__canvas {
    grid-template-columns: 1fr;
  }

  .voice-available__list {
    max-height: none;
    padding-right: 0;
  }

  .voice-available__header,
  .voice-mix__header {
    align-items: stretch;
  }

  .voice-filter {
    width: 100%;
  }

  .voice-mix__dropzone {
    min-height: 220px;
  }

  .field--slider label {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .voice-editor__identity {
    grid-template-columns: 1fr;
  }

  .voice-editor__toolbar {
    justify-content: flex-start;
  }

  .settings__section {
    grid-template-columns: 1fr;
  }

  .field--choices {
    grid-template-columns: 1fr;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.entity-tabs__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.875rem;
  padding-right: 1rem;
}

.entity-tabs__status-text {
  font-weight: 500;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
