.step .gate {
  justify-self: end;
  border: 1px solid #d8b9aa;
  border-radius: 8px;
  padding: 2px 5px;
  color: #aa482b;
  font-size: 8px;
  letter-spacing: .04em;
}
.step.done .gate { border-color: #a9c5b7; color: var(--green); }
.confirmation-gate {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 11px;
  align-items: center;
  margin-bottom: 18px;
  padding: 11px 13px;
  border: 1px solid #efc4b1;
  border-radius: 11px;
  background: #fff5ef;
}
.confirmation-gate .gate-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}
.confirmation-gate strong { display: block; font-size: 12px; }
.confirmation-gate p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.confirmation-gate .gate-state {
  border: 1px solid #e4b49e;
  border-radius: 12px;
  padding: 4px 8px;
  color: #aa482b;
  font-size: 9px;
}
.confirmation-gate.confirmed { border-color: #b9d2c5; background: #f2f8f4; }
.confirmation-gate.confirmed .gate-icon { background: var(--green); }
.confirmation-gate.confirmed .gate-state { border-color: #a9c5b7; color: var(--green); }
.source-proof {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #b9d2c5;
  border-radius: 10px;
  background: #f2f8f4;
}
.source-proof strong { display: block; margin-top: 4px; color: var(--green); font-size: 12px; }
.source-proof p { max-width: 55%; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; text-align: right; }
.evidence-card { margin-bottom: 18px; }
.evidence-card p { margin: 5px 0; }
.source-only { margin-top: 16px !important; padding: 10px; border-radius: 8px; background: #f2f8f4; color: var(--green) !important; }
.option-effect { margin-top: 10px; padding: 8px 10px; border-radius: 7px; background: #f2eee6; color: #61635d; font-size: 10px; line-height: 1.5; }
.strategy-ribbon { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; padding: 11px 13px; border-left: 3px solid var(--orange); border-radius: 0 9px 9px 0; background: #fff2ea; }
.strategy-ribbon strong { font-size: 12px; }
.strategy-ribbon span { color: var(--muted); font-size: 10px; text-align: right; }
.episode-tools { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px; border-radius: 10px; background: #f1ece3; }
.episode-tools label { flex: 1; color: var(--muted); font-size: 10px; }
.episode-tools select { margin-top: 5px; padding: 9px 11px; }
.asset-delete { margin-top: 10px; border: 0; background: transparent; color: #b34b32; font-size: 9px; cursor: pointer; }
.asset-add-row { display: grid; grid-template-columns: minmax(180px,1fr) 110px auto; gap: 8px; margin: 0 0 14px; }
.asset-add-row input, .asset-add-row select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.character-fix { display: grid; grid-template-columns: minmax(220px,1fr) auto; align-items: end; gap: 8px; margin: 12px 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.character-fix label { color: var(--muted); font-size: 10px; }
.character-fix input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.analysis-card.four { grid-template-columns: repeat(4,1fr); }
.analysis-card.six { grid-template-columns: repeat(6,1fr); }
.brain-console { display: grid; grid-template-columns: minmax(240px,1.3fr) minmax(260px,1fr) auto; gap: 14px; align-items: center; margin-bottom: 14px; padding: 18px; border: 1px solid #abcab9; border-radius: 12px; background: linear-gradient(135deg,#edf8f1,#fffefa); }
.brain-console h3 { margin: 5px 0; font-family: "Noto Serif SC",serif; }
.brain-console p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.brain-passes { display: flex; flex-wrap: wrap; gap: 6px; }
.brain-passes span { padding: 5px 7px; border-radius: 12px; background: #dfeee5; color: #2f6d4e; font-size: 8px; }
.people-section { margin: 0 0 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fffefa; }
.people-section h3 { margin: 5px 0 0; font-family: "Noto Serif SC", serif; }
.people-total { color: var(--orange); font-size: 12px; font-family: "Space Grotesk", sans-serif; }
.people-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.people-tools input { flex: 1 1 210px; min-width: 160px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.people-filter { border: 1px solid var(--line); border-radius: 16px; padding: 7px 10px; background: #fff; color: var(--muted); font-size: 9px; cursor: pointer; }
.people-filter.selected { border-color: var(--orange); background: #fff0e8; color: #a63e22; }
.people-list { display: grid; gap: 8px; max-height: 480px; overflow: auto; padding-right: 4px; }
.person-row { position: relative; display: grid; grid-template-columns: minmax(150px,.7fr) 120px minmax(260px,1.8fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.person-row[hidden] { display: none; }
.person-row strong { margin-left: 7px; font-family: "Noto Serif SC", serif; }
.person-role { display: inline-block; padding: 3px 6px; border-radius: 9px; background: #eee9df; color: var(--muted); font-size: 8px; }
.person-role.core { background: #ffe4d5; color: #9f351d; }
.person-role.support { background: #e4f1e9; color: #2f6d4e; }
.person-count { color: var(--muted); font-size: 9px; }
.person-count b { color: var(--ink); font-size: 12px; }
.person-row p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.person-delete { border: 0; background: transparent; color: #b34b32; font-size: 8px; cursor: pointer; }
.person-add-row { display: grid; grid-template-columns: minmax(180px,1fr) 120px auto; gap: 8px; margin-top: 12px; }
.person-add-row input, .person-add-row select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.brain-library,.brain-timeline { margin: 0 0 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fffefa; }
.brain-library h3,.brain-timeline h3 { margin: 5px 0 0; font-family: "Noto Serif SC",serif; }
.brain-tools,.asset-filterbar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.brain-tools input,.asset-filterbar input { flex: 1 1 220px; min-width: 170px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.brain-tab,.asset-filter { border: 1px solid var(--line); border-radius: 16px; padding: 7px 10px; background: #fff; color: var(--muted); font-size: 9px; cursor: pointer; }
.brain-tab.selected,.asset-filter.selected { border-color: var(--orange); background: #fff0e8; color: #a63e22; }
.brain-pane { display: none; max-height: 430px; overflow: auto; }
.brain-pane.selected { display: grid; gap: 8px; }
.brain-entity { display: grid; grid-template-columns: minmax(150px,.7fr) 70px minmax(280px,1.8fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.brain-entity[hidden] { display: none; }
.brain-entity span { display: block; color: var(--orange); font-size: 8px; }
.brain-entity strong { font-family: "Noto Serif SC",serif; }
.brain-entity>b { font-size: 10px; }
.brain-entity p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.brain-entity-delete { border: 0; background: transparent; color: #b34b32; font-size: 8px; cursor: pointer; }
.brain-add-row { display: grid; grid-template-columns: minmax(180px,1fr) 120px auto; gap: 8px; margin-top: 12px; }
.brain-add-row input,.brain-add-row select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.empty-state { color: var(--muted); font-size: 10px; }
.timeline-list { display: grid; gap: 8px; }
.timeline-list article { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-list article:last-child { border-bottom: 0; }
.timeline-list i { display: grid; place-items: center; width: 44px; height: 28px; border-radius: 14px; background: var(--ink); color: #fff; font-style: normal; font-size: 9px; }
.timeline-list strong { font-family: "Noto Serif SC",serif; font-size: 11px; }
.timeline-list p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.shot-edit { min-height: 84px; margin: 4px 0 8px; font-family: "Noto Serif SC", serif; font-size: 11px; line-height: 1.6; }
.delivery-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; margin-bottom: 18px; }
.delivery-stat { padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.delivery-stat span { display: block; color: var(--muted); font-size: 9px; }
.delivery-stat strong { display: block; margin-top: 6px; font-size: 13px; }
.export-actions { display: flex; gap: 9px; margin-top: 16px; }
.screenplay-doc { padding: 8px 28px 28px; }
.screenplay-scene { padding: 22px 0; border-bottom: 1px solid var(--line); }
.screenplay-scene:last-of-type { border-bottom: 0; }
.screenplay-scene h4 { margin: 0 0 16px; font-size: 18px; color: var(--ink); }
.screen-action { margin: 9px 0; line-height: 1.8; }
.screen-dialogue { margin: 10px 0 10px 2.5em; font-weight: 650; line-height: 1.75; }
.screen-chapter { display: inline-block; margin: 0 0 12px; padding: 5px 10px; border-radius: 999px; background: var(--paper-deep); color: var(--muted); font-size: 12px; }
.screen-hook { margin-top: 22px; padding: 16px; border-left: 3px solid var(--accent); background: var(--accent-pale); }
.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  visibility: hidden;
  padding: 18px;
  background: rgba(20,22,19,.52);
  opacity: 0;
  backdrop-filter: blur(7px);
  transition: .2s;
}
.modal-backdrop.open { visibility: visible; opacity: 1; }
.confirm-modal {
  position: relative;
  width: min(530px, 100%);
  padding: 30px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0,0,0,.3);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 15px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}
.confirm-seal {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 6px #f7d3c2;
  color: #fff;
  font-family: "Noto Serif SC", serif;
  font-weight: 900;
  transform: rotate(-8deg);
}
.confirm-modal h2 { margin: 7px 0 8px; font-family: "Noto Serif SC", serif; font-size: 24px; }
.confirm-modal > p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.confirm-effects { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 18px 0; }
.effect { padding: 10px; border-radius: 8px; background: #eee9df; }
.effect span { display: block; color: var(--muted); font-size: 9px; }
.effect strong { font-size: 11px; }
.effect.downstream { grid-column: 1 / -1; background: #fff0e8; color: #9d3c22; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-modal > small { display: block; margin-top: 13px; color: #96938b; font-size: 9px; line-height: 1.5; }
@media (max-width: 760px) {
  .pipeline { grid-template-columns: repeat(9, 1fr); }
  .step .gate { display: none; }
  .confirmation-gate { grid-template-columns: 34px 1fr; }
  .confirmation-gate .gate-state { display: none; }
  .source-proof { display: block; }
  .source-proof p { max-width: none; margin-top: 8px; text-align: left; }
  .confirm-modal { padding: 24px 18px; }
  .confirm-effects { grid-template-columns: 1fr; }
  .modal-actions { display: grid; }
  .modal-actions .btn { width: 100%; }
  .strategy-ribbon, .episode-tools { display: block; }
  .strategy-ribbon span { display: block; margin-top: 6px; text-align: left; }
  .episode-tools .btn { width: 100%; margin-top: 8px; }
  .delivery-grid { grid-template-columns: repeat(2,1fr); }
  .export-actions { display: grid; }
  .asset-add-row { grid-template-columns: 1fr; }
  .character-fix { grid-template-columns: 1fr; }
  .analysis-card.four { grid-template-columns: repeat(2,1fr); }
  .analysis-card.six { grid-template-columns: repeat(2,1fr); }
  .brain-console { grid-template-columns: 1fr; }
  .person-row { grid-template-columns: 1fr; }
  .person-add-row { grid-template-columns: 1fr; }
  .brain-entity { grid-template-columns: 1fr; }
  .brain-add-row { grid-template-columns: 1fr; }
}

/* Visual system v8 · editorial film production desk */
:root {
  --ink: #1d211d;
  --ink-2: #353a34;
  --paper: #f2eee6;
  --paper-deep: #e9e2d6;
  --panel: #fbfaf6;
  --panel-solid: #fffefa;
  --line: #ddd6ca;
  --line-strong: #c7bcad;
  --muted: #73766f;
  --orange: #e95732;
  --orange-2: #f27a50;
  --accent: #e95732;
  --accent-pale: #fff0e9;
  --green: #275444;
  --soft: #eee8de;
  --shadow: 0 18px 48px rgba(44, 38, 30, .07), 0 2px 8px rgba(44, 38, 30, .035);
}

html { scroll-behavior: smooth; }
body {
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  background:
    radial-gradient(circle at 78% -10%, rgba(233, 87, 50, .15), transparent 32%),
    radial-gradient(circle at 12% 104%, rgba(39, 84, 68, .08), transparent 32%),
    linear-gradient(145deg, #f7f3ec 0%, #eee8dd 100%);
  letter-spacing: .005em;
}
.noise { opacity: .12; }

.topbar {
  height: 72px;
  padding: 0 28px;
  border-bottom-color: rgba(29, 33, 29, .1);
  background: rgba(247, 244, 237, .88);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}
.brand { gap: 12px; font-size: 15px; letter-spacing: .03em; }
.brand-mark {
  width: 38px;
  height: 38px;
  background: linear-gradient(145deg, #292e29, #121512);
  box-shadow: 0 5px 14px rgba(29, 33, 29, .18);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
}
.project-switch {
  min-width: 210px;
  justify-content: center;
  padding: 8px 14px;
  background: rgba(255, 254, 250, .78);
  box-shadow: inset 0 1px rgba(255, 255, 255, .8);
}
.save-state { font-size: 11px; }
.btn {
  min-height: 40px;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 650;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(35, 32, 27, .08); }
.btn:focus-visible, .icon-btn:focus-visible, .step:focus-visible, .choice:focus-visible,
.people-filter:focus-visible, .brain-tab:focus-visible, .asset-filter:focus-visible {
  outline: 3px solid rgba(233, 87, 50, .2);
  outline-offset: 2px;
}
.btn.ghost { background: rgba(255, 254, 250, .58); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line-strong); background: var(--panel-solid); }
.btn.warm { background: #fff2eb; color: #a53d22; border-color: #efc5b4; }
.btn.primary {
  background: linear-gradient(135deg, #222722, #121512);
  padding: 12px 20px;
  box-shadow: 0 8px 22px rgba(20, 24, 20, .18);
}
.icon-btn { border-radius: 7px; padding: 5px; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }

.workspace {
  grid-template-columns: 250px minmax(620px, 1fr) 292px;
  gap: 16px;
  min-height: calc(100vh - 72px);
  padding: 16px;
}
.panel {
  border-color: rgba(58, 52, 44, .11);
  border-radius: 18px;
  background: rgba(251, 250, 246, .93);
  box-shadow: var(--shadow);
}
.sidebar, .inspector { padding: 24px 22px; }
.sidebar { position: sticky; top: 88px; height: calc(100vh - 104px); overflow: auto; }
.inspector { position: sticky; top: 88px; height: calc(100vh - 104px); }
.eyebrow, .section-label {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  font-size: 10px;
  letter-spacing: .2em;
}
.sidebar h1 {
  margin: 12px 0 10px;
  font-size: 32px;
  line-height: 1.22;
  letter-spacing: -.035em;
}
.lede { margin-bottom: 26px; color: #6f716b; font-size: 13px; line-height: 1.75; }
.pipeline { gap: 2px; }
.step {
  min-height: 48px;
  grid-template-columns: 32px 1fr auto;
  padding: 7px 8px;
  border-radius: 11px;
  transition: background .18s ease, color .18s ease;
}
.step:hover { background: rgba(233, 87, 50, .055); }
.step:not(:last-child):after { left: 23px; top: 39px; height: 20px; }
.step .num { width: 31px; height: 31px; font-family: "Space Grotesk", sans-serif; }
.step strong { font-size: 13px; font-weight: 650; }
.step small { font-size: 8px; }
.step.active { background: #fff1e9; }
.step.active .num { box-shadow: 0 0 0 4px rgba(233, 87, 50, .11); }
.step.done:hover { background: rgba(39, 84, 68, .055); }
.team-card { padding-top: 26px; }
.avatars span { width: 31px; height: 31px; box-shadow: 0 2px 5px rgba(30, 30, 26, .06); }
.rule-note { border: 1px solid rgba(58, 52, 44, .07); background: #f0ebe1; }

.stage { min-height: calc(100vh - 104px); }
.stage-head {
  padding: 30px 36px 24px;
  background: linear-gradient(180deg, rgba(255, 254, 250, .72), rgba(251, 250, 246, .2));
}
.stage-head h2 { margin-top: 9px; font-size: 30px; line-height: 1.25; letter-spacing: -.025em; }
.stage-head-actions { display: flex; align-items: center; gap: 8px; }
.view-mode-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: #eee9df; }
.mode-btn { min-width: 48px; padding: 5px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.mode-btn.active { background: var(--panel-solid); color: var(--ink); box-shadow: 0 2px 8px rgba(35,31,26,.09); }
.review-only { display: none !important; }
body.review-mode .edit-only { display: none !important; }
body.review-mode .review-only { display: block !important; }
.focus-toggle {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 254, 250, .65);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}
.focus-toggle:hover, .focus-toggle[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.status-pill {
  padding: 7px 12px;
  border: 1px solid rgba(58, 52, 44, .08);
  background: #f0ebe1;
  font-size: 10px;
  font-weight: 600;
}
.stage-content { padding: 28px 36px 36px; }
.stage-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding: 16px 36px;
  border-top-color: rgba(58, 52, 44, .11);
  background: rgba(247, 244, 237, .94);
  backdrop-filter: blur(14px);
}
.stage-footer p { font-size: 11px; line-height: 1.6; }
.footer-actions { gap: 10px; }

.confirmation-gate {
  grid-template-columns: 42px 1fr auto;
  gap: 14px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-color: #edc3b2;
  border-radius: 14px;
  background: linear-gradient(100deg, #fff3ed, #fffaf6);
}
.confirmation-gate .gate-icon { width: 38px; height: 38px; box-shadow: 0 5px 12px rgba(233, 87, 50, .18); }
.confirmation-gate strong { font-size: 13px; }
.confirmation-gate p { margin-top: 4px; font-size: 11px; line-height: 1.5; }
.confirmation-gate .gate-state { padding: 5px 9px; font-family: "Space Grotesk", sans-serif; font-weight: 600; }

.upload-zone {
  padding: 44px 28px;
  border-color: #c8bdaf;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.72), rgba(238,232,222,.56));
}
.upload-zone:hover { border-color: var(--orange); box-shadow: inset 0 0 0 1px rgba(233,87,50,.08); }
.upload-icon { width: 62px; height: 62px; border-radius: 18px; box-shadow: 0 10px 24px rgba(29,33,29,.14); }
.upload-zone h3 { font-size: 20px; }
.upload-zone p { font-size: 13px; line-height: 1.6; }
textarea, .field, select, .asset-add-row input, .asset-add-row select,
.person-add-row input, .person-add-row select, .brain-add-row input, .brain-add-row select,
.people-tools input, .brain-tools input, .asset-filterbar input, .character-fix input {
  border-color: #d7d0c5;
  border-radius: 10px;
  background: var(--panel-solid);
  font-size: 13px;
}
textarea { min-height: 190px; font-family: "Noto Serif SC", serif; font-size: 14px; line-height: 1.9; }

.choice-grid { gap: 14px; }
.choice { padding: 20px; border-radius: 15px; background: var(--panel-solid); }
.choice:hover { transform: translateY(-1px); }
.choice h3 { font-size: 19px; }
.choice p { font-size: 13px; line-height: 1.75; }
.choice .tags { gap: 7px; }
.tag { padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 600; }

.source-proof, .strategy-ribbon, .episode-tools, .brain-console,
.people-section, .brain-library, .brain-timeline, .analysis-card, .document-card {
  border-radius: 14px;
}
.source-proof { padding: 15px 17px; }
.strategy-ribbon {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-left-width: 4px;
  background: linear-gradient(90deg, #fff0e8, #fff8f4);
}
.strategy-ribbon strong { font-size: 13px; }
.strategy-ribbon span { font-size: 11px; line-height: 1.55; }
.episode-tools { padding: 14px; background: #f0ebe2; }
.analysis-card { gap: 16px; padding: 20px; }
.metric { padding-right: 12px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { font-size: 11px; }
.metric strong { margin-top: 7px; font-size: 21px; }
.document-card { padding: 24px; background: var(--panel-solid); }
.document-card h3 { margin-bottom: 15px; font-size: 20px; }
.document-card p, .document-card li { color: #4f544e; font-size: 13px; line-height: 1.9; }
.doc-toolbar { margin-bottom: 15px; }
.doc-toolbar h3 { margin: 5px 0 0; font-family: "Noto Serif SC", serif; font-size: 22px; }

.episode-list { gap: 10px; }
.episode {
  grid-template-columns: 62px 1fr auto;
  gap: 15px;
  padding: 15px 16px;
  border-radius: 11px;
  background: var(--panel-solid);
  transition: border-color .18s ease, transform .18s ease;
}
.episode:hover { transform: translateX(2px); border-color: var(--line-strong); }
.episode b { font-size: 14px; }
.episode strong { font-size: 14px; }
.episode span { font-size: 12px; line-height: 1.55; }
.episode i { font-size: 11px; }

.brain-console { padding: 20px; background: linear-gradient(135deg,#edf7f0,#fffefa 72%); }
.brain-console h3, .people-section h3, .brain-library h3, .brain-timeline h3 { font-size: 18px; }
.brain-console p { font-size: 11px; }
.brain-passes span { padding: 6px 9px; font-size: 9px; }
.people-section, .brain-library, .brain-timeline { padding: 20px; }
.person-row, .brain-entity { padding: 13px 14px; border-radius: 11px; }
.person-row p, .brain-entity p { font-size: 10px; line-height: 1.65; }
.person-row strong, .brain-entity strong { font-size: 13px; }
.people-filter, .brain-tab, .asset-filter { padding: 8px 12px; font-size: 10px; }

.asset-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.asset-card {
  position: relative;
  min-height: 150px;
  padding: 16px;
  border-radius: 12px;
  background: var(--panel-solid);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.asset-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 12px 26px rgba(44,38,30,.07); }
.asset-card h4 { margin: 10px 0 8px; font-size: 16px; }
.asset-card p { font-size: 11px; line-height: 1.7; }
.asset-delete { position: absolute; right: 12px; bottom: 11px; }

.screenplay-doc { max-width: 980px; margin: 0 auto; padding: 10px 34px 34px; }
.screenplay-scene { padding: 28px 0; }
.screenplay-scene h4 {
  margin-bottom: 20px;
  padding: 10px 12px;
  border-left: 3px solid var(--ink);
  background: #f3eee5;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 16px;
  letter-spacing: .01em;
}
.screen-action { margin: 11px 0; color: #4a504a !important; font-family: "Noto Serif SC", serif; font-size: 14px !important; line-height: 1.95 !important; }
.screen-dialogue { margin: 13px 5% 13px 12%; color: var(--ink) !important; font-size: 14px !important; line-height: 1.85 !important; }
.screen-chapter { padding: 6px 11px; font-size: 11px; }
.screen-hook { margin-top: 26px; padding: 18px 20px; }

.episode-navigator { display: flex; align-items: center; gap: 8px; }
.episode-arrow { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-solid); color: var(--ink); cursor: pointer; }
.episode-arrow:disabled { opacity: .35; cursor: default; }
.episode-rail { display: flex; gap: 8px; margin: 12px 0 16px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: thin; }
.episode-chip { flex: 0 0 132px; min-height: 50px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.55); color: var(--muted); text-align: left; cursor: pointer; }
.episode-chip b, .episode-chip span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.episode-chip b { color: var(--ink); font-family: "Space Grotesk", sans-serif; font-size: 12px; }
.episode-chip span { margin-top: 4px; font-size: 10px; }
.episode-chip.active { border-color: var(--orange); background: #fff2eb; box-shadow: inset 0 -2px 0 var(--orange); }
.source-coverage { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #d7d0c5; border-radius: 12px; background: #f8f5ee; }
.source-coverage > div:first-child { display: flex; justify-content: space-between; font-size: 11px; }
.source-coverage strong { font-family: "Space Grotesk", sans-serif; }
.source-coverage small { color: var(--muted); font-size: 10px; }
.coverage-track { position: relative; height: 6px; margin: 9px 0; overflow: hidden; border-radius: 999px; background: #ded7cc; }
.coverage-track i { position: absolute; top: 0; bottom: 0; border-radius: inherit; background: linear-gradient(90deg,var(--orange),#f0a45f); }
.script-workbench { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 14px; align-items: start; }
.script-workbench .screenplay-doc { width: 100%; max-width: none; margin: 0; }
.evidence-panel { position: sticky; top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #f1ede5; }
.evidence-panel h3 { margin: 5px 0 14px; font-family: "Noto Serif SC", serif; font-size: 18px; }
.evidence-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.evidence-metrics span { padding: 9px; border-radius: 8px; background: rgba(255,255,255,.65); color: var(--muted); font-size: 9px; }
.evidence-metrics b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 14px; }
.evidence-quote { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.evidence-quote small { color: var(--orange); font-size: 9px; font-weight: 700; }
.evidence-quote p { max-height: 118px; margin-top: 5px; overflow: auto; color: #50564f; font-family: "Noto Serif SC", serif; font-size: 11px; line-height: 1.75; }
.evidence-rule { margin-top: 12px; color: var(--muted); font-size: 9px; line-height: 1.6; }

.shot { grid-template-columns: 68px 1fr; gap: 16px; padding: 18px 0; }
.shot-id { padding: 10px 8px; border-radius: 10px; font-family: "Space Grotesk", sans-serif; font-size: 12px; }
.shot h4 { font-size: 16px; }
.shot p { font-size: 12px; line-height: 1.7; }
.shot .prompt { margin-top: 10px; padding: 12px 14px; border-radius: 9px; background: #f1ece3; }
.shot-edit { min-height: 104px; font-size: 13px; line-height: 1.75; }
.shot-timeline { display: flex; gap: 3px; min-height: 54px; margin: 0 0 16px; padding: 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #ece7de; }
.timeline-shot { min-width: 48px; padding: 7px 5px; border: 0; border-radius: 7px; background: #fffdf8; color: var(--ink); cursor: pointer; }
.timeline-shot:hover { background: #fff0e8; }
.timeline-shot b, .timeline-shot span { display: block; font-family: "Space Grotesk", sans-serif; font-size: 9px; }
.timeline-shot span { margin-top: 3px; color: var(--muted); }
.storyboard-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.story-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-solid); box-shadow: 0 8px 20px rgba(40,35,29,.04); }
.story-visual { position: relative; aspect-ratio: 16/7; overflow: hidden; padding: 15px; background: linear-gradient(145deg,#242a25,#111512); color: #fff; }
.visual-grid { position: absolute; inset: 0; opacity: .2; background-image: linear-gradient(rgba(255,255,255,.12) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.12) 1px,transparent 1px); background-size: 33.33% 50%; }
.story-visual > span { position: relative; font-family: "Space Grotesk", sans-serif; font-size: 8px; letter-spacing: .08em; opacity: .65; }
.story-visual > b { position: absolute; right: 14px; top: 13px; font-family: "Space Grotesk", sans-serif; font-size: 18px; }
.story-visual > small { position: absolute; left: 15px; bottom: 13px; font-size: 9px; opacity: .82; }
.story-card-body { padding: 16px; }
.story-card-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.story-card-head h4 { margin-top: 4px; font-size: 14px; line-height: 1.4; }
.shot-card-actions { display: flex; gap: 5px; }
.shot-card-actions button { height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #f4f0e8; color: var(--muted); font-size: 9px; cursor: pointer; }
.shot-card-actions button:disabled { opacity: .35; }
.story-card .shot-edit { width: 100%; min-height: 92px; }
.shot-review-text { min-height: 68px; color: #3f463f; font-family: "Noto Serif SC", serif; font-size: 12px; line-height: 1.8; }
.shot-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.shot-specs span { min-width: 0; padding: 8px; overflow: hidden; border-radius: 7px; background: #f4f0e8; color: var(--muted); font-size: 9px; line-height: 1.45; }
.shot-specs b { display: block; margin-bottom: 3px; color: var(--ink); }
.story-card details { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 9px; }
.story-card summary { color: var(--muted); font-size: 10px; cursor: pointer; }
.story-card .prompt { margin-top: 8px; padding: 10px; border-radius: 7px; background: #f1ece3; color: #50564f; font-size: 10px; line-height: 1.65; }

.inspector-head { min-height: 28px; }
.score-card { margin: 20px 0; padding: 18px; border-radius: 14px; background: linear-gradient(145deg,#222722,#111411); }
.score-card strong { font-family: "Space Grotesk", sans-serif; font-size: 26px; }
.progress { height: 5px; margin-top: 14px; }
.inspect-section { padding: 19px 0; }
.inspect-section h3 { margin-bottom: 13px; font-size: 12px; }
.stage-context-section { margin: 0 -4px; padding: 16px 14px; border: 1px solid #d8d0c4; border-radius: 12px; background: #f7f3eb; }
.stage-context-list { display: grid; gap: 8px; }
.stage-context-list div { display: grid; grid-template-columns: 20px 1fr; gap: 7px; align-items: start; color: var(--muted); font-size: 10px; line-height: 1.45; }
.stage-context-list i { display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-family: "Space Grotesk",sans-serif; font-size: 8px; font-style: normal; }
dl div { padding: 7px 0; font-size: 11px; }
.version-item { padding: 7px 0; font-size: 11px; }
.issue { padding-left: 11px; margin: 10px 0; font-size: 11px; line-height: 1.6; }
.privacy-note { margin-top: 6px; padding: 12px; font-size: 10px; line-height: 1.7; }

body.focus-mode .workspace { grid-template-columns: minmax(720px, 1180px); justify-content: center; }
body.focus-mode .sidebar, body.focus-mode .inspector { display: none; }
body.focus-mode .stage { width: 100%; }
body.focus-mode .stage-content { padding-left: clamp(28px, 5vw, 72px); padding-right: clamp(28px, 5vw, 72px); }
body.focus-mode .stage-head, body.focus-mode .stage-footer { padding-left: clamp(28px, 5vw, 72px); padding-right: clamp(28px, 5vw, 72px); }

.modal-backdrop { background: rgba(18, 21, 18, .6); }
.confirm-modal { width: min(590px, 100%); padding: 34px; border-radius: 20px; background: #fcfaf5; }
.confirm-seal { width: 62px; height: 62px; }
.confirm-modal h2 { font-size: 27px; }
.confirm-modal > p { font-size: 13px; }
.effect { padding: 12px; border-radius: 10px; }
.effect span { font-size: 10px; }
.effect strong { display: block; margin-top: 3px; font-size: 12px; line-height: 1.5; }
.confirm-modal > small { font-size: 10px; }

@media (min-width: 1650px) {
  .workspace { grid-template-columns: 270px minmax(720px, 1fr) 310px; gap: 18px; padding: 18px; }
  .stage-content { padding-left: 42px; padding-right: 42px; }
}

@media (max-width: 1280px) {
  .workspace { grid-template-columns: 228px minmax(560px, 1fr); }
  .inspector { display: none; }
  .sidebar { padding: 20px 17px; }
  .stage-content, .stage-head, .stage-footer { padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 1080px) {
  .script-workbench { grid-template-columns: 1fr; }
  .evidence-panel { position: static; }
  .storyboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .topbar { height: 64px; padding: 0 14px; grid-template-columns: 1fr auto; }
  .brand { font-size: 13px; }
  .brand-mark { width: 34px; height: 34px; }
  .project-switch, .save-state, .top-actions .ghost { display: none; }
  .workspace { display: block; min-height: calc(100vh - 64px); padding: 8px; }
  .sidebar { position: static; width: auto; height: auto; margin-bottom: 8px; padding: 13px 10px; overflow: visible; }
  .sidebar > .eyebrow, .sidebar h1, .lede, .team-card, .rule-note { display: none; }
  .pipeline { display: grid; grid-template-columns: repeat(9, minmax(34px, 1fr)); gap: 4px; overflow-x: auto; }
  .step { display: block; min-height: auto; padding: 4px 0; text-align: center; background: transparent; }
  .step:after, .step strong, .step small, .step .gate { display: none; }
  .step .num { width: 30px; height: 30px; margin: auto; }
  .step.active { background: transparent; }
  .stage { min-height: calc(100vh - 136px); border-radius: 15px; }
  .stage-head { padding: 22px 18px 18px; }
  .focus-toggle { display: none; }
  .view-mode-switch { margin-left: auto; }
  .stage-head h2 { font-size: 25px; }
  .stage-content { padding: 20px 18px 28px; }
  .stage-footer { padding: 13px 18px; }
  .stage-footer p { display: none; }
  .footer-actions { width: 100%; justify-content: flex-end; }
  .analysis-card, .analysis-card.four, .analysis-card.six { grid-template-columns: repeat(2, 1fr); }
  .metric { min-width: 0; }
  .metric:nth-child(even) { border-right: 0; }
  .document-card { padding: 18px; }
  .screenplay-doc { padding: 5px 18px 24px; }
  .screen-dialogue { margin-left: 5%; margin-right: 0; }
  .asset-grid { grid-template-columns: 1fr; }
  .shot { grid-template-columns: 54px 1fr; gap: 11px; }
  .episode-rail { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 520px) {
  .top-actions .warm { padding: 9px 11px; }
  .stage-head { display: block; }
  .stage-head-actions { margin-top: 12px; justify-content: space-between; }
  .status-pill { display: inline-block; margin-top: 12px; }
  .confirmation-gate { grid-template-columns: 36px 1fr; padding: 12px; }
  .confirmation-gate .gate-state { display: none; }
  .source-proof, .strategy-ribbon, .episode-tools { display: block; }
  .source-proof p, .strategy-ribbon span { max-width: none; margin-top: 7px; text-align: left; }
  .episode-tools .btn { width: 100%; margin-top: 9px; }
  .episode-navigator { width: 100%; }
  .episode-navigator label { flex: 1; }
  .episode-navigator select { width: 100%; }
  .shot-specs { grid-template-columns: 1fr; }
  .analysis-card, .analysis-card.four, .analysis-card.six { grid-template-columns: 1fr; }
  .metric { padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { padding-bottom: 0; border-bottom: 0; }
  .episode { grid-template-columns: 52px 1fr; }
  .episode i { grid-column: 2; }
  .delivery-grid { grid-template-columns: 1fr 1fr; }
  .export-actions, .asset-add-row, .person-add-row, .brain-add-row, .character-fix { display: grid; grid-template-columns: 1fr; }
  .confirm-modal { padding: 28px 20px; }
  .confirm-effects { grid-template-columns: 1fr; }
  .modal-actions { display: grid; }
  .modal-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
