:root {
  color-scheme: dark;
  --bg: #070a0f;
  --bg-2: #0d121b;
  --panel: rgba(18, 25, 36, 0.86);
  --panel-2: rgba(26, 35, 49, 0.92);
  --ink: #eef6ff;
  --muted: #91a2b7;
  --line: rgba(159, 184, 214, 0.22);
  --line-strong: rgba(160, 206, 255, 0.46);
  --cyan: #70e4ff;
  --gold: #e4c77b;
  --blue: #377dff;
  --danger: #ff5d6c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(112, 228, 255, 0.18), transparent 30%),
    radial-gradient(circle at 80% 18%, rgba(228, 199, 123, 0.13), transparent 26%),
    linear-gradient(135deg, #070a0f 0%, #111827 48%, #090d14 100%);
  color: var(--ink);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid rgba(112, 228, 255, 0.34);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(33, 190, 216, 0.82));
  color: #f7fbff;
  padding: 4px 8px;
  cursor: pointer;
  min-height: 26px;
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(23, 122, 180, 0.22);
}

button:hover {
  border-color: rgba(228, 199, 123, 0.8);
}

button,
.list-item,
.sentence-card,
.tree-row {
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.list-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

button.ghost {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

button.danger,
.tree-icon.danger {
  border-color: rgba(255, 93, 108, 0.48);
  background: rgba(255, 93, 108, 0.12);
  color: #ffb8c0;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 9, 15, 0.76);
  color: var(--ink);
  padding: 7px 9px;
  outline-color: var(--cyan);
  font-size: 13px;
}

textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.compact-textarea {
  min-height: 82px;
}

a {
  color: var(--cyan);
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 23, 35, 0.94), rgba(7, 10, 15, 0.96));
  padding: 14px;
  overflow: auto;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(112, 228, 255, 0.95), rgba(228, 199, 123, 0.85)),
    linear-gradient(#111827, #111827);
  box-shadow: 0 0 28px rgba(112, 228, 255, 0.35);
}

.brand strong {
  display: block;
  font-size: 16px;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.tree-hint {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.tree-node {
  margin: 4px 0;
}

.tree-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px;
}

.tree-row.active {
  border-color: rgba(112, 228, 255, 0.45);
  background: linear-gradient(135deg, rgba(112, 228, 255, 0.12), rgba(228, 199, 123, 0.08));
}

.tree-title {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  text-align: left;
  padding: 5px 6px;
  min-height: 26px;
  font-size: 12px;
}

.tree-toggle {
  width: 17px;
  flex: 0 0 17px;
  color: var(--gold);
}

.tree-tools {
  display: flex;
  gap: 5px;
}

.tree-icon {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 5px;
  background: rgba(112, 228, 255, 0.1);
  box-shadow: none;
  color: var(--cyan);
  font-weight: 800;
}

.tree-children {
  margin-left: 18px;
  border-left: 1px solid rgba(112, 228, 255, 0.2);
  padding-left: 8px;
}

.workspace {
  min-width: 0;
  padding: 16px;
  overflow: auto;
}

.hero {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)),
    linear-gradient(120deg, rgba(20, 28, 42, 0.98), rgba(10, 15, 24, 0.96));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.product-title {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
  color: transparent;
  background: linear-gradient(92deg, #ffffff 0%, #bfefff 28%, #e4c77b 60%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 34px rgba(112, 228, 255, 0.18);
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.hero-points span {
  border: 1px solid rgba(228, 199, 123, 0.48);
  border-radius: 999px;
  padding: 4px 9px;
  background: linear-gradient(135deg, rgba(228, 199, 123, 0.16), rgba(112, 228, 255, 0.08));
  color: #ffe6a2;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(228, 199, 123, 0.08);
}

.selected-title {
  margin-top: 10px;
  font-size: 15px;
  color: #dcecff;
  font-weight: 700;
}

.crumbs {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  gap: 8px;
}

.hero-stats div {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
}

.hero-stats strong {
  display: block;
  color: var(--cyan);
  font-size: 20px;
}

.hero-stats span {
  color: var(--muted);
  font-size: 12px;
}

.workflow-picker {
  display: grid;
  gap: 12px;
  min-width: min(360px, 100%);
}

.workflow-picker label {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  margin: 0;
}

.global-settings-btn {
  min-height: 40px;
  border-color: rgba(112, 228, 255, 0.55);
  background: rgba(112, 228, 255, 0.11);
  color: #e9fbff;
  font-weight: 900;
}

.workflow-select {
  min-height: 58px;
  border-radius: 10px;
  border-color: rgba(228, 199, 123, 0.68);
  background:
    linear-gradient(135deg, rgba(228, 199, 123, 0.16), rgba(112, 228, 255, 0.08)),
    rgba(5, 9, 15, 0.9);
  color: #fff6d6;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 18px 44px rgba(228, 199, 123, 0.12);
}

.workflow-board {
  margin-bottom: 18px;
}

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

.workflow-step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  border: 1px solid rgba(112, 228, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  box-shadow: none;
  text-align: left;
  min-height: 0;
}

.workflow-step span {
  color: var(--gold);
  font-weight: 900;
  font-size: 13px;
}

.workflow-step strong {
  color: var(--ink);
  line-height: 1.55;
  font-size: 13px;
  font-weight: 650;
}

.workflow-step em {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.workflow-step:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 199, 123, 0.62);
  background: rgba(112, 228, 255, 0.055);
}

.mapping-grid,
.asset-grid,
.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
}

.aligned-grid {
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  align-items: stretch;
}

.aligned-left {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.aligned-right {
  display: none;
}

.aligned-left .stage,
.aligned-right .mapping-card {
  min-height: 0;
}

.aligned-left .stage {
  grid-column: auto;
}

.aligned-right .mapping-card {
  grid-column: 2;
}

.grid-row-1 {
  grid-row: auto;
}

.grid-row-2 {
  grid-row: auto;
}

.grid-row-3 {
  grid-row: auto;
}

.grid-row-4 {
  grid-row: auto;
}

.asset-grid {
  margin-top: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.douyin-panel {
  grid-column: 1 / -1;
}

.douyin-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 62px 96px;
  gap: 8px;
  align-items: center;
}

.button-link {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(112, 228, 255, 0.34);
  border-radius: 7px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.inline-check input {
  width: auto;
}

.douyin-cookie-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 260px);
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

#douyinDownloadResult pre {
  white-space: pre-wrap;
  color: #ffb8c0;
  font-size: 12px;
  line-height: 1.5;
}

.douyin-frame-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  aspect-ratio: 16 / 9;
}

