:root {
  color-scheme: light;
  --color-canvas: #faf9f5;
  --color-surface: #ffffff;
  --color-surface-subtle: #f5f4ed;
  --color-surface-selected: #eeece4;
  --color-surface-inverse: #141413;
  --color-text: #141413;
  --color-text-secondary: #5f5e5a;
  --color-text-tertiary: #7a7974;
  --color-text-inverse: #ffffff;
  --color-border: rgba(31, 30, 29, .16);
  --color-border-strong: rgba(31, 30, 29, .28);
  --color-border-subtle: rgba(31, 30, 29, .10);
  --color-accent: #d97757;
  --color-accent-hover: #c86648;
  --color-accent-pressed: #b95b40;
  --color-accent-soft: #f6e7e1;
  --color-success: #437426;
  --color-success-soft: #e9f1dc;
  --color-warning: #805c1f;
  --color-warning-soft: #f6eedf;
  --color-danger: #a73d39;
  --color-danger-soft: #f7ecec;
  --color-info: #3266ad;
  --color-info-soft: #dfe9f6;
  --font-ui: "Helvetica Neue", Helvetica, Arial, ui-sans-serif, system-ui, sans-serif;
  --font-editorial: Georgia, "Times New Roman", ui-serif, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --heading-xl: 28px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;
  --shadow-hairline: 0 1px 2px rgba(20, 20, 19, .04);
  --shadow-float: 0 12px 32px rgba(20, 20, 19, .12);
  --focus-ring: 0 0 0 3px rgba(217, 119, 87, .24);
  --motion-fast: 140ms;
  --motion-base: 200ms;
  --sidebar-width: 82px;
  --sidebar-expanded-width: 248px;
  --page-gutter: 32px;
  --page-max: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: var(--color-canvas); scroll-behavior: smooth; }
body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--color-text);
  background: var(--color-canvas);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
img, video { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--color-accent-soft); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--motion-base) ease;
}
.shell.sidebar-expanded { --sidebar-width: var(--sidebar-expanded-width); }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 12px 18px;
  background: var(--color-surface-subtle);
  border-right: 1px solid var(--color-border-subtle);
  transition: padding var(--motion-base) ease;
}
.shell.sidebar-expanded .sidebar { padding-inline: 16px; }

.sidebar-toggle {
  position: absolute;
  top: 29px;
  right: -14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-hairline);
  transition: color var(--motion-fast) ease, border-color var(--motion-fast) ease, transform var(--motion-base) ease;
}
.sidebar-toggle:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.sidebar-toggle svg { width: 15px; height: 15px; transition: transform var(--motion-base) ease; }
.shell.sidebar-expanded .sidebar-toggle svg { transform: rotate(180deg); }

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 48px;
  padding: 0 0 24px;
}
.shell.sidebar-expanded .brand { justify-content: flex-start; padding-inline: 10px; }
.brand-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: var(--radius-md);
}
.brand-copy { display: none; gap: 1px; min-width: 0; }
.shell.sidebar-expanded .brand-copy { display: grid; }
.brand-copy strong { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.brand-copy small { color: var(--color-text-tertiary); font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }

.nav { display: grid; gap: 4px; }
.nav-bottom { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--color-border-subtle); }
.nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  justify-content: center;
  text-align: left;
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease, border-color var(--motion-fast) ease, padding var(--motion-base) ease;
}
.shell.sidebar-expanded .nav button { justify-content: flex-start; }
.nav button::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}
.nav button:hover { background: rgba(255, 255, 255, .72); color: var(--color-text); }
.nav button.active { background: var(--color-accent-soft); color: var(--color-text); border-color: rgba(217, 119, 87, .16); }
.nav button.active::before { background: var(--color-accent); }
.nav-icon { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 auto; }
.nav-icon svg { width: 19px; height: 19px; }
.nav-label { display: none; min-width: 0; }
.shell.sidebar-expanded .nav-label { display: inline; }
.queue-badge {
  display: none;
  min-width: 20px;
  height: 20px;
  position: absolute;
  top: 3px;
  right: 4px;
  margin-left: auto;
  padding: 0 5px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}
.shell.sidebar-expanded .queue-badge { position: static; min-width: 20px; height: 20px; padding: 0 6px; line-height: 20px; }
.queue-badge.visible { display: inline-flex; }

main {
  min-width: 0;
  padding: 34px var(--page-gutter) 56px;
}
.page { display: none; width: min(100%, var(--page-max)); margin: 0 auto; }
.page.active { display: block; animation: page-in var(--motion-base) ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 65px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border-subtle);
}
.page-head h1 {
  margin: 0;
  font-family: var(--font-editorial);
  font-size: clamp(26px, 2.2vw, var(--heading-xl));
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -.025em;
}
.page-head .subtle { max-width: 720px; margin-top: 6px; }
.subtle, .hint { color: var(--color-text-tertiary); }
.hint { font-size: var(--text-xs); }
/* .hint is a bare inline span, so a second one straight after the first runs
   into the end of it mid-sentence. Two hints in a row are always a stack.
   The global [hidden] rule above still wins, so a hidden one stays hidden. */
.hint + .hint { display: block; margin-top: 6px; }

h2, h3, p { margin-top: 0; }
h2 { font-size: var(--text-md); font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
h3 { font-size: var(--text-sm); font-weight: 600; line-height: 1.4; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hairline);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-fast) ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn.primary { background: var(--color-accent); color: var(--color-text-inverse); border-color: var(--color-accent); }
.btn.primary:hover:not(:disabled) { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
.btn.primary:active:not(:disabled) { background: var(--color-accent-pressed); border-color: var(--color-accent-pressed); }
.btn.secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn.secondary:hover:not(:disabled) { background: var(--color-surface-subtle); border-color: var(--color-border-strong); }
.btn.danger { background: var(--color-surface); color: var(--color-danger); border-color: rgba(167, 61, 57, .28); }
.btn.danger:hover:not(:disabled) { background: var(--color-danger-soft); border-color: rgba(167, 61, 57, .45); }
.btn.small { min-height: 36px; padding: 7px 10px; font-size: var(--text-xs); }
.icon-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; flex: 0 0 auto; }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; }
.btn[aria-busy="true"]::after {
  content: "";
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .72s linear infinite;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

label { display: block; margin: 0 0 14px; color: var(--color-text-secondary); font-size: var(--text-sm); font-weight: 500; }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  line-height: 1.45;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--color-border-strong); }
input:focus, textarea:focus, select:focus { border-color: var(--color-accent); box-shadow: var(--focus-ring); outline: none; }
input::placeholder, textarea::placeholder { color: #9a9890; opacity: 1; }
textarea { min-height: 104px; resize: vertical; }
select { appearance: auto; }
input[type="file"] { padding: 5px; color: var(--color-text-tertiary); font-size: var(--text-xs); }
input[type="file"]::file-selector-button {
  min-height: 32px;
  margin-right: 10px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-text);
  font: 600 var(--text-xs)/1 var(--font-ui);
  cursor: pointer;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
input[type="file"]::file-selector-button:hover { background: var(--color-surface-subtle); border-color: var(--color-border-strong); }
/* Checkboxes and radios opt out of the base field sizing above, which would
   otherwise stretch them to a full-width 44px block. Drawn rather than
   accent-coloured so the checked state matches the rest of the UI. */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  display: inline-grid;
  place-content: center;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--color-border-strong);
  border-radius: 6px;
  background: var(--color-surface);
  cursor: pointer;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  border-radius: 1px;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform var(--motion-fast) ease;
}
input[type="radio"]::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform var(--motion-fast) ease;
}
input[type="checkbox"]:checked, input[type="radio"]:checked {
  border-color: var(--color-accent);
  background: var(--color-accent);
}
input[type="checkbox"]:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
input[type="radio"]:checked::after { transform: scale(1); }
input[type="checkbox"]:hover:not(:disabled), input[type="radio"]:hover:not(:disabled) { border-color: var(--color-accent); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .45; cursor: not-allowed; }

