:root {
  --ink: #191714;
  --muted: #746f67;
  --line: #ddd6c9;
  --paper: #fffaf1;
  --page-ink: #111;
  --page-marker: rgba(55, 49, 40, 0.62);
  --surface: #efe8da;
  --panel: #f8f2e7;
  --panel-strong: #efe1c9;
  --accent: #2f5848;
  --accent-dark: #1f3b31;
  --topbar-bg: rgba(248, 242, 231, 0.97);
  --mode-bg: #e4dccf;
  --pill-text: #3f392f;
  --hover-tint: rgba(47, 88, 72, 0.12);
  --hover-border: rgba(47, 88, 72, 0.28);
  --field-bg: #fffdf8;
  --paper-line: rgba(74, 65, 51, 0.08);
  --modal-overlay: rgba(25, 23, 20, 0.38);
  --shadow-soft: rgba(25, 23, 20, 0.16);
  --shadow-deep: rgba(25, 23, 20, 0.28);
  --attention: #7d342e;
  --control-bg: #2b2925;
  --control-hover: #111;
  --control-contrast: #fffdf8;
  --page-sheet-gap: 28px;
  --page-sheet-height: 1056px;
  --page-sheet-width: 816px;
  --page-mask-top-height: 94px;
  --page-mask-bottom-height: 96px;
  --page-marker-offset: 110px;
  --paginated-height: var(--page-sheet-height);
}

:root[data-theme="dark"] {
  --ink: #eee7da;
  --muted: #b6aa99;
  --line: #4a4237;
  --surface: #181613;
  --page-ink: #111;
  --page-marker: rgba(55, 49, 40, 0.62);
  --panel: #23201b;
  --panel-strong: #342e25;
  --accent: #70aa91;
  --accent-dark: #a2d1bb;
  --topbar-bg: rgba(28, 25, 21, 0.97);
  --mode-bg: #2b261f;
  --pill-text: #eadfcf;
  --hover-tint: rgba(112, 170, 145, 0.16);
  --hover-border: rgba(112, 170, 145, 0.34);
  --field-bg: #15130f;
  --modal-overlay: rgba(4, 4, 4, 0.62);
  --shadow-soft: rgba(0, 0, 0, 0.38);
  --shadow-deep: rgba(0, 0, 0, 0.56);
  --attention: #f0a18f;
  --control-bg: #e7dccd;
  --control-hover: #fff7ea;
  --control-contrast: #14241d;
}

* {
  box-sizing: border-box;
}

html[data-writer-gate="checking"] body,
html[data-writer-gate="closed"] body {
  visibility: hidden;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

.maintenance-gate {
  align-items: center;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  inset: 0;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  position: fixed;
  z-index: 100;
}

.maintenance-gate[hidden] {
  display: none;
}

.maintenance-gate > div {
  max-width: 560px;
}

.maintenance-gate h1 {
  font-size: 34px;
  letter-spacing: 0;
  line-height: 1.08;
  margin: 4px 0 14px;
}

.maintenance-gate p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 12px;
}

.app-shell {
  min-height: 100vh;
}

.release-notice {
  align-items: center;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 42px;
  padding: 8px 18px;
}

.release-notice[hidden] {
  display: none;
}

.release-notice p {
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.release-notice.is-stale {
  background: color-mix(in srgb, var(--attention) 12%, var(--panel));
}

.release-notice button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--control-contrast);
  cursor: pointer;
  font: inherit;
  padding: 7px 10px;
}

.topbar {
  align-items: center;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: auto auto minmax(260px, 1fr) auto;
  min-height: 64px;
  padding: 10px 18px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-size: 18px;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand span {
  font-weight: 500;
}

.brand strong {
  font-weight: 750;
}

.mode-nav {
  align-items: center;
  background: var(--mode-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  gap: 2px;
  padding: 3px;
}

.mode-nav button {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  min-height: 28px;
  padding: 0 10px;
  white-space: nowrap;
}

.mode-nav button:hover,
.mode-nav button:focus-visible,
.mode-nav button.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--control-contrast);
}

.status {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

#projectTitle {
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  min-width: 180px;
  outline: none;
  padding: 6px 0;
}

#projectTitle:focus {
  border-bottom-color: var(--muted);
}

#saveStatus,
#pageStatus,
#elementStatus,
.side-panel li,
.inspector span,
.empty-row {
  color: var(--muted);
  font-size: 13px;
}

