/* ============================================================
   AI Content Production Studio — UI Foundation (Phase 1A)
   Visual direction: clean · modern · light · generous whitespace ·
   subtle borders · soft shadows · rounded cards · creative-tool feel
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f8;
  --border: #e6e8f0;
  --border-strong: #d4d7e3;
  --text: #171a2b;
  --text-2: #4b5068;
  --text-3: #8a90a8;
  --accent: #5b5bd6;
  --accent-hover: #4a4ac4;
  --accent-soft: #eeeefc;
  --accent-text: #3f3fb8;
  --danger: #d9463f;
  --danger-soft: #fdeceb;
  --success: #1f9d6a;
  --success-soft: #e6f6ef;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --info-soft: #e8f1fd;
  --info-text: #2b5ea8;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(23, 26, 43, 0.04), 0 1px 3px rgba(23, 26, 43, 0.06);
  --shadow: 0 4px 16px rgba(23, 26, 43, 0.06), 0 1px 3px rgba(23, 26, 43, 0.05);
  --shadow-lg: 0 20px 50px rgba(23, 26, 43, 0.14);

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; }
[hidden] { display: none !important; }

/* ── App shell ─────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
}
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 12.5px; color: var(--text-3); }

.sidebar-nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  transition: background .15s, color .15s;
  width: 100%;
  border: 0; background: transparent; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-text); }
.nav-icon { width: 20px; height: 20px; flex: 0 0 20px; }

.sidebar-footer { margin-top: auto; padding: 12px 12px 16px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex: 0 0 34px;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-meta strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-form { margin: 0; }
.sidebar-version { padding: 10px 12px 0; font-size: 11.5px; color: var(--text-3); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(246, 247, 251, 0.85);
  backdrop-filter: saturate(150%) blur(8px);
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid transparent;
}
.topbar-title { font-size: 17px; font-weight: 600; color: var(--text-2); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar .sidebar-toggle { display: none; }

.app-content { padding: 12px 28px 48px; max-width: 1240px; width: 100%; }

/* ── Language switch ───────────────────────────────────────── */
.lang-switch {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; margin: 0;
}
.lang-btn {
  border: 0; background: transparent; color: var(--text-3);
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; letter-spacing: .02em;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active { background: var(--text); color: #fff; }
.lang-switch--auth { margin-top: 22px; justify-content: center; display: flex; width: max-content; margin-left: auto; margin-right: auto; }

/* ── Page head & typography ────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 18px 0 22px;
}
.page-title { font-size: 26px; line-height: 1.2; }
.page-sub { margin-top: 6px; color: var(--text-3); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.link { color: var(--accent-text); font-weight: 500; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card--flush { padding: 0; overflow: hidden; }
.card--accent { background: linear-gradient(160deg, #ffffff 0%, var(--accent-soft) 100%); }
.card--dashed { border-style: dashed; border-color: var(--border-strong); box-shadow: none; background: transparent; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card h3 { font-size: 16px; margin-bottom: 10px; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat-label { color: var(--text-3); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }

/* ── Pipeline / steps ──────────────────────────────────────── */
.pipeline { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; counter-reset: p; }
.pipeline li {
  counter-increment: p; display: flex; align-items: center; gap: 10px;
  font-weight: 500; font-size: 14px;
}
.pipeline li::before {
  content: counter(p); width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px;
}
.pipeline small { color: var(--text-3); font-weight: 400; }

.steps { list-style: none; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.step {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-3); font-size: 13px; font-weight: 500;
}
.step span {
  width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700;
}
.step.is-current { color: var(--accent-text); border-color: var(--accent); }
.step.is-current span { background: var(--accent); color: #fff; }

.placeholder { text-align: center; padding: 48px 24px; }
.placeholder h3 { margin-top: 14px; font-size: 18px; }
.placeholder .steps { justify-content: center; }

/* ── Lists & tables ────────────────────────────────────────── */
.list { list-style: none; display: flex; flex-direction: column; }
.list-item + .list-item { border-top: 1px solid var(--border); }
.list-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; color: inherit; }
.list-link:hover { text-decoration: none; background: var(--surface-2); border-radius: var(--radius-sm); }
.list-title { font-weight: 600; }
.list-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfe; }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions .btn + .btn { margin-left: 6px; }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; font-weight: 500; }