.douyin-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.panel,
.stage,
.modal-card,
.compose-summary div {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.panel {
  padding: 12px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

h2,
h3,
label {
  margin: 0 0 8px;
  font-size: 14px;
  color: #f5f9ff;
}

.required-label {
  color: #ffe1a6;
  font-weight: 900;
}

.required-label::before {
  content: "*";
  display: inline-block;
  margin-right: 4px;
  color: #ff5d6c;
  font-weight: 900;
}

.optional-label {
  color: var(--muted);
  font-weight: 650;
}

.panel p,
.stage p,
.modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 12px;
}

.ai-settings-card {
  max-height: min(86vh, 880px);
  overflow: auto;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.inline-workbench {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.audio-section {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.03);
}

.selected-copy {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  line-height: 1.45;
  font-size: 13px;
  max-height: 82px;
  overflow: auto;
}

.selected-copy.active {
  color: #fff7d7;
  border-color: rgba(228, 199, 123, 0.82);
  background:
    linear-gradient(135deg, rgba(228, 199, 123, 0.18), rgba(112, 228, 255, 0.08)),
    rgba(255, 255, 255, 0.04);
  box-shadow: inset 4px 0 0 var(--gold), 0 10px 26px rgba(228, 199, 123, 0.12);
  font-weight: 700;
}

.sentence-summary {
  grid-template-columns: 64px 1fr;
}

.sentence-list {
  display: grid;
  gap: 6px;
  max-height: 620px;
  overflow: auto;
}

.modal-sentence-list {
  max-height: min(68vh, 680px);
  padding-right: 4px;
}

.sentence-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: start;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  box-shadow: none;
  color: var(--ink);
  padding: 10px;
  font-size: 13px;
}

.sentence-card.active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(112, 228, 255, 0.22), 0 14px 30px rgba(21, 151, 191, 0.16);
  transform: translateY(-1px);
}

.sentence-card.saved {
  border-color: rgba(228, 199, 123, 0.8);
  background: linear-gradient(135deg, rgba(228, 199, 123, 0.16), rgba(112, 228, 255, 0.08));
}

.sentence-no {
  color: var(--gold);
  font-weight: 800;
}

.sentence-text {
  line-height: 1.55;
}

.sentence-text small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.sentence-text b {
  display: inline-block;
  margin-left: 8px;
  border: 1px solid rgba(228, 199, 123, 0.55);
  border-radius: 999px;
  padding: 1px 6px;
  color: #ffe6a2;
  font-size: 11px;
}

.sentence-tools {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin: -2px 0 5px;
}

.sentence-tools button {
  min-height: 22px;
  padding: 3px 7px;
  font-size: 11px;
}

.sentence-badge {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 12px;
}

.sentence-card.saved .sentence-badge {
  color: #ffe6a2;
  border-color: rgba(228, 199, 123, 0.55);
}

.pipeline {
  display: grid;
  gap: 12px;
}

.pipeline.aligned-left,
.aligned-right {
  display: contents;
}

.stage {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 10px 12px;
  align-content: start;
}

.model-select {
  width: 220px;
  max-width: 100%;
}

.video-composer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0 8px;
}

.mode-switch button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.mode-switch button.active {
  border-color: rgba(228, 199, 123, 0.78);
  background: linear-gradient(135deg, rgba(228, 199, 123, 0.2), rgba(112, 228, 255, 0.08));
  color: #fff6d6;
  box-shadow: inset 0 0 0 1px rgba(228, 199, 123, 0.18);
}

.video-wide {
  grid-column: 1 / -1;
}

.video-half {
  min-width: 0;
}

.final-video-composer {
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 0.86fr);
  grid-template-rows: auto auto minmax(130px, 1fr) auto;
  grid-template-areas:
    "reference model"
    "reference audio"
    "reference music"
    "prompt prompt";
  align-items: start;
}

.final-video-composer > .composer-block:nth-child(1) {
  grid-area: model;
}

.final-video-composer > .composer-block:nth-child(2) {
  grid-area: audio;
}

.final-video-composer > .composer-block:nth-child(3) {
  grid-area: reference;
  min-height: 100%;
}

.final-video-composer > .composer-block:nth-child(4) {
  grid-area: music;
  min-height: 130px;
  align-self: stretch;
}

.final-video-composer > .seedance-panel {
  grid-area: prompt;
}

.final-video-composer #faceReferenceVideoPreview,
.final-video-composer #referenceFilesList:empty + #assetSourceState {
  margin-top: 10px;
}

.final-video-composer #faceReferenceVideoPreview video,
.final-video-composer #faceReferenceVideoPreview img {
  max-height: 420px;
  min-height: 260px;
}

.final-video-composer .composer-block {
  width: 100%;
  min-width: 0;
}

.final-video-composer .selected-audio-preview,
.final-video-composer .volume-control,
.final-video-composer .source-state,
.final-video-composer select,
.final-video-composer input {
  max-width: 100%;
  min-width: 0;
}

.final-video-composer .selected-audio-preview {
  overflow: hidden;
}

.final-video-composer .selected-audio-preview audio {
  display: block;
  max-width: 100%;
}

.final-video-composer #localReferenceFile {
  min-height: 48px;
}

.final-video-composer .video-model-card,
.final-video-composer > .composer-block:nth-child(1) {
  align-self: start;
}