#elementStatus,
#pageStatus {
  background: var(--panel-strong);
  border-radius: 999px;
  color: var(--pill-text);
  padding: 4px 9px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  justify-content: flex-end;
}

button {
  background: var(--control-bg);
  border: 1px solid var(--control-bg);
  border-radius: 6px;
  color: var(--control-contrast);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  min-height: 32px;
  padding: 0 10px;
}

button:hover,
button:focus-visible {
  background: var(--control-hover);
  outline: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--control-contrast);
}

.btn-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--hover-tint);
  border-color: var(--hover-border);
  color: var(--accent-dark);
}

.toolbar-link {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-size: 12px;
  min-height: 32px;
  padding: 0 10px;
  text-decoration: none;
  white-space: nowrap;
}

.toolbar-link[hidden] {
  display: none;
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
}

.btn-quiet:hover,
.btn-quiet:focus-visible {
  background: var(--hover-tint);
  color: var(--accent-dark);
}

.workspace {
  display: grid;
  gap: 20px;
  grid-template-columns: 180px minmax(640px, 1fr) 260px;
  padding: 22px;
}

.app-view[hidden] {
  display: none !important;
}

.side-panel,
.inspector {
  align-self: start;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  padding-right: 4px;
  position: sticky;
  top: 86px;
}

.side-panel h2,
.inspector h2 {
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.compact-list,
.map-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.compact-list li + li,
.map-list li + li {
  margin-top: 7px;
}

.list-button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  display: block;
  font-size: 13px;
  line-height: 1.35;
  min-height: auto;
  padding: 4px 6px;
  text-align: left;
  width: 100%;
}

.list-button:hover,
.list-button:focus-visible {
  background: rgba(47, 88, 72, 0.12);
  color: var(--accent-dark);
}

.entity-row {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.entity-row strong {
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.entity-row small {
  color: var(--muted);
  font-size: 11px;
}

.report-row-button .entity-row {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.report-row-button .entity-row strong {
  overflow-wrap: normal;
  word-break: normal;
}

.report-row-button .entity-row small {
  flex: 0 1 auto;
}

.report-row-detail {
  display: block;
}

.report-row-trail {
  color: var(--accent-dark);
  display: block;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
  text-transform: uppercase;
}

.entity-row-static {
  box-sizing: border-box;
  color: var(--ink);
  display: flex;
  padding: 4px 6px;
}

.entity-action-row {
  align-items: flex-start;
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr) auto;
  position: relative;
}

.entity-actions {
  display: grid;
  gap: 4px;
}

.entity-row-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(25, 23, 20, 0.16);
  min-width: 154px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 25;
}

.entity-row-menu[hidden] {
  display: none;
}

.entity-menu-trigger {
  align-self: start;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  min-height: 24px;
  min-width: 26px;
  opacity: 0;
  padding: 0 6px;
}

.entity-action-row:hover .entity-menu-trigger,
.entity-action-row:focus-within .entity-menu-trigger,
.entity-menu-trigger[aria-expanded="true"] {
  opacity: 1;
}

.entity-menu-trigger:hover,
.entity-menu-trigger:focus-visible {
  background: rgba(47, 88, 72, 0.1);
  color: var(--accent-dark);
}

.entity-menu-item {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  justify-content: flex-start;
  min-height: 28px;
  text-align: left;
  width: 100%;
}

.entity-menu-item:hover,
.entity-menu-item:focus-visible {
  background: rgba(47, 88, 72, 0.12);
  color: var(--accent-dark);
}

@media (hover: none) {
  .entity-menu-trigger {
    opacity: 1;
  }
}

.report-scope-toggle {
  display: grid;
  gap: 4px;
  grid-template-columns: 0.72fr 1.28fr;
  margin: 2px 0 8px;
}

.report-scope-toggle button {
  background: transparent;
  border: 1px solid rgba(25, 23, 20, 0.14);
  color: var(--muted);
  font-size: 11px;
  min-height: 26px;
  padding: 4px 7px;
}

.report-scope-toggle button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffaf2;
}

.report-section-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.report-section-block {
  border-top: 1px solid rgba(25, 23, 20, 0.1);
  padding-top: 10px;
}

.report-section-head {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 7px;
}

.report-section-head h3 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.report-section-head small {
  color: var(--muted);
  font-size: 11px;
  margin-left: auto;
}

.report-section-rows {
  margin-top: 0;
}