/* One checkbox plus its label, as a tappable row. */
.option-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.option-row:hover:not(.is-disabled) { border-color: var(--color-border-strong); background: var(--color-surface-subtle); }
.option-row:has(input:checked) { border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface)); }
.option-row.is-disabled { opacity: .6; cursor: not-allowed; }
.option-row input { margin-top: 1px; }
.option-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.option-row-note { color: var(--color-text-tertiary); font-size: var(--text-xs); font-weight: 400; }
.optional { color: var(--color-text-tertiary); font-weight: 400; }
.form-error { color: var(--color-danger); font-size: var(--text-xs); font-weight: 600; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.right { margin-left: auto; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.remake-direct-length-value {
  display: block;
  min-height: 44px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.create-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.create-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}
.create-tabs button {
  min-height: 38px;
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.create-tabs button.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-hairline); }
.create-view { display: none; }
.create-view.active { display: block; }

.setup { overflow: visible; border: 0; background: transparent; box-shadow: none; }
.setup-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 18px; }
.setup-column { display: grid; gap: 18px; min-width: 0; }
.form-section, details.advanced {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-hairline);
}
.format-section, .custom-concept-section { grid-column: 1 / -1; }
.product-section { grid-column: 1 / -1; }
.product-workspace { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.product-picker-pane { min-width: 0; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; color: var(--color-text); font-size: var(--text-md); font-weight: 600; }
.step {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(217, 119, 87, .28);
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent-pressed);
  font-size: 11px;
  font-weight: 600;
}
.tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text-tertiary);
  font-size: 11px;
  font-weight: 600;
}
.tip:hover { background: var(--color-surface-subtle); color: var(--color-text); }
.tip::after, .icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 70;
  bottom: calc(100% + 8px);
  left: auto;
  right: 0;
  width: max-content;
  max-width: 260px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease;
  box-shadow: var(--shadow-float);
}
.icon-btn[data-tip]::after { left: auto; right: 0; transform: translateY(3px); white-space: nowrap; }
.tip:hover::after, .tip:focus-visible::after { opacity: 1; transform: none; }
.icon-btn[data-tip]:hover::after, .icon-btn[data-tip]:focus-visible::after { opacity: 1; transform: none; }

.format-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.format-option, .tone-option { position: relative; margin: 0; color: var(--color-text); }
.format-option input, .tone-option input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.format-option span {
  display: block;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.format-option:hover span { border-color: var(--color-border-strong); }
.format-option strong { display: block; margin-bottom: 5px; font-size: var(--text-sm); font-weight: 600; }
.format-option small { display: block; color: var(--color-text-tertiary); font-size: var(--text-xs); font-weight: 400; line-height: 1.45; }
.format-option input:checked + span,
.tone-option input:checked + span { border-color: rgba(217, 119, 87, .52); background: var(--color-accent-soft); box-shadow: inset 0 0 0 1px rgba(217, 119, 87, .18); }
.format-option input:focus-visible + span,
.tone-option input:focus-visible + span { box-shadow: var(--focus-ring); }
.format-badge, .analysis-model, .platform-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--color-accent-soft);
  color: var(--color-accent-pressed);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.analysis-model { margin-left: 6px; }
.platform-badge.douyin { background: var(--color-surface-inverse); color: var(--color-text-inverse); }

.custom-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.custom-fields .custom-concept-main { grid-column: 1 / -1; }
.custom-fields textarea { min-height: 84px; }

.tone-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tone-option span {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 11px 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
  transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.tone-option small { margin-top: 2px; color: var(--color-text-tertiary); font-size: 11px; font-weight: 400; }
.cta-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease;
}
.chip:hover { background: var(--color-surface-subtle); color: var(--color-text); border-color: var(--color-border-strong); }

details.advanced { padding: 0; overflow: clip; }
details.advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 13px 16px;
  color: var(--color-text-secondary);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::after { content: "+"; color: var(--color-text-tertiary); font-size: 18px; font-weight: 400; }
details.advanced[open] summary::after { content: "−"; }
details.advanced[open] summary { border-bottom: 1px solid var(--color-border-subtle); color: var(--color-text); }
.advanced-body { padding: 16px; }
details.advanced.length-only summary { cursor: default; }
details.advanced.length-only summary::after { display: none; }
.length-only .advanced-body > .two-col { display: block; }
.length-only label { max-width: 360px; margin-bottom: 0; }

.picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.picker-head label { margin: 0; }
.asset-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding-right: 3px; overscroll-behavior: contain; }
.asset-choice {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 8px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: left;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}
.asset-choice:hover { border-color: var(--color-border-strong); background: var(--color-surface-subtle); }
.asset-choice.selected { border-color: rgba(217, 119, 87, .52); background: var(--color-accent-soft); box-shadow: inset 0 0 0 1px rgba(217, 119, 87, .15); }
.asset-choice img { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; background: var(--color-surface-subtle); }
.asset-choice strong, .asset-choice small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-choice strong { font-size: var(--text-xs); font-weight: 600; }
.asset-choice small { margin-top: 2px; color: var(--color-text-tertiary); font-size: 11px; }
.asset-family-item { min-width: 0; }
.asset-family-title { margin: 3px 0 7px; color: var(--color-text-tertiary); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.asset-family-variants { display: flex; flex-direction: column; gap: 6px; }
.selected-gallery { display: flex; align-items: center; gap: 7px; margin-top: 9px; padding-bottom: 2px; overflow-x: auto; }
.selected-gallery img { width: 46px; height: 46px; flex: 0 0 auto; border: 1px solid var(--color-border-subtle); border-radius: 8px; object-fit: cover; cursor: zoom-in; }
.gallery-more { min-height: 36px; padding: 6px 9px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface-subtle); color: var(--color-text-secondary); font-size: 11px; font-weight: 600; white-space: nowrap; }

.product-mention-field { position: relative; }
.mention-editor { position: relative; display: block; width: 100%; margin-top: 6px; font: 400 var(--text-sm)/1.5 var(--font-ui); }
.mention-backdrop, .mention-editor textarea { width: 100%; min-height: 104px; margin: 0; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.mention-backdrop { position: absolute; z-index: 0; inset: 0; overflow: hidden; border-color: transparent; background: var(--color-surface); color: var(--color-text); pointer-events: none; }
.mention-backdrop mark { padding: 0; border-radius: 3px; background: var(--color-info-soft); color: var(--color-info); text-decoration: underline; text-decoration-color: rgba(50, 102, 173, .35); text-underline-offset: 2px; }
.mention-editor textarea { position: relative; z-index: 1; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--color-text); resize: vertical; }
.mention-editor textarea::placeholder { color: #9a9890; -webkit-text-fill-color: #9a9890; }
.product-mention-menu {
  position: absolute;
  z-index: 80;
  top: 100%;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  max-height: 280px;
  margin-top: 6px;
  padding: 9px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-float);
}
.product-mention-option { display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; padding: 6px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-surface); text-align: left; }
.product-mention-option:hover, .product-mention-option:focus-visible { background: var(--color-surface-subtle); border-color: var(--color-border-strong); }
.product-mention-option img { width: 46px; height: 46px; border-radius: 7px; object-fit: cover; }
.product-mention-option span { font-size: 11px; font-weight: 600; }
.product-mention-empty { grid-column: 1 / -1; padding: 14px; color: var(--color-text-tertiary); font-size: var(--text-xs); text-align: center; }

.sticky-action {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(20, 20, 19, .08);
  backdrop-filter: blur(10px);
}

