:root {
  --bg: #14120e; --panel: #1c1914; --panel2: #24201a; --line: #3a3226;
  --text: #e9e1d0; --muted: #a39782; --dim: #6f6656;
  --brass: #c9a24a; --brass2: #e4c070; --red: #c8553d; --green: #8fae6b; --amber: #f0a23a;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--brass2); }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; }
input:focus, select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(201,162,74,.18); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.btn { border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 9px 16px; border-radius: 6px; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--brass); }
.btn.brass { background: linear-gradient(180deg, var(--brass2), var(--brass)); color: #1a140a; border-color: #8a6d2c; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.stamp { display: inline-block; font: 700 12px var(--mono); letter-spacing: .3em; color: var(--red); border: 2px solid var(--red); padding: 4px 12px; transform: rotate(-3deg); opacity: .85; }

/* ---------- home ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #1a1712, #14120e); }
.brand { font: 700 20px/1 var(--serif); letter-spacing: .2em; color: var(--brass2); text-decoration: none; }
.brand small { display: block; font: 11px var(--mono); letter-spacing: .14em; color: var(--dim); margin-top: 5px; text-transform: uppercase; }
.top .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 30px 24px 60px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px 28px; }
.center { max-width: 460px; margin: 10vh auto 0; }
.center h1 { font: 400 30px/1.2 var(--serif); margin: 14px 0 8px; }
.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; }
.err { color: #f0a090; min-height: 20px; font-size: 14px; margin: 6px 0; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; background: var(--c); }
.colors button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); }
.headrow { display: flex; align-items: end; gap: 12px; margin-bottom: 18px; }
.headrow h1 { font: 400 32px var(--serif); margin: 0; flex: 1; }
.newrow { display: flex; gap: 8px; margin-bottom: 22px; }
.newrow input { flex: 1; }
.proj { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin-bottom: 10px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.proj .info { flex: 1; min-width: 200px; }
.proj .t { font: 600 18px var(--serif); color: var(--text); text-decoration: none; }
.proj .t:hover { color: var(--brass2); }
.proj .m { font: 12px var(--mono); color: var(--dim); margin-top: 2px; }
.proj .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.invite { width: 100%; display: flex; gap: 8px; align-items: center; background: #18150f; border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px; font: 12px var(--mono); color: var(--muted); }
.invite code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--brass2); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--brass); padding: 10px 18px; border-radius: 8px; z-index: 40; }

/* ---------- script page ---------- */
body.script { overflow: hidden; height: 100vh; }
.sbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #1a1712; height: 56px; }
.sbar .back { color: var(--muted); text-decoration: none; font-size: 20px; padding: 0 4px; }
.sbar .back:hover { color: var(--brass2); }
.sbar h1 { font: 400 20px var(--serif); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.sbar .grow { flex: 1; }
.sbar select { padding: 6px 9px; font-size: 14px; min-width: 150px; }
.status { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; padding: 3px 9px; border-radius: 10px; border: 1px solid var(--line); }
.status.live { color: var(--green); border-color: #3e4d2c; }
.status.live::before { content: '● '; }
.status.wait { color: var(--amber); border-color: #6b4a1a; }
.people { display: flex; align-items: center; gap: 0; }
.av { width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #14120e; font: 700 12px/30px var(--sans); text-align: center; border: 2px solid #1a1712; margin-left: -6px; }
.av:first-child { margin-left: 0; }
#peopleCount { font-size: 13px; color: var(--muted); margin-left: 8px; }
.layout { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 56px); }
.scenes { border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 10px; background: #17140f; }
.scenes h3 { font: 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .14em; margin: 0 6px 8px; }
.scenes ul { list-style: none; margin: 0; padding: 0; }
.scenes li { font: 12.5px/1.35 var(--mono); padding: 7px 8px; border-radius: 5px; cursor: pointer; color: #cfc5b0; display: flex; gap: 8px; }
.scenes li:hover { background: var(--panel2); }
.scenes li.cur { background: var(--panel2); box-shadow: inset 3px 0 0 var(--brass); }
.scenes li .sn { color: var(--brass); min-width: 18px; }
.scenes li.none { color: var(--dim); font-style: italic; cursor: default; }
.desk { overflow-y: auto; padding: 34px 20px 120px; background: #2a2620; }
.paper { width: 8.5in; min-height: 11in; margin: 0 auto; background: #fbf8f1; color: #111; box-shadow: 0 10px 40px rgba(0,0,0,.55); padding: 1in 1in 1in 1.5in; }

/* screenplay elements (Courier 12pt layout) */
.ProseMirror { outline: none; font: 12pt/1.0 var(--mono); min-height: 8in; white-space: pre-wrap; word-wrap: break-word; position: relative; }
.ProseMirror p { margin: 0; padding: 0; min-height: 12pt; }
.ProseMirror .scene_heading { text-transform: uppercase; margin-top: 24pt; font-weight: 700; }
.ProseMirror > .scene_heading:first-child { margin-top: 0; }
.ProseMirror .action { margin-top: 12pt; }
.ProseMirror .character { text-transform: uppercase; margin-top: 12pt; margin-left: 2.0in; }
.ProseMirror .parenthetical { margin-left: 1.5in; width: 2.0in; }
.ProseMirror .dialogue { margin-left: 1.0in; width: 3.5in; }
.ProseMirror .transition { text-transform: uppercase; text-align: right; margin-top: 12pt; }
.ProseMirror .shot { text-transform: uppercase; margin-top: 12pt; }
.ProseMirror > p:first-child { margin-top: 0; }
.ProseMirror p:empty::before, .ProseMirror p > br:only-child::before { color: #b9b2a3; }
.ProseMirror p.scene_heading:has(> br:only-child)::before { content: 'INT. LOCATION - DAY'; color: #c4bdae; position: absolute; }
.ProseMirror p.character:has(> br:only-child)::before { content: 'CHARACTER'; color: #c4bdae; position: absolute; }
.ProseMirror p.dialogue:has(> br:only-child)::before { content: 'Dialogue'; color: #c4bdae; position: absolute; }
.ProseMirror p.parenthetical:has(> br:only-child)::before { content: '(beat)'; color: #c4bdae; position: absolute; }
.ProseMirror p.action:has(> br:only-child)::before { content: 'Action'; color: #d6d0c2; position: absolute; }
.ProseMirror p.transition:has(> br:only-child)::before { content: 'CUT TO:'; color: #c4bdae; position: absolute; right: 1in; }
.tag { border-bottom: 2px solid; }
.tag-prop { border-color: #c9862b; } .tag-wardrobe { border-color: #8a4fc4; } .tag-vehicle { border-color: #2b7cc9; } .tag-sfx { border-color: #c92b4a; }

/* other writers' cursors */
.ProseMirror-yjs-cursor { position: relative; margin-left: -1px; margin-right: -1px; border-left: 2px solid; border-right: none; word-break: normal; pointer-events: none; }
.ProseMirror-yjs-cursor > div { position: absolute; top: -1.35em; left: -2px; font: 600 11px/1 var(--sans); padding: 3px 6px; color: #14120e; border-radius: 4px 4px 4px 0; white-space: nowrap; user-select: none; }
.ProseMirror-yjs-selection { opacity: .35; }

.help { position: fixed; right: 18px; top: 66px; width: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 13px; z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.help h4 { margin: 0 0 8px; font: 400 17px var(--serif); color: var(--brass2); }
.help table { width: 100%; border-collapse: collapse; }
.help td { padding: 3px 0; vertical-align: top; }
.help td:first-child { font: 12px var(--mono); color: var(--brass2); width: 105px; }
.gate { max-width: 560px; margin: 16vh auto; text-align: center; padding: 0 20px; }
.gate h1 { font: 400 26px/1.3 var(--serif); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; } .scenes { display: none; }
  .paper { width: 100%; padding: .6in .5in; min-height: 0; }
  .ProseMirror .character { margin-left: 35%; } .ProseMirror .dialogue { margin-left: 15%; width: auto; margin-right: 10%; } .ProseMirror .parenthetical { margin-left: 25%; width: auto; }
  .sbar h1 { max-width: 30vw; } #peopleCount { display: none; }
}
.ProseMirror p.parenthetical:not(:has(> br:only-child))::before { content: '('; }
.ProseMirror p.parenthetical:not(:has(> br:only-child))::after { content: ')'; }

/* ---------- accounts, people, access ---------- */
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.nav a:hover { color: var(--text); background: var(--panel2); }
.nav a.on { color: var(--brass2); background: var(--panel2); }
.plain { color: var(--text); text-decoration: none; } .plain:hover { color: var(--brass2); text-decoration: underline; }
.field small { display: block; margin-top: 4px; font-size: 12px; }
.mt { margin-top: 14px; } .card.gap { margin-top: 18px; }
.center + .center { margin-top: 18px; }
.newrow select { min-width: 110px; }
.avs { display: flex; align-items: center; padding-left: 6px; }
.proj .av { display: inline-block; vertical-align: middle; }
.person .t { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role { font: 11px var(--mono); color: var(--brass); text-transform: uppercase; letter-spacing: .1em; }
.chip { font: 10.5px var(--mono); padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.chip.ok { color: var(--green); border-color: #3e4d2c; } .chip.wait { color: var(--amber); border-color: #6b4a1a; } .chip.off { color: var(--red); border-color: #5c2a1f; }
.new { color: var(--amber); font-weight: 600; }
.access { width: 100%; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; background: #18150f; border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; }
.access .muted.small { width: 100%; }
.chk { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.chk input { accent-color: var(--brass); width: 16px; height: 16px; margin: 0; padding: 0; }
.chk.off { opacity: .55; }
.chk .av { width: 24px; height: 24px; font-size: 10px; line-height: 24px; margin: 0; border: none; }
.okmsg { color: var(--green); } .errmsg { color: #f0a090; }
.newrow .btn { flex: none; }

/* ---------- pages ---------- */
.pageinfo { font: 12px var(--mono); color: var(--brass2); white-space: nowrap; }
.pg { color: var(--brass2); font-weight: 600; }
.scenes li .st { flex: 1; min-width: 0; }
.scenes li .sp { color: var(--dim); font-size: 11px; min-width: 20px; text-align: right; }
.scenes li.cur .sp { color: var(--brass); }
/* A page break: bottom margin of one sheet, a strip of desk, top margin of the next with its page number. */
.pb { display: block; width: 8.5in; margin-left: -1.5in; user-select: none; pointer-events: none; text-transform: none; font-weight: 400; text-align: left; white-space: normal; }
.ProseMirror .dialogue .pb { margin-left: -2.5in; }
.ProseMirror .parenthetical .pb { margin-left: -3.0in; }
.pb-more, .pb-contd { display: block; padding-left: 3.5in; text-transform: uppercase; }
.pb-gap { display: block; position: relative; height: 22px; margin: 0.6in 0 0.85in; background: #2a2620; box-shadow: inset 0 7px 9px -7px rgba(0,0,0,.6), inset 0 -7px 9px -7px rgba(0,0,0,.6); }
.pb-num { position: absolute; right: 1in; bottom: -0.55in; font: 12pt var(--mono); color: #111; }
@media (max-width: 900px) { .pb, .ProseMirror .dialogue .pb, .ProseMirror .parenthetical .pb { width: auto; margin-left: 0; } .pb-more, .pb-contd { padding-left: 35%; } .pb-gap { margin: 14px -20px; } .pb-num { right: 20px; bottom: -22px; font-size: 10pt; } }
/* A hair of extra width so a full 60-character line never wraps early because of font rounding. */
.paper { padding-right: 0.95in; }
.ProseMirror .dialogue { width: 3.55in; }
.ProseMirror .parenthetical { width: 2.05in; }
.ProseMirror > .pb + p { margin-top: 0 !important; }   /* no blank line at the top of a new page */
@media (max-width: 900px) { .paper { padding-right: .5in; } .ProseMirror .dialogue, .ProseMirror .parenthetical { width: auto; } }

/* ---------- breakdown ---------- */
.sbar .btn.active { border-color: var(--brass); color: var(--brass2); background: var(--panel2); }
.bd { display: none; border-left: 1px solid var(--line); background: #17140f; overflow-y: auto; padding: 14px 16px 40px; }
body.bd-on .layout { grid-template-columns: 250px 1fr 320px; }
body.bd-on .bd { display: block; }
.bd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bd-head h3 { font: 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .14em; margin: 0; }
.x { background: none; border: none; color: var(--dim); font-size: 18px; line-height: 1; padding: 0 4px; } .x:hover { color: var(--red); }
.bd-scene { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.bd-num { font: 700 13px var(--mono); color: var(--brass2); text-transform: uppercase; letter-spacing: .1em; } .bd-num span { color: var(--dim); font-weight: 400; }
.bd-loc { font: 600 17px/1.25 var(--serif); margin: 4px 0; }
.bd-meta { font: 12px var(--mono); color: var(--muted); }
.bd-cat { margin-bottom: 12px; }
.bd-cat h4, .bd-add h4 { font: 600 13px var(--sans); margin: 0 0 4px; display: flex; align-items: center; gap: 7px; } .bd-cat h4 span { color: var(--dim); font-weight: 400; }
.bd-cat ul { list-style: none; margin: 0; padding: 0 0 0 17px; } .bd-cat li { padding: 2px 0; font-size: 14px; display: flex; gap: 6px; align-items: baseline; } .bd-cat li i { color: var(--dim); font-size: 12px; }
.bd-cat .none { color: var(--dim); font-size: 13px; margin: 0 0 0 17px; font-style: italic; }
.bd-add { border-top: 1px solid var(--line); padding-top: 12px; margin: 14px 0 10px; display: grid; grid-template-columns: 1fr auto; gap: 6px; } .bd-add h4, .bd-add select { grid-column: 1 / -1; } .bd-add select, .bd-add input { padding: 6px 8px; font-size: 13px; min-width: 0; }
.cdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--tc); flex: none; margin-right: 6px; }
h4 .cdot { margin-right: 0; }
/* tags in the script only show while Breakdown is on */
.tag { border-bottom: 0; }
body.bd-on .tag { border-bottom: 2px solid var(--tc); background: color-mix(in srgb, var(--tc) 16%, transparent); border-radius: 2px 2px 0 0; }
.tag-cast { --tc: #d32f2f; }
.tag-extras { --tc: #f9a825; }
.tag-stunts { --tc: #ef6c00; }
.tag-props { --tc: #7b1fa2; }
.tag-prop { --tc: #7b1fa2; }
.tag-wardrobe { --tc: #00838f; }
.tag-makeup { --tc: #c2185b; }
.tag-vehicles { --tc: #ec407a; }
.tag-vehicle { --tc: #ec407a; }
.tag-animals { --tc: #9e9d24; }
.tag-sfx { --tc: #1976d2; }
.tag-vfx { --tc: #5e35b1; }
.tag-sound { --tc: #6d4c41; }
.tag-setdress { --tc: #2e7d32; }
.tag-equipment { --tc: #455a64; }
.tag-notes { --tc: #757575; }

.tagbubble { position: fixed; z-index: 30; width: 330px; background: var(--panel); border: 1px solid var(--brass); border-radius: 10px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.6); font-size: 13px; }
.tb-title { color: var(--muted); margin: 0 2px 6px; }
.tb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tagbubble button { display: flex; align-items: center; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 8px; text-align: left; font-size: 12.5px; }
.tagbubble button:hover { border-color: var(--brass); } .tagbubble button.on { border-color: var(--brass2); box-shadow: inset 0 0 0 1px var(--brass2); }
.tb-remove { margin-top: 6px; width: 100%; justify-content: center; color: #f0a090 !important; }
.tb-flash { background: #1d2416; border: 1px solid #3e4d2c; border-radius: 6px; padding: 7px 9px; margin-bottom: 8px; color: #cfe0b8; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tb-flash button { background: var(--brass); color: #1a140a; border-color: #8a6d2c; font-weight: 600; }

.reports { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 40; display: grid; place-items: center; }
.rep-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: min(1280px, 96vw); height: 90vh; display: flex; flex-direction: column; padding: 18px 20px; }
.rep-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .rep-head h2 { font: 400 24px var(--serif); margin: 0; color: var(--brass2); } .rep-head .grow { flex: 1; }
.rep-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0; }
.rep-tabs button { background: none; border: none; color: var(--muted); padding: 8px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.rep-tabs button.on { color: var(--brass2); border-bottom-color: var(--brass); }
.rep-body { overflow: auto; flex: 1; }
table.rep { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.rep th { text-align: left; font: 11px var(--mono); color: var(--brass); text-transform: uppercase; letter-spacing: .08em; padding: 7px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
table.rep td { padding: 7px 10px; border-bottom: 1px solid #2a251d; vertical-align: top; }
table.rep tr:hover td { background: #201c16; }
#printArea { display: none; }
@media (max-width: 1100px) { body.bd-on .layout { grid-template-columns: 1fr 300px; } body.bd-on .scenes { display: none; } }

@media print {
  @page { margin: 0.6in; }
  html, body { background: #fff !important; color: #000 !important; height: auto !important; overflow: visible !important; }
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing #printArea { display: block; font: 10.5pt/1.35 Arial, Helvetica, sans-serif; color: #000; }
  #printArea h1 { font: 700 18pt Georgia, serif; margin: 0 0 2pt; } #printArea h2 { font: 400 10pt Arial, sans-serif; color: #444; margin: 0 0 10pt; }
  #printArea table.rep { font-size: 9pt; } #printArea table.rep th { color: #000; background: #eee; position: static; border: 1px solid #999; } #printArea table.rep td { border: 1px solid #bbb; }
  #printArea .cdot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet { page-break-after: always; } .sheet:last-child { page-break-after: auto; }
  .sheet header { display: flex; gap: 18pt; align-items: flex-end; border-bottom: 2pt solid #000; padding-bottom: 6pt; margin-bottom: 10pt; }
  .sheet header small { font-size: 8.5pt; color: #555; } .sheet header h1 { white-space: nowrap; }
  .sheet-top { border-collapse: collapse; flex: 1; } .sheet-top th { font-size: 7.5pt; text-transform: uppercase; text-align: left; color: #555; padding: 0 6pt; } .sheet-top td { font-weight: 700; padding: 0 6pt; }
  .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8pt; }
  .sheet-box { border: 1pt solid #888; border-top: 4pt solid var(--tc); min-height: 1.15in; padding: 5pt 7pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
  .sheet-box h3 { font: 700 8.5pt Arial, sans-serif; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 4pt; }
}

/* ---------- project folders ---------- */
.headrow .btn { margin-bottom: 2px; }
.grp { margin-bottom: 26px; }
.grp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 2px 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.grp-t { background: none; border: 0; padding: 4px 6px 4px 0; display: flex; align-items: center; gap: 8px; color: var(--brass2); font: 400 22px/1.2 var(--serif); text-align: left; cursor: pointer; border-radius: 6px; }
.grp-t:hover .grp-name { text-decoration: underline; text-underline-offset: 4px; }
.grp-t:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.grp-t .caret { display: inline-block; font-size: 14px; color: var(--brass); transition: transform .15s; }
.grp.shut .caret { transform: rotate(-90deg); }
.grp.loose .grp-t { color: var(--muted); }
.grp-m { font: 12px var(--mono); color: var(--dim); }
.grp-head .grow { flex: 1; }
.grp-head .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.grp > .access { margin-bottom: 12px; }
.grp-body { padding-left: 14px; border-left: 2px solid var(--line); }
.grp-body .proj:last-child { margin-bottom: 0; }
.grp .empty { padding: 14px 0; text-align: left; }
.grp.shut .grp-head { margin-bottom: 0; }
select.move { padding: 5px 8px; font-size: 13px; background: transparent; color: var(--muted); max-width: 112px; cursor: pointer; }
select.move:hover { border-color: var(--brass); color: var(--text); }
select.move option { background: var(--panel2); color: var(--text); }
.newrow #target { max-width: 220px; }
.chk input:disabled { opacity: .55; }
.sbar h1 .crumb { color: var(--muted); font-size: 15px; }
@media (max-width: 700px) { .newrow { flex-wrap: wrap; } .newrow input { flex-basis: 100%; } .grp-body { padding-left: 8px; } }

/* ---------- stripboard ---------- */
.sch-legend { display: flex; gap: 16px; flex-wrap: wrap; font: 12px var(--mono); color: var(--muted); margin: 0 0 12px; }
.rep-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.sch-legend span { display: flex; align-items: center; gap: 6px; }
.strip-dot { width: 14px; height: 14px; border-radius: 3px; background: var(--sc); border: 1px solid rgba(0,0,0,.4); }
.int-d { --sc: #f3efe4; } .ext-d { --sc: #f2d65c; } .int-n { --sc: #8db6e6; } .ext-n { --sc: #8fcf92; }
.sch-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(330px, 430px) 1fr; gap: 18px; }
.sch-pool, .sch-days { overflow-y: auto; min-height: 0; padding-right: 6px; }
.sch-pool { border-right: 1px solid var(--line); padding-right: 16px; border-radius: 6px; }
.sch-pool h3 { font: 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .14em; margin: 0 0 10px; } .sch-pool h3 span { color: var(--brass); }
.sch-auto { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); background: #18150f; border: 1px dashed var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 12px; }
.sch-auto input { width: 62px; padding: 4px 6px; font-size: 13px; }
.sch-tip { margin-top: 14px; }
.sch-empty { text-align: center; padding: 60px 20px; color: var(--muted); } .sch-empty p:first-child { font: 400 22px var(--serif); color: var(--text); margin: 0 0 6px; }
.strip { display: grid; grid-template-columns: 26px 34px minmax(0, 1fr) 14px 40px auto; align-items: center; gap: 7px; background: var(--sc); color: #17130c; border-radius: 4px; padding: 5px 8px; margin-bottom: 4px; font: 13px/1.25 var(--sans); cursor: grab; border: 1px solid rgba(0,0,0,.35); }
.strip:focus-visible, .banner:focus-visible { outline: 3px solid var(--brass2); outline-offset: 1px; }
.strip.dragging, .banner.dragging { opacity: .35; }
.st-n { font: 700 14px var(--mono); text-align: right; }
.st-ie, .st-dn, .st-pg { font: 600 12px var(--mono); }
.st-pg { text-align: right; white-space: nowrap; }
.st-set { min-width: 0; } .st-set b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-set small { display: block; font-size: 11.5px; color: #4a4232; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-move { padding: 2px 4px; font-size: 12px; width: 78px; background: rgba(255,255,255,.55); color: #17130c; border-color: rgba(0,0,0,.35); cursor: pointer; }
.st-move option { background: var(--panel2); color: var(--text); }
.strip.gone { --sc: #2b2620; color: var(--muted); grid-template-columns: 1fr auto; cursor: default; font-style: italic; border-style: dashed; border-color: var(--line); }
.day { background: #18150f; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #0d0b08; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.day-n { font: 700 14px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--brass2); }
.day-head input[type=date] { padding: 4px 8px; font-size: 13px; color-scheme: dark; }
.day-head .grow { flex: 1; }
.day-m { font: 12px var(--mono); color: var(--muted); }
.day-cast { font-size: 12.5px; color: var(--muted); padding: 7px 12px 0; } .day-cast span { font: 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .1em; margin-right: 6px; } .day-cast .sets:not(:first-child) { margin-left: 16px; }
.day-body { padding: 10px 12px; min-height: 46px; }
.day-empty { border: 1px dashed var(--line); border-radius: 4px; color: var(--dim); text-align: center; padding: 10px; font-size: 13px; }
.banner { display: flex; align-items: center; gap: 8px; background: #3a3226; border: 1px solid #54483a; border-radius: 4px; padding: 3px 8px; margin-bottom: 4px; cursor: grab; }
.banner input { flex: 1; background: transparent; border-color: transparent; padding: 3px 6px; font: italic 13px var(--sans); text-align: center; }
.banner input:hover, .banner input:focus { border-color: var(--line); background: var(--panel2); }
.banner .grip { color: var(--dim); }
.drop-before { box-shadow: 0 -3px 0 0 var(--brass2); }
.day-body.drop-end { box-shadow: inset 0 -3px 0 0 var(--brass2); }
.sch-pool.drop-here { box-shadow: inset 0 0 0 2px var(--brass2); }
@media (max-width: 900px) { .sch-body { grid-template-columns: 1fr; overflow-y: auto; } .sch-pool, .sch-days { overflow: visible; } .sch-pool { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 14px; } }
@media print {
  #printArea table.sched { margin-bottom: 14pt; break-inside: auto; } #printArea table.sched tr { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printArea table.sched .p-day th { background: #000; color: #fff; font-size: 10pt; letter-spacing: .08em; }
  #printArea .p-int-d td { background: #fff; } #printArea .p-ext-d td { background: #fbeea0; } #printArea .p-int-n td { background: #cfe0f5; } #printArea .p-ext-n td { background: #cfeacf; }
  #printArea .p-banner td { background: #ddd; text-align: center; font-style: italic; } #printArea .p-end td { background: #eee; font-weight: 700; }
}
.btn:disabled { opacity: .35; cursor: default; } .btn:disabled:hover { border-color: var(--line); }

/* dark scrollbars and pickers to match the room */
@media screen { :root { color-scheme: dark; } .paper { color-scheme: light; } }

/* ---------- cast & crew, call sheets ---------- */
.cs-pane { flex: 1; min-height: 0; overflow-y: auto; padding-right: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.link { background: none; border: 0; padding: 0; color: var(--brass2); text-decoration: underline; cursor: pointer; font: inherit; }
.cs-card { background: #18150f; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; max-width: 900px; }
.cs-card h3 { font: 11px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .14em; margin: 0 0 10px; } .cs-card h3 span { color: var(--brass); }
.cs-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .cs-fields label { display: block; font-size: 13px; color: var(--muted); } .cs-fields input { display: block; width: 100%; margin-top: 4px; }
table.cs-list { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
table.cs-list th { text-align: left; font: 11px var(--mono); color: var(--brass); text-transform: uppercase; letter-spacing: .08em; padding: 4px 6px; }
table.cs-list td { padding: 3px 6px; vertical-align: middle; }
table.cs-list input:not([type=checkbox]) { width: 100%; padding: 6px 8px; font-size: 14px; }
table.cs-list input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brass); }
.w-num { width: 76px; } .w-min { width: 70px; } .w-sc { width: 70px; } .w-act { width: 118px; white-space: nowrap; text-align: right; } .w-act .btn { margin-right: 4px; }
.cs-btns { display: flex; gap: 8px; margin: 6px 0 8px; }
.cs-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; } .cs-bar .grow { flex: 1; } .cs-bar label { font-size: 13px; color: var(--muted); } .cs-bar select { padding: 6px 10px; }

/* The sheet itself: white paper, laid out like the printed call sheet. Shaded boxes are fill-in. */
.cs-sheet { color-scheme: light; background: #fff; color: #111; font: 11.5px/1.3 Arial, Helvetica, sans-serif; width: 8.3in; max-width: 100%; margin: 0 auto 30px; padding: .3in; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.cs-sheet table.cs-t { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0 0 7px; }
.cs-sheet .cs-t th, .cs-sheet .cs-t td { border: 1px solid #333; padding: 2px 5px; text-align: left; vertical-align: middle; overflow: hidden; height: 20px; }
.cs-sheet .cs-t th { background: #222; color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.cs-sheet .lab { background: #e4e4e4; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.cs-sheet .cs-t td.ctr { text-align: center; } .cs-sheet .cs-t td.rt { text-align: right; font-weight: 700; text-transform: uppercase; font-size: 9.5px; }
.cs-sheet .auto { color: #999; font-size: 10.5px; }
.cs-sheet input, .cs-sheet textarea, .cs-sheet select { width: 100%; border: 0; border-radius: 2px; background: #fdf3cf; color: #111; font: inherit; padding: 2px 4px; box-shadow: none; }
.cs-sheet input:focus, .cs-sheet textarea:focus, .cs-sheet select:focus { outline: 2px solid #b8860b; box-shadow: none; }
.cs-sheet textarea { display: block; resize: none; overflow: hidden; min-height: 44px; }
.cs-top { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: end; gap: 10px; border-bottom: 3px solid #111; padding-bottom: 5px; margin-bottom: 7px; }
.cs-top small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: #555; } .cs-top b { font-size: 14px; }
.cs-co input, .cs-co .cs-val { text-align: center; font-size: 15px; font-weight: 700; } .cs-co { text-align: center; }
.cs-when { text-align: right; }
.cs-info { display: grid; grid-template-columns: 1.35fr .7fr 1.35fr; gap: 7px; align-items: stretch; }
.cs-info .cs-t th, .cs-info .cs-t td { padding: 2px 3px; }
.cs-l1 { width: 26%; } .cs-l3 { width: 35%; } .cs-r1, .cs-r3 { width: 23%; }
.cs-mid { border: 1px solid #333; margin-bottom: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px; }
.cs-title { font: 700 16px/1.15 Georgia, serif; text-transform: uppercase; letter-spacing: .04em; }
.cs-calllab { font-size: 10px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; margin-top: 8px; }
.cs-call input, .cs-call .cs-val { font-size: 24px; font-weight: 800; text-align: center; } .cs-call { width: 100%; }
.cs-two { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 7px; align-items: start; }
.cs-two textarea, .cs-two .cs-text { border: 1px solid #333; }
.cs-text { white-space: pre-wrap; min-height: 34px; padding: 3px 5px; }
.cs-scenes td input { margin-top: 2px; } .cs-scenes td b { display: block; }
.c-sc { width: 8%; } .c-ch { width: 12%; } .c-dn { width: 6%; } .c-pg { width: 8%; } .c-loc { width: 27%; }
.c-n { width: 5%; } .c-st { width: 9%; } .c-tm { width: 13%; } .c-mn { width: 8%; } .c-in2 { width: 22%; }
.c-pos { width: 26%; } .c-ph { width: 27%; } .c-in { width: 20%; }
.cs-sheet input[type=time]::-webkit-calendar-picker-indicator { display: none; }
.cs-banner td { background: #ddd; text-align: center !important; font-style: italic; }
.cs-total td { background: #f1f1f1; }
.cs-sheet table.cs-head { margin-bottom: 0; }
.cs-needs .lab { width: 20%; }
.cs-crew table.cs-t { margin: 0; }
@media screen and (max-width: 900px) { .cs-fields { grid-template-columns: 1fr; } .cs-sheet { padding: .15in; } .cs-info { grid-template-columns: 1fr; } }
@media print {
  @page callsheet { margin: 0.4in; }
  #printArea .cs-sheet { page: callsheet; width: auto; margin: 0; padding: 0; box-shadow: none; font-size: 8.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printArea .cs-sheet .auto { display: none; }
  #printArea .cs-sheet .cs-t th, #printArea .cs-sheet .cs-t td { height: 15pt; }
  #printArea .cs-sheet tr, #printArea .cs-two { break-inside: avoid; }
  #printArea .cs-val { display: block; min-height: 1em; }
  #printArea .p-sec { font: 700 11pt Arial, sans-serif; text-transform: uppercase; letter-spacing: .08em; margin: 14pt 0 5pt; }
}

/* ---------- export ---------- */
.exp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.exp-card p { margin: 0; }
.exp-fields { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; align-items: center; padding: 12px 14px; background: #18150f; border: 1px dashed var(--line); border-radius: 6px; }
.exp-fields label { font-size: 13px; color: var(--muted); }
.exp-fields input, .exp-fields textarea { width: 100%; padding: 7px 9px; font: inherit; font-size: 14px; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
.exp-fields textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(201,162,74,.18); }
.exp-fields.off { opacity: .45; }
.exp-note { grid-column: 1 / -1; }
.exp-go { display: flex; justify-content: flex-end; }
@media (max-width: 560px) { .exp-fields { grid-template-columns: 1fr; } }

/* ---------- script formats ---------- */
.ProseMirror .act { text-align: center; text-transform: uppercase; text-decoration: underline; margin-top: 24pt; }
.ProseMirror .sound, .ProseMirror .music { text-transform: uppercase; margin-top: 12pt; }
.ProseMirror p.act:has(> br:only-child)::before { content: 'ACT ONE'; color: #c4bdae; position: absolute; left: 0; right: 0; }
.cue { position: absolute; left: 0; text-indent: 0; text-decoration: none; font-weight: 400; user-select: none; pointer-events: none; }

/* stage play: names at a centre tab, speeches full width, directions indented in parentheses */
.fmt-stage .ProseMirror .scene_heading { text-align: center; text-transform: none; font-weight: 400; margin-top: 12pt; }
.fmt-stage .ProseMirror .character { margin-left: 25ch; }
.fmt-stage .ProseMirror .dialogue { margin-left: 0; width: calc(60ch + .05in); }
.fmt-stage .ProseMirror .action, .fmt-stage .ProseMirror .parenthetical { margin-left: 15ch; width: calc(45ch + .05in); }
.fmt-stage .ProseMirror p.action:not(:has(> br:only-child))::before { content: '('; }
.fmt-stage .ProseMirror p.action:not(:has(> br:only-child))::after { content: ')'; }
.fmt-stage .ProseMirror p.scene_heading:has(> br:only-child)::before { content: 'Scene 1'; left: 0; right: 0; }
.fmt-stage .ProseMirror p.action:has(> br:only-child)::before { content: '(Stage direction)'; }
.fmt-stage .pb-more, .fmt-stage .pb-contd { padding-left: 4in; }
.fmt-stage .ProseMirror .dialogue .pb { margin-left: -1.5in; } .fmt-stage .ProseMirror .parenthetical .pb, .fmt-stage .ProseMirror .action .pb { margin-left: calc(-1.5in - 15ch); }

/* audio drama: cue number, then a column for SOUND: / MUSIC: / the speaker, then the words */
.fmt-audio .ProseMirror { display: grid; grid-template-columns: 4ch 14ch minmax(0, 1fr); align-items: start; align-content: start; }
.fmt-audio .ProseMirror > * { grid-column: 1 / -1; min-width: 0; position: relative; }
.fmt-audio .ProseMirror > .action { grid-column: 2 / -1; }
.fmt-audio .ProseMirror > .character { grid-column: 2; margin-left: 0; padding-right: 1ch; overflow-wrap: anywhere; }
.fmt-audio .ProseMirror > .character .cue { left: -4ch; }
.fmt-audio .ProseMirror > p.character:not(:has(> br))::after { content: ':'; }
.fmt-audio .ProseMirror > .dialogue, .fmt-audio .ProseMirror > .parenthetical { grid-column: 3; margin-left: 0; width: auto; }
.fmt-audio .ProseMirror > .parenthetical { text-transform: uppercase; }
.fmt-audio .ProseMirror > .character + .dialogue, .fmt-audio .ProseMirror > .character + .parenthetical { margin-top: 12pt; }
.fmt-audio .ProseMirror > .pb + .character + .dialogue, .fmt-audio .ProseMirror > .pb + .character + .parenthetical,
.fmt-audio .ProseMirror > .character:first-child + .dialogue, .fmt-audio .ProseMirror > .character:first-child + .parenthetical { margin-top: 0; }
.fmt-audio .ProseMirror > .sound, .fmt-audio .ProseMirror > .music { grid-column: 2 / -1; padding-left: 14ch; text-indent: -14ch; }
.fmt-audio .ProseMirror > .sound::before, .fmt-audio .ProseMirror > .music::before { content: 'SOUND:'; display: inline-block; width: 14ch; text-indent: 0; }
.fmt-audio .ProseMirror > .music::before { content: 'MUSIC:'; text-decoration: underline; }
.fmt-audio .ProseMirror > .sound .cue, .fmt-audio .ProseMirror > .music .cue { left: -4ch; }
.fmt-audio .ProseMirror > p.character:has(> br)::before { content: 'NAME'; color: #c4bdae; position: absolute; }
.fmt-audio .ProseMirror > p.dialogue:has(> br:only-child)::before { content: 'What they say'; }
.fmt-audio .ProseMirror > p.parenthetical:has(> br:only-child)::before { content: '(HOW THEY SAY IT)'; }
.fmt-audio .ProseMirror > p.action:has(> br:only-child)::before { content: 'Note'; }
.fmt-audio .ProseMirror > p.scene_heading:has(> br:only-child)::before { content: 'SCENE 1: WHERE, WHEN'; }
.fmt-audio .ProseMirror > .pb { grid-column: 1 / -1; }
.fmt-audio .ProseMirror .dialogue .pb, .fmt-audio .ProseMirror .parenthetical .pb { margin-left: calc(-1.5in - 18ch); }
.fmt-audio .pb-more, .fmt-audio .pb-contd { padding-left: calc(1.5in + 4ch); }
@media (max-width: 900px) { .fmt-stage .ProseMirror .character { margin-left: 35%; } .fmt-stage .ProseMirror .action, .fmt-stage .ProseMirror .parenthetical { margin-left: 20%; width: auto; } .fmt-stage .ProseMirror .dialogue { width: auto; margin-right: 0; } }
select.fmt { field-sizing: content; padding: 0 2px; font: inherit; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: pointer; }
select.fmt:hover, select.fmt:focus { border-color: var(--line); color: var(--text); }
select.fmt option { background: var(--panel2); color: var(--text); }
.newrow #newFormat { max-width: 170px; }