/* ── Badges & pills ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-2); color: var(--text-2);
}
.badge--draft { background: var(--surface-2); color: var(--text-2); }
.badge--planned { background: var(--info-soft); color: var(--info-text); }
.badge--approved { background: var(--accent-soft); color: var(--accent-text); }
.badge--generated { background: var(--success-soft); color: var(--success); }
.badge--archived { background: #f0f0f0; color: var(--text-3); }
.pill {
  display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); letter-spacing: .04em;
}
.pill--accent { background: var(--accent-soft); color: var(--accent-text); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(91, 91, 214, .3); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #c33a33; }
.btn--danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn--danger-ghost:hover { background: var(--danger-soft); }
.btn--sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }

/* ── Forms ─────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-help { font-size: 12.5px; color: var(--text-3); }
.field-error { font-size: 12.5px; color: var(--danger); min-height: 0; }
.field-error:empty { display: none; }
.input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.is-invalid { border-color: var(--danger); }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; gap: 2px; }
.segment { position: relative; }
.segment input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segment span {
  display: inline-block; padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-3);
  cursor: pointer;
}
.segment input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segment input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--info { background: var(--info-soft); color: var(--info-text); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }

/* ── Empty state ───────────────────────────────────────────── */
.empty { text-align: center; padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { color: var(--text-3); margin-bottom: 6px; }
.empty h3 { font-size: 17px; }
.empty .btn { margin-top: 12px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(23, 26, 43, .38);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease-out;
}
.modal-card {
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 22px 24px 24px;
  animation: popIn .18s ease-out;
}
.modal-card--sm { max-width: 400px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--text); color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow); animation: popIn .18s ease-out; max-width: 360px;
}
.toast--error { background: var(--danger); }
.toast--success { background: var(--success); }

/* ── Auth page ─────────────────────────────────────────────── */
.auth-body { background: radial-gradient(1200px 600px at 80% -10%, var(--accent-soft), transparent), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 440px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 32px 32px 28px;
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth-brand h1 { font-size: 16px; }
.auth-brand p { font-size: 13px; color: var(--text-3); }
.auth-title { font-size: 24px; margin-bottom: 4px; }
.auth-sub { color: var(--text-3); margin-bottom: 22px; }

/* ── Responsive ────────────────────────────────────────────── */
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(23, 26, 43, .35); z-index: 35; }

@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease-out;
    box-shadow: none;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .sidebar-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .app-content { padding: 8px 16px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 4px 0; }
  .dl dt { margin-top: 8px; }
  .auth-card { padding: 26px 22px; }
}

/* ============================================================
   WIZARD — Step 1 (Phase 1B)
   ============================================================ */
.wizard { max-width: 780px; margin: 0 auto; padding-bottom: 24px; }

