/* Dubbing workspace. The public site and the Studio share the same color tokens. */
.studio-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100dvh;
}
.studio-shell .studio-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
}
.studio-sidebar .brand {
  font-size: 24px;
  letter-spacing: -.055em;
  width: fit-content;
  margin-bottom: 5px;
}
.studio-sidebar .brand-mark { border-radius: 9px; background: var(--ui-forest); }
.studio-back {
  color: var(--muted);
  font-size: .83rem;
  text-decoration: none;
  padding-inline: 3px;
}
.studio-shell button, .studio-shell .download {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  color: var(--ui-on-cta);
  background: var(--ui-cta);
  border: 1px solid var(--ui-cta);
  border-radius: 8px;
  font: 660 .84rem/1.35 var(--ui-font);
  text-decoration: none;
}
.studio-shell :is(button, .download):hover:not(:disabled) { filter: brightness(.94); }
.studio-shell :is(button, .download).secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.studio-shell #newProject { width: 100%; }
.studio-shell summary { color: var(--ink); cursor: pointer; font-weight: 650; }
.studio-projects > summary, #service-details > summary {
  font-size: .78rem;
  margin: 0 2px 7px;
  color: var(--muted);
}
#projects { display: grid; gap: 3px; }
#projects .project-item {
  min-width: 0;
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-color: transparent;
  padding: 8px 10px;
}
.project-item > span { min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.project-item small, .studio-shell small { font-size: .75rem; }
#projects .project-item:hover { background: var(--soft); filter: none; }
#projects .project-item[aria-current="true"] { color: var(--green); background: var(--green-soft); }
#projects > p { margin: 0 5px; font-size: .8rem; }
.studio-tools { display: grid; gap: 6px; padding-block: 10px; border-top: 1px solid var(--line); }
.studio-shell .studio-tools button { justify-content: flex-start; border-color: transparent; }
.studio-shell .studio-tools button:hover:not(:disabled) { background: var(--soft); filter: none; }
.studio-shell .status { white-space: pre-line; color: var(--muted); font-size: .77rem; margin: 8px 2px; }

.studio-shell main { min-width: 0; width: 100%; max-width: 1510px; padding: 28px clamp(16px, 4vw, 52px) 54px; }
.studio-header, .studio-display-options, .studio-actions, .studio-shell .toolbar, .studio-shell .toolbar > div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}
.studio-header { justify-content: space-between; align-items: flex-start; padding-block: 2px 20px; gap: 12px; }
.studio-header > div:first-child { min-width: 0; }
.studio-display-options { flex-wrap: nowrap; }
.studio-shell .studio-display-options select { width: auto; max-width: 148px; }
.studio-display-options button { white-space: nowrap; }
.studio-breadcrumb { font-size: .83rem; font-weight: 650; color: var(--green); margin: 0 0 5px; }
.studio-shell h1 {
  font: 740 clamp(26px, 4vw, 42px)/1.17 var(--ui-font);
  letter-spacing: -.05em;
  margin: 0;
  overflow-wrap: anywhere;
}
.studio-shell h2 { font: 720 1.14rem/1.25 var(--ui-font); letter-spacing: -.025em; margin: 0; }
.studio-shell h3 { margin-bottom: 9px; font-size: 1rem; }
.studio-shell .muted { font-size: .84rem; line-height: 1.5; color: var(--muted); }
.studio-shell .studio-actions { margin: 0 0 16px; }
.studio-shell .toolbar { justify-content: space-between; gap: 11px; }

.studio-shell input:not([type="checkbox"], [type="radio"]),
.studio-shell textarea, .studio-shell select {
  min-width: 0;
  min-height: 43px;
  max-width: 100%;
  padding: 8px 11px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.studio-shell input:not([type="checkbox"], [type="radio"]), .studio-shell textarea { width: 100%; }
.studio-shell input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ui-cta); margin: 0; }
.studio-shell textarea { resize: vertical; min-height: 94px; }
.studio-shell select:disabled, .studio-shell textarea:disabled, .studio-shell input:disabled { opacity: .65; }
.studio-shell label { min-width: 0; }