.composer-block {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.prompt-block {
  grid-row: auto;
}

.block-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.block-head span {
  color: var(--gold);
  font-weight: 900;
}

.block-head strong {
  color: var(--ink);
}

.block-head em {
  display: none;
}

.composer-block label {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.source-state {
  margin-top: 6px;
  border: 1px solid rgba(112, 228, 255, 0.18);
  border-radius: 7px;
  padding: 5px 7px;
  color: #cfefff;
  background: rgba(112, 228, 255, 0.06);
  font-size: 11px;
  line-height: 1.45;
}

.media-preview {
  margin-top: 7px;
  border: 1px solid rgba(112, 228, 255, 0.22);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
}

.media-preview img,
.media-preview video {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: #050912;
}

.media-preview .media-preview-name {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-files-list {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.reference-file-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(112, 228, 255, 0.2);
  border-radius: 7px;
  padding: 5px 6px;
  background: rgba(112, 228, 255, 0.05);
}

.reference-file-chip span {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seedance-panel {
  border-color: rgba(228, 199, 123, 0.45);
  background: linear-gradient(135deg, rgba(228, 199, 123, 0.09), rgba(112, 228, 255, 0.05));
}

.seedance-compact-head,
.seedance-config,
.seedance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  margin-bottom: 8px;
}

.seedance-compact-head {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 8px;
}

.seedance-config small {
  color: var(--gold);
  white-space: nowrap;
  font-size: 11px;
}

.seedance-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seedance-grid label {
  display: grid;
  gap: 5px;
  margin: 0;
  color: var(--muted);
}

.compose-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.compose-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-end;
}

.stage.collapsed .inline-workbench {
  display: none;
}

.stage.collapsed {
  background: rgba(18, 25, 36, 0.68);
}

.stage-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.script-length-control {
  width: min(220px, 100%);
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.script-length-control select {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.mini-btn {
  min-height: 22px;
  padding: 3px 7px;
  font-size: 11px;
}

.list-actions,
.mapped-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.list-actions {
  margin-top: 7px;
}

.danger.mini-btn {
  border-color: rgba(255, 93, 108, 0.42);
  color: #ffd6db;
}

.stage.accent {
  border-color: rgba(228, 199, 123, 0.5);
}

.stage.stage-focus {
  border-color: rgba(228, 199, 123, 0.9);
  box-shadow: 0 0 0 2px rgba(228, 199, 123, 0.28), var(--shadow);
}

.stage-index {
  color: var(--gold);
  font-size: 21px;
  font-weight: 900;
}

.mapping-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.generation-progress {
  display: grid;
  gap: 8px;
}

.generation-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.generation-progress-head strong {
  color: #f8fbff;
}

.generation-progress-head span {
  color: var(--gold);
  font-weight: 900;
}

.generation-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.generation-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width 0.35s ease;
}

.generation-progress small {
  color: var(--muted);
}

.mapping-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mapping-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.mapping-card strong {
  display: block;
  color: var(--ink);
  line-height: 1.45;
  word-break: break-word;
}

.mapping-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.mapped-list {
  margin-top: auto;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.mapped-item {
  border: 1px solid rgba(112, 228, 255, 0.22);
  border-radius: 7px;
  padding: 8px;
  background: rgba(112, 228, 255, 0.06);
  display: grid;
  gap: 5px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.mapped-item.active {
  border-color: rgba(228, 199, 123, 0.95);
  background: linear-gradient(135deg, rgba(228, 199, 123, 0.18), rgba(112, 228, 255, 0.08));
  box-shadow: inset 4px 0 0 var(--gold);
}

.mapped-item:hover {
  transform: translateY(-1px);
  border-color: rgba(112, 228, 255, 0.45);
}

.mapped-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.mapped-item-head b {
  border: 1px solid rgba(228, 199, 123, 0.62);
  border-radius: 999px;
  padding: 2px 6px;
  color: var(--gold);
  font-size: 11px;
}

.mapped-meta {
  color: var(--muted);
  font-size: 11px;
}

.mapped-item a,
.mapped-item code {
  font-size: 12px;
  word-break: break-all;
}

.mapped-item code {
  color: var(--muted);
  font-family: "Fira Code", Consolas, monospace;
}

.mapped-item audio,
.mapped-item video {
  width: 100%;
  max-height: 220px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
}

.video-play-zone {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(228, 199, 123, 0.42);
  border-radius: 8px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(228, 199, 123, 0.12), rgba(112, 228, 255, 0.07));
}

.video-play-zone video {
  width: 100%;
  max-height: 260px;
  border-radius: 7px;
  background: #000;
}

.mapped-video-current {
  display: grid;
  gap: 3px;
}

.mapped-video-current strong {
  color: var(--gold);
  font-size: 12px;
}

.mapped-video-current code {
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

.mapped-video-list {
  display: grid;
  gap: 6px;
}

.mapped-video-row {
  width: 100%;
  min-height: 0;
  justify-content: start;
  display: grid;
  gap: 3px;
  text-align: left;
  border-color: rgba(112, 228, 255, 0.2);
  background: rgba(112, 228, 255, 0.05);
}

.mapped-video-row span {
  color: var(--ink);
  font-size: 12px;
  word-break: break-all;
}

.mapped-video-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.mapped-video-row.active {
  border-color: rgba(228, 199, 123, 0.85);
  background: rgba(228, 199, 123, 0.14);
}

.reference-video-uploader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 6px;
}

#referenceVideoPreview {
  width: 100%;
  max-height: 180px;
  border-radius: 8px;
  background: #000;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}

.form-row.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recorder {
  display: grid;
  gap: 7px;
  align-items: center;
  margin-bottom: 10px;
}

.audio-compact-toolbar {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.recording-control-group,
.reference-audio-source-group {
  display: grid;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.recording-control-group {
  grid-template-columns: 78px 56px minmax(180px, 1fr) 82px;
}

.reference-audio-source-group {
  grid-template-columns: minmax(210px, 1.2fr) 102px minmax(88px, 0.7fr) 112px 72px;
}

.audio-compact-toolbar #referenceAudioSelect,
.audio-compact-toolbar #localReferenceAudioFile,
.audio-compact-toolbar #referenceVideoAudioFile {
  width: 100%;
  min-width: 0;
}

.audio-compact-toolbar #referenceVideoAudioFile[hidden] {
  display: none;
}

.audio-compact-toolbar button,
.audio-compact-toolbar input,
.audio-compact-toolbar select,
.audio-compact-toolbar .file-trigger {
  min-height: 24px;
  padding: 3px 6px;
  font-size: 12px;
}

.audio-compact-toolbar .file-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
}

.visually-hidden-file {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-toolbar {
  grid-template-columns: 66px 48px max-content minmax(220px, 1fr) minmax(140px, 0.8fr) 72px;
  margin-bottom: 0;
}

.audio-filter-row,
.audio-generate-row,
.audio-control-row {
  display: grid;
  grid-template-columns: 64px minmax(160px, 1fr) minmax(160px, 1fr);
  gap: 7px;
  align-items: center;
}

.audio-filter-row {
  grid-template-columns: 64px minmax(150px, 1fr) minmax(150px, 1fr) 70px;
}

.audio-control-row {
  grid-template-columns: 64px repeat(3, minmax(0, 1fr));
  margin-top: 6px;
}

.audio-quality-row {
  grid-template-columns: 64px repeat(3, minmax(0, 1fr));
}

.audio-control-row.audio-control-grid,
.audio-quality-row.audio-control-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.audio-control-grid label {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.audio-context-text {
  min-height: 46px;
  margin-top: 6px;
}

.audio-guidance-help {
  margin-top: 6px;
  border: 1px solid rgba(246, 200, 95, 0.68);
  border-radius: 7px;
  padding: 8px 10px;
  background: rgba(246, 200, 95, 0.16);
  color: #fff4c2;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.audio-toolbar input,
.audio-toolbar select,
.audio-toolbar button,
.audio-filter-row select,
.audio-filter-row button,
.audio-generate-row select,
.audio-generate-row input,
.audio-generate-row button,
.audio-control-row select,
.audio-context-text {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 12px;
}

.audio-generate-row label,
.audio-control-row label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.inline-label {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  width: max-content;
  justify-self: end;
  margin-right: -6px;
}

.model-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.model-readonly span {
  color: var(--muted);
}

.model-readonly strong {
  color: var(--text);
  font-weight: 700;
}

#recordingTag {
  min-width: 0;
}

.primary-wide {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  border-color: rgba(255, 229, 150, 0.85);
  background: linear-gradient(92deg, #0ea5e9 0%, #47e6ff 35%, #f6c85f 100%);
  color: #061018;
  font-weight: 900;
  box-shadow: 0 12px 34px rgba(71, 230, 255, 0.24), 0 8px 24px rgba(246, 200, 95, 0.18);
}

button.ghost.primary-wide {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  box-shadow: none;
}

.composer-block .primary-wide,
.inline-workbench .primary-wide {
  display: flex;
  justify-content: center;
  align-items: center;
  grid-column: 1 / -1;
}

.primary-wide:hover {
  transform: translateY(-1px);
  border-color: #fff2b6;
}

.generate-video-wide {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
}

audio {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: block;
}

audio::-webkit-media-controls-enclosure {
  max-width: 100%;
}

#recordPreview {
  height: 26px;
  max-width: 260px;
}

.recording-status {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffdf74;
  font-size: 12px;
  font-weight: 800;
}

.recording-status[hidden] {
  display: none;
}

.recording-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff4d6d;
  box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.7);
  animation: recordingPulse 1s infinite;
}

.saved-recording-result {
  margin-top: 8px;
  border: 1px solid rgba(246, 200, 95, 0.62);
  border-radius: 8px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(246, 200, 95, 0.15), rgba(71, 230, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 22px rgba(246, 200, 95, 0.12);
}

.saved-recording-result[hidden] {
  display: none;
}

.batch-audio-panel {
  display: grid;
  gap: 9px;
  margin-top: 8px;
}

.batch-audio-panel[hidden] {
  display: none;
}

.batch-progress {
  display: grid;
  gap: 6px;
}

.batch-progress strong {
  color: #f5f9ff;
  font-size: 12px;
}

.batch-progress-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(112, 228, 255, 0.28);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
}

.batch-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #47e6ff, #f6c85f);
  transition: width 0.28s ease;
}

.batch-audio-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.segment-pill {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 12px;
}

.segment-pill strong,
.segment-pill span {
  line-height: 1;
  white-space: nowrap;
}

.segment-pill.pending {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}

.segment-pill.running {
  border-color: rgba(112, 228, 255, 0.6);
  background: rgba(112, 228, 255, 0.14);
  color: #e8fbff;
}

.segment-pill.done {
  border-color: rgba(246, 200, 95, 0.7);
  background: linear-gradient(135deg, rgba(112, 228, 255, 0.2), rgba(246, 200, 95, 0.24));
  color: #fff5c8;
}

.segment-pill.error {
  border-color: rgba(255, 93, 108, 0.62);
  background: rgba(255, 93, 108, 0.13);
  color: #ffd0d5;
}

.segment-generate-status {
  margin-top: 8px;
  border: 1px solid rgba(112, 228, 255, 0.38);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(112, 228, 255, 0.1);
  color: #dff9ff;
  font-size: 12px;
  font-weight: 800;
}

.segment-generate-status[hidden] {
  display: none;
}

.segment-fallback-note {
  display: block;
  margin-top: 6px;
  color: #ffdf74;
  font-size: 12px;
}

#regenerateSegmentAudioBtn.loading {
  border-color: rgba(112, 228, 255, 0.7);
  background: rgba(112, 228, 255, 0.18);
  color: #effdff;
  cursor: progress;
}

.saved-recording-title {
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 3px;
}

.saved-recording-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

@keyframes recordingPulse {
  70% {
    box-shadow: 0 0 0 8px rgba(255, 77, 109, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 109, 0);
  }
}

.list {
  display: grid;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
  margin-top: 10px;
}

.compact-list {
  max-height: 210px;
}

.list.tall {
  max-height: 460px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.list-item.active {
  border-color: var(--gold);
  box-shadow: inset 4px 0 0 var(--gold);
}

.reference-audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.reference-audio-actions .mini-btn {
  min-height: 26px;
}

.list-item:hover,
.sentence-card:hover,
.tree-row:hover {
  transform: translateY(-1px);
}

.item-title {
  font-weight: 800;
  margin-bottom: 4px;
  color: #f8fbff;
}

.item-meta,
.empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.result {
  margin-top: 10px;
  min-height: 22px;
  color: var(--cyan);
  word-break: break-all;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 7, 12, 0.76);
  backdrop-filter: blur(10px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    var(--panel-2);
}

.modal-card.large {
  width: min(1180px, 100%);
}

.modal-card.compact-modal {
  width: min(420px, 100%);
}

.modal-card.error-modal-card {
  width: min(680px, 100%);
}

#promptModal .modal-head h2 {
  color: #172033;
}

#promptModal .modal-head .close-modal {
  color: #172033;
  border-color: rgba(23, 32, 51, 0.28);
}