.preview-panel { min-height: 520px; padding: 22px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.preview-head h2 { margin: 0; }
.empty-preview { min-height: 430px; display: grid; place-items: center; border: 1px dashed var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface-subtle); }
.empty-inner { width: min(100%, 520px); padding: 32px; text-align: center; }
.empty-inner h2 { margin-bottom: 7px; font-family: var(--font-editorial); font-size: 22px; font-weight: 400; }
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px; border: 1px solid rgba(217, 119, 87, .24); border-radius: var(--radius-lg); background: var(--color-accent-soft); color: var(--color-accent-pressed); font-size: 20px; }
.selection-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 480px; margin: 20px auto 0; text-align: left; }
.selection-tile { padding: 10px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface); }
.selection-tile img { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; object-fit: cover; }
.selection-tile b { display: block; margin-top: 7px; font-size: var(--text-xs); }
.selection-tile small { color: var(--color-text-tertiary); }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-selected);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status.completed { background: var(--color-success-soft); color: var(--color-success); }
.status.failed { background: var(--color-danger-soft); color: var(--color-danger); }
.status.running, .status.queued { background: var(--color-info-soft); color: var(--color-info); }
.status.cancelled { background: var(--color-warning-soft); color: var(--color-warning); }
.progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; margin: 14px 0; }
.progress { height: 6px; overflow: hidden; border-radius: var(--radius-full); background: var(--color-surface-selected); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--color-accent); transition: width .3s ease; }
.milestone-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px 10px; margin: 8px 0 14px; }
.milestone-list.empty { display: none; }
.milestone { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 7px; align-items: start; min-width: 0; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.milestone.done { color: var(--color-text-secondary); }
.milestone.running { color: var(--color-text); font-weight: 600; }
.milestone.failed { color: var(--color-danger); }
.milestone-icon { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--color-border-subtle); border-radius: 50%; background: var(--color-surface); font-size: 11px; font-weight: 700; line-height: 1; }
.milestone.done .milestone-icon { border-color: rgba(67, 116, 38, .28); background: var(--color-success-soft); color: #437426; }
.milestone.failed .milestone-icon { border-color: rgba(167, 61, 57, .28); background: var(--color-danger-soft); color: #a73d39; }
.milestone-copy { min-width: 0; padding-top: 1px; }
.milestone-copy small { display: block; margin-top: 2px; color: var(--color-text-tertiary); font-weight: 400; line-height: 1.35; }
.milestone-spinner { width: 9px; height: 9px; border: 1.5px solid rgba(31, 30, 29, .18); border-top-color: var(--color-accent); border-radius: 50%; animation: spin .8s linear infinite; }
.milestone-list.compact { display: flex; flex-wrap: wrap; gap: 5px 9px; margin: 7px 0 0; }
.milestone-list.compact .milestone { display: inline-grid; grid-template-columns: 16px auto; gap: 4px; font-size: 10px; }
.milestone-list.compact .milestone-icon { width: 14px; height: 14px; font-size: 9px; }
.progress-percent { color: var(--color-text-tertiary); font-size: 11px; font-variant-numeric: tabular-nums; }
/* One bar + reading, reused by every surface that shows estimated progress
   (Kling Motion renders, Batch Clean, post-production). The bar itself is the
   shared .progress element, so all of them animate and colour identically. */
.progress-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.progress-line small { color: var(--color-text-tertiary); font-size: 10px; font-variant-numeric: tabular-nums; }
.kling-motion-progress { margin-top: 6px; }
.bc-batch-progress { margin: 4px 0 10px; }
/* Per-video, so it sits between the label and the status chip rather than
   stretching the row. */
.bc-item-progress { flex: 0 0 108px; }
.postprod-progress { display: grid; gap: 6px; margin-top: 10px; }
.timer { min-width: 58px; color: var(--color-text-tertiary); font-family: var(--font-mono); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.error, .warning { margin-top: 12px; padding: 11px 12px; border: 1px solid; border-radius: var(--radius-md); font-size: var(--text-xs); line-height: 1.45; }
.error { border-color: rgba(167, 61, 57, .28); background: var(--color-danger-soft); color: #7f2c28; }
.warning { border-color: rgba(128, 92, 31, .28); background: var(--color-warning-soft); color: #5a4815; }

.output-grid { display: grid; grid-template-columns: minmax(250px, 360px) minmax(320px, 1fr); gap: 24px; margin-top: 20px; }
.video { display: block; width: 100%; border-radius: var(--radius-md); background: #111; }
.prompt-panel { max-height: 700px; overflow: auto; padding-right: 3px; }
.beat, .cost { margin-bottom: 10px; overflow: clip; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface); }
.beat summary, .cost summary { padding: 12px 13px; cursor: pointer; font-weight: 600; }
.beat-body { padding: 0 13px 13px; }
.spoken { padding: 10px; border-radius: 8px; background: var(--color-surface-subtle); }
/* English reading of a non-English spoken line, for anyone reviewing a script
   in a language they do not read. It is the same text burned into the video. */
.spoken-english { margin-top: 6px; padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--color-border); color: var(--color-text-secondary); font-size: 13px; }
.spoken-english b { display: block; margin-bottom: 2px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.cost table { width: 100%; border-collapse: collapse; }
.cost td { padding: 9px 12px; border-top: 1px solid var(--color-border-subtle); }
.cost td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.viral-platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.viral-platform-panel { padding: 20px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.viral-platform-panel h2 { margin-bottom: 4px; }
.viral-analyze-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 16px; }
.viral-analyze-form label { margin: 0; }
.viral-upload-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; color: var(--color-text-tertiary); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; }
.viral-upload-divider::before, .viral-upload-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border-subtle); }
.viral-upload-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 10px; }
.viral-upload-form label { margin: 0; }
.analysis-note { margin-top: 12px; color: var(--color-text-tertiary); font-size: var(--text-xs); }

.remake-card { padding: 22px; }
.remake-card h2 { margin: 0 0 7px; }
.remake-library { margin-bottom: 20px; }
.remake-library-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.remake-library-head h2 { margin-bottom: 3px; }
.remake-library-actions { display: flex; align-items: center; gap: 10px; }
.remake-library-actions label, .remake-reference-check { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--color-text-secondary); font-size: var(--text-xs); }
.remake-library-actions input, .remake-reference-check input, .mandatory-scene-toggle input, .remake-flags input, .remake-readiness input { margin: 0; }
.remake-platform-sections { display: grid; gap: 22px; }
.remake-platform-section { padding-top: 2px; }
.remake-platform-section + .remake-platform-section { padding-top: 22px; border-top: 1px solid var(--color-border-subtle); }
.remake-platform-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: var(--text-md); }
.remake-reference-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; }
.remake-reference-card { position: relative; overflow: clip; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface); transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, transform var(--motion-fast) ease; }
.remake-reference-card:hover { transform: translateY(-1px); border-color: var(--color-border-strong); box-shadow: 0 8px 20px rgba(20, 20, 19, .06); }
.remake-reference-card.active { border-color: rgba(217, 119, 87, .55); box-shadow: inset 0 0 0 1px rgba(217, 119, 87, .16); }
.remake-reference-open { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
.remake-reference-thumb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--color-surface-subtle); }
.remake-reference-copy { padding: 11px 12px 7px; }
.remake-reference-copy strong, .remake-reference-copy span { display: block; }
.remake-reference-copy strong { overflow: hidden; font-size: var(--text-sm); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.remake-reference-copy span { display: -webkit-box; margin-top: 3px; overflow: hidden; color: var(--color-text-tertiary); font-size: 11px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.remake-reference-footer { display: flex; align-items: center; gap: 7px; padding: 8px 10px 10px; }
.remake-reference-footer .hint { margin-right: auto; }
.remake-reference-check { position: absolute; z-index: 2; top: 8px; left: 8px; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-hairline); }
.remake-reference-delete { width: 34px; height: 34px; min-height: 34px; }
.remake-platform-empty { padding: 22px; border: 1px dashed var(--color-border); border-radius: var(--radius-md); color: var(--color-text-tertiary); text-align: center; }

.remake-layout { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 20px; }
.remake-source { position: sticky; top: 22px; align-self: start; max-height: calc(100vh - 44px); overflow-y: auto; }
.remake-source video { display: block; width: 100%; max-height: 520px; border-radius: var(--radius-md); background: #111; }
.remake-summary, .remake-readiness, .remake-contract, .remake-next { margin-top: 12px; padding: 12px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface-subtle); font-size: var(--text-xs); line-height: 1.5; }
.remake-readiness:empty { display: none; }
.remake-readiness.ok { border-color: rgba(67, 116, 38, .28); background: var(--color-success-soft); }
.remake-readiness.warn { border-color: rgba(128, 92, 31, .28); background: var(--color-warning-soft); }
.remake-readiness.blocked { border-color: rgba(167, 61, 57, .28); background: var(--color-danger-soft); }
.remake-readiness ul { margin: 8px 0 0; padding-left: 18px; }
.remake-readiness label { display: flex; align-items: flex-start; gap: 7px; margin: 0; font-size: var(--text-xs); }
.remake-readiness .remake-rules { margin-top: 8px; color: var(--color-text-tertiary); }
.remake-scenes { display: grid; gap: 12px; margin-top: 14px; }
.remake-scene { padding: 15px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface); }
.remake-scene.mandatory { border-left: 3px solid var(--color-accent); }
.remake-scene-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.remake-scene-title { display: flex; align-items: center; gap: 9px; }
.remake-scene-head strong { font-size: var(--text-sm); }
.mandatory-scene-toggle { display: flex; align-items: center; gap: 6px; margin: 0; padding: 4px 8px; border-radius: var(--radius-full); background: var(--color-accent-soft); color: var(--color-accent-pressed); font-size: 11px; font-weight: 600; }
.remake-scene-grid, .remake-scene-advanced-grid, .remake-contract-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.remake-scene-grid .wide, .remake-scene-advanced, .remake-contract-grid .wide { grid-column: 1 / -1; }
.remake-scene-main textarea { min-height: 66px; }
.remake-scene-advanced { margin-top: 8px; border-top: 1px solid var(--color-border-subtle); }
.remake-scene-advanced summary { padding: 11px 0 4px; color: var(--color-text-tertiary); font-size: var(--text-xs); font-weight: 500; cursor: pointer; }
.remake-flags { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.remake-flags label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--text-xs); }
.remake-contract h3 { margin-bottom: 3px; }
.remake-contract textarea { min-height: 68px; }
.remake-picker .asset-picker { max-height: 340px; }
.remake-action { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 14px; background: var(--color-surface); border-top: 1px solid var(--color-border-subtle); }