.empty-workspace {
  padding: clamp(12px, 2.9vw, 29px);
  background: var(--ui-tint);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.dropzone {
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  min-height: 328px;
  padding: 25px 16px;
  border: 1px dashed var(--muted);
  border-radius: 14px;
  background: var(--surface);
  transition: background-color .16s ease, border-color .16s ease;
}
.dropzone.is-dragging { border-color: var(--green); background: var(--green-soft); }
.dropzone .upload-symbol {
  display: grid;
  place-items: center;
  width: 55px;
  height: 55px;
  margin-bottom: 17px;
  border-radius: 14px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 1.6rem;
  font-weight: 700;
}
.dropzone h2 { font-size: clamp(21px, 4vw, 27px); }
.dropzone p { margin: 8px 0 17px; color: var(--muted); font-size: .89rem; }
.dropzone small { margin-top: 11px; }

.studio-shell :is(.preview, .target-language-bar, .cast-panel, .editor, .result, .statistics-panel),
.studio-shell #progress-panel, .studio-shell #error-panel, .studio-shell #notice {
  min-width: 0;
  padding: clamp(14px, 2.45vw, 23px);
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
}
.studio-shell :is(.cast-panel, .editor, .statistics-panel) { margin-top: 17px; }
.studio-shell .workspace { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 16px; align-items: start; }
.studio-shell .preview-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
#duration { color: var(--muted); text-align: end; font-size: .8rem; font-variant-numeric: tabular-nums; }
.studio-shell video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 540px;
  background: #121814;
  border-radius: 8px;
}
.studio-shell .glossary { margin-top: 14px; }
.studio-shell .glossary textarea { margin-top: 10px; }
.studio-shell .glossary p { margin-bottom: 0; }
.studio-shell .target-language-bar { display: grid; align-content: start; gap: 12px; }
.studio-shell .target-language-bar label, .studio-shell dialog label { display: grid; align-content: start; gap: 5px; font-size: .85rem; font-weight: 600; }
.studio-shell .target-language-bar p { margin-bottom: 0; }
.studio-shell #notice { white-space: pre-wrap; padding: 11px 14px; margin-bottom: 13px; }
.studio-shell #notice.error, .studio-shell #progress-panel.failed { color: var(--danger); background: var(--danger-bg); }
.studio-shell #progress-panel { margin-bottom: 12px; padding-block: 14px; }
.studio-shell .progress-head { display: flex; justify-content: space-between; gap: 15px; }
.studio-shell progress { width: 100%; height: 9px; margin-top: 9px; accent-color: var(--ui-cta); }
#progress-warning { margin-bottom: 0; color: var(--warning); font-size: .83rem; }
#progress-warning:empty, .dialog-notice:empty { display: none; }
.studio-shell #error-panel { margin-bottom: 14px; padding-block: 12px; color: var(--danger); }
#error-detail { margin-bottom: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.studio-shell .result { margin-bottom: 16px; background: var(--green-soft); }
.studio-shell .result :is(video, audio) { margin-top: 15px; }
.studio-shell .statistics-panel .toolbar > strong { color: var(--green); font-size: .84rem; }
#statistics-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(225px, 100%), 1fr)); gap: 0 18px; margin-top: 8px; }
.statistics-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .8rem; }
.statistics-row strong { white-space: nowrap; }
.statistics-row.is-active { color: var(--green); }

.studio-shell .cast-panel > p { margin: 9px 0 12px; }
#cast { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(247px, 100%), 1fr)); gap: 12px; }
.speaker-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.speaker-card audio { height: 36px; }
.voice-metrics { width: 100%; font-size: .74rem; border-collapse: collapse; }
.voice-metrics td { padding: 5px 2px; border-bottom: 1px solid var(--line); }
.voice-metrics td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#count { display: inline-block; color: var(--green); font-size: .83rem; margin-left: 4px; }
.studio-shell .empty { margin: 0; padding: 20px 0 3px; text-align: center; color: var(--muted); }
.studio-shell .segment {
  min-width: 0;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(90px, .5fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
}
.studio-shell .segment > div { min-width: 0; }
.studio-shell .segment label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .78rem; }
.studio-shell .segment input { min-height: 35px; margin-bottom: 6px; }
.studio-shell .segment textarea { min-height: 132px; }
.studio-shell .segment > button {
  min-width: 37px;
  min-height: 37px;
  align-self: start;
  padding: 0;
  border-color: transparent;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 1rem;
}
.voice-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; grid-column: 1 / -1; }
.voice-controls audio { height: 37px; max-width: 360px; }

.studio-shell dialog {
  width: min(670px, calc(100% - 32px));
  max-height: calc(100dvh - 30px);
  padding: clamp(16px, 3vw, 26px);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 18px 90px rgb(0 0 0 / 25%);
}
.studio-shell dialog::backdrop { background: rgb(13 27 17 / 63%); }
.studio-shell dialog > .toolbar, .studio-shell dialog form > .toolbar { margin-bottom: 12px; }
.studio-shell dialog label { margin-block: 10px; }
.studio-shell .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.studio-shell .choice {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.choice:has(input:checked) { background: var(--green-soft); border-color: var(--green); }
.studio-shell .dialog-notice { white-space: pre-line; color: var(--muted); margin-bottom: 6px; }
.studio-shell .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
#upload-name { overflow-wrap: anywhere; padding: 8px 11px; margin: 0; color: var(--green); background: var(--green-soft); border-radius: 8px; font-size: .87rem; font-weight: 650; }
#upload-target-note { margin: 7px 0 11px; }
#reference-mix-form { margin: 15px 0 23px; }
.reference-mix-group { min-width: 0; margin: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; }
.reference-mix-group legend { padding: 0 4px; font-size: .88rem; }
#model-list { display: grid; gap: 8px; margin-block: 12px; }
.model-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.model-card audio { grid-column: 1 / -1; height: 36px; }
.add-model { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 15px; }

@media (max-width: 960px) {
  .studio-shell { grid-template-columns: 196px minmax(0, 1fr); }
  .studio-shell .workspace { grid-template-columns: 1fr; }
  .studio-shell .segment { gap: 8px; }
}
@media (max-width: 700px) {
  .studio-shell { display: block; }
  .studio-shell .studio-sidebar {
    position: static;
    height: auto;
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }
  .studio-sidebar .brand { margin: 0; }
  .studio-back { text-align: right; }
  .studio-shell #newProject { width: fit-content; }
  .studio-shell:has(#studio-work[hidden]) #newProject { display: none; }
  .studio-projects, .studio-tools, #service-details { grid-column: 1 / -1; }
  #projects { max-height: 140px; overflow-y: auto; }
  .studio-shell .studio-tools { display: flex; flex-wrap: wrap; gap: 5px; padding-block: 4px; }
  .studio-shell .studio-tools button { border-color: var(--line); }
  .studio-shell main { padding-top: 18px; }
  .studio-shell .segment { grid-template-columns: minmax(0, 1fr) auto; }
  .studio-shell .segment > div { grid-column: 1; }
  .studio-shell .segment > button { grid-column: 2; grid-row: 1; }
  .studio-shell .segment > .voice-controls { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .studio-shell .settings-grid { grid-template-columns: 1fr; gap: 6px; }
  .studio-shell .dropzone { min-height: 275px; }
  .studio-header { padding-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .dropzone { transition: none; }
}