.video-line-card {
  background:
    linear-gradient(135deg, rgba(242, 245, 240, 0.97), rgba(232, 237, 242, 0.94)),
    #f4f6f2;
  color: #1b2430;
}

.video-line-card .modal-head {
  align-items: flex-start;
}

.video-line-card .modal-head h2 {
  color: #111827;
}

.video-line-card .modal-head p {
  margin: 6px 0 0;
  color: #526070;
  line-height: 1.5;
}

.video-line-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 14px;
}

.video-line-source,
.video-line-preview-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(30, 41, 59, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.video-line-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #111827;
}

.video-line-step span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #172033;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.video-line-url-row,
.video-line-record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.video-line-note {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid rgba(14, 116, 144, 0.2);
  border-radius: 8px;
  background: rgba(236, 254, 255, 0.78);
  color: #155e75;
  font-size: 12px;
  line-height: 1.5;
}

.video-line-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  color: #73808f;
  font-size: 12px;
}

.video-line-divider::before,
.video-line-divider::after {
  content: "";
  height: 1px;
  background: rgba(30, 41, 59, 0.14);
}

.video-line-preview {
  min-height: 220px;
  background: #0f172a;
}

.video-line-preview video {
  width: 100%;
  max-height: 330px;
  object-fit: contain;
  background: #0f172a;
}

#videoLineText {
  min-height: 180px;
}

#videoLineStatus[data-type="success"] {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(220, 252, 231, 0.8);
  color: #166534;
}

#videoLineStatus[data-type="info"] {
  border-color: rgba(14, 116, 144, 0.25);
  background: rgba(207, 250, 254, 0.72);
  color: #155e75;
}

@media (max-width: 860px) {
  .video-line-layout,
  .video-line-url-row,
  .video-line-record-row {
    grid-template-columns: 1fr;
  }
}

#openGeneratedVideoHistoryBtn {
  margin-top: 8px;
}

.error-modal-card p {
  margin: 0 0 10px;
  color: #fee2e2;
}

.error-modal-card pre {
  max-height: 48vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
  font-size: 12px;
  line-height: 1.5;
}