.remake-events { display: grid; gap: 6px; max-height: 340px; margin-top: 12px; overflow-y: auto; }
.remake-event { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; align-items: start; padding: 8px 9px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-surface); }
.remake-event.selected { border-color: rgba(217, 119, 87, .55); background: var(--color-accent-soft); }
.remake-event-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 6px; background: transparent; font-size: var(--text-xs); line-height: 1.4; text-align: left; }
.remake-event-meta { display: block; margin-top: 2px; color: var(--color-text-tertiary); font-size: 11px; }
.remake-event.inferred .remake-event-meta { color: var(--color-warning); }
.remake-event-band { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--color-surface-selected); }
.remake-event-band i { display: block; height: 100%; border-radius: inherit; background: var(--color-accent); }
.remake-event-play { width: 30px; height: 30px; min-height: 30px; }
.remake-strip-title { margin: 14px 0 0; color: var(--color-text-tertiary); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.remake-strip-title:has(+ .remake-evidence:empty) { display: none; }
.remake-evidence { display: flex; gap: 7px; margin-top: 10px; padding-bottom: 4px; overflow-x: auto; }
.remake-evidence figure { flex: 0 0 78px; margin: 0; }
.remake-evidence img { width: 78px; height: 78px; border-radius: 8px; object-fit: cover; background: var(--color-surface-subtle); }
.remake-evidence figcaption { margin-top: 3px; color: var(--color-text-tertiary); font-size: 10px; text-align: center; }

.remake-loading-card {
  position: relative;
  min-height: 168px;
  display: grid;
  place-items: center;
  gap: 10px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}
.remake-loading-label { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-tertiary); }
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(31, 30, 29, .14);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.library-toolbar { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.library-toolbar-label { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: .04em; }
.group-toggle { display: inline-flex; gap: 2px; padding: 3px; background: var(--color-surface-subtle); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-full); }
.group-option { border: 0; background: transparent; color: var(--color-text-secondary); font: 600 var(--text-xs)/1 var(--font-ui); padding: 7px 14px; border-radius: var(--radius-full); cursor: pointer; transition: background var(--motion-fast) ease, color var(--motion-fast) ease; }
.group-option:hover { color: var(--color-text); }
.group-option.active { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 2px rgba(20, 20, 19, .08); }
.library-toolbar { flex-wrap: wrap; }
.library-subgroup { display: flex; align-items: center; gap: 10px; }
.library-subgroup[hidden] { display: none; }
.subgroup-option { border: 0; background: transparent; color: var(--color-text-secondary); font: 600 var(--text-xs)/1 var(--font-ui); padding: 7px 14px; border-radius: var(--radius-full); cursor: pointer; transition: background var(--motion-fast) ease, color var(--motion-fast) ease; }
.subgroup-option:hover { color: var(--color-text); }
.subgroup-option.active { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 2px rgba(20, 20, 19, .08); }
.library-section { margin: 0 0 22px; }
.library-subsection { margin: 0 0 16px; padding-left: 16px; border-left: 1px solid var(--color-border-subtle); }
.library-subsection .library-section-title { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-secondary); }
.library-subsection .library-section-head { margin-bottom: 10px; }
.library-section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 0 2px; cursor: pointer; list-style: none; }
.library-section-head::-webkit-details-marker { display: none; }
.library-section-head::before { content: "▾"; font-size: 11px; color: var(--color-text-tertiary); transition: transform var(--motion-fast) ease; }
.library-section:not([open]) .library-section-head::before { transform: rotate(-90deg); }
.library-section-title { font-size: var(--text-md); font-weight: 600; letter-spacing: -.01em; }
.library-section-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; background: var(--color-surface-subtle); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-secondary); }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
/* Library multi-select and per-video status. The selection bar sits above the
   grid and only appears once there is something downloadable to select. */
.library-selection { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; padding: 8px 12px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.project { position: relative; overflow: clip; border-radius: var(--radius-md); transition: border-color var(--motion-fast) ease, transform var(--motion-fast) ease, box-shadow var(--motion-fast) ease; }
.project.selected { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.project-select { position: absolute; z-index: 2; top: 8px; left: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-sm); background: rgba(20, 20, 19, .55); cursor: pointer; }
.project-select input { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--color-accent); }
.project-label-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.label-status select { min-height: 24px; padding: 2px 20px 2px 7px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background-color: var(--color-surface); font-size: 11px; font-weight: 600; cursor: pointer; }
/* Each status reads at a glance, so a grid of cards can be scanned without
   opening the dropdowns. New is deliberately the quiet one. */