.wiz-steps { list-style: none; display: flex; gap: 6px; margin: 6px 0 22px; padding: 0; }
.wiz-step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; color: var(--text-3); font-size: 13px; font-weight: 500; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.wiz-step-no { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex: 0 0 22px; }
.wiz-step-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wiz-step.is-current { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
.wiz-step.is-current .wiz-step-no { background: var(--accent); color: #fff; }

.wiz-head { margin-bottom: 18px; }
.wiz-head .page-title { font-size: 28px; }
.wiz-editing { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

.wiz-form { display: flex; flex-direction: column; gap: 14px; }
.wiz-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.wiz-block--idea { padding-top: 18px; }
.wiz-label-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wiz-label { font-size: 13.5px; font-weight: 650; color: var(--text); display: block; }
.wiz-under { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; min-height: 18px; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-3); }
.tag--required { background: var(--accent-soft); color: var(--accent-text); }

.idea-input {
  width: 100%; min-height: 140px; resize: vertical; padding: 14px 16px; font-size: 16px; line-height: 1.55;
  border: 1px solid var(--border-strong); border-radius: 14px; background: #fbfbfe; color: var(--text); font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.idea-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.idea-input.is-invalid { border-color: var(--danger); }
.idea-input::placeholder { color: #a3a8bd; }
.wiz-idea-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.btn--soft { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn--soft:hover { background: #e3e3fb; }
.btn--lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }

/* Enhance demo */
.enhance-demo { margin-top: 14px; border: 1px dashed var(--border-strong); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); }
.enhance-demo-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.enhance-demo-head strong { flex: 1; font-size: 14px; }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.enhance-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.enhance-col { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-height: 96px; display: flex; flex-direction: column; gap: 8px; }
.enhance-col--pending { border-style: dashed; }
.enhance-col-title { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.enhance-text { font-size: 13.5px; white-space: pre-wrap; color: var(--text-2); }
.skeleton-lines { display: flex; flex-direction: column; gap: 8px; }
.skeleton-lines span { height: 10px; border-radius: 6px; background: linear-gradient(90deg, #ececf4 25%, #f6f6fb 50%, #ececf4 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton-lines span:nth-child(2) { width: 85%; } .skeleton-lines span:nth-child(3) { width: 60%; }
@keyframes shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* Compact controls grid */
.wiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.wiz-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wiz-field--full { grid-column: 1 / -1; }
.wiz-sub { margin-top: 2px; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select { width: 100%; appearance: none; -webkit-appearance: none; padding: 10px 36px 10px 13px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input--sm { padding: 8px 11px; font-size: 13.5px; }
.segmented--full { display: flex; width: 100%; }
.segmented--full .segment { flex: 1; display: flex; }
.segmented--full .segment span { flex: 1; text-align: center; padding: 8px 6px; }
.segmented--wrap { flex-wrap: wrap; }
.inline-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.num-wrap { position: relative; display: inline-flex; align-items: center; }
.input--num { width: 92px; padding: 8px 26px 8px 11px; text-align: right; font-size: 14px; }
.num-suffix { position: absolute; right: 10px; font-size: 12.5px; color: var(--text-3); pointer-events: none; }
.per-scene { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.per-scene-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.per-scene-name { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.total-box { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 14px; }

/* Reference */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 22px; text-align: center; color: var(--text-3); cursor: pointer; margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: border-color .15s, background .15s; }
.dropzone p { color: var(--text-2); font-size: 14px; }
.dropzone:hover, .dropzone.is-over, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.link-btn { background: none; border: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.ref-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ref-card { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.ref-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: #ddd; }
.ref-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ref-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ref-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-opt { position: relative; }
.pill-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pill-opt span { display: inline-block; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.pill-opt input:checked + span { background: var(--text); color: #fff; border-color: var(--text); }
.pill-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.alert.small { font-size: 13px; padding: 9px 12px; margin: 10px 0 0; }

/* Advanced (details) */
.wiz-advanced { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.wiz-advanced summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 14px 20px; cursor: pointer; border-radius: var(--radius-lg); }
.wiz-advanced summary::-webkit-details-marker { display: none; }
.wiz-advanced summary:hover { background: var(--surface-2); }
.wiz-adv-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.wiz-adv-help { flex: 1; font-size: 12.5px; color: var(--text-3); }
.wiz-advanced .chev { color: var(--text-3); transition: transform .2s; }
.wiz-advanced[open] .chev { transform: rotate(180deg); }
.wiz-advanced[open] summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.adv-body { padding: 16px 20px 20px; }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: 10px; margin-bottom: 16px; overflow-x: auto; }
.tab { flex: 1; border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-3); cursor: pointer; white-space: nowrap; }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.adv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.adv-span { grid-column: 1 / -1; }
.adv-grid textarea.input { resize: vertical; min-height: 44px; }

/* Sticky action bar */
.wiz-actions { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px 12px 20px; background: rgba(255,255,255,.92); backdrop-filter: blur(10px) saturate(150%); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); margin-top: 4px; }
.wiz-actions-summary { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wiz-actions-summary #actionTotal { color: var(--accent-text); font-weight: 600; }

@media (max-width: 860px) {
  .wiz-steps { gap: 4px; }
  .wiz-step { padding: 8px; justify-content: center; }
  .wiz-step:not(.is-current) .wiz-step-label { display: none; }
  .wiz-head .page-title { font-size: 24px; }
  .wiz-block { padding: 16px; border-radius: 14px; }
  .wiz-grid, .adv-grid, .enhance-compare { grid-template-columns: 1fr; }
  .idea-input { font-size: 15px; }
  .segmented--full .segment span { padding: 10px 4px; font-size: 13px; }
  .ref-card { grid-template-columns: 72px 1fr; }
  .ref-thumb { width: 72px; height: 72px; }
  .wiz-adv-help { display: none; }
  .wiz-actions { flex-direction: column; align-items: stretch; bottom: 8px; padding: 12px 14px; }
  .wiz-actions .btn { width: 100%; }
  .wiz-actions-note { display: none; }
}

/* Summary & done-steps (Phase 1B) */
.dl--summary { grid-template-columns: 160px 1fr; }
.summary-idea { white-space: normal; line-height: 1.55; }
.wiz-step.is-done, .step.is-done { color: var(--success); border-color: var(--success-soft); }
.wiz-step.is-done .wiz-step-no, .step.is-done span { background: var(--success-soft); color: var(--success); }
.per-scene-row .num-wrap { flex: 0 0 auto; }
.per-scene-row .input--num { width: 84px; }
@media (max-width: 860px) {
  .per-scene { grid-template-columns: 1fr 1fr; }
  .per-scene-row { padding: 6px 6px 6px 10px; gap: 6px; }
  .per-scene-row .input--num { width: 78px; padding-right: 22px; }
}

/* ============================================================
   STEP 2 — Storyboard Plan · STEP 3 — Master Prompt (Phase 1C)
   ============================================================ */
.wizard--wide { max-width: 960px; }
.wiz-head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wiz-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wiz-actions-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.warn-text { color: var(--warn) !important; font-weight: 600; }
.cta-text { color: var(--accent-text) !important; font-weight: 600; }
.icon-btn--sm { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }

.plan-brief { margin-top: 12px; }
.brief-logline { font-size: 15.5px; font-weight: 500; color: var(--text); margin-bottom: 14px; line-height: 1.5; }
.brief-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 16px; margin: 0; }
.brief-grid div { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.brief-grid dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 600; }
.brief-grid dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.brief-wide { grid-column: span 2; }
.brief-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 16px 0 8px; }
.assumptions { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.assumptions li { display: flex; align-items: baseline; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--text-3); position: relative; top: 2px; }
.dot--high { background: var(--warn); } .dot--medium { background: var(--accent); } .dot--low { background: var(--border-strong); }

.plan-structure { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.plan-structure-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plan-structure-head h3 { font-size: 16px; }
.scene-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.scene-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: linear-gradient(90deg, var(--accent-soft), var(--surface)); border-bottom: 1px solid var(--border); }
.scene-id { font-weight: 800; letter-spacing: .06em; font-size: 12.5px; color: var(--accent-text); background: var(--surface); border: 1px solid var(--accent); padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.scene-meta { flex: 1; min-width: 0; }
.scene-title { font-weight: 650; font-size: 15px; }
.scene-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.shot-block { padding: 12px 18px 14px; border-top: 1px dashed var(--border); }
.shot-block:first-of-type { border-top: 0; }
.shot-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.shot-id { font-weight: 700; font-size: 13.5px; }
.shot-desc { font-size: 13px; color: var(--text-2); }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.frame-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.frame-card.is-hero { border-color: var(--accent); background: #fbfbff; }
.frame-head { display: flex; align-items: center; gap: 8px; }
.frame-head .icon-btn--sm { margin-left: auto; }
.frame-id { font-weight: 800; font-size: 13px; background: var(--text); color: #fff; padding: 2px 8px; border-radius: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.frame-type { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--text-3); }
.frame-state { font-size: 13.5px; font-weight: 500; line-height: 1.45; }
.frame-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 12.5px; }
.frame-meta dt { color: var(--text-3); white-space: nowrap; } .frame-meta dd { margin: 0; color: var(--text-2); }

.howto { margin-top: 12px; }
.howto-list { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; margin: 8px 0 10px; }
.ref-checklist { list-style: none; margin: 6px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.ref-checklist label { display: flex; align-items: center; gap: 8px; }
.prompt-card { margin-top: 14px; }
.prompt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.prompt-box { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; background: #fbfbfe; border: 1px solid var(--border-strong); border-radius: 12px; padding: 16px 18px; max-height: 60vh; overflow: auto; color: var(--text); }
.prompt-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .brief-grid { grid-template-columns: 1fr 1fr; }
  .brief-wide { grid-column: span 2; }
  .scene-head { flex-wrap: wrap; padding: 12px 14px; }
  .shot-block { padding: 10px 14px 12px; }
  .frames { grid-template-columns: 1fr; }
  .wiz-actions-btns { width: 100%; flex-direction: column; } .wiz-actions-btns .btn { width: 100%; }
  .prompt-box { font-size: 12.5px; padding: 12px; max-height: 50vh; }
}