.result-preview-body {
  display: grid;
  gap: 10px;
}

.result-preview-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 280px);
  align-items: center;
  justify-content: start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.result-preview-toolbar label {
  color: var(--muted);
  font-size: 12px;
}

.result-preview-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 12px;
  min-height: 420px;
}

.result-preview-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: min(70vh, 720px);
  overflow: auto;
  padding-right: 4px;
}

.result-preview-row {
  width: 100%;
  min-height: 58px;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.result-preview-row.active {
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(56, 189, 248, 0.14);
}

.result-preview-row span,
.result-preview-row em {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-preview-row em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.result-preview-player {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 9px;
  min-width: 0;
}

.result-preview-player.audio-preview-player {
  grid-template-rows: auto auto auto auto minmax(120px, 1fr) auto;
  align-content: start;
}

.result-preview-empty {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.result-preview-empty.compact {
  min-height: 120px;
  padding: 12px;
  text-align: center;
}

.result-preview-empty[hidden] {
  display: none;
}

.result-preview-player strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-preview-mark-row {
  display: grid;
  grid-template-columns: minmax(160px, 260px) auto;
  gap: 8px;
  align-items: center;
  justify-content: start;
}

.result-preview-mark-row select {
  min-height: 30px;
}

.result-preview-mark-row button {
  white-space: nowrap;
}

.result-preview-body video,
.result-preview-body img {
  width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050912;
}

.result-preview-body audio {
  width: 100%;
}

.selected-audio-preview {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.selected-audio-preview[hidden] {
  display: none;
}

.selected-audio-preview audio {
  width: 100%;
}

.volume-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.volume-control input {
  grid-column: 1 / -1;
  width: 100%;
}

.volume-control span {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.result-preview-detail {
  color: var(--muted);
  font-size: 12px;
}

.result-preview-prompt {
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.18);
}

.result-preview-path {
  display: block;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
}

.result-name {
  margin-left: 8px;
  color: var(--muted);
}

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

  .result-preview-list {
    max-height: 180px;
  }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.modal-head-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-shrink: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.modal-grid section {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.14);
}

.compose-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.inline-summary {
  margin-bottom: 0;
}

.compose-summary div {
  padding: 12px;
}

.compose-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.compose-summary strong {
  color: var(--ink);
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 28px));
}

.toast {
  opacity: 0;
  transform: translateY(8px);
  border: 1px solid rgba(255, 125, 125, 0.52);
  border-radius: 9px;
  padding: 10px 12px;
  background:
    linear-gradient(135deg, rgba(93, 20, 32, 0.98), rgba(24, 29, 40, 0.98));
  color: #fff7f7;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(228, 199, 123, 0.65);
  background: linear-gradient(135deg, rgba(20, 91, 74, 0.98), rgba(24, 29, 40, 0.98));
  color: #f5fff9;
}

@media (max-width: 1100px) {
  .app-shell,
  .mapping-grid,
  .aligned-grid,
  .asset-grid,
  .modal-grid,
  .video-composer,
  .compose-footer,
  .mapping-sections {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 46vh;
  }

  .aligned-left,
  .aligned-right {
    display: grid;
    gap: 12px;
  }

  .aligned-right.hidden {
    display: none !important;
  }

  .aligned-left .stage,
  .aligned-right .mapping-card {
    grid-column: auto;
    grid-row: auto;
  }

  .final-video-composer {
    grid-template-rows: auto;
    grid-template-areas:
      "model"
      "reference"
      "audio"
      "music"
      "prompt";
  }

  .final-video-composer > .composer-block:nth-child(3) {
    min-height: 0;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .workspace,
  .sidebar,
  .hero {
    padding: 14px;
  }

  .hero-stats,
  .form-row,
  .recorder,
  .audio-toolbar,
  .audio-filter-row,
  .audio-generate-row,
  .douyin-controls,
  .sentence-card,
  .aligned-left {
    grid-template-columns: 1fr;
  }

  .sentence-badge {
    justify-self: start;
  }

  .recording-control-group {
    grid-template-columns: 1fr 1fr;
  }

  .recording-control-group #recordingTag,
  .recording-control-group #saveRecordingBtn {
    grid-column: 1 / -1;
  }

  .reference-audio-source-group {
    grid-template-columns: 1fr;
  }

  .reference-audio-source-group #extractReferenceAudioBtn,
  .reference-audio-source-group #openReferenceAudioModalBtn {
    width: 100%;
  }

  .stage-title-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .script-length-control {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}


.scene-composer,
.video-split-grid {
  margin-top: 10px;
}

.video-split-grid {
  display: grid;
  gap: 12px;
}

.nested-composer {
  margin-top: 0;
}

.scene-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.scene-composer .compact-textarea {
  min-height: 68px;
}

.scene-preview {
  min-height: 140px;
  border: 1px solid rgba(112, 228, 255, 0.2);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(6, 16, 24, 0.42);
  color: var(--muted);
  font-size: 12px;
}

.scene-preview img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}

.face-replace-panel {
  border-color: rgba(112, 228, 255, 0.36);
}

.digital-human-panel {
  border-color: rgba(228, 199, 123, 0.42);
  background: linear-gradient(135deg, rgba(112, 228, 255, 0.04), rgba(228, 199, 123, 0.06));
}

@media (max-width: 980px) {
  .scene-action-row {
    grid-template-columns: 1fr;
  }
}

/* React workflow redesign */
body {
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 255, 255, 0.96), transparent 26%),
    linear-gradient(135deg, #f7f9fb 0%, #eef2f6 42%, #ffffff 100%);
  color: #18202b;
}

.react-workbench.app-shell {
  min-height: 100vh;
  grid-template-columns: 292px minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.88), rgba(255,255,255,0.38)),
    linear-gradient(135deg, rgba(205, 214, 224, 0.25), rgba(255, 255, 255, 0));
}

.flow-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(241,245,249,0.9)),
    linear-gradient(135deg, rgba(255,255,255,0.45), rgba(164,174,190,0.14));
  border-right: 1px solid rgba(145, 158, 171, 0.28);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.8);
}

.flow-sidebar .brand,
.metal-hero,
.react-flow-summary,
.tab-stage {
  border-color: rgba(145, 158, 171, 0.24);
  box-shadow: 0 14px 34px rgba(31, 41, 55, 0.08), inset 0 1px 0 rgba(255,255,255,0.95);
}

.flow-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 12px;
  color: #5b6573;
  font-size: 13px;
  font-weight: 700;
}

.react-workspace {
  padding: 24px 28px 36px;
  max-width: 1500px;
  width: 100%;
}

.metal-hero,
.react-flow-summary,
.tab-stage {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(246,248,251,0.9)),
    linear-gradient(110deg, rgba(255,255,255,0.8), rgba(180,190,204,0.14));
}