.label-status.downloaded select { border-color: rgba(67, 116, 38, .34); background-color: var(--color-success-soft); color: var(--color-success); }
.label-status.edited select { border-color: rgba(128, 92, 31, .34); background-color: var(--color-warning-soft); color: var(--color-warning); }
.label-status.posted select { border-color: rgba(217, 119, 87, .38); background-color: var(--color-accent-soft); color: var(--color-accent); }
.project:hover { transform: translateY(-1px); border-color: var(--color-border-strong); box-shadow: 0 8px 20px rgba(20, 20, 19, .06); }
.project-media { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; background: #20201e; cursor: pointer; }
.project-media video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.project-placeholder { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255, 255, 255, .32); border-radius: 50%; color: #fff; font-size: 15px; }
.project-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; }
.project-title { overflow: hidden; font-size: var(--text-sm); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.project-subline { display: flex; align-items: center; gap: 7px; min-width: 0; margin-top: 4px; }
.project-subline .status { min-height: 20px; padding: 2px 6px; font-size: 10px; }
.project-subline .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-actions { display: flex; gap: 5px; flex-wrap: nowrap; }
.project-actions .icon-btn { width: 34px; height: 34px; min-height: 34px; }
.project-error { grid-column: 1 / -1; margin: 0; padding: 8px; }

.product-profile-fields { margin-top: 16px; padding: 16px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.product-workspace > .product-profile-fields { margin-top: 0; }
.remake-creator-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--color-border-subtle); }
.product-profile-fields[hidden] { display: none; }
.product-profile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.product-profile-head b { display: block; font-size: var(--text-sm); }
.product-profile-head .hint { margin-top: 2px; }
.product-profile-fields label:last-child { margin-bottom: 0; }
.asset-profile-status { display: block; margin-top: 2px; color: var(--color-text-tertiary); font-size: 10px; }
.media-dialog.profile-dialog { width: min(92vw, 620px); height: auto; max-height: 88vh; grid-template-rows: auto minmax(0, 1fr); }
.profile-body { min-height: 0; overflow-y: auto; }
.profile-form { padding: 18px; }
.profile-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.assets-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.asset-section { padding: 20px; }
.asset-section > h2 { margin-bottom: 4px; }
.assets-tabs-row { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.assets-tabs .tab-count { display: inline-flex; min-width: 20px; height: 18px; align-items: center; justify-content: center; margin-left: 6px; padding: 0 6px; border-radius: var(--radius-full); background: var(--color-surface-subtle); color: var(--color-text-tertiary); font-size: 10px; font-weight: 600; }
.assets-tabs button.active .tab-count { background: var(--color-border-subtle); color: var(--color-text-secondary); }
.asset-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 16px; }
.asset-search { flex: 1 1 200px; min-width: 0; }
.asset-count { color: var(--color-text-tertiary); font-size: var(--text-xs); white-space: nowrap; }
.asset-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.family-toggle { display: flex; flex: 1; min-width: 0; align-items: flex-start; gap: 8px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.family-caret { flex: none; margin-top: 1px; color: var(--color-text-tertiary); transition: transform var(--motion-fast) ease; }
.family-toggle[aria-expanded="true"] .family-caret { transform: rotate(90deg); }
.family-title { min-width: 0; }
.family-card .family-head { margin-bottom: 0; }
.family-card.expanded .family-head { margin-bottom: 12px; }
.family-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-bottom: 12px; }
.family-photo-grid img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--color-surface-subtle); }
.upload { margin: 14px 0 18px; padding: 14px; border: 1px dashed var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.upload label { margin-bottom: 10px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.asset-card { position: relative; overflow: clip; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface); transition: border-color var(--motion-fast) ease, transform var(--motion-fast) ease; }
.asset-card:hover { transform: translateY(-1px); border-color: var(--color-border-strong); }
.asset-media { position: relative; cursor: zoom-in; }
.asset-media > img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--color-surface-subtle); }
.photo-count { position: absolute; right: 6px; bottom: 6px; display: inline-flex; min-width: 24px; height: 24px; align-items: center; justify-content: center; padding: 0 7px; border-radius: var(--radius-full); background: rgba(20, 20, 19, .8); color: #fff; font-size: 10px; font-weight: 600; }
.asset-info { display: flex; align-items: center; gap: 6px; padding: 8px; }
.asset-name { min-width: 0; flex: 1; overflow: hidden; font-size: var(--text-xs); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.asset-delete { width: 32px; height: 32px; min-height: 32px; }

.btn.ghost { background: transparent; color: var(--color-text-secondary); border-color: var(--color-border-subtle); border-style: dashed; }
.btn.ghost:hover:not(:disabled) { background: var(--color-surface-subtle); border-color: var(--color-border-strong); color: var(--color-text); }
.family-grid { display: flex; flex-direction: column; gap: 14px; }
.family-card { padding: 16px; }
.family-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.family-head b { font-size: var(--text-sm); }
.family-head .hint { display: block; margin-top: 2px; }
.variant-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.variant-chip { position: relative; width: 220px; overflow: clip; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface); transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, opacity var(--motion-fast) ease; }
.variant-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.variant-head b { flex: 1; min-width: 0; overflow: hidden; font-size: var(--text-xs); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.variant-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 4px; min-height: 58px; padding: 8px; border-top: 1px solid var(--color-border-subtle); background: var(--color-surface-subtle); transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease; }
.variant-photos img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-sm); cursor: grab; background: var(--color-surface); transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease; }
.variant-photos img:active { cursor: grabbing; }
.variant-photos img.dragging { opacity: .35; transform: scale(.95); }
.variant-chip.drop-compatible { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.variant-chip.drop-compatible::after { content: "Move here"; position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: color-mix(in srgb, var(--color-accent-soft) 88%, transparent); color: var(--color-accent-pressed); font-size: var(--text-xs); font-weight: 700; pointer-events: none; }
.variant-chip.drop-target { box-shadow: inset 0 0 0 2px var(--color-accent), var(--shadow-float); }
.variant-chip.drop-target::after { content: "Drop to move"; }
.variant-chip.drop-pending { opacity: .65; }
.add-variant { align-self: flex-start; min-height: 40px; }

.queue-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 15px 16px; }
.queue-list { display: grid; gap: 8px; }
.queue-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px 14px; border-radius: var(--radius-md); }
.queue-position { display: grid; place-items: center; min-width: 44px; min-height: 34px; padding: 4px 7px; border-radius: 8px; background: var(--color-surface-selected); color: var(--color-text-secondary); font-family: var(--font-mono); font-size: 10px; font-weight: 600; }
.queue-position.active { background: var(--color-accent-soft); color: var(--color-accent-pressed); }
.queue-title { font-size: var(--text-sm); font-weight: 600; }
.queue-meta { margin-top: 3px; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.queue-progress { display: grid; grid-template-columns: minmax(80px, 180px) auto; gap: 7px; align-items: center; margin-top: 7px; }
.queue-progress small { color: var(--color-text-tertiary); font-size: 10px; font-variant-numeric: tabular-nums; }
.queue-actions { display: flex; align-items: center; gap: 6px; }
.queue-actions .icon-btn { width: 36px; height: 36px; min-height: 36px; }

.settings-card { padding: 24px; }
.settings-group { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--color-border-subtle); }
.settings-group h2 { margin-bottom: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; max-width: 980px; }
.settings-card > details.advanced { box-shadow: none; }

.loading-state, .empty-state {
  grid-column: 1 / -1;
  min-height: 150px;
  display: grid;
  place-items: center;
  padding: 32px 22px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
  color: var(--color-text-tertiary);
  text-align: center;
}
.empty-state h2 { margin-bottom: 6px; color: var(--color-text); font-family: var(--font-editorial); font-size: 22px; font-weight: 400; }
.empty-state p { max-width: 520px; margin-bottom: 14px; }
.loading-state:not(.remake-loading-card)::before { content: ""; width: 22px; height: 22px; margin-bottom: 10px; border: 2px solid rgba(31, 30, 29, .14); border-top-color: var(--color-accent); border-radius: 50%; animation: spin .8s linear infinite; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 140;
  display: none;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius-md);
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-float);
  font-size: var(--text-xs);
  font-weight: 500;
}