.mini-action {
  border-radius: 4px;
  font-size: 11px;
  min-height: auto;
  padding: 3px 6px;
}

.entity-menu-item.mini-action {
  min-height: 28px;
  padding: 5px 8px;
}

.rename-review-item {
  display: grid;
  gap: 5px;
}

.rename-review-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.rename-review-meta {
  color: var(--muted);
  font-size: 11px;
}

.rename-review-text {
  border-left: 2px solid rgba(47, 88, 72, 0.22);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.25;
  padding-left: 8px;
  white-space: pre-wrap;
}

.rename-review-text.is-next {
  color: var(--accent-dark);
}

.local-project-item {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.local-project-item strong,
.local-project-item small {
  display: block;
}

.local-project-item small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.local-project-badge {
  color: var(--accent-dark);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.local-project-hint {
  color: var(--muted);
}

.local-project-group-label {
  align-items: baseline;
  border-top: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-top: 10px;
}

.local-project-group-label:first-child {
  border-top: 0;
  padding-top: 0;
}

.local-project-group-label strong {
  font-size: 12px;
  text-transform: uppercase;
}

.local-project-group-label small {
  color: var(--muted);
  font-size: 11px;
}

.local-project-undo {
  background: rgba(47, 88, 72, 0.06);
  border: 1px solid rgba(47, 88, 72, 0.14);
  padding: 8px;
}

.local-project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.local-project-actions .subtle-danger {
  color: #7d342e;
}

.safety-panel {
  max-width: 520px;
}

.safety-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.technical-section {
  opacity: 0.72;
}

.page-stage {
  display: flex;
  justify-content: center;
  min-width: 0;
  overflow: auto;
}

.page-wrap {
  position: relative;
}

.page-frame {
  min-height: var(--paginated-height);
  position: relative;
  width: var(--page-sheet-width);
}

.page-sheets,
.page-masks {
  height: var(--paginated-height);
  inset: 0 auto auto 0;
  pointer-events: none;
  position: absolute;
  width: var(--page-sheet-width);
}

.page-sheets {
  z-index: 0;
}

.page-masks {
  z-index: 2;
}

.paper-sheet,
.paper-mask {
  height: var(--page-sheet-height);
  left: 0;
  position: absolute;
  top: calc(var(--sheet-index, 0) * (var(--page-sheet-height) + var(--page-sheet-gap)));
  width: var(--page-sheet-width);
}

.paper-sheet {
  background: var(--paper);
  border: 1px solid rgba(74, 65, 51, 0.08);
  box-shadow: 0 12px 34px rgba(40, 34, 24, 0.12), 0 1px 3px rgba(40, 34, 24, 0.08);
}

.paper-mask::before,
.paper-mask::after {
  background: var(--paper);
  content: "";
  left: 0;
  position: absolute;
  right: 0;
}

.paper-mask::before {
  height: var(--page-mask-top-height);
  top: 0;
}

.paper-mask::after {
  bottom: 0;
  height: var(--page-mask-bottom-height);
}

.paper-page-number,
.paper-dialogue-contd,
.paper-dialogue-more,
.paper-scene-contd,
.paper-scene-more,
.paper-custom-header,
.paper-custom-footer {
  color: rgba(55, 49, 40, 0.62);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 12pt;
  font-weight: 500;
  line-height: 1;
  position: absolute;
  white-space: nowrap;
}

.paper-page-number {
  right: 96px;
  top: 48px;
}

.paper-dialogue-contd {
  color: var(--page-ink);
  left: 355px;
  top: 72px;
}

.paper-dialogue-more {
  color: var(--page-ink);
  left: 355px;
  top: 976px;
}

.paper-scene-contd {
  left: 144px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  top: 48px;
}

.paper-scene-more {
  max-width: 420px;
  overflow: hidden;
  right: 96px;
  text-overflow: ellipsis;
  top: 976px;
}

.paper-custom-header,
.paper-custom-footer {
  left: 144px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paper-custom-header {
  top: 48px;
}

.paper-custom-footer {
  top: 976px;
}

.paper-gap-mask {
  background: var(--surface);
  height: var(--page-sheet-gap);
  left: 0;
  position: absolute;
  top: calc((var(--sheet-index, 0) * (var(--page-sheet-height) + var(--page-sheet-gap))) + var(--page-sheet-height));
  width: var(--page-sheet-width);
}

.script-page {
  background: transparent;
  color: var(--page-ink);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 12pt;
  line-height: 1;
  min-height: var(--paginated-height);
  outline: none;
  padding: 96px 96px 96px 144px;
  position: relative;
  z-index: 1;
  width: 816px;
}

.pagination-measure-frame {
  left: -20000px;
  pointer-events: none;
  position: absolute;
  top: 0;
  visibility: hidden;
  width: var(--page-sheet-width);
  z-index: -1;
}

.pagination-measure-page {
  min-height: var(--page-sheet-height);
}

.script-block {
  min-height: 1em;
  outline: none;
  position: relative;
  white-space: pre-wrap;
}

.script-block:empty::before {
  color: #b4aa9a;
  content: attr(data-placeholder);
}

.script-block.action:empty::before {
  content: "";
}

.script-block:focus {
  background: transparent;
}

.script-block.has-note::after {
  background: rgba(47, 88, 72, 0.72);
  border-radius: 999px;
  content: "";
  height: 6px;
  position: absolute;
  right: -18px;
  top: 0.25em;
  width: 6px;
}

.script-block + .script-block {
  margin-top: 1em;
}

.character + .dialogue,
.character + .parenthetical,
.dialogue + .parenthetical,
.parenthetical + .dialogue {
  margin-top: 0;
}

.script-block.dual-dialogue-group {
  display: grid;
  gap: 0.2in;
  grid-template-columns: 1fr 1fr;
  max-width: 5.55in;
  white-space: normal;
}

.dual-dialogue-column {
  min-width: 0;
}

.dual-dialogue-line {
  min-height: 1em;
  white-space: pre-wrap;
}

.dual-dialogue-line.character {
  margin-left: 0.55in;
  text-transform: uppercase;
  width: 1.6in;
}

.dual-dialogue-line.dialogue {
  margin-left: 0;
  width: 2.4in;
}

.dual-dialogue-line.parenthetical {
  margin-left: 0.35in;
  width: 1.9in;
}

.script-block.has-page-break-before {
  margin-top: var(--page-break-offset, 220px);
}

.script-block.has-page-break-before::before {
  background: var(--paper);
  color: rgba(47, 88, 72, 0.78);
  content: attr(data-page-start);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 700;
  left: 50%;
  letter-spacing: 0.06em;
  padding: 0 10px;
  position: absolute;
  text-transform: uppercase;
  top: calc(-1 * var(--page-marker-offset));
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 3;
}

.scene-heading,
.character,
.transition {
  text-transform: uppercase;
}

.character {
  margin-left: 2.2in;
  width: 2.2in;
}

.dialogue {
  margin-left: 1in;
  width: 3.5in;
}

@supports (-moz-appearance: none) {
  .action,
  .scene-heading {
    width: 5.95in;
  }

  .dialogue {
    width: 3.48in;
  }
}

.parenthetical {
  margin-left: 1.55in;
  width: 2.45in;
}

.transition {
  margin-left: auto;
  text-align: right;
  width: 2.1in;
}

.element-picker,
.cue-picker {
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow: 0 14px 30px rgba(30, 24, 16, 0.18);
  display: grid;
  gap: 2px;
  padding: 6px;
  position: absolute;
  width: 160px;
  z-index: 4;
}

.element-picker[hidden] {
  display: none;
}

.cue-picker[hidden] {
  display: none;
}

.element-picker button,
.cue-picker button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: 28px;
  padding: 0 7px;
}

.element-picker button.is-selected,
.element-picker button:hover,
.cue-picker button.is-selected,
.cue-picker button:hover,
.cue-picker button:focus-visible {
  background: var(--accent);
  color: white;
}

kbd {
  font: inherit;
  font-size: 11px;
  opacity: 0.7;
}

.inspector-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.section-heading {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.inspector-disclosure {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--ink);
  cursor: pointer;
  margin: 0 0 10px;
  min-height: 26px;
  padding: 0 2px 0 18px;
  position: relative;
  text-align: left;
  width: 100%;
}

.inspector-disclosure::before {
  color: var(--muted);
  content: ">";
  font-size: 11px;
  left: 2px;
  position: absolute;
  top: 5px;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}

.inspector-disclosure[aria-expanded="false"]::before {
  transform: rotate(0deg);
}

.inspector-disclosure:hover,
.inspector-disclosure:focus-visible {
  background: rgba(47, 88, 72, 0.08);
  color: var(--ink);
}

.inspector-disclosure h2 {
  margin: 0;
}

.inspector-disclosure span {
  text-align: right;
}

.inspector-section-body[hidden] {
  display: none;
}

.inspector-section.is-collapsed {
  padding-bottom: 10px;
}

.inspector-section.has-attention .inspector-disclosure span {
  color: #8f3f12;
  font-weight: 700;
}

.stat-list {
  display: grid;
  gap: 7px 12px;
  grid-template-columns: 1fr auto;
  margin: 0;
}

.stat-list dt {
  color: var(--muted);
  font-size: 13px;
}

.stat-list dd {
  font-size: 13px;
  font-weight: 650;
  margin: 0;
  text-align: right;
}

.stat-list .is-attention {
  color: #8f3f12;
}

.scene-fact-list {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
}

.scene-fact-button strong {
  color: var(--accent-dark);
}

.scene-fact-button.is-active-scene {
  background: rgba(47, 88, 72, 0.1);
}

.scene-fact-omitted {
  color: var(--muted);
  font-size: 0.84rem;
  padding: 2px 8px 4px;
}

.map-list .list-button {
  display: grid;
  gap: 7px;
  grid-template-columns: 22px 1fr;
}

.map-list strong {
  color: var(--accent-dark);
}

.focus-mode .side-panel,
.focus-mode .inspector {
  display: none;
}

.focus-mode .workspace {
  grid-template-columns: 1fr;
}

.modal-backdrop {
  align-items: center;
  background: rgba(25, 23, 20, 0.38);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none;
}

.notes-panel {
  max-width: 520px;
}

.notes-target {
  background: #fffaf1;
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  margin: 14px 0;
  padding: 12px;
}

.notes-target span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.notes-target p {
  color: var(--muted);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  white-space: pre-wrap;
}

.notes-textarea {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.draft-desk-view {
  padding: 18px 22px 24px;
  overflow-x: hidden;
}

.view-header {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.view-header h1 {
  font-size: 22px;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0 0 5px;
}

.view-header p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.view-actions,
.desk-pane-head,
.desk-pane-head > div,
.desk-pane-head .tool-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.desk-pane-head,
.desk-pane-head > div {
  flex-wrap: wrap;
  min-width: 0;
}

.view-actions,
.desk-pane-head {
  justify-content: space-between;
}

.draft-desk-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(780px, 0.95fr);
  min-width: 0;
}

.desk-pane {
  align-content: start;
  background: rgba(248, 242, 231, 0.72);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
}

.desk-pane-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  min-height: 38px;
  padding-bottom: 10px;
}

.desk-pane-head h2 {
  font-size: 12px;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.desk-pane-head span {
  color: var(--muted);
  font-size: 12px;
}

.desk-pane-head select {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  min-height: 32px;
  min-width: 0;
  padding: 0 8px;
}

.desk-pane-head button {
  min-height: 32px;
  white-space: nowrap;
}

#deskDraftSelect {
  width: min(340px, 40vw);
}

#deskSceneSelect {
  width: min(360px, 32vw);
}

.compact-fallback-select {
  opacity: 0.82;
}

.rail-fallback-select:not(:focus):not(:focus-visible) {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.rail-fallback-select:focus,
.rail-fallback-select:focus-visible {
  opacity: 1;
  width: min(360px, 32vw);
}

.desk-pane-head .tool-row {
  margin: 0;
}

.desk-source-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(132px, 0.16fr) minmax(0, 1fr);
  min-width: 0;
}

.desk-source-scenes {
  border-right: 1px solid var(--line);
  min-width: 0;
  padding-right: 12px;
}

.desk-source-scenes h3 {
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.desk-source-scenes .choice-list {
  margin-top: 0;
}

.desk-source-scene-item {
  border-bottom: 1px solid rgba(74, 65, 51, 0.08);
  padding-bottom: 7px;
}

.desk-source-scene-item + .desk-source-scene-item {
  margin-top: 8px;
}

.desk-source-scenes .desk-source-scene-select {
  padding-bottom: 5px;
}

.desk-source-scene-rail-actions {
  display: flex;
  gap: 5px;
  padding: 0 8px 0;
}

.choice-list .desk-source-scene-rail-actions button {
  background: transparent;
  border: 1px solid rgba(48, 43, 34, 0.2);
  border-radius: 4px;
  color: rgba(37, 33, 27, 0.82);
  display: block;
  flex: 1 1 0;
  font-size: 10px;
  height: auto;
  line-height: 1;
  min-height: 24px;
  padding: 4px 5px;
  text-align: center;
  width: auto;
}

.choice-list .desk-source-scene-rail-actions button:hover,
.choice-list .desk-source-scene-rail-actions button:focus-visible {
  background: rgba(47, 93, 77, 0.1);
  border-color: rgba(47, 93, 77, 0.42);
  outline: none;
}

.desk-preview {
  box-shadow: 0 10px 26px rgba(40, 34, 24, 0.08);
  min-height: calc(100vh - 198px);
  overflow: auto;
}

.desk-source-preview {
  max-width: 100%;
}

.desk-editor-host {
  display: flex;
  justify-content: center;
  min-width: 0;
  overflow: auto;
}

.desk-editor-host .page-frame {
  flex: 0 0 var(--page-sheet-width);
}

.modal-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(25, 23, 20, 0.28);
  max-height: min(780px, calc(100vh - 48px));
  overflow: auto;
  padding: 18px;
  width: min(680px, calc(100vw - 48px));
}

.wide-modal {
  width: min(1180px, calc(100vw - 48px));
}

.command-palette-panel {
  width: min(640px, calc(100vw - 48px));
}

.modal-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.modal-header h2 {
  font-size: 16px;
  letter-spacing: 0;
  margin: 0 0 5px;
  text-transform: uppercase;
}

.modal-header p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.modal-body {
  display: grid;
  gap: 16px;
}

.draft-compare-body,
.rewrite-body {
  grid-template-columns: 260px 1fr;
}

.scene-history-body {
  grid-template-columns: 220px 220px minmax(0, 1fr);
}

.draft-compare-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.draft-compare-grid h3,
.rewrite-body h3,
.scene-history-body h3 {
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.choice-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.choice-list li + li {
  margin-top: 6px;
}

.choice-list button {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  display: block;
  height: auto;
  line-height: 1.35;
  min-height: 34px;
  padding: 7px 8px;
  text-align: left;
  width: 100%;
}

.choice-list button:hover,
.choice-list button:focus-visible,
.choice-list button.is-selected {
  background: rgba(47, 88, 72, 0.12);
  border-color: rgba(47, 88, 72, 0.2);
}

.choice-list small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.command-palette-input {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

.command-palette-results {
  max-height: min(470px, calc(100vh - 260px));
  overflow: auto;
}

.command-section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 8px 8px 2px;
  text-transform: uppercase;
}

.command-section-label + li {
  margin-top: 2px;
}

.scene-history-rail,
.scene-history-compare {
  min-width: 0;
}

.panel-meta {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
}

.spread-row {
  align-items: flex-start;
  justify-content: space-between;
}

.spread-row h3 {
  margin-bottom: 4px;
}

.find-script-controls {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.find-script-controls input {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  min-height: 34px;
  padding: 7px 9px;
}

.find-result-list button span:first-child {
  font-family: "Courier Prime", "Courier New", Courier, monospace;
}

.script-preview {
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--page-ink);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.15;
  min-height: 320px;
  overflow: auto;
  padding: 22px 30px;
}

.preview-block {
  border: 1px solid transparent;
  color: var(--page-ink);
  margin: 0 0 11px;
  padding: 2px 4px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.preview-block.is-action:empty::before {
  content: "";
}

.preview-block.is-scene-heading,
.preview-block.is-character,
.preview-block.is-transition {
  text-transform: uppercase;
}

.preview-block.is-character {
  margin-left: 42%;
  width: 30%;
}

.preview-block.is-dialogue {
  margin-left: 24%;
  width: 48%;
}

.preview-block.is-parenthetical {
  margin-left: 32%;
  width: 36%;
}

.preview-block.is-dual-dialogue {
  display: grid;
  gap: 0.2in;
  grid-template-columns: 1fr 1fr;
  max-width: 100%;
  white-space: normal;
}

.preview-block.is-transition {
  margin-left: auto;
  text-align: right;
  width: 34%;
}

.preview-block button {
  margin-right: 6px;
  margin-top: 6px;
}

.script-preview.desk-source-preview {
  box-sizing: border-box;
  font-size: 12px;
  justify-self: center;
  line-height: 1;
  min-height: calc(100vh - 198px);
  padding: 82px 78px 82px 112px;
  width: min(100%, 760px);
}

.desk-source-preview.is-paginated-preview {
  background: transparent;
  border: 0;
  display: grid;
  gap: var(--page-sheet-gap);
  justify-items: center;
  padding: 0;
}

.preview-paper-sheet {
  background: var(--paper);
  border: 1px solid rgba(74, 65, 51, 0.08);
  box-shadow: 0 10px 26px rgba(40, 34, 24, 0.08);
  box-sizing: border-box;
  color: var(--page-ink);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1;
  min-height: var(--page-sheet-height);
  overflow: hidden;
  padding: 82px 78px 82px 112px;
  position: relative;
  width: min(100%, 760px);
}

.preview-paper-number {
  color: rgba(55, 49, 40, 0.62);
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1;
  position: absolute;
  right: 78px;
  top: 42px;
}

.desk-source-preview .preview-block {
  margin: 0 0 1em;
  padding: 0;
  position: relative;
}

.desk-source-preview .preview-block.is-active-source-scene {
  color: var(--page-ink);
}

.source-scene-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: 10px;
  opacity: 0.24;
  transform: translateY(-1px);
  transition: opacity 120ms ease;
  vertical-align: baseline;
}

.desk-source-preview .preview-block:hover .source-scene-actions,
.desk-source-preview .preview-block:focus-within .source-scene-actions,
.desk-source-preview .preview-block.is-active-source-scene .source-scene-actions,
.script-preview .preview-block:hover .source-scene-actions,
.script-preview .preview-block:focus-within .source-scene-actions {
  opacity: 0.82;
}

.source-scene-actions button {
  background: transparent;
  border: 1px solid rgba(48, 43, 34, 0.22);
  border-radius: 4px;
  color: rgba(37, 33, 27, 0.86);
  font: inherit;
  font-size: 10px;
  line-height: 1;
  margin: 0;
  padding: 4px 6px;
}

.source-scene-actions button:hover,
.source-scene-actions button:focus-visible {
  background: rgba(47, 93, 77, 0.1);
  border-color: rgba(47, 93, 77, 0.42);
  outline: none;
}

.desk-source-preview .preview-block.is-character {
  margin-left: 2.2in;
  width: 2.2in;
}

.desk-source-preview .preview-block.is-dialogue {
  margin-left: 1in;
  width: 3.5in;
}

@supports (-moz-appearance: none) {
  .desk-source-preview .preview-block.is-action,
  .desk-source-preview .preview-block.is-scene-heading {
    width: 5.95in;
  }

  .desk-source-preview .preview-block.is-dialogue {
    width: 3.48in;
  }
}

.desk-source-preview .preview-block.is-parenthetical {
  margin-left: 1.55in;
  width: 2.45in;
}

.desk-source-preview .preview-block.is-transition {
  margin-left: auto;
  text-align: right;
  width: 2.1in;
}

.tool-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.rewrite-body label {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.rewrite-body select {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  margin-bottom: 8px;
  min-height: 32px;
  width: 100%;
}

.cut-bin-list {
  display: grid;
  gap: 10px;
}

.cut-bin-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.cut-bin-item p {
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.cut-bin-actions {
  display: flex;
  gap: 8px;
}

.title-page-form,
.alias-form {
  display: grid;
  gap: 12px;
}

.alias-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.alias-list li {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 36px;
  padding-top: 8px;
}

.alias-list strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.title-page-panel {
  max-width: min(960px, calc(100vw - 36px));
  width: min(960px, calc(100vw - 36px));
}

.title-page-body {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 0.8fr) minmax(280px, 1fr);
}

.title-page-form label,
.alias-form label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
  text-transform: uppercase;
}

.title-page-form input,
.title-page-form textarea,
.alias-form input,
.revision-create input {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  min-height: 34px;
  padding: 7px 9px;
  width: 100%;
}

.title-page-form textarea {
  min-height: 86px;
  resize: vertical;
}

.title-page-preview-wrap {
  display: grid;
  justify-items: center;
}

.title-page-preview {
  aspect-ratio: 8.5 / 11;
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow: 0 16px 34px rgba(42, 36, 26, 0.12);
  color: var(--ink);
  display: grid;
  font-family: "Courier Prime", "Courier New", Courier, monospace;
  font-size: clamp(10px, 1.15vw, 13px);
  grid-template-rows: 1fr auto;
  max-height: 560px;
  padding: 1in 0.85in 0.85in;
  white-space: pre-wrap;
  width: min(100%, 430px);
}

.title-page-preview-center {
  align-self: center;
  display: grid;
  gap: 12px;
  justify-items: center;
  margin-top: -0.4in;
  text-align: center;
}

.title-page-preview-title {
  text-transform: uppercase;
}

.title-page-preview-footer {
  align-items: end;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.title-page-preview-contact,
.title-page-preview-draft {
  min-width: 0;
}

.title-page-preview-draft {
  text-align: right;
}

.revision-actions,
.revision-create,
.review-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 860px) {
  .title-page-body {
    grid-template-columns: 1fr;
  }

  .title-page-preview {
    max-height: none;
  }
}

.review-actions {
  justify-content: flex-end;
  margin-bottom: 0;
  margin-top: 12px;
}

.revision-create input {
  flex: 1;
  min-width: 0;
}

.table-scratch {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  min-height: 360px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.table-view {
  overflow: auto;
  padding: 18px 22px 24px;
}

.table-workspace {
  min-width: 0;
}

.table-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  margin: -2px 0 16px;
  padding-bottom: 10px;
}

.table-tabs button {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
}

.table-tabs button:hover,
.table-tabs button:focus-visible,
.table-tabs button.is-selected {
  background: rgba(47, 88, 72, 0.12);
  border-color: rgba(47, 88, 72, 0.24);
}

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

.table-names {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-legacy-material {
  grid-column: 1 / -1;
}

.table-names-group {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.table-names-group h3 {
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.table-name-add {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.table-name-add input {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  flex: 1;
  font: inherit;
  min-height: 34px;
  min-width: 0;
  padding: 7px 9px;
}

.table-name-add button {
  min-width: 56px;
}

.table-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  min-height: 32px;
  padding: 0;
}

.table-chip {
  display: inline-flex;
}

.table-chip-list button {
  background: #fffdf8;
  border-color: var(--line);
  color: var(--ink);
  font-size: 12px;
  padding: 6px 8px;
}

.table-chip-insert {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
}

.table-chip-remove {
  border-bottom-left-radius: 0;
  border-left: 0;
  border-top-left-radius: 0;
  color: var(--muted) !important;
}

.table-section-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.table-section-head h3 {
  font-size: 12px;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.table-filter-input {
  background: #fffdf8;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  margin: 0 0 10px;
  min-height: 34px;
  padding: 7px 9px;
  width: 100%;
}

.table-row-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.table-row-list li {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 6px 12px;
  grid-template-columns: 86px 1fr auto;
  padding: 8px 0;
}

.table-row-list button.table-row-button {
  align-items: baseline;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 6px 12px;
  grid-template-columns: 86px 1fr auto;
  padding: 0;
  text-align: left;
  width: 100%;
}

.table-row-list button.table-row-button:hover span {
  text-decoration: underline;
}

.table-row-list button.table-row-button.is-selected {
  background: rgba(47, 88, 72, 0.08);
  outline: 1px solid rgba(47, 88, 72, 0.22);
  outline-offset: 4px;
}

.table-row-list strong {
  color: var(--accent-dark);
  font-size: 12px;
  text-transform: uppercase;
}

.table-row-list span {
  min-width: 0;
}

.table-row-list small {
  color: var(--muted);
  font-size: 11px;
}

.table-row-list .table-row-omitted {
  background: rgba(47, 88, 72, 0.05);
  border-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.table-row-list .table-row-omitted strong {
  color: var(--muted);
}

.drift-used strong {
  color: #2f5848;
}

.drift-changed strong {
  color: #8b5a22;
}

.drift-missing strong {
  color: #8a3731;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 170px minmax(580px, 1fr);
  }

  .draft-desk-grid {
    grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
    position: static;
  }
}

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

  .status,
  .toolbar,
  .mode-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .workspace,
  .inspector {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .side-panel,
  .inspector {
    max-height: none;
    position: static;
  }

  .page-stage {
    justify-content: flex-start;
  }

  .draft-compare-body,
  .rewrite-body,
  .scene-history-body,
  .draft-compare-grid,
  .draft-desk-grid,
  .desk-source-layout,
  .table-names {
    grid-template-columns: 1fr;
  }

  .desk-source-scenes {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 10px;
  }

  .view-header {
    align-items: start;
    flex-direction: column;
  }

  .view-actions,
  .desk-pane-head {
    align-items: start;
    flex-direction: column;
  }

  .desk-pane-head select,
  .desk-pane-head > div {
    width: 100%;
  }

  .desk-source-preview {
    padding: 36px 44px;
  }
}