.react-workbench .product-title {
  color: #1f2937;
  background: none;
  -webkit-text-fill-color: currentColor;
  text-shadow: none;
  letter-spacing: 0;
}

.react-workbench .eyebrow {
  color: #b08b2f;
  letter-spacing: 0.12em;
}

.react-workbench .selected-title,
.react-workbench .crumbs,
.react-workbench .panel-head p,
.react-workbench .stage p,
.react-workbench label {
  color: #526174;
}

.react-workbench .stage h2,
.react-workbench .panel-head h2,
.react-workbench .workflow-picker label {
  color: #1f2937;
}

.react-workbench textarea,
.react-workbench input,
.react-workbench select {
  background: linear-gradient(180deg, #ffffff, #f5f7fa);
  color: #172033;
  border: 1px solid rgba(126, 141, 160, 0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.react-workbench textarea::placeholder,
.react-workbench input::placeholder {
  color: #7a8797;
}

.react-workbench .hero-stats > div {
  background: linear-gradient(145deg, #f8fafc, #d7dde5);
  color: #475569;
  border: 1px solid rgba(126, 141, 160, 0.26);
}

.react-workbench .hero-stats strong {
  color: #1d4ed8;
}

.react-workbench .workflow-select {
  background: linear-gradient(145deg, #2f343b, #1d232b);
  color: #fff8df;
}

.react-workbench .global-settings-btn {
  color: #1d4ed8;
  background: linear-gradient(145deg, #eff6ff, #ffffff);
  border-color: rgba(59,130,246,0.28);
}

.react-workbench .hero-points span {
  color: #a27112;
  background: #fffdf5;
  border-color: rgba(176, 139, 47, 0.32);
}

.react-workbench .stage-index {
  color: #c09022;
}

.react-workbench button {
  border-radius: 8px;
}

.react-workbench .ghost,
.react-workbench .mini-btn {
  color: #1d4ed8;
  background: linear-gradient(145deg, #ffffff, #eef6ff);
  border: 1px solid rgba(59, 130, 246, 0.28);
}

.react-workbench .ghost:hover,
.react-workbench .mini-btn:hover {
  background: linear-gradient(145deg, #eff6ff, #ffffff);
  border-color: rgba(59, 130, 246, 0.46);
}

.react-flow-summary {
  margin-top: 18px;
}

.flow-tabs.workflow-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 18px;
}

.flow-tabs .workflow-step {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 10px;
  align-items: center;
  padding: 14px 12px;
  border-radius: 8px;
  border: 1px solid rgba(139, 152, 169, 0.28);
  background: linear-gradient(135deg, rgba(255,255,255,0.86), rgba(239,243,248,0.74));
  color: #1f2937;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
}

.flow-tabs .workflow-step span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #f8fafc, #dfe5ec);
  border: 1px solid rgba(133, 147, 165, 0.32);
  color: #546070;
  font-weight: 800;
}

.flow-tabs .workflow-step strong {
  font-size: 14px;
  line-height: 1.2;
}

.flow-tabs .workflow-step em {
  color: #687386;
  font-size: 12px;
  line-height: 1.45;
  font-style: normal;
}

.flow-tabs .workflow-step.active {
  border-color: rgba(59, 130, 246, 0.45);
  background: linear-gradient(135deg, #ffffff, #edf5ff);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.10), inset 0 1px 0 rgba(255,255,255,0.96);
}

.flow-tabs .workflow-step.active span {
  background: linear-gradient(145deg, #dbeafe, #ffffff);
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.32);
}

.tab-stage-shell {
  margin-top: 18px;
  min-height: 520px;
}

.tab-stage {
  display: none;
}

.tab-stage.active-tab-stage {
  display: grid;
}

.tab-stage.hidden {
  display: none !important;
}

.sentence-picker-card {
  width: min(1180px, calc(100vw - 48px));
}

.sentence-picker-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  min-height: 560px;
}

.modal-tree,
.modal-sentence-list {
  border: 1px solid rgba(145, 158, 171, 0.22);
  border-radius: 8px;
  background: rgba(248,250,252,0.74);
  overflow: auto;
  max-height: 62vh;
  padding: 12px;
}

.asset-modal-card {
  width: min(1240px, calc(100vw - 48px));
}

.modal-asset-grid.asset-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
  margin: 0;
}

@media (max-width: 900px) {
  .react-workbench.app-shell {
    grid-template-columns: 1fr;
  }
  .flow-sidebar {
    position: static;
    height: auto;
  }
  .sentence-picker-layout,
  .modal-asset-grid.asset-grid {
    grid-template-columns: 1fr;
  }
}

/* High-contrast light metal pass */
.react-workbench {
  color-scheme: light;
  --ink: #101820;
  --muted: #334154;
  --line: rgba(47, 61, 76, 0.30);
  --line-strong: rgba(30, 43, 57, 0.44);
  --cyan: #006a64;
  --gold: #83510c;
  --surface: #dbe2e8;
  --surface-raised: #eef2f5;
  --surface-metal: #cfd8df;
  --surface-pressed: #c2ccd5;
  --text-strong: #101820;
  --text: #202b36;
  --text-muted: #485666;
  --text-soft: #5b6979;
  --stroke: rgba(47, 61, 76, 0.30);
  --stroke-strong: rgba(30, 43, 57, 0.44);
  --accent: #006a64;
  --accent-strong: #004f4b;
  --accent-soft: #d5e5e3;
  --amber: #83510c;
  --focus: #0f766e;
  color: var(--text);
}

body {
  background:
    linear-gradient(135deg, #d7dee5 0%, #c9d2da 48%, #e5eaee 100%);
}

.react-workbench.app-shell {
  background:
    linear-gradient(90deg, #d6dde4 0%, #c8d1da 26%, #e3e8ed 100%);
}

.react-workbench .flow-sidebar {
  background:
    linear-gradient(180deg, #e9eef2 0%, #d3dbe3 100%);
  border-right-color: var(--stroke);
}

.react-workbench .brand {
  background: linear-gradient(135deg, #eef2f5, #cbd5dd);
  border: 1px solid var(--stroke);
}

.react-workbench .brand strong,
.react-workbench .flow-sidebar-head,
.react-workbench .panel-head h2,
.react-workbench .stage h2,
.react-workbench .workflow-picker label {
  color: var(--text-strong);
}

.react-workbench .brand small,
.react-workbench .selected-title,
.react-workbench .crumbs,
.react-workbench .panel-head p,
.react-workbench .stage p,
.react-workbench label,
.react-workbench .flow-tabs .workflow-step em {
  color: var(--text-muted);
}

.react-workbench .brand-mark {
  background: linear-gradient(135deg, #00756f 0%, #c8d1d9 58%, #b9822b 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.react-workbench .metal-hero,
.react-workbench .react-flow-summary,
.react-workbench .tab-stage,
.react-workbench .modal-card,
.react-workbench .panel {
  background:
    linear-gradient(145deg, rgba(239,243,246,0.98), rgba(210,219,227,0.96));
  border: 1px solid var(--stroke);
  box-shadow:
    0 16px 38px rgba(20, 31, 43, 0.14),
    inset 0 1px 0 rgba(255,255,255,0.72);
}

.react-workbench .product-title {
  color: #0b1117;
  background: linear-gradient(102deg, #010305 0%, #070c11 28%, #1a242e 43%, #4a5661 49%, #0b1117 55%, #020407 78%, #1f2a34 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 rgba(255,255,255,0.28);
}

.react-workbench .eyebrow,
.react-workbench .stage-index {
  color: var(--amber);
}

.react-workbench .hero-points span {
  color: #513208;
  background: #eadcc4;
  border: 1px solid rgba(131, 81, 12, 0.32);
}

.react-workbench .hero-stats > div {
  background: linear-gradient(145deg, #e8edf1, #c8d1da);
  border: 1px solid var(--stroke);
  color: var(--text-muted);
}

.react-workbench .hero-stats strong {
  color: var(--accent-strong);
}

.react-workbench input,
.react-workbench select,
.react-workbench textarea {
  background: #edf1f4;
  color: var(--text-strong);
  border: 1px solid var(--stroke-strong);
  box-shadow: inset 0 1px 2px rgba(36,49,66,0.05);
}

.react-workbench input:focus-visible,
.react-workbench select:focus-visible,
.react-workbench textarea:focus-visible,
.react-workbench button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
  border-color: var(--focus);
}

.react-workbench textarea::placeholder,
.react-workbench input::placeholder {
  color: #718095;
}

.react-workbench .workflow-select {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.46), rgba(142,155,168,0.18)),
    linear-gradient(180deg, #edf2f5 0%, #c6d0d9 100%);
  color: #0b1117;
  border-color: var(--stroke-strong);
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255,255,255,0.65), 0 -1px 0 rgba(52,63,75,0.18);
  -webkit-text-fill-color: #0b1117;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.82),
    inset 0 -1px 0 rgba(69,82,96,0.14),
    0 8px 18px rgba(28, 40, 54, 0.10);
}

.react-workbench .workflow-select option {
  background: #eef3f6;
  color: #101820;
  font-weight: 700;
}

.react-workbench .workflow-picker label {
  display: inline-block;
  color: #26313d;
  background: linear-gradient(102deg, #020407 0%, #101923 34%, #68737e 50%, #111923 62%, #030609 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 rgba(255,255,255,0.42);
  font-weight: 900;
}

.react-workbench .workflow-select:focus,
.react-workbench .workflow-select:hover {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.52), rgba(142,155,168,0.22)),
    linear-gradient(180deg, #f1f5f7 0%, #c5d0d8 100%);
  color: #05080c;
  -webkit-text-fill-color: #05080c;
}

.react-workbench button,
.react-workbench .primary-wide {
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  border: 1px solid rgba(0, 95, 90, 0.55);
  box-shadow: 0 8px 18px rgba(0, 117, 111, 0.18);
}

.react-workbench button:hover,
.react-workbench .primary-wide:hover {
  background: linear-gradient(145deg, #00847d, #00514d);
  border-color: #004844;
}

.react-workbench .ghost,
.react-workbench .mini-btn,
.react-workbench .global-settings-btn {
  color: var(--accent-strong);
  background: linear-gradient(145deg, #e9eef2, var(--accent-soft));
  border: 1px solid rgba(0, 117, 111, 0.28);
  box-shadow: none;
}

.react-workbench .ghost:hover,
.react-workbench .mini-btn:hover,
.react-workbench .global-settings-btn:hover {
  color: #003f3c;
  background: linear-gradient(145deg, #f5fffd, #d5eeeb);
  border-color: rgba(0, 95, 90, 0.48);
}

.react-workbench .flow-tabs .workflow-step {
  background: linear-gradient(145deg, #e9eef2, #cfd8df);
  border: 1px solid var(--stroke);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
}

.react-workbench .flow-tabs .workflow-step strong {
  color: var(--text-strong);
}

.react-workbench .flow-tabs .workflow-step span {
  color: var(--accent-strong);
  background: linear-gradient(145deg, #e8edf1, #c1ccd5);
  border: 1px solid rgba(80, 96, 116, 0.28);
}

.react-workbench .flow-tabs .workflow-step.active {
  background: linear-gradient(145deg, #e4efed, #c3d8d5);
  border-color: rgba(0, 117, 111, 0.48);
  box-shadow: 0 10px 22px rgba(0, 117, 111, 0.12), inset 0 1px 0 #fff;
}

.react-workbench .flow-tabs .workflow-step.active span {
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  border-color: rgba(0, 95, 90, 0.45);
}

.react-workbench .tree-row,
.react-workbench .sentence-card,
.react-workbench .list-item,
.react-workbench .modal-tree,
.react-workbench .modal-sentence-list {
  background: #e9eef2;
  color: var(--text);
  border-color: var(--stroke);
}

.react-workbench .tree-row strong,
.react-workbench .sentence-card strong,
.react-workbench .list-item strong {
  color: var(--text-strong);
}

.react-workbench .tree-row.active,
.react-workbench .sentence-card.active,
.react-workbench .list-item.active {
  background: var(--accent-soft);
  border-color: rgba(0, 117, 111, 0.48);
  color: var(--text-strong);
}

.react-workbench .source-state,
.react-workbench .result,
.react-workbench .selected-copy,
.react-workbench .selected-audio-preview,
.react-workbench .media-preview,
.react-workbench .scene-preview {
  background: #e1e7ec;
  color: var(--text);
  border-color: var(--stroke);
}

.react-workbench .required-label {
  color: #8a3f00;
  font-weight: 800;
}

.react-workbench .optional-label {
  color: var(--text-muted);
  font-weight: 650;
}

.react-workbench,
.react-workbench p,
.react-workbench li,
.react-workbench td,
.react-workbench th,
.react-workbench label,
.react-workbench small,
.react-workbench em,
.react-workbench .selected-title,
.react-workbench .crumbs,
.react-workbench .panel-head p,
.react-workbench .stage p,
.react-workbench .flow-tabs .workflow-step em,
.react-workbench .hero-stats span,
.react-workbench .source-state,
.react-workbench .result,
.react-workbench .selected-copy,
.react-workbench .list,
.react-workbench .mapped-list,
.react-workbench .reference-files-list,
.react-workbench .audio-control-row,
.react-workbench .inline-label,
.react-workbench .recording-status,
.react-workbench .saved-recording-result,
.react-workbench .batch-progress,
.react-workbench .tree-row,
.react-workbench .sentence-card,
.react-workbench .list-item {
  color: #263445;
}

.react-workbench .brand small,
.react-workbench .workflow-step em,
.react-workbench .sentence-card p,
.react-workbench .list-item p,
.react-workbench .tree-hint,
.react-workbench .optional-label,
.react-workbench .block-head em,
.react-workbench .modal-card p,
.react-workbench .volume-control,
.react-workbench .media-preview {
  color: #334154;
}

.react-workbench input::placeholder,
.react-workbench textarea::placeholder {
  color: #4b5b6d;
  opacity: 1;
}

.react-workbench input:disabled,
.react-workbench select:disabled,
.react-workbench textarea:disabled,
.react-workbench button:disabled {
  opacity: 0.68;
}

.react-workbench .react-workspace {
  padding: 10px 28px 36px;
}

.react-workbench .metal-hero {
  position: relative;
  top: auto;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.react-workbench .product-title {
  font-size: clamp(32px, 3.5vw, 50px);
  line-height: 1;
  background: linear-gradient(102deg, #010305 0%, #070c11 28%, #1a242e 43%, #4a5661 49%, #0b1117 55%, #020407 78%, #1f2a34 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 0 rgba(255,255,255,0.28);
}

.react-workbench .eyebrow {
  margin-bottom: 4px;
}

.react-workbench .selected-title {
  margin-top: 6px;
}

.react-workbench .hero-points {
  margin-top: 8px;
}

.react-workbench .workflow-picker {
  gap: 10px;
}

.react-workbench .workflow-select {
  min-height: 48px;
}

.react-workbench .hero-stats div {
  min-height: 58px;
  padding: 10px 8px;
}

.react-workbench .react-flow-summary {
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 14px 16px;
}

.react-workbench .tab-stage-shell {
  margin-top: 12px;
}

.client-auth {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}
.client-auth-chip {
  border: 1px solid rgba(20, 30, 36, .16);
  background: #ffffff;
  color: #13201d;
  border-radius: 999px;
  padding: 9px 15px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
  font-weight: 800;
}
.client-auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 16, 18, .55);
  backdrop-filter: blur(8px);
}
.client-auth-modal[hidden] { display: none; }
.client-auth-panel {
  width: min(420px, 100%);
  background: #fbfcfb;
  border: 1px solid rgba(20, 30, 36, .14);
  border-radius: 12px;
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
  padding: 22px;
}
.client-auth-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.client-auth-head strong { display: block; font-size: 22px; line-height: 1.2; color: #13201d; }
.client-auth-head span { display: block; margin-top: 7px; color: #66716d; font-size: 13px; line-height: 1.45; }
.client-auth-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  color: #52615c;
  background: #f0f4f2;
}
.client-auth-form button.primary {
  background: #216b5a;
  border-color: #216b5a;
  color: #fff;
}
.client-auth-form {
  display: none;
  gap: 13px;
}
.client-auth-form.active { display: grid; }
.client-auth-form label {
  display: grid;
  gap: 7px;
  color: #66716d;
  font-size: 13px;
}
.client-auth-form label small {
  margin-left: 4px;
  color: #94a19c;
  font-size: 12px;
  font-weight: 500;
}
.client-auth-form input {
  width: 100%;
  border: 1px solid #d9e0dd;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: #101816;
  caret-color: #216b5a;
}

.client-auth-form input::placeholder {
  color: #8a9691;
}

.client-auth-form input:focus {
  outline: 2px solid rgba(33, 107, 90, 0.22);
  border-color: #216b5a;
  background: #ffffff;
}
.client-auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
}
.client-auth-code-row button {
  white-space: nowrap;
  border-color: #cfd9d5;
  color: #216b5a;
  background: #f7faf8;
}
.client-auth-code-row button:disabled {
  cursor: not-allowed;
  opacity: .7;
}
.client-auth-form div {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.client-auth-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 2px;
  font-weight: 900;
}
.client-auth-debug {
  margin-top: 12px;
  border-top: 1px solid #e3e9e6;
  padding-top: 10px;
}
.client-auth-debug summary {
  cursor: pointer;
  color: #66716d;
  font-size: 12px;
  user-select: none;
}
.client-auth-debug .client-auth-form {
  margin-top: 10px;
}
.client-auth-account {
  display: grid;
  gap: 12px;
}
.client-auth-account[hidden],
.client-auth-guest[hidden],
.client-auth-plans[hidden] {
  display: none;
}
.client-auth-account-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dce7e2;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f4faf7);
}
.client-auth-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #216b5a;
  color: #fff;
  font-weight: 900;
}
.client-auth-account-card strong {
  display: block;
  color: #13201d;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-auth-account-card span {
  display: block;
  margin-top: 3px;
  color: #66716d;
  font-size: 12px;
}
.client-auth-account-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.client-auth-account-stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 11px;
  border: 1px solid #e1e8e5;
  border-radius: 8px;
  background: #fff;
}
.client-auth-account-stats span {
  color: #66716d;
  font-size: 12px;
}
.client-auth-account-stats strong {
  color: #13201d;
  font-size: 13px;
  text-align: right;
}
.client-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.client-auth-actions .danger {
  color: #b8323d;
  border-color: rgba(184, 50, 61, .28);
  background: #fff8f8;
}
.client-auth-plans {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e3e9e6;
}
.client-auth-plans-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}
.client-auth-plans-head strong {
  color: #13201d;
}
.client-auth-plans-head span {
  color: #66716d;
  font-size: 12px;
}
.client-auth-plan-list {
  display: grid;
  gap: 8px;
}
.client-auth-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 1px solid #dde6e2;
  border-radius: 8px;
  background: #fff;
}
.client-auth-plan.active {
  border-color: #216b5a;
  background: #eef8f4;
}
.client-auth-plan div {
  display: grid;
  gap: 2px;
}
.client-auth-plan strong {
  color: #13201d;
}
.client-auth-plan span {
  color: #66716d;
  font-size: 12px;
  line-height: 1.35;
}
.client-auth-plan em {
  color: #b46b18;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}
.client-auth-plan button {
  white-space: nowrap;
}
.client-auth-plan-empty {
  padding: 10px;
  border: 1px dashed #d9e0dd;
  border-radius: 8px;
  color: #66716d;
}
.client-auth-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: #b8323d;
  font-size: 13px;
  line-height: 1.45;
}
.client-auth-message[data-type="success"] {
  color: #1f7a54;
}

@media (max-width: 520px) {
  .client-auth {
    top: 12px;
    right: 12px;
  }
  .client-auth-panel {
    padding: 18px;
  }
  .client-auth-code-row {
    grid-template-columns: 1fr;
  }
  .client-auth-actions {
    grid-template-columns: 1fr;
  }
  .client-auth-plan {
    grid-template-columns: 1fr;
  }
}