.media-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(20, 20, 19, .82);
  backdrop-filter: blur(7px);
}
.media-modal.open { display: grid; }
.media-dialog { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(96vw, 1320px); height: min(92vh, 900px); overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.media-dialog.video-preview { width: min(92vw, 720px); height: auto; max-height: 88vh; }
.media-dialog.video-preview .media-stage { min-height: min(62vh, 620px); overflow: hidden; padding: 12px; }
.media-dialog.video-preview .media-stage video { display: block; width: auto; max-width: 100%; height: auto; max-height: min(70vh, 680px); }
.media-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--color-border-subtle); }
.media-title { overflow: hidden; font-size: var(--text-sm); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.media-stage { display: grid; place-items: center; min-height: 0; padding: 18px; overflow: auto; background: #20201e; }
.media-stage img, .media-stage video { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }
.media-strip { display: flex; justify-content: center; gap: 7px; min-height: 0; padding: 10px 14px; overflow-x: auto; border-top: 1px solid var(--color-border-subtle); }
.media-strip:empty { display: none; }
.media-strip button { width: 54px; height: 54px; flex: 0 0 auto; padding: 2px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-surface); }
.media-strip button.active { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.media-strip img { width: 100%; height: 100%; border-radius: 5px; object-fit: cover; }
.add-photo-btn { display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; flex: 0 0 auto; border: 2px dashed var(--color-border-subtle); border-radius: 8px; cursor: pointer; color: var(--color-text-secondary); transition: border-color .15s, color .15s; }
.add-photo-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }

.kling-motion-layout { display: grid; grid-template-columns: minmax(320px, 480px) minmax(0, 1fr); gap: 18px; align-items: start; }
.kling-motion-card { padding: 22px; }
.kling-motion-card h2 { margin: 0 0 14px; }
.kling-motion-form label { margin-bottom: 12px; }
.kling-motion-form .picker-head { margin-top: 4px; }
.kling-motion-form .asset-picker { max-height: 232px; }
#klingMotionCreatorPreview img { cursor: default; }
.kling-motion-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.kling-mute-label { display: flex !important; align-items: center; gap: 8px; margin-top: 28px; font-weight: 500; }
.kling-mute-label input { width: auto; min-height: auto; margin: 0; }
.kling-motion-list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.kling-motion-list-head h2 { margin: 0; }
.kling-motion-list-head .subtle { font-size: var(--text-xs); }

/* One card per render, sized to the 9:16 output so a full queue reads as a
   gallery of clips instead of a stack of full-width players. */
.kling-motion-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 14px; align-items: start; }
.kling-motion-tasks > .empty-state { grid-column: 1 / -1; }
.kling-motion-task {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.kling-motion-task.processing { border-style: dashed; }
.kling-motion-thumb { position: relative; aspect-ratio: 9 / 16; background: #111; }
.kling-motion-chips { position: absolute; top: 8px; left: 8px; z-index: 1; display: flex; align-items: center; gap: 6px; }
.kling-motion-thumb .status { min-height: 20px; padding: 2px 7px; font-size: 10px; }
.kling-motion-video, .kling-motion-poster { display: block; width: 100%; height: 100%; object-fit: cover; background: #111; }
.kling-motion-poster.placeholder { background: linear-gradient(160deg, var(--color-surface-subtle), var(--color-surface)); }
.kling-motion-task.processing .kling-motion-poster { opacity: .62; }
.kling-motion-meta { display: grid; gap: 3px; padding: 10px 11px 0; }
.kling-motion-task-title { font-size: var(--text-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kling-motion-meta .hint { font-size: 11px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kling-motion-tag { justify-self: start; margin-top: 2px; padding: 1px 7px; border-radius: 999px; background: var(--color-surface-subtle); color: var(--color-text-tertiary); font-size: 10px; }
.kling-motion-task-actions { display: flex; align-items: center; gap: 7px; margin-top: auto; padding: 10px 11px 11px; }
.kling-motion-task-actions .btn { min-height: 32px; padding: 6px 9px; font-size: 11px; }
.status.processing { background: var(--color-info-soft); color: var(--color-info); }
.status.interrupted { background: var(--color-warning-soft); color: var(--color-warning); }
.kling-motion-batch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.kling-motion-batch:empty { display: none; }
.kling-dl-history { margin-top: 4px; }
.dl-chip { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; white-space: nowrap; }
.dl-chip.new { color: var(--color-accent); background: var(--color-accent-soft); }
.dl-chip.downloaded { color: var(--color-success); background: var(--color-success-soft); }

@media (max-width: 1180px) {
  :root { --sidebar-expanded-width: 220px; --page-gutter: 24px; }
  .format-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assets-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  :root { --sidebar-expanded-width: 220px; }
  .nav button::before { left: -12px; }
  .queue-badge { min-width: 18px; height: 18px; line-height: 18px; }
  .setup-body, .output-grid, .settings-grid { grid-template-columns: 1fr; }
  .product-workspace { grid-template-columns: 1fr; }
  .remake-layout { grid-template-columns: 1fr; }
  .remake-source { position: static; max-height: none; }
  .settings-grid { max-width: none; }
  .kling-motion-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --page-gutter: 16px; }
  .shell { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    width: 100%;
    height: auto;
    padding: 8px 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--color-border-subtle);
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-toggle { display: none; }
  .shell.sidebar-expanded .brand { justify-content: center; padding-inline: 0; }
  .shell.sidebar-expanded .brand-copy, .shell.sidebar-expanded .nav-label { display: none; }
  .shell.sidebar-expanded .nav button { justify-content: center; }
  .brand { min-height: 44px; margin-right: 2px; padding: 0 6px 0 2px; flex: 0 0 auto; }
  .brand-logo { width: 32px; height: 32px; }
  .nav { display: flex; gap: 3px; min-width: max-content; flex: 0 0 auto; overflow: visible; }
  .nav-bottom { margin: 0; padding: 0; border: 0; }
  .nav button { min-width: 44px; width: 44px; height: 44px; padding: 0; flex: 0 0 auto; }
  .nav button::before { display: none; }
  .nav button.active { background: var(--color-accent-soft); }
  .queue-badge { top: 0; right: 0; }
  main { padding-top: 24px; }
  .page-head { align-items: flex-start; min-height: 0; margin-bottom: 18px; padding-bottom: 16px; }
  .tip::after { left: auto; right: 0; transform: translateY(3px); }
  .tip:hover::after, .tip:focus-visible::after { transform: none; }
  .page-head h1 { font-size: 25px; }
  .create-toolbar { align-items: stretch; }
  .create-tabs { flex: 1; }
  .create-tabs button { flex: 1; }
  .viral-platform-grid, .viral-analyze-form, .viral-upload-form, .custom-fields, .two-col, .remake-scene-grid, .remake-scene-advanced-grid, .remake-contract-grid { grid-template-columns: 1fr; }
  .custom-fields .custom-concept-main, .remake-scene-grid .wide, .remake-scene-advanced, .remake-contract-grid .wide { grid-column: auto; }
  .viral-analyze-form .btn, .viral-upload-form .btn { width: 100%; }
  .remake-library-head { align-items: flex-start; flex-direction: column; }
  .remake-library-actions { width: 100%; justify-content: flex-end; }
  .remake-reference-grid { grid-template-columns: 1fr; }
  .queue-item { grid-template-columns: 46px minmax(0, 1fr); }
  .queue-actions { grid-column: 2; justify-content: flex-end; }
  .sticky-action { position: static; bottom: auto; }
}

@media (max-width: 520px) {
  main { padding-bottom: 34px; }
  .page-head { gap: 12px; }
  .page-head .icon-btn { width: 38px; height: 38px; min-height: 38px; }
  .format-grid, .tone-grid, .asset-picker, .selection-preview { grid-template-columns: 1fr; }
  .format-option span { min-height: 0; }
  .form-section, .remake-card, .asset-section, .settings-card, .preview-panel { padding: 16px; }
  .sticky-action { align-items: stretch; flex-direction: column; padding: 12px; }
  .sticky-action .btn.primary { width: 100%; }
  .library-grid, .asset-grid { grid-template-columns: 1fr; }
  .asset-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
  .asset-media > img { height: 96px; aspect-ratio: 1 / 1; }
  .asset-info { align-self: stretch; }
  .queue-summary { align-items: flex-start; flex-direction: column; }
  .media-modal { padding: 8px; }
  .media-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .media-dialog.video-preview { width: min(calc(100vw - 16px), 620px); height: auto; max-height: calc(100dvh - 16px); }
  .media-dialog.video-preview .media-stage { min-height: 0; }
  .toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}

@media (max-width: 340px) {
  .brand { display: none; }
  .nav button { min-width: 42px; width: 42px; }
  .create-toolbar { flex-wrap: wrap; }
  .create-toolbar > .icon-btn { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .spinner, .loading-state:not(.remake-loading-card)::before, .btn[aria-busy="true"]::after {
    animation: none !important;
    border-right-color: rgba(31, 30, 29, .14);
  }
  .page.active { animation: none; }
  .btn:hover:not(:disabled), .project:hover, .asset-card:hover, .remake-reference-card:hover { transform: none; }
}

/* Batch Clean */
.bc-item{display:flex;align-items:center;gap:12px;padding:11px 0;border-top:1px solid rgba(127,127,127,.18)}
.bc-item:first-child{border-top:0}
.bc-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bc-batch-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:6px}
.bc-batch-actions{display:flex;align-items:center;gap:8px}
.bc-sep{border:0;border-top:1px solid rgba(127,127,127,.18);margin:16px 0}

.postprod-followup{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-top:14px;padding:14px 16px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface-subtle)}
.postprod-followup>div{display:flex;flex-direction:column;gap:3px;min-width:0}.postprod-followup strong{font-size:14px}.postprod-followup span{font-size:13px;color:var(--color-text-tertiary);line-height:1.35}.postprod-followup .btn{flex:0 0 auto}@media(max-width:700px){.postprod-followup{align-items:stretch;flex-direction:column}.postprod-followup .btn{width:100%}}

/* Auto Edit video picker: keep the compose page focused on explicitly selected videos. */
.auto-edit-picker-actions { flex-wrap: nowrap; }
.edit-selected-tray { min-height: 154px; border: 1px dashed var(--color-border); border-radius: 14px; background: var(--color-surface-muted); padding: 12px; }
.edit-selected-empty { min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px; text-align: center; color: var(--color-text-muted); }
.edit-selected-empty strong { color: var(--color-text); }
.edit-selected-empty .btn { margin-top: 5px; }
.edit-selected-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.edit-selected-card { min-width: 0; overflow: hidden; border: 1px solid var(--color-border-subtle); border-radius: 12px; background: var(--color-surface); }
.edit-selected-preview { position: relative; display: block; width: 100%; padding: 0; border: 0; background: #111; cursor: pointer; }
.edit-selected-preview video { display: block; width: 100%; aspect-ratio: 9 / 11; object-fit: cover; pointer-events: none; }
.edit-selected-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px; }
.edit-selected-meta > div { min-width: 0; }
.edit-workflow-pill { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); overflow: hidden; padding: 4px 7px; border-radius: 999px; background: rgba(18,18,18,.72); color: #fff; font-size: 9px; font-weight: 750; line-height: 1; text-overflow: ellipsis; white-space: nowrap; backdrop-filter: blur(6px); }
.edit-picker-modal { z-index: 70; }
.edit-picker-dialog { width: min(1120px, calc(100vw - 40px)); height: min(860px, calc(100dvh - 40px)); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
.edit-picker-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: end; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--color-border-subtle); background: var(--color-surface-muted); }
.edit-picker-search { margin: 0; }
.edit-picker-search span { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 700; color: var(--color-text-muted); }
.edit-picker-search input { width: 100%; }
.edit-picker-filter { display: flex; align-items: center; gap: 5px; }
.edit-picker-filter .group-option { min-height: 36px; padding: 7px 10px; white-space: nowrap; }
.edit-picker-groups { min-height: 0; overflow-y: auto; padding: 16px 18px 22px; }
.edit-picker-section + .edit-picker-section { margin-top: 22px; }
.edit-picker-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.edit-picker-section-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-picker-section-head span { min-width: 26px; padding: 3px 7px; border-radius: 999px; background: var(--color-surface-muted); color: var(--color-text-muted); font-size: 11px; font-weight: 750; text-align: center; }
.edit-picker-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
.edit-picker-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--color-border-subtle); border-radius: 13px; background: var(--color-surface); cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.edit-picker-card:hover { transform: translateY(-1px); border-color: var(--color-border); }
.edit-picker-card.selected { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
.edit-picker-card > input { position: absolute; top: 9px; right: 9px; z-index: 4; width: 19px; height: 19px; accent-color: var(--color-accent); }
.edit-picker-video { position: relative; display: block; background: #111; }
.edit-picker-video video { display: block; width: 100%; aspect-ratio: 9 / 12; object-fit: cover; pointer-events: none; }
.edit-picker-preview { position: absolute; left: 50%; top: 50%; z-index: 3; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.65); border-radius: 50%; background: rgba(0,0,0,.52); color: #fff; opacity: 0; transform: translate(-50%,-50%); transition: opacity .16s ease; }
.edit-picker-preview svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.edit-picker-card:hover .edit-picker-preview, .edit-picker-preview:focus-visible { opacity: 1; }
.edit-picker-card .edit-video-meta { display: flex; flex-direction: column; gap: 2px; }
.edit-picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--color-border-subtle); background: var(--color-surface); }

@media (max-width: 1100px) {
  .edit-picker-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .edit-picker-filter { flex-wrap: wrap; }
  .edit-picker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .edit-selected-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edit-picker-dialog { width: 100vw; height: 100dvh; max-width: none; border-radius: 0; }
  .edit-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edit-picker-footer { align-items: stretch; flex-direction: column; }
  .edit-picker-footer .row, .edit-picker-footer .btn { width: 100%; }
  .edit-picker-footer .btn { flex: 1; }
}
@media (max-width: 480px) {
  .auto-edit-card-head { align-items: stretch; flex-direction: column; }
  .auto-edit-picker-actions .btn { flex: 1; }
  .edit-selected-grid { grid-template-columns: 1fr; }
}

/* Batch Clean */
.bc-item{display:flex;align-items:center;gap:12px;padding:11px 0;border-top:1px solid rgba(127,127,127,.18)}
.bc-item:first-child{border-top:0}
.bc-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bc-batch-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:6px}
.bc-sep{border:0;border-top:1px solid rgba(127,127,127,.18);margin:16px 0}
/* Character Generator */
.asset-section-head,.character-generator-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.character-generator{margin:16px 0 20px;padding:18px;border:1px solid var(--color-border);border-radius:var(--radius-lg,14px);background:var(--color-surface-subtle)}.character-generator-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px}.character-generator-form label{display:flex;flex-direction:column;gap:2px;font-weight:600;font-size:var(--text-sm,13px)}.character-generator-form .optional{display:block;font-weight:400;line-height:1.4}.character-generator-head strong{font-size:var(--text-md,15px)}.character-generator-status:empty{display:none}.character-generator-status{margin-top:14px;padding:9px 12px;border-radius:9px;background:var(--color-surface);border:1px solid var(--color-border-subtle)}.character-generator-form .wide{grid-column:1/-1}.character-generator-previews{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:12px}.character-generator-preview{overflow:hidden;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface)}.character-generator-preview img{display:block;width:100%;aspect-ratio:9/16;object-fit:cover}.character-generator-preview span{display:block;padding:8px 10px;font-size:var(--text-xs);font-weight:600;color:var(--color-text-secondary);border-top:1px solid var(--color-border-subtle)}.character-generator-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.character-generator-actions:empty{display:none}@media(max-width:720px){.asset-section-head,.character-generator-head{align-items:stretch;flex-direction:column}.character-generator-form{grid-template-columns:1fr}.character-generator-form .wide{grid-column:auto}.character-generator-previews{grid-template-columns:1fr 1fr 1fr}}

/* Product family editor: product photos are explicitly grouped by operator-defined variants. */
.product-family-create { display: grid; gap: 12px; }
.variant-builder-head, .variant-manager-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.new-product-variants, .family-variant-manager-list { display: grid; gap: 12px; }
.new-product-variant, .managed-variant { padding: 12px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface); }
.new-variant-head, .managed-variant-head { display: flex; align-items: flex-end; gap: 10px; justify-content: space-between; }
.new-variant-head > label, .managed-variant-head > label { flex: 1; margin: 0; }
.family-variant-manager { margin: 0 18px 18px; padding-top: 18px; border-top: 1px solid var(--color-border-subtle); }
.managed-variant-actions { display: flex; gap: 6px; align-items: center; }
.managed-add-photos { margin: 12px 0; }
.managed-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.managed-photo { min-width: 0; overflow: hidden; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-sm); background: var(--color-surface-subtle); }
.managed-photo img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.managed-photo-actions { display: grid; gap: 6px; padding: 7px; }
.managed-photo-actions select { min-width: 0; width: 100%; }
@media (max-width: 720px) {
  .new-variant-head, .managed-variant-head, .variant-manager-head { align-items: stretch; flex-direction: column; }
  .managed-variant-actions { width: 100%; }
}

/* Batch Clean localization */
.bc-localization-controls { margin-top: 14px; padding: 14px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: var(--color-surface-subtle); }
.bc-stage { display: inline-flex; margin-left: 8px; padding: 2px 7px; border-radius: var(--radius-full); background: var(--color-info-soft); color: var(--color-info); font-size: var(--text-xs); font-weight: 650; vertical-align: middle; }
.bc-warning { display: inline-flex; margin-left: 6px; padding: 2px 7px; border-radius: var(--radius-full); background: var(--color-warning-soft); color: var(--color-warning); font-size: var(--text-xs); font-weight: 650; vertical-align: middle; }

/* Disk pressure banner and reclaim dialog.
   The banner is docked rather than floating: at 90% full the next render is the
   thing at risk, so it holds a line at the top of the shell until the usage
   drops back under the threshold or the operator dismisses it for the session. */
.disk-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-xs);
}
.disk-banner[hidden] { display: none; }
.disk-banner.is-critical {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}
.disk-banner-icon { display: flex; flex: 0 0 auto; }
.disk-banner-icon svg { width: 18px; height: 18px; }
.disk-banner-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; flex: 1 1 auto; }
.disk-banner-text { color: inherit; opacity: .85; }
.disk-banner .btn { flex: 0 0 auto; }

.disk-usage-line { margin-bottom: 12px; }
.disk-meter {
  position: relative;
  height: 8px;
  margin: 8px 0 4px;
  border-radius: 999px;
  background: var(--color-surface-selected);
  overflow: hidden;
}
.disk-meter-fill { height: 100%; background: var(--color-success); transition: width .3s ease; }
.disk-meter-fill.is-warning { background: var(--color-warning); }
.disk-meter-fill.is-critical { background: var(--color-danger); }

.disk-list { display: flex; flex-direction: column; gap: 8px; }
.disk-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 10px;
  background: var(--color-surface);
}
.disk-item.is-empty { opacity: .55; }
.disk-item input { margin-top: 3px; flex: 0 0 auto; }
.disk-item-body { min-width: 0; }
.disk-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.disk-item-size { font-variant-numeric: tabular-nums; color: var(--color-text-secondary); }
.disk-item-detail { display: block; margin-top: 2px; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.disk-tag {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--color-surface-selected);
  color: var(--color-text-secondary);
}
.disk-tag.is-review { background: var(--color-warning-soft); color: var(--color-warning); }
.disk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

/* Password gate */
.login-page {
  display: grid;
  min-height: 100vh;
  background: var(--color-canvas);
}
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr);
  width: min(100%, 1120px);
  min-height: 680px;
  margin: auto;
  padding: clamp(24px, 5vw, 72px);
}
.login-context {
  display: flex;
  align-items: flex-end;
  min-width: 0;
  padding: clamp(38px, 6vw, 76px);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border-subtle);
  border-right: 0;
}
.login-context-copy { max-width: 470px; }
.login-context h1 {
  margin: 0 0 18px;
  font-family: var(--font-editorial);
  font-size: clamp(36px, 4.6vw, 62px);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.045em;
}
.login-context-copy > p:last-child {
  max-width: 400px;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-md);
}
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(36px, 5vw, 64px);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-hairline);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: clamp(54px, 8vw, 88px);
}
.login-brand-logo {
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  object-fit: contain;
}
.login-brand-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.login-eyebrow {
  margin: 0 0 12px;
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.login-heading { margin-bottom: 26px; }
.login-heading h2 {
  margin: 0 0 8px;
  font-family: var(--font-editorial);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -.035em;
}
.login-heading > p:last-child { margin: 0; color: var(--color-text-secondary); }
.login-form label { margin-bottom: 6px; }
.login-form input { margin-top: 0; }
.login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  padding: 9px 15px;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  font-weight: 600;
  transition: background var(--motion-fast) ease, border-color var(--motion-fast) ease, transform var(--motion-fast) ease;
}
.login-submit:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); transform: translateY(-1px); }
.login-submit:active { background: var(--color-accent-pressed); border-color: var(--color-accent-pressed); transform: none; }
.login-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: var(--text-xs);
  font-weight: 600;
}
.login-form input[aria-invalid="true"] { border-color: var(--color-danger); }

@media (max-width: 760px) {
  .login-shell {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
  }
  .login-context { display: none; }
  .login-card {
    width: min(100%, 430px);
    margin: auto;
    padding: clamp(30px, 8vw, 44px);
    border-radius: var(--radius-lg);
  }
  .login-brand { margin-bottom: 52px; }
}

/* Library filtering */
.library-filter-panel { margin: 0 0 16px; padding: 14px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); background: var(--color-surface-subtle); }
.library-filter-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.library-search { flex: 1 1 280px; margin: 0; }
.library-search input { width: 100%; min-height: 38px; margin: 0; background: var(--color-surface); }
.library-quick-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.library-quick { min-height: 34px; padding: 7px 11px; border: 1px solid transparent; border-radius: var(--radius-full); background: transparent; color: var(--color-text-secondary); font: 600 var(--text-xs)/1 var(--font-ui); cursor: pointer; }
.library-quick:hover { color: var(--color-text); background: var(--color-surface); }
.library-quick.active { color: var(--color-text); background: var(--color-surface); border-color: var(--color-border-subtle); box-shadow: 0 1px 2px rgba(20,20,19,.07); }
.library-advanced-filters { display: grid; grid-template-columns: repeat(3,minmax(150px,1fr)); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-subtle); }
.library-advanced-filters[hidden] { display: none; }
.library-advanced-filters label, .library-sort { margin: 0; font-size: var(--text-xs); color: var(--color-text-secondary); }
.library-advanced-filters select, .library-sort select { min-height: 36px; margin-top: 5px; background: var(--color-surface); }
.library-view-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-subtle); }
.library-view-row .library-toolbar { margin: 0; }
.library-sort { min-width: 150px; }
.library-filter-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 11px; }
.library-active-filters { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.library-filter-chip, .library-clear-filters { border: 0; border-radius: var(--radius-full); cursor: pointer; font: 600 11px/1 var(--font-ui); }
.library-filter-chip { padding: 6px 9px; color: var(--color-text-secondary); background: var(--color-surface); border: 1px solid var(--color-border-subtle); }
.library-filter-chip:hover { color: var(--color-text); border-color: var(--color-border); }
.library-clear-filters { padding: 6px 8px; color: var(--color-accent); background: transparent; }
@media (max-width: 820px) {
  .library-advanced-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-view-row { align-items: stretch; flex-direction: column; }
  .library-sort { width: 100%; }
}
@media (max-width: 560px) {
  .library-filter-panel { padding: 11px; }
  .library-advanced-filters { grid-template-columns: 1fr; }
  .library-quick-filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .library-quick { white-space: nowrap; }
}
