:root {
  --bg: #16181d;
  --bg-panel: #1e2128;
  --bg-panel-2: #262a33;
  --border: #33384477;
  --text: #e8e9ec;
  --text-dim: #9a9fab;
  --group-border: #9a9fab59; /* the box round a group of toolbar icons */
  /* Purple, brightened so it reads on the dark panels: --accent is the fill /
     border / highlight colour, --accent-text the purple for text and icons,
     --on-accent the (dark) text on a filled --accent button or tag.
     --accent-2 stays the deeper purple, for hover fills and white-text banners. */
  --accent: #a78bfa;
  --accent-text: #ddd6fe;
  --on-accent: #1a1040;
  --accent-2: #6d28d9;
  --danger: #e5484d;
  --radius: 8px;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

/* 100dvh tracks a phone's collapsing URL bar (100vh doesn't, and leaves the
   bottom of the app hidden behind it); --app-height/--app-top are set from JS
   only while the soft keyboard is up, to fit what's left above it (see
   setupMobileLayout in app.js). */
#app {
  height: 100vh; height: var(--app-height, 100dvh);
  position: relative; top: var(--app-top, 0px);
  display: flex; flex-direction: column;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

.btn {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn:hover { background: #31363f; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: #c4b5fd; border-color: #c4b5fd; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.danger { color: var(--danger); }
.btn.icon-only { padding: 6px 10px; font-size: 16px; line-height: 1; }
.btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.btn[hidden] { display: none; }
/* Sidebar/details-pane visibility toggle (see #btn-toggle-sidebar and
   #btn-toggle-details) — available at any width, not just narrow ones, so a
   normal desktop browser that's simply not very wide can still free up room
   for the script instead of forcing a horizontal scrollbar. */
.sidebar.panel-collapsed, .details-pane.panel-collapsed { display: none; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }
.topbar-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.topbar-actions-main { display: flex; gap: 8px; flex-wrap: wrap; }

.editor-topbar {
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}
.editor-topbar-rows { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.show-title-row { padding: 8px 12px 4px; display: flex; gap: 8px; }
/* Logo doubles as a button back to the Library — stretch (the flex default)
   makes its height match the row, and aspect-ratio:1 keeps it square. */
.editor-logo {
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.editor-logo:hover { background: var(--bg-panel-2); border-color: var(--border); }
/* The ShowCreator logo is the app's own picture (the masks of logo-mark.png), not the 🎭 emoji, which every device draws in its own style. */
.logo-img { display: block; width: 30px; height: 30px; border-radius: 7px; flex: 0 0 auto; }
.editor-logo .logo-img { width: 100%; height: 100%; max-width: 30px; max-height: 30px; }
.logo-img-title { display: inline-block; width: 34px; height: 34px; vertical-align: middle; margin-right: 6px; }
/* The full logo (logo-emblem.png, transparent background): sign-in screen, Library header and, on wide screens, the editor top bar.
   Too fine for anything much under 70px, so smaller places keep the star-and-masks logo-mark.png. */
.logo-emblem { display: block; width: 76px; height: 76px; flex: 0 0 auto; }
.signin-box .signin-emblem { width: 132px; height: 132px; margin: -6px auto -2px; }
.library-brand { display: flex; align-items: center; gap: 14px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-name { font-size: 22px; }
.brand-tag { font-size: 12px; font-weight: 400; color: var(--text-dim); }
@media (max-width: 860px) { .library-brand .logo-emblem { width: 56px; height: 56px; } .brand-name { font-size: 18px; } }
@media (max-width: 560px) { .brand-tag { display: none; } }
.editor-logo-big { display: none; }
@media (min-width: 900px) {
  .editor-logo-big { display: flex; aspect-ratio: auto; align-self: center; margin-left: 10px; padding: 2px; }
  .editor-logo-big .logo-emblem { width: 70px; height: 70px; }
  .show-title-row .editor-logo { display: none; }
}
.show-title-input {
  width: 100%;
  max-width: 320px;
  min-width: 120px;
  background: transparent;
  border: none;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
}
.show-title-input:hover, .show-title-input:focus { background: var(--bg-panel-2); outline: none; }

/* "New version available" notice (see checkForNewVersion in app.js) */
.update-banner {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 16px); padding: 8px 12px;
  background: var(--accent-2); color: #fff; border-radius: var(--radius);
  box-shadow: 0 8px 24px #00000066; font-size: 13px;
}
.update-banner .btn { flex: 0 0 auto; white-space: nowrap; }

/* Library */
.library { display: flex; flex-direction: column; height: 100%; }
.library-list {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  overflow-y: auto;
}
.show-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  position: relative;
}
.show-card:hover { border-color: var(--accent); }
.show-card h3 { margin: 0 0 6px; font-size: 16px; }
.show-card .meta { color: var(--text-dim); font-size: 12px; }
.show-card .card-delete {
  position: absolute; top: 8px; right: 8px;
  background: transparent; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 14px;
}
.show-card .card-delete:hover { color: var(--danger); }
.library-empty { color: var(--text-dim); padding: 40px; text-align: center; grid-column: 1/-1; }
.library-error { color: var(--danger); }
.library-section { display: flex; flex-direction: column; min-height: 0; }
.library-section[hidden] { display: none; }
.library-section h2 { margin: 20px 24px 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }

/* Sign-in / loading screens */
.app-loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-dim); }
.signin-screen { display: flex; align-items: center; justify-content: center; height: 100%; }
.signin-box {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; width: 360px; text-align: center; display: flex; flex-direction: column; gap: 12px;
}
.signin-box h1 { margin: 0 0 4px; }
.signin-box p { color: var(--text-dim); font-size: 13px; margin: 0 0 8px; }
.signin-error { color: var(--danger); font-size: 12px; }

/* Account chip + role banner (multi-user collaboration) */
.account-chip { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.account-chip[hidden] { display: none; }
.account-chip .account-email { color: var(--text-dim); font-size: 12px; }
.role-banner {
  background: #8b5cf61a; border-bottom: 1px solid var(--border); color: var(--text-dim);
  font-size: 12px; padding: 6px 16px; text-align: center;
}
.role-hidden { display: none !important; }

/* Draw toolbar — a dropdown anchored to the pencil button itself (#menu-draw
   is a plain .menu, same position:relative anchor as the View/Export/Edit/
   Help menus use for their own .menu-panel — see setDrawMode/
   renderDrawToolbar, which show/hide this the same way those toggle their
   panels, just without the others' click-outside-closes behavior: closing
   on an outside click would close this the instant you touched the script
   to actually draw). */
.draw-toolbar {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px #00000055;
  padding: 10px 12px; width: 300px;
}
.draw-toolbar[hidden] { display: none; }
.draw-toolbar-group { display: flex; align-items: center; gap: 6px; }
.draw-color-swatch {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent;
  padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px #00000033;
}
.draw-color-swatch.selected { border-color: var(--text); }
.draw-width-btn {
  width: 28px; height: 28px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-panel-2); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.draw-width-btn.selected { border-color: var(--accent); background: #8b5cf61a; }
.draw-width-dot { display: block; border-radius: 50%; background: var(--text); }
.draw-toolbar-btn {
  background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.draw-toolbar-btn.selected { border-color: var(--accent); background: #8b5cf61a; color: var(--accent); }
.draw-toolbar-done { width: 100%; }
.draw-toolbar-visibility, .draw-toolbar-visibility-static {
  font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; width: 100%;
}
.draw-toolbar-legend { font-size: 11px; color: var(--text-dim); width: 100%; }
/* "Selected sketch" section (see renderDrawToolbar) — a hairline rule marks
   it off from the always-present color/width/mode controls above it. */
.draw-toolbar-selected {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%;
  border-top: 1px solid var(--border); padding-top: 10px;
}
.draw-toolbar-selected .draw-toolbar-btn { align-self: flex-start; }

/* Add-collaborator row — used by the Settings page (see renderSettingsView) */
.share-add-row { display: flex; gap: 8px; align-items: center; }
.share-add-row .modal-input { flex: 1; margin: 0; }
.share-role-select { background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }

/* Editor layout */
.editor { display: flex; flex-direction: column; height: 100%; }
.editor-body { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 260px;
  flex: 0 0 auto;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
}
.sidebar-section { margin-bottom: 20px; }
.sidebar-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; cursor: pointer; user-select: none;
}
.sidebar-section-header h2 {
  font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); margin: 0; flex: 1;
}
.sidebar-collapse-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 0 4px 0 0; font-size: 11px; transition: transform 0.15s;
  flex: 0 0 auto;
}
.sidebar-section.collapsed .sidebar-collapse-btn { transform: rotate(-90deg); }
.sidebar-section.collapsed .sidebar-section-body { display: none; }

.act-block { margin-bottom: 10px; }
.act-title-row { display: flex; align-items: center; gap: 4px; }
.act-chevron { flex: 0 0 auto; width: 14px; text-align: center; font-size: 12px; color: var(--text-dim); cursor: pointer; user-select: none; }
.act-block.collapsed .act-chevron { transform: rotate(-90deg); }
.act-block.collapsed .scene-item, .act-block.collapsed > .add-scene-row { display: none; }
.act-title-input { cursor: pointer; }
.act-title-input {
  min-width: 0; /* lets the name shrink so the row's move/delete buttons never push the sidebar wider */
  background: transparent; border: none; font-weight: 600; flex: 1;
  padding: 4px; border-radius: 4px;
}
.act-title-input:hover, .act-title-input:focus { background: var(--bg-panel-2); outline: none; }
.scene-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 6px 8px; margin-left: 8px; border-radius: 6px;
  cursor: pointer; color: var(--text-dim); font-size: 14px;
}
.scene-item:hover { background: var(--bg-panel-2); }
.scene-item.active { background: var(--accent); color: var(--on-accent); }
/* The computed "Sc. 3"/"M1:" prefix (auto-numbering only — see
   renderActsList/renderMusicList) sits beside the actual editable name. */
.scene-item .scene-name-number { flex: 0 0 auto; white-space: nowrap; }
.scene-name-input {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  background: transparent; border: none; color: inherit; font-weight: inherit;
  padding: 2px 4px; border-radius: 4px;
}
.scene-name-input:hover, .scene-name-input:focus { background: var(--bg-panel-2); outline: none; color: var(--text); }
.scene-name-input::placeholder { color: inherit; opacity: 0.6; }
/* Once a scene is selected its letter/attach/cut/copy/delete controls show
   up too (see renderActsList) — forced onto their own full-width row below
   the scene name instead of competing for space on the same line. */
.scene-item-actions { display: flex; align-items: center; gap: 6px; flex: 1 0 100%; }
.scene-letter-input {
  /* Wide enough for its own "+Aa" placeholder (a typed value is at most 2
     chars, so it never needs the extra room the placeholder does). */
  flex: 0 0 auto; width: 40px; text-align: center; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 0;
  background: var(--bg-panel-2); color: var(--text);
}
.scene-letter-input:focus { outline: none; border-color: var(--accent); }
.scene-letter-input::placeholder { color: var(--text-dim); font-weight: 600; }
.script-pane-inner .scene-letter-input {
  background: #00000010; color: #111111; border-color: #00000022;
}
.scene-letter-attach {
  flex: 0 0 auto; width: 22px; height: 22px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; line-height: 1;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-panel-2); color: var(--text-dim); cursor: pointer;
}
.scene-letter-attach:hover { border-color: var(--accent); color: var(--accent); }
.scene-letter-attach.hidden-toggle { display: none; }
.script-pane-inner .scene-letter-attach {
  background: #00000010; color: #555555; border-color: #00000022;
}
.icon-btn {
  background: transparent; border: none; color: inherit; opacity: 0.6;
  cursor: pointer; padding: 2px 4px; font-size: 12px;
}
.icon-btn:hover { opacity: 1; }
.add-scene-row { display: flex; align-items: center; }
.add-scene-btn {
  margin-left: 8px; font-size: 12px; color: var(--text-dim);
  background: transparent; border: none; cursor: pointer; padding: 4px 8px;
}
.add-scene-btn:hover { color: var(--accent); }
.add-scene-btn:disabled { opacity: 0.3; cursor: default; }
.add-scene-btn:disabled:hover { color: var(--text-dim); }
/* "+ Add act" sits at the top level (acts aren't indented, only their
   scenes are) — lines its text up with the act name above it instead of
   inheriting the scene-row indent every other .add-scene-btn uses. */
.add-scene-btn.no-indent { margin-left: 0; padding-left: 4px; }

.character-row {
  display: flex; align-items: center; gap: 6px; padding: 4px 2px; margin-left: 8px;
  border-radius: 4px; cursor: pointer;
}
/* Selected (see selectCharacter) — same accent highlight a selected line/scene/act gets in
   the main pane (.line-row.selected etc.), one shade lighter to suit sitting in the sidebar. */
.character-row.selected { background: #8b5cf61a; }
/* min-width: 0 lets the name shrink so the count, notes and delete buttons all stay
   inside the sidebar (an input's default minimum width was pushing the delete button out). */
.character-name-input {
  background: transparent; border: none; flex: 1; min-width: 0; padding: 2px 4px; border-radius: 4px;
}
.character-name-input:hover, .character-name-input:focus { background: var(--bg-panel-2); outline: none; }
/* A character group (see isCharacterGroup): italic name, and a button showing how many are in it. */
.character-group-row .character-name-input { font-style: italic; }
.character-group-btn, .character-makegroup-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  flex: 0 0 auto; min-width: 28px; height: 24px; padding: 0 7px;
  font-size: 14px; font-weight: 600; line-height: 1; opacity: 1; cursor: pointer;
  background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
}
.character-group-btn:hover, .character-makegroup-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.character-group-icon { display: inline-flex; }
.character-group-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.character-name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.character-name-wrap .character-name-input { flex: none; width: 100%; box-sizing: border-box; }
.character-group-tag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-style: italic; color: var(--text-dim); padding: 0 4px; line-height: 1.2; }

.summary-members-group, .summary-char-group-th { font-style: italic; }
.character-line-count {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-panel-2);
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 12px;
  text-align: center;
}

/* Details pane "Props" section — see renderLinePropsSection. Each assigned
   prop is its name (typed/selected like a character — see resolvePropName)
   with the scope <select> and delete button tucked below, hidden until the
   row is clicked/focused (.expanded), so the list reads as plain names
   until you actually mean to edit one. */
.props-character-block { margin-bottom: 16px; }
.props-character-block:last-child { margin-bottom: 0; }
.props-character-name { font-weight: 700; font-size: 13px; margin-bottom: 6px; margin-left: 8px; }
/* How many performers play the character — see buildPropsCharacterBlock. */
.props-cast-count { font-weight: 400; font-size: 12px; color: var(--text-dim); margin-left: 8px; }
.props-cast-count.unknown { font-style: italic; }
/* "×4" after a prop's name, and the Qty field in its expanded details (also
   used in the Props table) — see propQuantityFor. */
/* A prop's total across every assignment, under its name in the Props table. */
.props-total { display: block; font-size: 12px; color: var(--text-dim); padding: 2px 4px 0; }
.props-qty-badge { flex: 0 0 auto; font-size: 12px; color: var(--text-dim); padding-right: 4px; }
.props-qty-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-dim); }
.props-qty-input {
  width: 56px; box-sizing: border-box; background: var(--bg-panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px; font-size: 12px;
}
/* A Qty nobody has typed shows the number worked out from the cast as its placeholder: light enough to read on the dark
   box, but still dimmer than a number typed in (which is --text). */
.props-qty-input::placeholder { color: #b3b8c4; opacity: 1; }
/* The details pane's "Cast" section (see renderSongCastSection) — one row
   per character singing in the selected song, with how many performers are
   assigned to cover them via Casting > Blocking and Tracks (0 if none yet). */
.details-cast-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 13px; }
.details-cast-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details-cast-count { flex: 0 0 auto; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.details-cast-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.props-row { padding: 2px 0; margin-left: 16px; }
.props-row-main { display: flex; align-items: center; gap: 4px; }
.props-scope-icon { flex: 0 0 auto; display: inline-flex; color: var(--text-dim); }
.props-scope-icon svg { display: block; }
.props-name-input {
  display: block; flex: 1; min-width: 0; box-sizing: border-box;
  background: transparent; border: none; padding: 4px; border-radius: 4px;
}
.props-name-input:hover, .props-name-input:focus { background: var(--bg-panel-2); outline: none; }
.props-row-details { display: none; align-items: center; gap: 6px; margin-top: 4px; padding-left: 4px; }
.props-row.expanded .props-row-details { display: flex; }
.props-scope-text { flex: 0 1 auto; min-width: 0; color: var(--text-dim); font-size: 12px; } /* (a list of scenes wraps) */
/* A WHAM item whose scope doesn't reach the selected scene (see
   assignmentAppliesToScene) — dimmed rather than hidden, plus the
   .props-inactive-tag label, so the character's whole WHAM history stays
   visible with what's actually on right now still standing out. */
.props-row-inactive .props-row-main { opacity: 0.5; }
.props-inactive-tag { flex: 0 0 auto; font-size: 11px; color: var(--text-dim); font-style: italic; padding-left: 2px; }

/* An item's notes (buildItemNotes) under its row in the details pane: shown when something is
   written, or while the row is open for editing. In the catalog table they sit in a Notes column. */
.props-row-notes { display: none; margin: 0 0 6px 30px; }
.props-row-notes.has-text, .props-row.expanded + .props-row-notes { display: block; }
.props-row-notes textarea, .props-notes-cell textarea {
  display: block; width: 100%; box-sizing: border-box; min-height: 3.4em; resize: vertical;
  background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 7px; font: inherit; font-size: 12px; line-height: 1.35;
}
.props-row-notes textarea:focus, .props-notes-cell textarea:focus { outline: none; border-color: var(--accent); }
.props-notes-cell { min-width: 220px; }

/* Props main view's "add a new prop" row — see renderPropsView. */
.props-catalog-add-row { margin-top: 16px; max-width: 400px; }

/* A WHAM item's reference-documents control — a small "🔗" toggle (see
   buildWhamLinksControl) that opens openWhamLinksModal, the same centered
   modal-overlay shell as the rest of the app's modals (openModalPrompt
   etc.) rather than a dropdown anchored to the toggle button, which could
   open off the edge of the details pane or the screen. */
.wham-links-toggle { font-size: 12px; }
.wham-link-list { max-height: 40vh; overflow-y: auto; margin-bottom: 8px; }
/* In the links dialog the links are listed at the weight of the "Paste a link…" boxes under them: bigger text, and a row
   as tall as one of those boxes. */
.wham-link-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px; min-height: 37px; font-size: 16px; }
.wham-link-list .wham-link-anchor { max-width: calc(100% - 70px); margin-right: auto; }
.wham-link-row.editing { flex-wrap: wrap; justify-content: flex-start; padding: 4px 2px; }
.wham-link-input.invalid { border-color: var(--danger); }
.wham-link-anchor { color: var(--accent); text-decoration: underline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.wham-link-add-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.wham-link-add-row[hidden] { display: none; }
.wham-link-plus { font-size: 20px; line-height: 1; padding: 4px 10px; margin-bottom: 12px; opacity: 1; }
.wham-link-input {
  flex: 1 1 120px; min-width: 0; background: var(--bg-panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 14px;
}
.wham-link-input:focus { outline: none; border-color: var(--accent); }
.wham-link-error { color: var(--danger); font-size: 12px; margin: -4px 0 12px; }
/* An item's own reference documents, listed under its row in the details
   pane (see buildPropsCharacterBlock) — indented a bit past .props-row's
   own 16px so they read as belonging to the item above them. */
.wham-item-links {
  display: flex; flex-direction: column; gap: 2px;
  margin: 0 0 4px 30px; font-size: 12px;
}
.wham-item-links .wham-link-anchor {
  max-width: 100%; white-space: normal; overflow-wrap: anywhere; overflow: visible; text-overflow: clip;
}

/* Set Module — a set object's own reference links, shown in the details
   pane's "Set" section (renderSetOwnBlock/renderSetSection) and the Set
   view's table (renderSetView). Reuses .tracker-text-input, .wham-links-toggle
   (buildWhamLinksControl) and .icon-btn.move-btn — same shape as everything
   else that names/links/moves an item, just its own layout wrapper here. */
.set-current-info { margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
/* The Set section: the description indented like the links, a small "Document Links" subheading at the same
   indent (with the 🔗 control beside it), and the links one step further in. */
.set-indent { margin-left: 30px; }
.set-name-field.set-indent { width: calc(100% - 30px); }
.set-doc-head { display: flex; align-items: center; gap: 6px; margin-left: 30px; }
.set-doc-title { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
.set-doc .wham-item-links { margin-left: 44px; margin-top: 2px; }
/* Dimmed so a set only carried through from earlier in the script (not
   attached at this exact line/scene — see renderSetSection) visibly reads
   as inherited rather than as something that belongs here. */
.set-current-name { color: var(--text-dim); font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
.set-name-field { display: block; resize: none; overflow: hidden; font-family: inherit; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.set-own-block { display: flex; flex-direction: column; gap: 8px; }

/* Script pane */
.script-pane {
  --pane-pad-x: 32px;
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px var(--pane-pad-x);
  min-width: 0;
  /* A small gap between the scrollbars and the actual browser edge (see
     .casting-table-wrap below for why) — right/bottom only, since left/top
     already border the sidebar/topbar rather than the raw window edge. */
  margin: 0 8px 8px 0;
}
/* Casting's own scroll container gets zero padding on every side (see
   updateMainViewMenuHighlight, which toggles this class) — the toolbar,
   table header and row-label column are all position: sticky against THIS
   element, and sticky's stuck position is pinned to the scrollport's padding
   edge while its normal, unstuck position sits padding-inset from that edge.
   Any nonzero padding here is exactly the distance you'd see those sticky
   pieces visibly slide before locking in place the moment you start
   scrolling — zero padding means there's no gap left to slide through, and
   the sticky boundary already matches their resting position from the very
   first pixel of scroll. */
.script-pane.script-pane-casting { padding: 0; }
/* Same fix, same reasoning, as .script-pane-casting above, for the Music
   Tracker's own sticky header row and frozen left columns (see
   renderMusicTrackerView) — any padding here is a permanent gap between
   .script-pane's actual clip edge and their sticky "stuck" resting position
   (sticky's stuck position is pinned to the padding edge, not the border
   edge), so whatever row/column happens to sit there keeps peeking through
   above/beside the sticky piece instead of staying hidden behind it, for as
   long as the pane stays scrolled at all — not just a one-time slide like
   Casting's own toolbar drift, since nothing here ever un-sticks once
   scrolled. Content sits flush against the pane's edges as a result, same
   trade-off Casting already made — cell padding carries the visual
   breathing room instead. */
.script-pane.script-pane-music-tracker { padding: 0; }
/* Every Casting page has a title in #scene-header, except Characters, which keeps its own inside its list (so nothing
   is left to show there, and the empty box is taken out of the flow). */
.script-pane-casting #scene-header:empty { display: none; }
.script-pane-casting #scene-header h2, .script-pane-summary-table #scene-header h2 { margin-bottom: 0; }
.script-pane-casting .script-pane-inner.tracker-view #scene-header, .script-pane-summary-table .script-pane-inner.tracker-view #scene-header { padding: 16px 24px 12px; }
/* The full 400px gutter only makes sense once there's enough room for it
   alongside the 1200px-capped page; narrower desktop/laptop widths keep the
   smaller padding above so the page isn't crushed. */
@media (min-width: 2000px) {
  .script-pane { --pane-pad-x: 400px; }
}
/* Just a centering wrapper now — the white A4 page and the black cue panel
   beside it are two separate boxes (see #scene-header/.scene-page-bg and
   .scene-cue-bg below), not one wide box with a cutout.
   --cue-col/--cue-gap size that black cue panel and the gap beside it —
   #scene-header, .scene-block, .scene-page-bg and .scene-cue-bg all read
   the same two variables, so collapsing them to 0 (see .no-cues below) lets
   the page reclaim that width in one place instead of four. Width is fluid
   (not a fixed 8.27in) up to that same total as a cap, so a plain desktop
   window that's simply not very wide shrinks the page and wraps its text
   instead of forcing a horizontal scrollbar — the printed page's own line
   count is computed against the fixed A4 width regardless (see
   countWrappedRows), so this reflow never changes numbering. */
.script-pane-inner {
  --cue-col: 340px;
  --cue-gap: 28px;
  width: 100%;
  max-width: calc(8.27in + var(--cue-gap) + var(--cue-col));
  margin: 0 auto;
  font-family: "Times New Roman", Times, serif;
  /* Stretches to at least fill the visible script pane, and stretches
     #lines-list to match — see .scene-block:last-child below — so the
     white page (and black cue panel) keep going to the bottom of the
     screen even when a scene's own content is short, rather than stopping
     partway down and exposing the app's dark background underneath. */
  min-height: 100%;
  display: flex;
  flex-direction: column;
  /* Positioning root for #script-drawing-svg (see below) — one ink layer
     covering the WHOLE script (every act/scene currently rendered into
     #lines-list), not scoped to any single scene, so a stroke can run
     across scene/act boundaries and over an act's own heading too. */
  position: relative;
}
/* No cue types currently visible (see state.visibleCueTypes) — the whole
   script has nothing to show in the black panel, so don't reserve width for
   it at all; the page expands to fill the freed space. */
.script-pane-inner.no-cues {
  --cue-col: 0px;
  --cue-gap: 0px;
}
#scene-header {
  width: calc(100% - var(--cue-gap) - var(--cue-col));
  box-sizing: border-box;
  background: #ffffff;
  border-radius: 8px 8px 0 0;
  padding: 1in 1in 0.3in;
  box-shadow: 0 4px 24px #00000055;
}
/* Script view no longer puts anything in #scene-header — every act (not
   just the active one) renders its own heading inline in #lines-list now
   (see renderScriptPane/.act-heading-page below), so acts scroll straight
   into each other instead of #scene-header being a fixed "current act"
   title above a single act's scenes. Left empty, #scene-header would still
   render as its own blank white box (padding/shadow with nothing in it) —
   hidden outright instead. `:not(.tracker-view)` is exactly the script view
   (see updateMainViewMenuHighlight, which sets tracker-view for every OTHER
   main view — those still use #scene-header for their own page heading). */
.script-pane-inner:not(.tracker-view) #scene-header { display: none; }
/* Text size (the A−/A+ pair in the menu bar — setupViewSize in app.js): --text-scale is set on <html>.
   Everything on the script page that has its own point size multiplies it by the scale (see the
   calc(… * var(--text-scale, 1)) sizes below and in the Summary page rules); this is the 12pt that the
   rest of the page (a song title's label, the "Music Ends" line …) inherits. Screen only — the PDF is
   built separately. */
.script-pane-inner:not(.tracker-view) { font-size: calc(12pt * var(--text-scale, 1)); }
/* Text-legibility overrides for the light "page" — everything here previously
   assumed a dark background. Buttons/badges keep their own dark chip styling
   (unaffected, since they set their own background+color), only the plain
   text sitting directly on the white page needs darkening. */
.script-pane-inner #scene-header h2,
.script-pane-inner .act-heading-page,
.script-pane-inner .scene-title-input,
.script-pane-inner .scene-title-auto-label,
.script-pane-inner .scene-subtitle-input,
.script-pane-inner .songtitle-label,
.script-pane-inner .line-text {
  color: #111111;
}
.script-pane-inner .scene-title-input:hover,
.script-pane-inner .scene-title-input:focus {
  background: #00000010;
}
.script-pane-inner .script-empty {
  color: #6b6b6b;
}
.script-pane-inner .line-row:hover { background: #00000008; }
.script-pane-inner .line-row[data-type="direction"] .line-text {
  color: #555555;
}
.script-pane-inner .line-character-input { color: #111111; }
.script-pane-inner .line-character-input::placeholder { color: #999999; }
.script-pane-inner .line-text,
.script-pane-inner .line-character-input {
  font-size: calc(12pt * var(--text-scale, 1));
}

.act-heading { margin: 0 0 28px; font-size: calc(16pt * var(--text-scale, 1)); font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
/* The title of every view and page (viewHeading in app.js): Title Case, one size down from the 16pt
   the Script's own act headings use. */
.act-heading.view-heading { font-size: calc(14pt * var(--text-scale, 1)); text-transform: none; letter-spacing: 0.01em; }
/* Every act's own heading, inline in #lines-list (see renderScriptPane) —
   same opaque-white-page trick .scene-block's own title-row padding uses for
   scene-to-scene spacing (see the "no margin/padding" comment on
   .scene-block below): zero margin/gap around this box means it stacks
   flush against the scene blocks immediately before/after it, so the white
   page reads as one continuous sheet straight through an act boundary
   instead of showing the app's own dark background through a gap there. */
.act-heading-page {
  width: calc(100% - var(--cue-gap) - var(--cue-col));
  box-sizing: border-box;
  background: #ffffff;
  margin: 0;
  padding: 64px 1in 24px;
}
.script-pane-inner.stacked-cues .act-heading-page { width: 100%; }
/* Only the very first act's heading gets the rounded top corners + shadow
   that used to belong to #scene-header unconditionally — that's what marks
   the actual start of the printed page; every act after it is just a
   heading partway down the same continuous sheet, no edge to round. */
.act-heading-first { border-radius: 8px 8px 0 0; padding-top: 1in; box-shadow: 0 4px 24px #00000055; }
/* An act with no scenes yet still needs to keep the white page unbroken
   underneath its heading (see .act-heading-page above) — same box, just
   holding a placeholder message instead of scene content. */
.act-empty {
  width: calc(100% - var(--cue-gap) - var(--cue-col));
  box-sizing: border-box;
  background: #ffffff;
}
.script-pane-inner.stacked-cues .act-empty { width: 100%; }
.script-empty { color: var(--text-dim); text-align: center; padding: 60px 20px; }

/* Each scene is a two-column grid — the white A4 page on the left, a black
   cue panel on the right. The cue column is a fixed width (--cue-col, 0 when
   no-cues) but the page column is 1fr — up to the max-width cap on
   .script-pane-inner it's the same ~A4 width as before, but it shrinks
   (wrapping its text) rather than overflowing once the window's narrower
   than that. Line rows and their cue cells are auto-paired into matching
   grid rows so a line's cues always land level with it. */
.scene-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--cue-col);
  column-gap: var(--cue-gap);
  align-items: start;
  /* Jumping here from the sidebar (see scrollToScene) lands with ~100px of
     breathing room above it instead of flush against the very top edge. */
  scroll-margin-top: 100px;
  /* Grid's default align-content ("normal", which behaves like "stretch")
     shares out any extra height in the container by inflating EVERY row's
     own track to fill it — including the gaps between rows of actual
     content. That's the wrong place for the height flex-grow (see
     .scene-block:last-child below) is adding: it should sit entirely below
     the last real row, not be smeared between the lines. */
  align-content: start;
  /* position:relative alone does NOT create a stacking context (that needs
     an explicit z-index too) — without z-index:0 here, the z-index:-1 on
     .scene-page-bg/.scene-cue-bg below escapes this element entirely and
     stacks behind the whole page's dark background instead of just behind
     this scene's own text. */
  position: relative;
  z-index: 0;
}
#lines-list { display: flex; flex-direction: column; flex: 1 1 auto; }
/* Only the last scene stretches to fill any leftover space in the pane —
   earlier scenes keep their natural content height. .scene-page-bg/
   .scene-cue-bg are absolutely positioned (see above) so they automatically
   follow however tall that makes this block, with no extra JS needed. */
.scene-block:last-child { flex: 1 1 auto; }
/* No margin/padding here for scene-to-scene spacing — that space is instead
   built into the second-and-later scene's title row (see the JS: extra
   padding-top on the scene-title-input) so it stays *inside* the grid rows
   the page/cue backgrounds span, keeping both backgrounds continuous across
   scene boundaries instead of showing a gap of the app's own background
   color between one scene's block and the next. */
/* Connector lines from each cue-attached word to its GO/STANDBY marker —
   drawn by JS (updateCueConnectors) once real layout is available. */
.cue-connector-svg {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
}
.cue-connector-line { fill: none; }
.cue-connector-line.go { stroke: #10b981; stroke-width: 1.5; }
.cue-connector-line.standby { stroke: #f59e0b; stroke-width: 1.5; }
/* Freehand ink layer — ONE svg covering the whole script (every act/scene
   .script-pane-inner currently renders — see #script-drawing-svg's static
   markup in index.html and its own position:relative above), not scoped to
   any single scene, so a stroke can run across scene/act boundaries and
   over an act's own heading. Sized/positioned by updateScriptDrawingOverlay
   to match .script-pane-inner exactly, same technique as .cue-connector-svg
   above, and painted after #lines-list in the DOM so strokes sit on top of
   the script's own text and cue connectors. pointer-events stays "none"
   (transparent to clicks/scroll/typing) except while Draw mode is actually
   on, so it never gets in the way of normal script use. touch-action:none
   while drawing stops a stylus/finger stroke from also scrolling the page
   underneath it. */
.script-drawing-svg { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.script-drawing-svg.draw-mode-on { pointer-events: auto; touch-action: none; cursor: crosshair; }
.script-drawing-svg.draw-mode-on.erase-mode-on { cursor: cell; }
.script-drawing-svg.draw-mode-on.select-mode-on { cursor: pointer; }
.scene-drawing-preview { opacity: 0.85; }
/* A private stroke's own dashed outline (see appendDrawingStroke) is drawn
   with the stroke's own color, same as the solid public case — only the
   dash pattern differs, so color/width stay meaningful either way. */
.scene-drawing-private-ring { fill: none; stroke-width: 1; stroke-dasharray: 2,2; opacity: 0.9; }
/* Selected-for-editing halo (see selectDrawingAt/renderDrawToolbar) —
   painted first, directly under its own stroke, so it reads as a soft glow
   rather than obscuring the ink. */
.scene-drawing-halo { fill: none; stroke: var(--accent); opacity: 0.35; }
circle.scene-drawing-halo { fill: var(--accent); stroke: none; }
/* Painted behind the whole page/cue columns respectively, so each reads as
   its own distinct box (white page, black panel) sitting side by side.
   Positioned elements paint after normal-flow siblings regardless of DOM
   order, so without z-index:-1 these would sit on TOP of the scene's own
   title/lines/cues instead of behind them (.scene-block has position:relative
   above, so this stacks behind its own content, not behind the whole page). */
.scene-page-bg {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: calc(100% - var(--cue-gap) - var(--cue-col));
  background: #ffffff;
  z-index: -1;
}
.scene-cue-bg {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(100% - var(--cue-col));
  width: var(--cue-col);
  background: #0c0d10;
  z-index: -1;
  border-radius: 8px;
}
/* Below 708px (= 2 * 340px cue-col + 28px gap, the point where the page
   column would be squeezed to less than the cue column itself) the cue
   margin would be wider than the script it annotates — switch to stacking
   each line's cues directly beneath it instead, same as the true-mobile
   layout. Driven by a JS-measured width (see updateStackedCueMode), which
   toggles this class on .script-pane-inner, NOT a CSS @container query —
   tried that first, but at least one engine tested resolves a percentage (or
   even a left/right-stretched auto) width on .scene-page-bg against a
   stale/oversized track size once .scene-block collapses to a single
   flexible (1fr) column inside a size-contained ancestor, visibly wider than
   .scene-block's own actual box. A JS-toggled class sidesteps that engine
   bug entirely. */
.script-pane-inner.stacked-cues #scene-header,
.script-pane-inner.stacked-cues .scene-page-bg { width: 100%; }
/* minmax(0, 1fr), not a bare 1fr — a bare 1fr track has an implicit "auto"
   minimum (won't shrink below the widest item's own intrinsic content
   width), which is exactly what was making this column (and everything
   measured against it, like .scene-page-bg's width) render wider than the
   pane actually is. */
.script-pane-inner.stacked-cues .scene-block { grid-template-columns: minmax(0, 1fr); }
/* Each line-row/cue-cell pair still carries its own explicit grid-row and
   grid-column as an inline style (see the JS loop that lays them out side by
   side) — an inline style beats anything here short of !important, so just
   narrowing the column count doesn't actually stack them. Forcing every
   direct child to span the one column and fall into the next auto row puts
   them back in plain DOM order (title, line, its cue, next line, its cue,
   ...) — exactly "beneath it" instead of beside it. Absolutely positioned
   children (the page/cue backgrounds, the connector overlay) don't
   participate in grid auto-placement at all, so this is a no-op for them
   regardless. */
.script-pane-inner.stacked-cues .scene-block > * { grid-column: 1 / -1 !important; grid-row: auto !important; }
/* Explicit breathing room between every stacked item (title, line, its cue,
   next line, ...) — without this, only .line-row's own 4px margin-bottom
   separated one line from the next, which left a cue block sitting right up
   against (or effectively touching) the next line's text directly below
   it. */
.script-pane-inner.stacked-cues .scene-block { row-gap: 10px; }
.script-pane-inner.stacked-cues .scene-cue-bg { display: none; }
.script-pane-inner.stacked-cues .cue-margin-cell { margin: 4px 0 8px 24px; background: #0c0d10; border-radius: 6px; }
/* Nothing to actually show (see .cue-margin-cell-empty in app.js) — collapse
   it entirely instead of leaving a small empty black box under every line
   that has no cue on it. Except while the line is focused (.show-cue-actions,
   toggled by isLineActive), since that's exactly when the "+ Cue" button
   needs to be reachable to add one in the first place. */
.script-pane-inner.stacked-cues .cue-margin-cell-empty:not(.show-cue-actions) { display: none; }
/* layoutCueMargins (which normally makes .inline-cue-add absolutely
   positioned and pads the cell's min-height to match, see app.js) never runs
   in stacked mode — drawStackedCueConnectors takes over instead and leaves
   the button's own default absolute positioning untouched, so the cell (which
   sizes itself to its flex content) collapsed to fit nothing and the button
   hung out below it, half-clipped. Putting it back in normal flow here lets
   the cell's flex column simply grow to contain it. */
.script-pane-inner.stacked-cues .inline-cue-add { position: static; align-self: flex-start; }
/* Connector lines stay visible here too, now drawn straight down to each
   cue's own marker below it instead of sideways — see
   drawStackedCueConnectors in app.js. */
/* Both are <textarea> (not <input>) so a long title/description actually
   wraps once the page narrows instead of just scrolling/clipping inside a
   single-line field — resize/overflow/line-height here are what keep a
   textarea looking like a plain uppercase text field instead of a boxed
   multi-line control; autoResize() (same helper .line-text uses) grows the
   height to fit as it wraps. */
.scene-title-input {
  background: transparent; border: none; font-weight: 700; font-size: calc(14pt * var(--text-scale, 1));
  text-transform: uppercase; font-family: inherit; line-height: 1.4;
  width: 100%; box-sizing: border-box; padding: 4px 1in; border-radius: 4px;
  resize: none; overflow: hidden;
}
.scene-title-auto {
  display: flex; align-items: flex-start; gap: 8px;
  width: 100%; box-sizing: border-box; padding: 4px 1in;
}
.scene-title-auto-label { font-weight: 700; font-size: calc(14pt * var(--text-scale, 1)); text-transform: uppercase; flex: 0 0 auto; line-height: 1.4; padding: 4px 0; }
/* A Preset/Interval's title row (see renderScriptPane) — just its fixed
   label, no editable field beside it, so nothing else here hints it can be
   clicked (to select it, same as any other scene) the way a real input's
   text cursor normally would. */
.scene-title-special { cursor: pointer; }
.scene-subtitle-input {
  background: transparent; border: none; font-family: inherit; font-size: calc(14pt * var(--text-scale, 1)); font-weight: 700; text-transform: uppercase;
  line-height: 1.4; flex: 1; min-width: 0; padding: 4px 0; color: inherit;
  resize: none; overflow: hidden;
}
.scene-subtitle-input:hover, .scene-subtitle-input:focus { outline: none; background: #00000010; }
.scene-empty { padding: 20px 1in; }
/* A scene's title row (see renderScriptPane) — the same "text object"
   treatment a selected .line-row already gets: a translucent purple wash
   over the white page behind it (there's no opaque background of its own
   here to hide it — that's .scene-page-bg, a shared sibling behind the
   whole scene — so this composites over it exactly like .line-row.selected
   does), plus a floating Move/Delete toolbar. position:relative anchors
   that toolbar (.scene-actions, absolutely positioned) against this row
   specifically, not the whole page. */
.scene-title-row { position: relative; border-radius: 6px; border: 1px solid transparent; }
.scene-title-row.selected { background: #8b5cf61a; border-color: var(--accent); }
.scene-actions {
  position: absolute; right: 4px; top: -14px;
  display: none; flex-direction: row; gap: 2px;
  background: #ffffffee; border-radius: 6px; padding: 2px;
  box-shadow: 0 2px 8px #00000033; z-index: 2;
}
.scene-title-row.show-actions .scene-actions { display: flex; }
/* An act's heading (see renderScriptPane) — same idea, one level up. Unlike
   a scene/line title, the heading itself (.act-heading-page) IS an opaque
   white box (there's no separate shared background behind it the way
   .scene-page-bg is for a scene) — a plain translucent overlay on this
   wrapper would be invisible, painted UNDER that opaque white rather than
   over it. An inset box-shadow instead paints inside the white box's own
   border edge, on top of its background, giving the same visible tint. */
.act-heading-row { position: relative; cursor: pointer; }
.act-heading-row.selected .act-heading-page { box-shadow: inset 0 0 0 999px #8b5cf61a; }
.act-heading-row.selected .act-heading-first { box-shadow: 0 4px 24px #00000055, inset 0 0 0 999px #8b5cf61a; }
.act-actions {
  position: absolute; right: 1in; top: 16px;
  display: none; flex-direction: row; gap: 2px;
  background: #ffffffee; border-radius: 6px; padding: 2px;
  box-shadow: 0 2px 8px #00000033; z-index: 2;
}
.act-heading-row.show-actions .act-actions { display: flex; }

.line-row {
  display: flex;
  gap: 10px;
  padding: 2px 1in;
  box-sizing: border-box;
  border-radius: 6px;
  /* Every text block (character+dialogue, direction, song title...) is
     separated from the next by one dialogue line's worth of blank space,
     matching standard script formatting — this plus the row's own 2px
     top/bottom padding above adds up to ~1 line-height at the dialogue
     font size (see .line-text's line-height below). */
  margin-bottom: calc(17px * var(--text-scale, 1));
  border: 1px solid transparent;
  align-items: flex-start;
  /* Jumping here from the Musical Numbers list (see scrollToLine) lands with
     ~100px of breathing room above it instead of flush against the top. */
  scroll-margin-top: 100px;
  position: relative;
}
.line-row:hover { background: #ffffff08; }
/* Trailing blank space at the very end of the whole script — see
   renderScriptPane, which appends this once, after the last line of the
   last scene of the last act only. Sized to ~4 single-line text objects at
   the dialogue font size: one is ~46px (12pt font × 1.3 line-height ≈
   20.8px, + .line-text's 2px+2px padding, + .line-row's own 2px+2px padding,
   + its 17px margin-bottom above) — 4 × 46px = 184px. */
.script-end-spacer { grid-column: 1 / -1; height: calc(184px * var(--text-scale, 1)); }
/* Sits in the .line-row's own 1in left margin (see its padding above),
   right-aligned flush against where the text column starts — one badge per
   physical printed row, each with its own inline `top` set by
   applyDialogueLineNumberPositions (not fixed here: a wrapped paragraph
   needs several of these stacked at real per-row spacing). */
/* Sits in the same 1in left margin as .line-number-badge, left-aligned
   where that badge is right-aligned, so the two never overlap — only
   visible while this line is selected (see .line-row.selected below). */
.line-type-icon {
  position: absolute; left: 0; top: 2px; width: 1in; padding-left: 4px;
  box-sizing: border-box; font-size: 13px; line-height: 1; pointer-events: none;
  display: none;
}
.line-row.selected .line-type-icon { display: block; }
.line-number-badge {
  position: absolute; left: 0; width: 1in; padding-right: 8px;
  box-sizing: border-box; text-align: right;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 10px; color: #999999; pointer-events: none;
}
/* Same compact prefix a parallel line's part already shows (see
   .line-number-badge-inline) — used for a plain dialogue/lyric line instead
   of per-row .line-number-badge once the page is narrower than true A4 (see
   applyDialogueLineNumberPositions): there's no reliable on-screen row to
   pin an absolute badge to at that point, but the number itself is still
   meaningful, so show it once, inline, rather than not at all. */
.line-number-badge-inline, .line-number-badge-compact {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 10px; color: #999999; margin-right: 4px;
}
.line-row.selected { background: #8b5cf61a; border-color: var(--accent); }
.line-row.bulk-selected { background: #fbbf2422; border-color: #fbbf24aa; }

.line-select-checkbox {
  display: none;
  flex: 0 0 auto;
  margin-top: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}
/* Touch devices have no shift+click, so they get checkboxes for multi-select
   instead — but only once the ☑ button beside the pencil turns it on. */
.multiselect-btn { display: none; }
.multiselect-btn[hidden] { display: none !important; }
#btn-toggle-multiselect.multiselect-active { background: #8b5cf61a; color: var(--accent); }
@media (pointer: coarse), (max-width: 860px) {
  .multiselect-btn { display: inline-block; }
  body.multiselect-on .line-select-checkbox { display: inline-block; width: 22px; height: 22px; }
  /* The datalist's own drop-down arrow beside a character's name. */
  .line-character-input::-webkit-calendar-picker-indicator,
  .line-character-input::-webkit-list-button { display: none !important; }
}

.line-content { flex: 1; min-width: 0; position: relative; }
/* The toolbar's Section menu (openSectionMenu). */
.section-menu {
  position: fixed; z-index: 1500; min-width: 190px; padding: 4px;
  background: var(--bg-panel); border: 1px solid #4b5160; border-radius: 8px;
  box-shadow: 0 6px 24px #00000066; display: flex; flex-direction: column; gap: 2px;
}
.section-menu-note { padding: 6px 10px; font-size: 12px; color: var(--text-dim, #9ca3af); }
.section-menu-item {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  background: transparent; border: none; color: var(--text, #e5e7eb); text-align: left;
  padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.section-menu-item:hover:not(:disabled) { background: #8b5cf633; }
.section-menu-item:disabled { opacity: 0.45; cursor: default; }
.section-menu-item.active { background: #8b5cf61a; color: var(--accent); font-weight: 600; }
.section-menu-key { font-size: 11px; color: var(--text-dim, #9ca3af); }
/* Chorus / Verse / Bridge markers, in the character-name style (same font, size and colour as .line-character-input):
   "(VERSE 1)" beside a name (.line-section-name, placed by positionSectionMarkers), or on a line of its own
   between rows of the lyric (.section-island, inside the editable text — it is not part of the text). */
.line-section-name, .section-island {
  font-size: 13px; font-weight: 400; text-transform: uppercase; line-height: normal; white-space: nowrap;
  color: var(--accent); font-family: inherit;
}
.line-section-name { position: absolute; top: 0; left: 50%; padding: 2px 0; }
.section-island { display: block; text-align: center; padding: 2px 0; user-select: none; -webkit-user-select: none; cursor: default; }
.script-pane-inner .line-section-name, .script-pane-inner .section-island { color: #111111; font-size: calc(12pt * var(--text-scale, 1)); }
/* While a lyric is being edited its lyric tags (Verse, Chorus …) turn purple, so it is clear what is a tag and what is lyric text. */
.script-pane-inner .line-row.selected .line-section-name, .script-pane-inner .line-row.selected .section-island { color: #7c3aed; }
.section-tag.editable { cursor: pointer; }
.section-tag.editable:hover { text-decoration: underline; }
.line-character-input.hide-placeholder::placeholder { color: transparent; }
.line-section-name.no-name .sb { display: none; }
.line-character-input {
  background: transparent; border: none; color: var(--accent);
  font-weight: 400; text-transform: uppercase; font-size: 13px;
  margin-bottom: 0; padding: 2px 0; width: 100%; text-align: center;
}
.line-character-input::placeholder { color: var(--text-dim); text-transform: none; font-weight: 400; }
/* While the typed name hasn't been resolved to an existing/new character yet,
   show it exactly as typed — the uppercase-on-the-page look only applies once
   resolveCharacterInput has confirmed a real character and normalized the
   field to that character's name. */
.line-character-input.unresolved-input { text-transform: none; }
.line-character-input:focus { outline: none; border-bottom: 1px solid var(--accent); }
.line-text {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  resize: none;
  overflow: hidden;
  line-height: 1.3;
  padding: 2px 0;
}
.line-text:focus { outline: none; }
/* A dialogue / lyric while it is edited (createRichLineField): an editable box standing in for the
   textarea, so bold / italic / underline show as they are typed. It is a block that grows with its
   text (a textarea's height is set by autoResize) and keeps its line breaks. */
.rich-line {
  display: block; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal;
  min-height: calc(1.3em + 6px); cursor: text; box-sizing: border-box;
  /* A textarea is autoResize()d to its text plus 2px — this keeps every dialogue / lyric exactly as tall as before. */
  border-bottom: 2px solid transparent;
}
.rich-line[hidden] { display: none; }
.rich-line.rich-readonly { cursor: default; }
/* The Bold / Italic / Underline toolbar buttons while the caret is in text that has that style. */
[data-text-format].format-active { background: #8b5cf633; color: var(--accent); }
.line-row[data-type="direction"] .line-text { font-style: italic; color: var(--text-dim); text-align: center; }
.line-row[data-type="songtitle"] .line-text { font-weight: 700; text-align: left; letter-spacing: 0.03em; text-transform: uppercase; }
.line-row[data-type="dialogue"] .line-text { text-align: left; width: calc(100% - 24px); margin: 0 12px; }
.line-row[data-type="lyric"] .line-text { text-align: left; text-transform: uppercase; letter-spacing: 0.02em; width: calc(100% - 24px); margin: 0 12px; }

/* A cued line's text swaps between this read-only colored display and its
   plain textarea (see .line-text-display) — the wrapper just needs to behave
   like the textarea did directly, including inside the direction brackets. */
.line-text-wrap { display: block; width: 100%; }
.direction-wrap .line-text-wrap { flex: 1; min-width: 0; }
.line-text-display {
  white-space: pre-wrap;
  cursor: text;
  min-height: 1.5em;
}
.line-text-display:hover { background: #00000008; border-radius: 3px; }
/* Marks the word where the line's cue actually falls, instead of a separate
   connector line — green for GO, orange for STANDBY. */
.cue-word-go { color: #0d9668; font-weight: 700; }
.cue-word-standby { color: #b45309; font-weight: 700; }
/* The same colours while a line is edited (paintEditCueHighlights): colour only — the display's bold would change the
   widths and be read back as formatting. A Song Title's plain box is coloured whole. */
::highlight(edit-cue-word-go) { color: #0d9668; background-color: #0d966822; }
::highlight(edit-cue-word-standby) { color: #b45309; background-color: #b4530922; }
::highlight(edit-cue-word-props) { color: #0f766e; background-color: #0f766e22; }
.script-pane-inner .line-input.cue-edit-cue-word-go { color: #0d9668; }
.script-pane-inner .line-input.cue-edit-cue-word-standby { color: #b45309; }
.script-pane-inner .line-input.cue-edit-cue-word-props { color: #0f766e; }
/* Marker for a cue placed after a line's last word — no text of its own. */
.cue-end-anchor {
  display: inline-block; width: 0.7em; height: 0.9em; margin-left: 0.25em;
  border-bottom: 3px solid currentColor; vertical-align: baseline;
}

/* Change history & Director approval — see recordHistoryEdit/renderDetailsPane.
   Applied per-field (text, characterIds, scene title/subtitle) so a pending
   change to one field doesn't make an unrelated approved field look pending
   too. */
.field-pending { color: var(--danger) !important; }
.field-pending-delete { text-decoration: line-through; opacity: 0.55; }
/* Whole-object strikethrough for a line/scene pending deletion — every
   field inside reads as struck-through and dimmed until a Director
   approves or rejects it. */
.line-row.pending-delete .line-text, .line-row.pending-delete .line-text-display,
.line-row.pending-delete .line-character-input, .line-row.pending-delete .parallel-part-header {
  text-decoration: line-through; opacity: 0.55;
}
.scene-block.pending-delete .scene-title-input, .scene-block.pending-delete .scene-title-auto,
.scene-item.pending-delete .scene-name-input, .scene-item.pending-delete .scene-name-number {
  text-decoration: line-through; opacity: 0.55;
}
/* A restore (see restoreDeletedLine/-Scene) is the mirror image of a pending
   deletion above — back in the live script, but not yet signed off — so it
   gets the same red-for-pending treatment as any other unapproved field,
   just applied to the whole item at once instead of one field. */
.line-row.pending-restore .line-text, .line-row.pending-restore .line-text-display,
.line-row.pending-restore .line-character-input, .line-row.pending-restore .parallel-part-header {
  color: var(--danger);
}
.scene-block.pending-restore .scene-title-input, .scene-block.pending-restore .scene-title-auto,
.scene-item.pending-restore .scene-name-input, .scene-item.pending-restore .scene-name-number {
  color: var(--danger);
}
/* "Show deleted items" ghost markers (see renderDeletedLineGhostRow/
   renderDeletedSceneGhostBlock) — dashed/muted, click-to-select-only, no
   editable content of its own. */
.line-row-ghost, .scene-block-ghost {
  display: flex; align-items: center; gap: 8px;
  border: 1px dashed var(--border, #d1d5db); border-radius: 6px;
  padding: 6px 10px; margin: 4px 0; opacity: 0.65; cursor: pointer;
  color: #6b7280; font-style: italic; grid-column: 1 / -1;
}
.line-row-ghost.selected, .scene-block-ghost.selected { opacity: 0.9; border-color: var(--accent); }
.line-ghost-icon, .scene-ghost-icon { flex: 0 0 auto; }
.line-ghost-preview, .scene-ghost-preview { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.parallel-wrap {
  position: relative;
  display: grid;
  column-gap: 0;
  row-gap: 2px;
  width: 100%;
  align-items: start;
}
/* While one of its lines is being edited (the row is selected) the simultaneous layout table shows its
   cell borders in grey, so it's clear which row of it the text being typed belongs to. The row rules
   (.parallel-guide) are drawn by positionParallelGuides, since the singer being edited is one tall box. */
.line-row.selected .parallel-wrap { box-shadow: inset 0 0 0 1px #b9bdc6; }
.line-row.selected .parallel-wrap > [style*="border-left"] { border-left-color: #b9bdc6 !important; }
.parallel-guide { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid #b9bdc6; pointer-events: none; display: none; z-index: 1; }
.line-row.selected .parallel-guide { display: block; }
/* Editing a singer swaps their row cells for one tall editable box (and back). Both must use exactly the same
   line metrics — no gap between rows, no padding above or below a row, one line-height — or the text jumps
   when it is clicked into or left. A row that holds a wrapped paragraph is then the same height either way. */
.parallel-wrap { row-gap: 0; }
.parallel-wrap .line-text { padding-top: 0; padding-bottom: 0; }
.parallel-wrap .rich-line { border-bottom: 0; min-height: 1.3em; }
.parallel-wrap .line-text-display { min-height: 1.3em; }
.parallel-wrap .parallel-cell-underlay { visibility: hidden; pointer-events: none; }
.parallel-part-header { position: relative; min-width: 0; padding-right: 18px; }
.parallel-wrap .line-text,
.parallel-wrap .line-text-display {
  text-align: left;
  width: 100%;
  margin: 0;
  min-width: 0;
}
.line-row[data-content-type="lyric"] .parallel-wrap .line-text,
.line-row[data-content-type="lyric"] .parallel-wrap .line-text-display {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.parallel-remove-part { position: absolute; top: -2px; right: -4px; }
.parallel-row-delete {
  align-self: start;
  margin-top: 2px;
  justify-self: end;
}
.script-pane-inner .parallel-remove-part,
.script-pane-inner .parallel-row-delete {
  color: var(--danger);
}
/* Like a plain dialogue / lyric line, a simultaneous block only shows its delete buttons once it is selected. */
.line-row:not(.selected) .parallel-remove-part,
.line-row:not(.selected) .parallel-row-delete,
.line-row:not(.selected) .parallel-row-add { display: none; }
.parallel-row-add { align-self: start; justify-self: start; margin-top: 2px; font-size: 16px; font-weight: 700; line-height: 1; padding: 0 2px; color: #0d9668; opacity: 1; }
.parallel-row-add:hover { color: #047857; }

.direction-wrap { display: flex; align-items: flex-start; width: 100%; }
.direction-wrap .line-text { flex: 1; }
/* Song titles are always indented in from the margin rather than centered —
   with auto music numbers on, "Music N:" is a separate computed label
   sitting before the title field; off, the same "Music N: " text lives
   inside the title itself (see seedManualMusicTitles), so the wrap and its
   indentation stay the same either way and nothing visibly shifts. Same
   flex layout as .scene-title-auto/-label/-subtitle-input (a natural-width
   label plus a small fixed gap, not a reserved column) — the title field's
   min-width:0 is what actually matters: without it, a narrow page can't
   shrink the field at all and the browser used to break the title itself
   mid-word; with it, the field just wraps normally instead, same as a
   scene description does. */
.songtitle-wrap { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding-left: 60px; }
.songtitle-label { font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; flex: 0 0 auto; line-height: 1.3; padding: 2px 0; white-space: nowrap; }
.songtitle-wrap .line-text { flex: 1; min-width: 0; text-align: left; }
/* "Lyrics by: / Music by:" under a Song Title — same indent as the title, small and italic. */
.songtitle-credits { padding-left: 60px; font-style: italic; font-size: calc(10.5pt * var(--text-scale, 1)); line-height: 1.3; color: var(--text-dim); }
/* Music Ends — same left indent as its Song Title, but the label itself
   reads as a closing marker: italic, right-justified, no bold/uppercase. */
.musicend-wrap { display: flex; width: 100%; padding-left: 60px; }
.musicend-label { flex: 1; min-width: 0; text-align: right; font-style: italic; cursor: pointer; }
.line-badges { flex: 0 0 auto; display: flex; gap: 4px; padding-top: 4px; }
.badge-count {
  font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--bg-panel-2);
  color: var(--text-dim); cursor: default;
}
.badge-count.note { color: #fbbf24; cursor: pointer; }
.badge-count.note:hover { background: #ffffff1f; }
/* Floats just above the selected line as a small toolbar — the right-hand
   margin next to the text column is now occupied by the cue list, so the
   actions can no longer float out into it without overlapping cue pills —
   and only appears once you've actually selected or are editing that line,
   to keep the page uncluttered. */
.line-actions {
  position: absolute;
  right: 4px;
  top: -26px;
  display: none;
  flex-direction: row;
  gap: 2px;
  background: #ffffffee;
  border-radius: 6px;
  padding: 2px;
  box-shadow: 0 2px 8px #00000033;
  z-index: 2;
}
.line-row.show-actions .line-actions {
  display: flex;
}
/* These three toolbars float over the white script page, so their buttons need DARK
   colours and a visible edge (the dark-panel lavender used elsewhere vanishes on white). */
.line-actions .icon-btn, .scene-actions .icon-btn, .act-actions .icon-btn {
  opacity: 1;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 3px 8px;
  min-width: 30px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}
/* .icon-btn.move-btn/.delete-btn (not scoped to .line-actions) — a scene's
   own move button also shows in the sidebar (.scene-item-actions), and an
   act's in its title row (.act-title-row), not just their floating
   in-page toolbar (.scene-actions/.act-actions) — see renderActsList. Same
   purple "armed" state everywhere a move can be pending. */
.icon-btn.move-btn { background: #a78bfa2e; color: var(--accent-text); }
.icon-btn.move-btn:hover { background: #a78bfa55; }
.icon-btn.move-btn.armed { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.icon-btn.move-btn.armed:hover { background: var(--accent); color: var(--on-accent); }
/* On the white page: deep purple / deep red text on a tinted, outlined button. */
.line-actions .icon-btn.move-btn, .scene-actions .icon-btn.move-btn, .act-actions .icon-btn.move-btn {
  background: #8b5cf626; color: #5b21b6; border-color: #7c3aed66;
}
.line-actions .icon-btn.move-btn:hover, .scene-actions .icon-btn.move-btn:hover, .act-actions .icon-btn.move-btn:hover {
  background: #8b5cf64d; color: #4c1d95;
}
.line-actions .icon-btn.move-btn.armed, .scene-actions .icon-btn.move-btn.armed, .act-actions .icon-btn.move-btn.armed {
  background: #6d28d9; border-color: #6d28d9; color: #ffffff;
}
.line-actions .delete-btn, .scene-actions .delete-btn, .act-actions .delete-btn { background: #e5484d1f; color: #b91c1c; border-color: #dc262666; }
.line-actions .delete-btn:hover, .scene-actions .delete-btn:hover, .act-actions .delete-btn:hover { background: #e5484d40; color: #991b1b; }
/* In the sidebar the move / delete buttons are dark chips like the +Aa letter box beside
   them (same fill, text and border), larger than before, so they read on the plain panel
   and on a selected scene's purple row alike. Delete uses a line-drawn trash can (see
   trashIcon in app.js) in a soft red. */
.scene-item .icon-btn, .act-title-row .icon-btn, .sidebar-delete-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; min-width: 28px; height: 24px; padding: 0 7px;
  font-size: 16px; line-height: 1; opacity: 1; cursor: pointer;
  background: var(--bg-panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
}
.scene-item .icon-btn:hover, .act-title-row .icon-btn:hover, .sidebar-delete-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.sidebar-delete-btn, .scene-item .sidebar-delete-btn, .act-title-row .sidebar-delete-btn { color: #ff8a8f; }
.sidebar-delete-btn:hover, .scene-item .sidebar-delete-btn:hover, .act-title-row .sidebar-delete-btn:hover { border-color: #ff8a8f; color: #ffb3b6; }
.scene-item.active .icon-btn.move-btn.armed { background: var(--accent-2); border-color: var(--accent-2); color: #ffffff; }
/* Cast in song: the Edit All / Edit Ensemble buttons, and the box they open (openCastTagDialog). */
/* Cast in Song / Scene: the groups under the characters — All, Ensemble and the character groups that are on a line. */
.details-cast-groups { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.details-cast-group .details-cast-name { flex: 1 1 auto; font-weight: 600; }
.details-cast-group.clickable { cursor: pointer; }
.details-cast-group.clickable:hover .details-cast-name { color: var(--accent-text); }
.details-cast-pencil { flex: 0 0 auto; font-size: 14px; opacity: 0.85; padding: 0 4px; }
.details-cast-pencil:hover { opacity: 1; color: var(--accent-text); }
.details-cast-members { margin: 0 0 4px 16px; }
.details-cast-members .details-cast-name { font-weight: 400; }
/* The character group box, with a share of each character's cast. */
.summary-members-list-shares { grid-template-columns: 1fr; }
.summary-members-share-row { display: flex; flex-direction: column; gap: 2px; }
.summary-members-share-row .summary-members-item { display: flex; align-items: center; gap: 4px; }
.character-group-share { margin-left: auto; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.character-group-share-input { width: 52px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 2px 4px; font-size: 13px; }
.character-group-share-warn { margin: 0 0 4px 22px; font-size: 12px; color: #fbbf24; }
.character-group-links { margin: 6px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.character-group-links-title { font-weight: 600; font-size: 13px; }
.details-cast-linked { margin: 2px 0 4px; font-size: 12px; }

.details-cast-warn { flex: 0 0 auto; color: var(--danger); font-size: 13px; cursor: help; }
.cast-tag-hint { margin: 4px 0 8px; }
.cast-tag-list { max-height: 40vh; overflow-y: auto; margin: 8px 0; display: flex; flex-direction: column; gap: 2px; min-width: 260px; }
.cast-tag-row { font-size: 14px; padding: 3px 2px; cursor: pointer; }
.cast-tag-row.locked { color: var(--text-dim); cursor: default; }
.cast-tag-add-row { display: flex; gap: 6px; margin: 8px 0; }
.cast-tag-add-row .modal-input { flex: 1 1 auto; min-width: 0; margin: 0; }

.set-linked-note { margin: 2px 0 4px; }

.set-number-cell { font-weight: 700; text-align: center; width: 48px; }
/* The Set view: Attached to is half the width it had (it holds only the place now), and the Set (description) column
   takes what that frees; Link / Unlink, Move and Remove are together in the last column. */
.set-view-table { table-layout: fixed; width: 100%; }
.set-view-table .set-col-no { width: 48px; }
.set-view-table .set-col-where { width: 13%; }
.set-view-table .set-col-links { width: 112px; }
.set-view-table .th-short { display: none; }
.set-view-table .set-col-actions { width: 190px; }
.set-view-table td, .set-view-table th { overflow-wrap: anywhere; }
.set-view-table td.set-actions-cell, .set-view-table td.set-links-cell { white-space: nowrap; text-align: right; }
.set-view-table th.set-col-links, .set-view-table th.set-col-actions { text-align: right; }
.set-view-wrap { container-type: inline-size; }
.set-tools-row { display: none; }
.set-view-table td.set-tools-cell { text-align: right; white-space: nowrap; }
.set-tools-cell > * { vertical-align: middle; }
.set-view-table .set-row-selected td { background: #a78bfa1f; }
/* As the window narrows the Links and button columns shrink (never wrapping)… */
@container (max-width: 900px) {
  .set-view-table .set-col-links { width: 64px; }
  .set-view-table .set-col-actions { width: 150px; }
  .set-view-table .th-full { display: none; }
  .set-view-table .th-short { display: inline; }
  .set-view-table .set-col-where { width: 15%; }
}
/* …and below this they go: the selected row shows them on a line of its own. */
@container (max-width: 640px) {
  .set-view-table .set-col-links, .set-view-table .set-links-cell,
  .set-view-table .set-col-actions, .set-view-table .set-actions-cell { display: none; }
  .set-tools-row.set-row-selected { display: table-row; }
  .set-view-table .set-col-where { width: 22%; }
}
.set-actions-cell > * { vertical-align: middle; }
.set-where-cell { white-space: normal; }

/* A linked row is grey: what it shows belongs to the set it is linked to. */
.set-row-linked td { color: var(--text-dim); background: #ffffff08; }
.set-row-linked .set-name-field { color: var(--text-dim); background: transparent; border: 0; padding-left: 0; padding-right: 0; } /* so it lines up with the "The Same as Set No. N" under it */
.set-linked-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-link-pill { margin: 0; font-size: 11px; padding: 1px 10px; cursor: pointer; font-family: inherit; }
.set-link-pill:hover { background: #a78bfa55; }
.set-goto { color: var(--accent-text); text-decoration: underline; cursor: pointer; }

/* Move and Remove on the same line as the "Set" heading, only while the section is open. */
.set-header-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.details-section.collapsed .set-header-actions { display: none; }
@media (max-width: 860px) { .editor .details-section.collapsed .set-header-actions { display: flex; } }
.btn-trash-icon { display: inline-flex; }
.btn-trash-icon svg { width: 16px; height: 16px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Delete buttons that aren't in the sidebar: the same bin, always red (binIcon in app.js). */
.bin-red { color: var(--danger); vertical-align: middle; }
/* The bin on a script (take one assignment out): a little larger so the page and the bin both read. */
.btn-trash-icon.bin-on-script svg { width: 22px; height: 22px; stroke-width: 1.8; }
button:hover > .bin-red { color: #ff6b70; }
.line-actions .add-btn { background: #10b98126; color: #0d9668; }
.line-actions .add-btn:hover { background: #10b98145; }

/* Details pane */
.details-pane {
  width: 300px;
  flex: 0 0 auto;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
}
.details-empty { color: var(--text-dim); font-size: 13px; text-align: center; margin-top: 40px; }
/* A character selected directly in the sidebar's own Characters list (see
   renderCharacterDetailsPane) — just their name, above their own notes section below. */
.details-character-head { margin-bottom: 16px; }
.details-character-name { font-weight: 700; font-size: 16px; }
.details-title-kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 2px; }
.details-title-where { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.details-pane h3 { font-size: 13px; text-transform: uppercase; color: var(--text-dim); margin: 0 0 10px; }
/* Collapsible Notes/History sections — see appendDetailsSection. Reuses the
   sidebar's own .sidebar-collapse-btn styling for a consistent look. */
.details-section { margin-bottom: 20px; }
.details-section-header {
  display: flex; align-items: center; gap: 2px;
  margin-bottom: 10px; cursor: pointer; user-select: none;
}
.details-section-header h3 { margin: 0; }
.details-section.collapsed .sidebar-collapse-btn { transform: rotate(-90deg); }
.details-section.collapsed .details-section-body { display: none; }
.details-line-preview {
  background: var(--bg-panel-2); border-radius: 6px; padding: 10px; font-size: 13px;
  margin-bottom: 20px; color: var(--text-dim);
}
 .note-item {
  background: var(--bg-panel-2); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px;
  position: relative;
}

 .note-item textarea {
  width: 100%; background: transparent; border: none; resize: none;
  color: var(--text); line-height: 1.4; padding: 0;
}
 .note-item textarea:focus { outline: none; }
.item-remove {
  position: absolute; top: 6px; right: 6px; background: transparent; border: none;
  color: var(--text-dim); cursor: pointer; font-size: 12px;
}
.item-remove:hover { color: var(--danger); }
.note-item { border-left: 3px solid #fbbf24; }
.note-links { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.note-links[hidden] { display: none; }
.note-link-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.note-link-row .note-link { flex: 1 1 auto; min-width: 0; }
.note-link-input {
  flex: 1 1 120px; min-width: 0; padding: 3px 6px; font-size: 12px; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
}
.note-link-input.invalid { border-color: var(--danger); }
.note-link { font-size: 12px; color: var(--accent-text); text-decoration: underline; word-break: break-all; }
.note-meta {
  display: flex; align-items: center; gap: 4px; margin: 0 20px 4px 0;
  font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.02em;
}
.note-visibility-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.note-visibility-toggle input { margin: 0; }
.note-visibility-static { cursor: default; }
.add-item-btn {
  width: 100%; padding: 8px; border: 1px dashed var(--border); background: transparent;
  color: var(--text-dim); border-radius: 6px; cursor: pointer; margin-bottom: 20px;
}
.add-item-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Details pane History section — see renderHistorySection/renderHistoryItem. */
.history-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim);
  margin: 14px 0 6px;
}
.history-group-label:first-of-type { margin-top: 0; }
.history-item {
  background: var(--bg-panel-2); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px;
  border-left: 3px solid var(--border); font-size: 12px;
}
.history-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.history-action { font-weight: 700; }
.history-status {
  border-radius: 999px; padding: 1px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
}
.history-status-pending { background: var(--danger); color: white; }
.history-status-approved { background: #0d9668; color: white; }
.history-status-rejected { background: var(--bg); color: var(--text-dim); }
.history-status-superseded { background: var(--bg); color: var(--text-dim); }
.history-meta { color: var(--text-dim); margin-top: 4px; }
.history-diff { margin-top: 6px; line-height: 1.4; word-break: break-word; }
.history-diff-old { color: var(--text-dim); text-decoration: line-through; }
.history-diff-new { color: var(--text); }
.history-actions { display: flex; gap: 6px; margin-top: 8px; }
.history-actions[hidden] { display: none; }
/* A settled (approved/rejected/superseded) entry — other than the current
   value — is click-to-reveal a Restore button (see renderHistoryItem), to
   keep the log itself scannable instead of showing an action on every row. */
.history-item-clickable { cursor: pointer; }
.history-item-clickable:hover { outline: 1px solid var(--border); }

/* Pending Approvals dialog — each change as a card showing the whole line /
   scene with the change marked (see renderPendingItemPreview). */
.approval-list { display: flex; flex-direction: column; gap: 12px; }
.approval-card {
  background: var(--bg-panel-2); border: 1px solid var(--border); border-left: 3px solid var(--danger);
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.approval-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.approval-where { font-weight: 700; }
.approval-change { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--danger); font-weight: 700; }
.approval-meta { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.approval-preview {
  margin: 10px 0; padding: 10px 12px; background: var(--bg); border-radius: 6px; border: 1px solid var(--border);
  line-height: 1.5; word-break: break-word;
}
.approval-preview-delete { border-color: #dc2626; }
.approval-preview-restore { border-color: #0d9668; }
.approval-field-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 2px; }
.approval-line + .approval-field-label { margin-top: 8px; }
.approval-character { font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: 0.03em; }
.approval-title { font-size: 15px; font-weight: 700; }
.approval-text { white-space: pre-wrap; }
.approval-direction { font-style: italic; }
.approval-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.approval-part { padding: 6px 8px; border-radius: 6px; border: 1px dashed var(--border); }
.approval-part-changed { border-style: solid; border-color: #d97706; }
.approval-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.diff-ins { background: rgba(13, 150, 104, 0.28); color: inherit; text-decoration: none; border-radius: 3px; padding: 0 1px; }
.diff-del { background: rgba(220, 38, 38, 0.22); color: inherit; text-decoration: line-through; border-radius: 3px; padding: 0 1px; }

/* Checkbox toggles used in the sidebar (Show line numbers) and the
   Numbering section of Settings (see renderSettingsView) */
.auto-scene-toggle {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim);
  cursor: pointer; user-select: none; margin: 4px 0;
}
.auto-scene-toggle:last-of-type { margin-bottom: 10px; }
.auto-scene-toggle input { cursor: pointer; }
.auto-scene-toggle:has(input:disabled) { opacity: 0.5; cursor: default; }
.auto-scene-toggle input:disabled { cursor: default; }

/* Cue types filter (lives inside the View menu panel, see .menu-panel) —
   a view-only toggle, doesn't touch the data. */
.cue-filter-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.cue-filter-quick {
  flex: 1; background: var(--bg-panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 4px; font-size: 12px; cursor: pointer;
}
.cue-filter-quick:hover { border-color: var(--accent); color: var(--accent); }
.cue-filter-row {
  display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px;
  cursor: pointer; user-select: none;
}
/* Cue Types only (not the Music Tracker's Columns list, which reuses this
   same row style) — indented to match the scene/song/character lists. */
#cue-filter-list .cue-filter-row { margin-left: 8px; }
.cue-filter-row input { cursor: pointer; }
/* Summary > By Character, "Characters to Show": a heading per character family (click to fold it up; its box ticks or
   clears the whole family) over its characters' tick boxes. --fam-color is the family's colour. */
.summary-chars-head {
  display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 3px 4px 3px 6px;
  border-left: 3px solid var(--fam-color, var(--border)); color: var(--fam-color, var(--text-dim));
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; user-select: none;
}
.summary-chars-head:hover { background: var(--bg-panel-2); }
.summary-chars-head input { cursor: pointer; margin: 0; }
.summary-chars-chevron { flex: 0 0 auto; width: 10px; }
.summary-chars-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-chars-count { margin-left: auto; flex: 0 0 auto; font-weight: 400; letter-spacing: 0; color: var(--text-dim); }
.summary-chars-indent { padding-left: 14px; }
.summary-chars-group { font-style: italic; }
.cue-filter-swatch {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
}

/* Cue margin — the right-hand column beside the script text, sitting on its
   own black panel (.scene-cue-bg) rather than the page's white background.
   Each line's cell holds one small grid per word the line has cues attached
   to (earliest word first) — one row per cue on that word (type, number and
   description all in that row), with a single shared GO/STANDBY marker in
   its own column right after the number, stretched to the height of all that
   word's cues (multiple cues on the same word still fire on just the one
   mark; different words each get their own, stacked). Where each cue falls
   is shown by coloring its attached word directly in the text (see
   .cue-word-go/-standby) rather than a connector line. */
.cue-margin-cell {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  gap: 6px;
  position: relative;
}
.cue-margin-grid {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto auto;
  align-items: stretch;
  column-gap: 6px;
  row-gap: 4px;
}
/* A second (or third...) word-group on the same line gets a divider above it
   so it's clear these are separate attachment points, stacked earliest-word
   first. */
.cue-margin-grid + .cue-margin-grid {
  padding-top: 6px;
  border-top: 1px solid #ffffff1a;
}
/* The word itself isn't repeated here (it's already colored in the script
   text) — this row just holds the per-group actions, which only appear
   while the user is interacting with this line (see .show-cue-actions). */
.cue-margin-controls-row {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  min-height: 20px;
}
/* The Script / delete buttons under a cue's type in the Fly Cues table. */
.cue-row-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; white-space: nowrap; }
/* A cue block whose word has been deleted from the line (see cueGroupIsFloating in app.js). */
.cue-margin-grid-floating { outline: 1px dashed #fbbf24; outline-offset: 2px; border-radius: 4px; cursor: pointer; }
.cue-floating-chip {
  margin-right: auto; flex: 0 0 auto; cursor: pointer;
  font-size: 11px; font-weight: 700; color: #fbbf24; background: #fbbf2422;
  border: 1px solid #fbbf2466; border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.cue-floating-chip:hover { background: #fbbf2444; }
.cue-row-flag { display: block; margin: 6px 0 0; }
/* The "who has it?" prompt (openWhoHasItModal): a ticked list of characters, Preset on Stage first. */
.who-has-list { max-height: 240px; overflow-y: auto; margin: 6px 0 10px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 0; }
.who-has-scenes { max-height: 170px; margin-top: 8px; }
.who-has-scenes[hidden] { display: none; }
.who-has-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px; cursor: pointer; font-size: 14px; }
.who-has-row:hover { background: #ffffff10; }
.who-has-row input { margin: 0; }
.who-has-heading { padding: 6px 10px 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--fam-color, var(--text-dim)); }
/* A family's colour is on its <optgroup> heading in the Character boxes; the names under it stay in the normal colour. */
.tracker-select optgroup option { color: var(--text); }
.who-has-heading-blank { padding: 0; border-top: 1px solid var(--border); margin-top: 4px; }
.who-has-preset { font-weight: 700; border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 6px; }
.props-give-btn { font-size: 16px; font-weight: 700; line-height: 1; }
.cue-row-actions .icon-btn svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cue-margin-move, .cue-margin-add {
  display: none;
  flex: 0 0 auto;
  font-size: 11px; font-weight: 600; font-style: normal; letter-spacing: normal;
  border: 1px solid #ffffff4d; background: #ffffff1f; color: var(--text);
  border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap;
}
.cue-margin-move:hover, .cue-margin-add:hover { border-color: var(--accent); color: var(--accent); background: #8b5cf633; }
.cue-margin-move.armed { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cue-margin-move.armed:hover { background: var(--accent); color: var(--on-accent); }
.cue-margin-cell.show-cue-actions .cue-margin-move,
.cue-margin-cell.show-cue-actions .cue-margin-add,
.cue-margin-cell.show-cue-actions .inline-cue-add {
  display: inline-block;
}
/* A role-gated button (see applyRoleGating/canEditCueType in app.js) sets
   the native `hidden` attribute — needs an explicit override here since it
   has to beat the .show-cue-actions rule above at equal-or-higher
   specificity, the same reason .cue-move-banner[hidden] exists elsewhere. */
.cue-margin-cell.show-cue-actions .cue-margin-move[hidden],
.cue-margin-cell.show-cue-actions .cue-margin-add[hidden] {
  display: none;
}
.inline-cue-type {
  border: none; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.02em; color: #10131a; cursor: pointer;
  align-self: center;
}
.inline-cue-number {
  font-size: 18px; font-weight: 700; color: #b7bcc7; min-width: 20px; text-align: center;
  align-self: center;
}
.inline-cue-number-input {
  width: 36px; font-size: 18px; font-weight: 700; color: #e9ebf0; text-align: center;
  background: #ffffff14; border: 1px solid #ffffff2a; border-radius: 4px; padding: 2px 4px;
  align-self: center;
}
.inline-cue-number-input.cue-number-clash {
  border-color: var(--danger); background: #e5484d33; color: #ff9a9d;
}
.inline-cue-number-preview {
  color: #fbbf24;
  font-style: italic;
}
.inline-cue-desc {
  background: #ffffff0d; border: 1px solid transparent; color: #e9ebf0; font-size: 12px;
  min-width: 0; padding: 3px 6px; border-radius: 4px;
  align-self: center;
}
/* The description box grows to fit its text (fitCueDescription in app.js sets its height, up to half the window). */
textarea.inline-cue-desc {
  box-sizing: border-box; resize: none; overflow: hidden; display: block;
  font-family: inherit; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere;
}
.inline-cue-desc-preview {
  min-width: 0; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto;
  font-size: 12px; font-style: italic; color: #fbbf24; padding: 3px 6px;
  align-self: center;
}
.inline-cue-desc:focus, .inline-cue-number-input:focus { outline: none; border-color: #ffffff44; }
/* The description plus its sub-cue controls (see renderCueList): the input
   and ⚡ button on one row, the "Also fires…" / "Fired by…" note beneath. */
.inline-cue-desc-wrap { align-self: center; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inline-cue-desc-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.inline-cue-desc-row .inline-cue-desc { flex: 1 1 auto; }
.inline-cue-trigger {
  display: none; flex: 0 0 auto;
  background: transparent; border: none; color: #8b8f99; cursor: pointer;
  font-size: 12px; padding: 2px 4px; border-radius: 4px;
}
.inline-cue-trigger:hover { color: var(--accent); }
/* A cue that's already a sub-cue keeps its ⚡ showing so it reads as one. */
.inline-cue-trigger.active { display: inline-block; color: #fbbf24; }
.cue-margin-cell.show-cue-actions .inline-cue-trigger { display: inline-block; }
.cue-margin-cell.show-cue-actions .inline-cue-trigger[hidden],
.inline-cue-trigger[hidden] { display: none; }
.inline-cue-notes[hidden] { display: none; }
.inline-cue-note { font-size: 11px; line-height: 1.3; color: #b7bcc7; padding: 0 6px; }
.inline-cue-note-fires { color: #fbbf24; }
/* Sub-cues are drawn smaller and indented, so they read as belonging to the
   cue that fires them (or as timecode-fired) rather than as called cues. */
.inline-cue-type.inline-cue-sub { opacity: 0.85; font-size: 10px; padding: 2px 8px; margin-left: 10px; }
.inline-cue-number.inline-cue-sub, .inline-cue-number-input.inline-cue-sub { font-size: 14px; }
.inline-cue-desc-wrap.inline-cue-sub { border-left: 2px solid #fbbf2466; padding-left: 4px; }
.cue-summary-sub td { font-size: 0.92em; opacity: 0.9; }
.cue-summary-sub td:first-child { padding-left: 24px; }
.cue-filter-subcues[hidden] { display: none; }
.cue-filter-subcues { margin-top: 8px; padding-top: 8px; border-top: 1px solid #ffffff1a; }
.inline-cue-desc-flys, .inline-cue-desc-domes {
  font-family: inherit; text-align: left; cursor: pointer; line-height: 1.35;
  min-width: 0; max-height: 50vh; overflow-y: auto; white-space: normal; overflow-wrap: anywhere;
}
.inline-cue-desc-flys:hover, .inline-cue-desc-flys:focus, .inline-cue-desc-domes:hover, .inline-cue-desc-domes:focus { outline: none; border-color: #ffffff44; }
.inline-cue-desc-flys:disabled, .inline-cue-desc-domes:disabled { cursor: default; opacity: 0.7; }
/* The Dome Cue dialog: one card per followspot, its settings underneath once it is ticked. */
.dome-spot-list { max-height: 55vh; overflow-y: auto; margin-bottom: 8px; }
.dome-spot { border: 1px solid #ffffff1f; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.dome-spot-head { margin: 0; font-size: 15px; }
.dome-spot-body { margin-top: 8px; padding-left: 4px; }
.dome-spot-body[hidden], .dome-fields[hidden] { display: none; }
.dome-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin-top: 8px; }
.dome-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12px; color: var(--text-dim); }
.dome-field .tracker-select, .dome-field .modal-input { width: 100%; margin: 0; }
.dome-field[hidden] { display: none; }
/* The Domes cues page (buildDomeCueTable): a cue-sheet table, one group of columns per followspot. The first header
   row has a fixed height so the second row can stick just below it. */
.dome-spot-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 10px; font-size: 13px; }
.dome-spot-filter-label { color: var(--text-dim); font-size: 12px; }
.tracker-table.dome-table .dome-head-top th { height: 32px; box-sizing: border-box; }
.tracker-table.dome-table .dome-head-sub th { top: 32px; z-index: 3; }
.tracker-table.dome-table th.dome-group-head { z-index: 3; }
/* The page scrolls inside its own box both ways, so the two heading rows and the first three columns stay put
   (fitDomeTable sets its width — a whole number of followspot groups — and height). Sticky cells need the table to
   be overflow: visible, and separate borders to keep their edges when stuck. */
.dome-page .tracker-table-wrap { overflow: auto; }
.tracker-table.dome-table { overflow: visible; border-collapse: separate; border-spacing: 0; border: 0; }
.tracker-table.dome-table th, .tracker-table.dome-table td { border-width: 0 1px 1px 0; }
.tracker-table.dome-table thead .dome-head-top th { border-top-width: 1px; }
.tracker-table.dome-table tr > :first-child { border-left: 1px solid var(--border); }
.tracker-table.dome-table .dome-frozen { position: sticky; z-index: 1; background: var(--bg-panel); }
.tracker-table.dome-table tbody tr:nth-child(even) td.dome-frozen { background: #262a33; }
.tracker-table.dome-table th.dome-frozen { z-index: 5; background: var(--bg-panel-2); }
.tracker-table.dome-table .dome-frozen-last { box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.5); }
.tracker-table.dome-table td.cue-summary-line-cell { min-width: 200px; max-width: 280px; white-space: normal; }
/* a band's text keeps to the left edge while the table is scrolled sideways */
.cue-band-text { position: sticky; left: 8px; display: inline-block; }
/* the narrow-screen cards (buildDomeCueCards) */
.cue-band-card { margin: 12px 0 6px; padding: 6px 8px; border-radius: 6px; background: var(--bg-panel-2); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; }
.cue-band-card-song { color: var(--text-dim); font-weight: 600; }
.dome-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.dome-card-head { display: flex; gap: 10px; align-items: flex-start; }
.dome-card-num { flex: 0 0 auto; min-width: 44px; font-weight: 700; }
.dome-card-line { flex: 1 1 auto; min-width: 0; }
.dome-card-lx, .dome-card-note { margin-top: 4px; font-size: 12px; }
.dome-card-spot { margin-top: 6px; padding: 6px 8px; border-radius: 4px; }
.dome-card { cursor: pointer; }
.dome-card-empty { margin-top: 6px; font-size: 12px; font-style: italic; }
.dome-card-pairs { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 2px; }
/* The Domes script (mountDomeCallerScript): built from the main script's own classes (.script-pane-inner, .scene-block,
   .line-row ...) so the text looks exactly the same; only the cue column and the cue blocks are its own. */
.dome-script-inner { min-height: 0; }
.dome-lines { display: flex; flex-direction: column; flex: 1 1 auto; }
/* beside the script the cue blocks sit straight on the dark background — no panel behind them */
.dome-script-inner .scene-cue-bg { display: none; }
.dome-cue-cell { min-width: 0; padding: 0 8px; }
/* on the page, under their line: the same margin each side */
.script-pane-inner.stacked-cues .dome-cue-cell { margin: 2px 24px 8px 24px; padding: 0; }
.dome-call-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.dome-call-path { fill: none; stroke: #10b981; stroke-width: 1.5; }
.dome-call-dot { fill: #10b981; }
/* a cue's block: plain white with fine rules, like the cue sheet on paper */
.dome-call-block { margin: 0 0 8px; padding: 6px; background: #ffffff; color: #111111; border: 1px solid #c5c9d1; border-radius: 6px; font: 11px/1.3 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; cursor: pointer; }
.dome-call-table { border-collapse: collapse; }
.dome-call-table th, .dome-call-table td { border: 1px solid #c5c9d1; padding: 2px 6px; text-align: center; vertical-align: top; }
.dome-call-table th { background: #f1f3f6; color: #4b5563; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.dome-call-table td { color: #111111; white-space: nowrap; }
.dome-call-top { width: 100%; margin-bottom: 6px; }
.dome-call-top td { text-align: left; font-size: 12px; white-space: normal; }
.dome-call-top td.dome-call-cue, .dome-call-top td.dome-call-lx { width: 1%; white-space: nowrap; }
.dome-call-top td.dome-call-cue { font-weight: 700; }
.dome-call-spots { display: flex; flex-wrap: wrap; gap: 6px; }
.dome-call-table td.dome-out { color: #6b7280; }
.dome-call-empty { font-style: italic; color: #6b7280; }
.dome-card-pairs em { font-style: normal; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.tracker-table.dome-table th.dome-group-head { text-align: center; }
.tracker-table.dome-table th.dome-gap, .tracker-table.dome-table td.dome-gap { width: 8px; min-width: 8px; padding: 0; background: var(--bg); }
/* Cues in the same cue group, side by side in the Cues table: a bar down the left edge, a faint tint, and a dashed
   line (instead of a solid one) between the rows that go together */
.tracker-table tr.cue-together > td:first-child { box-shadow: inset 4px 0 0 var(--accent); padding-left: 12px; }
.tracker-table tr.cue-together > td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.tracker-table tr.cue-together:not(.cue-together-last) > td { border-bottom-style: dashed; }
/* The scene and song bands running down every cue table (makeCueBandAdder) */
.tracker-table tr.cue-band td { font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; background: var(--bg-panel-2); }
.tracker-table tr.cue-band-scene td { color: var(--text); }
.tracker-table tr.cue-band-song td { color: var(--text-dim); font-weight: 600; }
.tracker-table tbody tr.cue-band, .tracker-table tbody tr.cue-band:nth-child(even) { background: var(--bg-panel-2); }
.tracker-table.dome-table td.dome-edit { cursor: pointer; white-space: nowrap; text-align: center; background: var(--dome-tint, transparent); }
.tracker-table.dome-table td.dome-edit:hover { background: #ffffff1a; }
.tracker-table.dome-table td.dome-out { color: var(--text-dim); }
.tracker-table.dome-table td.dome-empty { color: var(--text-dim); font-style: italic; text-align: left; }
/* (the frozen Note cell is also a dome-edit cell: keep its solid background over the see-through one above) */
.tracker-table.dome-table td.dome-edit.dome-frozen { background: var(--bg-panel); }
.tracker-table.dome-table tbody tr:nth-child(even) td.dome-edit.dome-frozen { background: #262a33; }
.tracker-table.dome-table td.dome-edit.dome-frozen:hover { background: #2f3440; }
.tracker-table.dome-table td.dome-lx { min-width: 44px; max-width: 120px; white-space: normal; }
.tracker-table.dome-table .dome-lx-text { font-size: 11px; color: var(--text-dim); }
.tracker-table.dome-table td.dome-note { min-width: 90px; max-width: 200px; white-space: normal; text-align: left; }
.tracker-table.dome-table td.dome-cue-num { white-space: nowrap; }
.dome-presets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
@media (max-width: 520px) { .dome-fields { grid-template-columns: minmax(0, 1fr); } }
.inline-cue-preset-badge {
  margin-left: 6px; font-size: 9px; font-weight: 800; letter-spacing: 0.04em;
  color: #04170f; background: #fbbf24; border-radius: 3px; padding: 1px 4px;
}
.fly-state-pill {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; border-radius: 999px;
  padding: 2px 10px;
}
.fly-state-in { background: #10b98133; color: #34d399; }
.fly-state-out { background: #ffffff14; color: #b7bcc7; }
.inline-cue-remove {
  background: transparent; border: none; color: #8b8f99; cursor: pointer;
  font-size: 11px; padding: 2px 4px; border-radius: 4px;
  align-self: center;
  display: none;
}
.inline-cue-remove:hover { color: var(--danger); }
.inline-cue-move-out {
  background: transparent; border: none; color: #8b8f99; cursor: pointer;
  font-size: 13px; padding: 2px 4px; border-radius: 4px;
  align-self: center;
  display: none;
}
.inline-cue-move-out:hover { color: var(--accent); }
.inline-cue-move-out.armed { color: var(--accent); }
.cue-margin-cell.show-cue-actions .inline-cue-move-out,
.cue-margin-cell.show-cue-actions .inline-cue-remove {
  display: inline-block;
}
.cue-margin-cell.show-cue-actions .inline-cue-move-out[hidden],
.cue-margin-cell.show-cue-actions .inline-cue-remove[hidden] {
  display: none;
}
/* Spans every cue row on this line (grid-row set inline per cue count) so
   it reads as one tall marker for the whole group, right after the numbers. */
.cue-margin-go {
  border: none; cursor: pointer;
  background: #10b981; color: #04170f; font-size: 10px; font-weight: 800;
  letter-spacing: 0.04em; border-radius: 0; padding: 3px 8px;
  writing-mode: horizontal-tb;
}
.cue-margin-go:hover { filter: brightness(1.08); }
.cue-margin-go.standby { background: #f59e0b; color: #2b1400; }
.inline-cue-add {
  display: none;
  border: 1px solid #ffffff4d; background: #ffffff1f; color: var(--text);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  align-self: flex-start; white-space: nowrap;
  position: absolute;
}
.inline-cue-add:hover { border-color: var(--accent); color: var(--accent); background: #8b5cf633; }

.cue-move-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  position: sticky; top: 0; z-index: 5;
  width: 8.27in; max-width: 100%; margin: 0 auto 16px;
  background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 16px #00000044;
}
/* A class-selector display rule outranks the UA [hidden] rule at equal
   specificity by coming later in the cascade, so the `hidden` attribute the
   JS toggles would otherwise be silently ignored and the banner would show
   permanently — this reasserts it. */
.cue-move-banner[hidden] { display: none; }
.cue-move-banner button {
  background: #ffffff40; border: 1px solid #ffffff80; color: var(--on-accent);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.cue-move-banner button:hover { background: #ffffff66; }

/* Multi-select (the ☑ button): its own bar, sticky like the move banner, with
   the count and the two ways out. Tall tap targets — it's for touch screens. */
.multiselect-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;
  width: 8.27in; max-width: 100%; margin: 0 auto 12px; padding: 6px 10px;
  background: #fbbf24; color: #1a1a1a; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.multiselect-bar[hidden] { display: none; }
.multiselect-bar button {
  background: #ffffffa0; border: 1px solid #00000040; color: #1a1a1a;
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.multiselect-bar button:disabled { opacity: 0.45; cursor: default; }
/* While selecting, a tap on a line ticks it rather than editing it. */
body.multiselect-on .line-row { cursor: pointer; }
/* The active line's "+ Cue" strip would push the lines below it around between taps. */
body.multiselect-on .cue-margin-cell .cue-add-row { display: none; }
body.multiselect-on .cue-margin-cell:has(> .cue-add-row:only-child) { display: none; }

/* Top menu bar — on a normal-width screen a row of icon buttons for the
   views (built by buildViewNav() in app.js), then Export (an icon that opens
   its dropdown), Edit and the tools; Settings and Help sit at the right end of
   the title row above (.title-row-tools), beside the security-group label.
   Below 720px (keep in step with COMPACT_MENU_QUERY in app.js) it goes back to
   the classic text menus: View ▾ / Export ▾ / Edit ▾ / Help ▾ in this bar, with
   Settings inside View. Each menu button reveals a dropdown panel; see
   setupTopMenus() in app.js. Also carries the
   sidebar/details-pane toggle at each edge (see #btn-toggle-sidebar/
   #btn-toggle-details in app.js) — left one directly above the sidebar it
   controls, right one pushed to the far edge via margin-left:auto (put on
   the undo button so undo/redo ride along with it, staying next to it)
   directly above the details pane it controls. */
.menu-bar {
  display: flex; align-items: center; gap: 2px; padding: 4px 12px;
  border-top: 1px solid var(--border);
}
#btn-undo { margin-left: auto; }
.role-chip {
  margin: 0 8px; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  background: #a78bfa2e; color: var(--accent-text); border: 1px solid var(--accent);
}
.role-chip[hidden] { display: none; }

/* Right end of the title row: warning chip, security-group chip, Settings, Help.
   align-self keeps it centred without disturbing the logo, which relies on
   stretching to the row's height. */
.title-row-tools { margin-left: auto; align-self: center; display: flex; align-items: center; gap: 2px; min-width: 0; }
.title-row-tools .role-chip { margin: 0 8px 0 0; }
.menu-bar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex: 0 0 auto; }
.view-icons { display: flex; align-items: center; gap: 2px; }
/* Line icons (currentColor, so hover/active/dark all follow the text colour) */
.menu-btn svg {
  width: 18px; height: 18px; display: block; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.view-icon-btn, .menu-btn-dual { position: relative; padding: 7px 8px; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
.mb-icon { display: flex; }
.mb-label, .nav-label { display: none; line-height: 1.2; font-size: 13px; white-space: nowrap; }
/* Descriptors beside the icons — .nav-labels is put on .editor by fitNavLabels()
   (app.js) whenever the first toolbar has room for them. */
.editor.nav-labels .mb-label, .editor.nav-labels .nav-label { display: inline; }
.editor.nav-labels .menu-btn-dual .help-badge, .editor.nav-labels .menu-btn-dual .msg-badge { position: static; margin-left: 2px; }
/* Each icon has its own colour (--nav-color) with a matching tint (--nav-tint)
   for hover and for the current view. */
.editor .view-icon-btn, #btn-menu-export, #btn-menu-help, #btn-messages { color: var(--nav-color, var(--text)); }
.editor .view-icon-btn:hover, #btn-menu-export:hover, #btn-menu-help:hover, #btn-messages:hover { background: var(--nav-tint, var(--bg-panel-2)); }
.editor .view-icon-btn.active { background: var(--nav-tint); color: var(--nav-color); box-shadow: inset 0 -2px 0 var(--nav-color); }
[data-main-view="script"]       { --nav-color: #60a5fa; --nav-tint: #60a5fa30; }
[data-main-view="musicTracker"] { --nav-color: #f472b6; --nav-tint: #f472b630; }
[data-main-view="cueSummary"]   { --nav-color: #fbbf24; --nav-tint: #fbbf2430; }
[data-main-view="set"]          { --nav-color: #2dd4bf; --nav-tint: #2dd4bf30; }
[data-main-view="flys"]         { --nav-color: #e879f9; --nav-tint: #e879f930; }
[data-main-view="props"]        { --nav-color: #fb923c; --nav-tint: #fb923c30; }
[data-main-view="costumes"]     { --nav-color: #f87171; --nav-tint: #f8717130; }
[data-main-view="wigs"]         { --nav-color: #a3e635; --nav-tint: #a3e63530; }
[data-main-view="audio"]        { --nav-color: #22d3ee; --nav-tint: #22d3ee30; } /* its own colour: cyan, beside the lime of Wigs, Hair & Makeup */
[data-main-view="casting"]      { --nav-color: #c4b5fd; --nav-tint: #c4b5fd30; }
[data-main-view="rehearsal"]    { --nav-color: #fb923c; --nav-tint: #fb923c30; } /* orange: stands out from the blue/teal Edit icons beside it */
[data-main-view="settings"]     { --nav-color: #cbd5e1; --nav-tint: #cbd5e130; }
#btn-menu-export { --nav-color: #22d3ee; --nav-tint: #22d3ee30; }
#btn-menu-help   { --nav-color: #7dd3fc; --nav-tint: #7dd3fc30; }
#btn-messages    { --nav-color: #fcd34d; --nav-tint: #fcd34d30; }
/* The narrow-screen text menus keep the plain text colour. */
@media (max-width: 720px) {
  #btn-menu-export, #btn-menu-help, #btn-messages { color: var(--text); }
  #btn-menu-export:hover, #btn-menu-help:hover, #btn-messages:hover { background: var(--bg-panel-2); }
}
.menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.menu-btn[hidden], .menu-item[hidden], .settings-nav-item[hidden] { display: none !important; }
/* The View dropdown is only for the narrow layout. */
#menu-view { display: none; }
/* Red badge / dot on an icon's corner (icon layout) — inline again in the menus */
.menu-btn-dual .help-badge, .menu-btn-dual .msg-badge { position: absolute; top: -1px; right: -2px; margin: 0; line-height: 15px; min-width: 15px; padding: 0 4px; font-size: 10px; }
.menu-alert-dot {
  position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--bg-panel);
}
.menu-alert-dot[hidden] { display: none; }
@media (max-width: 720px) {
  .view-icons, .menu-bar-sep, .title-row-tools .view-icon-btn { display: none; }
  #menu-view { display: block; }
  .menu-btn-dual { padding: 6px 10px; line-height: normal; }
  .menu-btn-dual .mb-icon { display: none; }
  .menu-btn-dual .mb-label { display: inline; }
  .menu-btn-dual .help-badge, .menu-btn-dual .msg-badge { position: static; margin-left: 6px; line-height: 16px; min-width: 16px; padding: 0 5px; font-size: 11px; }
  .menu-alert-dot { position: static; display: inline-block; margin-left: 6px; box-shadow: none; }
  .menu-alert-dot[hidden] { display: none; }
  /* Messages and Help stay icons on a narrow screen (the red count sits on the icon's corner); Export keeps its text. */
  #btn-messages, #btn-menu-help { padding: 7px 8px; line-height: 1.2; }
  #btn-messages .mb-icon, #btn-menu-help .mb-icon { display: flex; }
  #btn-messages .mb-label, #btn-menu-help .mb-label { display: none; }
  #btn-messages .msg-badge, #btn-menu-help .help-badge { position: absolute; top: -1px; right: -2px; margin: 0; line-height: 15px; min-width: 15px; padding: 0 4px; font-size: 10px; }
}
/* Help menu, fault / feature forms, developer reports */
.menu-panel.menu-panel-right { left: auto; right: 0; }
.help-badge, .msg-badge {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 16px; text-align: center;
}
.help-badge[hidden], .msg-badge[hidden] { display: none; }

/* Messages (openMessagesModal): notes you were tagged in, and updates on your reports. */
.messages-box { min-width: min(560px, 94vw); }
.messages-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.messages-controls .fb-check { margin: 0; }
.messages-controls select { width: auto; flex: 1 1 130px; min-width: 0; }
.messages-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; margin-bottom: 12px; }
.message-card { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--bg-panel-2); }
.message-card.read { opacity: 0.7; }
.message-card.unread { border-color: var(--accent); }
.message-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.message-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.message-card.read .message-dot { background: transparent; border: 1px solid var(--text-dim); box-sizing: border-box; }
.message-title { flex: 1 1 auto; min-width: 0; font-size: 13px; }
.message-card.unread .message-title { font-weight: 600; }
.message-date { flex: 0 0 auto; font-size: 11px; color: var(--text-dim); }
.message-detail { margin: 4px 0 0 16px; font-size: 12px; color: var(--text-dim); }
.message-quote { margin: 4px 0 0 16px; padding-left: 8px; border-left: 2px solid var(--border); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-actions { display: flex; gap: 6px; margin: 8px 0 0 16px; }
.message-badge-tag { background: #fcd34d33; color: #fcd34d; }
/* A production note's "Make into comment" button (see renderNoteItem). */
.note-item { position: relative; }
.note-to-comment { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.note-to-comment .btn-trash-icon svg { width: 14px; height: 14px; }

/* ---- Comments: conversations on a line, scene, act, cue or track task (see "Comments" in app.js) ---- */
.comment-btn {
  display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; cursor: pointer;
  font-size: 11px; font-weight: 700; line-height: 1.2; border: 1px solid transparent; border-radius: 10px;
  background: transparent; padding: 1px 6px; font-family: inherit;
}
.comment-btn[hidden] { display: none !important; }
.comment-btn .btn-trash-icon svg { width: 13px; height: 13px; stroke-width: 2; }
.comment-btn .comment-count:empty { display: none; }
/* The count on the script: blue while something is open, grey once everything is resolved. */
.comment-btn-badge { background: #2563eb; color: #fff; }
.comment-btn-badge:not(.has-open) { background: #6b7280; }
.comment-btn-badge:hover { filter: brightness(1.12); }
/* In a line / scene / act toolbar (white, floating over the page). */
.line-actions .comment-btn-tool, .scene-actions .comment-btn-tool, .act-actions .comment-btn-tool {
  background: #2563eb1f; color: #1d4ed8; border-color: #2563eb66; border-radius: 4px; gap: 4px;
}
.line-actions .comment-btn-tool:hover, .scene-actions .comment-btn-tool:hover, .act-actions .comment-btn-tool:hover { background: #2563eb40; color: #1e40af; }
.line-actions .comment-btn-tool.has-open, .scene-actions .comment-btn-tool.has-open, .act-actions .comment-btn-tool.has-open { background: #2563eb; color: #fff; }
.line-actions .comment-btn-tool .btn-trash-icon svg, .scene-actions .comment-btn-tool .btn-trash-icon svg, .act-actions .comment-btn-tool .btn-trash-icon svg { width: 16px; height: 16px; }
/* While a line, scene or act is selected its toolbar is showing, and the toolbar's own comment button carries the count: the badge steps aside. */
.line-row.show-actions .comment-btn-badge, .scene-title-row.show-actions .scene-title-badges, .act-heading-row.show-actions > .comment-btn-badge { display: none; }
/* A scene or act count sits at the right-hand end of its title row (a scene's note count beside it). */
.scene-title-badges { position: absolute; right: 6px; top: 4px; z-index: 1; display: flex; align-items: center; gap: 4px; }
.scene-title-row.has-note-badge { padding-right: 96px; }
.act-heading-row > .comment-btn-badge { position: absolute; right: 1in; top: 18px; z-index: 1; }
/* Beside a cue or a track task in the margin: a seventh column, the empty bubble only while the line is being worked
   on (like the other cue buttons), the count whenever there is a conversation. */
.cue-margin-grid.with-comments { grid-template-columns: auto auto auto 1fr auto auto auto; }
.comment-btn-cue { display: none; color: #8b8f99; padding: 2px 4px; align-self: center; border-radius: 4px; }
.comment-btn-cue:hover { color: var(--accent); }
.cue-margin-cell.show-cue-actions .comment-btn-cue, .comment-btn-cue.has-threads { display: inline-flex; }
.comment-btn-cue[hidden] { display: none !important; }
.comment-btn-cue.has-open { color: #60a5fa; }
.comment-btn-cue.has-threads:not(.has-open) { color: #6b7280; }

/* The box that floats over the script with the conversation in it: semi-transparent, each person's words in their own colour. */
.comment-float {
  position: fixed; z-index: 900; width: min(400px, calc(100vw - 16px)); max-height: 70vh; display: flex; flex-direction: column;
  background: rgba(22, 24, 30, 0.80); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 10px; box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5);
  color: var(--text); font-size: 13px; overflow: hidden;
}
.cf-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: move; touch-action: none; background: rgba(255, 255, 255, 0.06); border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.cf-head .btn-trash-icon svg { width: 18px; height: 18px; color: #60a5fa; }
.cf-title-box { flex: 1 1 auto; min-width: 0; }
.cf-title { font-weight: 700; font-size: 13px; }
.cf-where { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-close { flex: 0 0 auto; background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.cf-close:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.cf-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 10px; }
.cf-note { font-size: 12px; color: var(--text-dim); padding: 2px 0; }
.cf-error { color: #fca5a5; }
.cf-meta { font-size: 11px; color: rgba(255, 255, 255, 0.62); }
.cf-mini { background: transparent; border: none; color: rgba(255, 255, 255, 0.7); cursor: pointer; padding: 1px 5px; border-radius: 4px; font-size: 12px; line-height: 1.2; }
.cf-mini:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.cf-del { margin-left: auto; }
.cf-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* One conversation. */
.cf-thread { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.cf-thread.resolved .cf-issue { opacity: 0.78; }
.cf-issue { border-left: 4px solid; border-radius: 6px; padding: 6px 9px; color: #fff; cursor: pointer; }
.cf-issue-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-issue-label { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(0, 0, 0, 0.35); border-radius: 3px; padding: 1px 5px; }
.cf-status { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.cf-status.open { background: #fbbf24; color: #3b2a00; }
.cf-status.done { background: #34d399; color: #04170f; }
.cf-issue-head .cf-meta { flex: 1 1 auto; }
.cf-issue-text, .cf-post-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; line-height: 1.35; }
.cf-folded { font-size: 11px; color: var(--text-dim); padding-left: 4px; }
.cf-people-row { display: flex; align-items: baseline; gap: 6px; }
.cf-people-label { font-size: 11px; color: var(--text-dim); flex: 0 0 auto; }
.cf-people, .cf-tagrow { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cf-chip { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.08); color: #fff; }
.cf-chip-x { cursor: pointer; }
.cf-chip-x:hover { background: rgba(255, 255, 255, 0.22); }
.cf-task { border-left: 3px solid; background: rgba(255, 255, 255, 0.07); border-radius: 6px; padding: 5px 9px; display: flex; flex-direction: column; gap: 4px; }
.cf-task.done { opacity: 0.8; }
.cf-posts { display: flex; flex-direction: column; gap: 5px; }
.cf-post { border-left: 3px solid; border-radius: 6px; padding: 5px 9px; color: #fff; }
.cf-post.mine { margin-left: 18px; }
.cf-post-head { font-size: 12px; }
.cf-resolved-note { font-size: 11px; color: #6ee7b7; }
.cf-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-thread > .cf-actions { padding-bottom: 2px; }
.cf-taskform { display: flex; flex-direction: column; gap: 5px; background: rgba(255, 255, 255, 0.07); border-radius: 6px; padding: 6px 8px; }
/* Writing: a new comment or a reply. */
.cf-composer { display: flex; flex-direction: column; gap: 6px; }
.cf-text { width: 100%; resize: vertical; background: rgba(0, 0, 0, 0.35); color: #fff; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 13px; }
.cf-text:focus { outline: none; border-color: #60a5fa; }
.cf-extras { display: flex; flex-direction: column; gap: 5px; }
.cf-picker { background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.cf-picker .modal-input { margin: 0; }
.cf-picker-list { max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; }
.cf-pick { display: flex; align-items: center; gap: 5px; padding: 3px 4px; border-radius: 4px; cursor: pointer; font-size: 12.5px; }
.cf-pick:hover { background: rgba(255, 255, 255, 0.12); }
.cf-pick-email { margin-left: auto; font-size: 10.5px; color: var(--text-dim); }
.cf-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.cf-taskrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-taskrow .tracker-select { width: auto; max-width: 150px; margin: 0; }
.cf-taskrow .modal-input { flex: 1 1 140px; min-width: 0; margin: 0; }
.cf-send .cf-meta { margin-left: auto; }
.cf-new { border-top: 1px solid rgba(255, 255, 255, 0.18); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.cf-new-title { font-size: 12px; font-weight: 700; }
.cf-new-btn { align-self: flex-end; }
.cf-emoji-btn { padding: 1px 7px; font-size: 14px; line-height: 1.3; }
.cf-emoji-panel { display: flex; flex-wrap: wrap; gap: 1px; margin-top: 4px; padding: 4px; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; }
.cf-emoji { background: transparent; border: none; cursor: pointer; font-size: 19px; line-height: 1.2; padding: 2px 4px; border-radius: 4px; }
.cf-emoji:hover { background: rgba(255, 255, 255, 0.18); }
.cf-tag-btn { margin-left: 2px; }
@media (max-width: 720px) {
  /* A phone gets it as a sheet along the bottom of the screen. */
  .comment-float { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-height: 75vh; }
  .cf-head { cursor: default; }
}
.fb-box { max-height: 92vh; overflow-y: auto; }
.fb-field { margin-bottom: 12px; flex: 1; min-width: 0; }
.fb-field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.fb-field .modal-input, .fb-field .tracker-select { margin-bottom: 0; width: 100%; }
.fb-hint { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.fb-row { display: flex; gap: 12px; flex-wrap: wrap; }
.fb-text {
  width: 100%; box-sizing: border-box; resize: vertical; background: var(--bg-panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text); font: inherit; font-size: 13px; line-height: 1.45;
}
.fb-text:focus { outline: none; border-color: var(--accent); }
.fb-check { display: block; font-size: 13px; margin: 0 0 8px; }
.fb-msg { min-height: 18px; margin-bottom: 12px; }
.fb-error { color: var(--danger); font-size: 13px; padding: 8px 10px; border: 1px solid var(--danger); border-radius: 8px; margin-bottom: 8px; }
/* .modal-box is declared further down with the same specificity, so this needs the extra class to win its width */
.modal-box.fb-reports-box { width: 860px; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; }
.fb-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.fb-filters .fb-search { margin-bottom: 0; flex: 1; min-width: 140px; width: auto; }
.fb-list { overflow-y: auto; min-height: 120px; flex: 1; margin-bottom: 14px; }
.fb-empty { color: var(--text-dim); padding: 24px 0; text-align: center; }
.fb-card { border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; margin-bottom: 8px; background: var(--bg-panel-2); }
.fb-card-fault { border-left-color: var(--danger); }
.fb-card-feature { border-left-color: #60a5fa; }
.fb-card-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 2px; cursor: pointer; flex-wrap: wrap; }
.fb-card-title { flex: 1; min-width: 160px; font-weight: 600; }
.fb-card-date { font-size: 12px; color: var(--text-dim); }

.fb-card-meta { font-size: 12px; color: var(--text-dim); padding: 0 12px 8px; word-break: break-word; }
.fb-badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg-panel); border: 1px solid var(--border); white-space: nowrap; }
.fb-badge-fault { color: #fca5a5; border-color: var(--danger); }
.fb-badge-feature { color: #93c5fd; border-color: #60a5fa; }
.fb-status-new { color: #fbbf24; border-color: #fbbf24; }
.fb-status-inprogress { color: #a78bfa; border-color: #a78bfa; }
.fb-status-done { color: #34d399; border-color: #34d399; }
.fb-status-wontdo { color: var(--text-dim); }
.fb-card-body { border-top: 1px solid var(--border); padding: 10px 12px 4px; }
.fb-section { margin-bottom: 10px; }
.fb-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 2px; }
.fb-section-text { font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; margin: 0; font-family: inherit; }
pre.fb-section-text { font-family: Consolas, "Courier New", monospace; font-size: 11px; }
.fb-manage { align-items: flex-end; }
.fb-manage-buttons { display: flex; gap: 8px; margin-bottom: 12px; }

/* Google Drive backup status chip (menu bar) and its dialog */
.offline-chip { background: #f59e0b26; color: #fbbf24; border-color: #f59e0b; font-weight: 600; cursor: help; }
.offline-chip[hidden] { display: none; }
/* "Offline" pill beside the show's name (shared shows, while the connection is down —
   the show is then read-only; see "online / offline" in app.js). */
.offline-pill {
  flex: 0 0 auto; align-self: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #f59e0b26; color: #fbbf24; border: 1px solid #f59e0b; cursor: help; white-space: nowrap;
}
.offline-pill[hidden] { display: none; }
/* The stage dialog: one choice per stage */
.stage-choices { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.stage-choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.stage-choice.current { border-color: var(--accent); }
.stage-choice input { margin-top: 3px; }
.stage-choice-body { display: flex; flex-direction: column; gap: 2px; }
.stage-choice-info { color: var(--text-dim); font-size: 12.5px; }
/* Settings > Security Groups > Stage access, and Settings > Notifications */
.stage-access-table { width: 100%; }
.stage-access-table th, .stage-access-table td { text-align: center; padding: 4px 8px; }
.stage-access-table th:first-child, .stage-access-table td:first-child { text-align: left; }
.stage-access-table .stage-access-cat th { text-align: left; background: var(--bg-panel-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }
.stage-access-table .btn.small { padding: 1px 7px; font-size: 11px; margin: 0 1px; }
.stage-access-colbtns td { padding-top: 2px; padding-bottom: 6px; }
.stage-access-bulk { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
/* Settings > Security Groups: the one table of permissions; each category folds up inside it */
.permission-section-count { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.stage-access-table .perm-cat:not(.open) > tr:not(.stage-access-cat) { display: none; }
.stage-access-table .stage-access-cat { cursor: pointer; user-select: none; }
.stage-access-table .stage-access-cat th { color: var(--text); }
.perm-cat-chevron { display: inline-block; width: 1.1em; color: var(--text-dim); }
.perm-cat-chevron::before { content: "▸"; display: inline-block; transition: transform .12s; }
.perm-cat.open .perm-cat-chevron::before { transform: rotate(90deg); }
.stage-access-table td.perm-label { min-width: 220px; cursor: help; padding-left: 30px; }
.stage-access-table td.perm-label:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stage-access-table tr.perm-row-included td.perm-label strong { color: var(--text-dim); font-weight: 600; }
.stage-access-table input:disabled { opacity: 0.45; }
/* The bubble that explains a permission (rest the mouse on its name, or tap / click it) */
.perm-tip { position: fixed; z-index: 2000; max-width: 320px; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-panel-2); color: var(--text); font-size: 12.5px; line-height: 1.4; box-shadow: 0 6px 20px #0009; pointer-events: none; }
.stage-access-table th { white-space: nowrap; }
.stage-access-table .stage-access-cat th { white-space: normal; }
/* Settings > Users: the security groups a person is in (drop-down checklist) */
.groups-picker { min-width: 150px; }
.groups-picker-summary { cursor: pointer; list-style: none; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-panel-2); }
.groups-picker-summary::-webkit-details-marker { display: none; }
/* (In the flow of the row, not floating: the table sits in a scrolling wrapper that would clip a floating list.) */
.groups-picker-panel { min-width: 200px; max-width: 320px; padding: 8px 10px; margin-top: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-panel); display: flex; flex-direction: column; gap: 4px; }
.notify-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.notify-card h3 { margin: 0 0 4px; font-size: 15px; }
.notify-about { color: var(--text-dim); font-size: 12.5px; margin-bottom: 8px; }
.notify-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0; }
.notify-row-label { font-weight: 600; font-size: 12.5px; min-width: 130px; }
.notify-row .tracker-select { width: auto; min-width: 280px; max-width: 100%; }
/* Notifications: what is selected as a vertical list, with a pencil that opens the choices */
.notify-picks { display: flex; flex-wrap: wrap; gap: 8px 36px; margin-top: 8px; }
.notify-pick { min-width: 170px; }
.notify-pick-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.notify-pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.notify-pick > .meta { font-size: 13px; color: var(--text-dim); }
.notify-pick-list li::before { content: "•"; color: var(--text-dim); margin-right: 7px; }
.btn-pencil-icon svg { stroke: var(--text-dim); }
button:hover > .btn-pencil-icon svg { stroke: var(--text); }
.notify-choice-box { min-width: min(360px, 92vw); }
.notify-choice-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; margin: 4px 0 12px; padding-right: 4px; }
/* While offline-locked, the buttons the lock blocks (see OFFLINE_BLOCKED_CLICKS in app.js) look it. */
body.offline-locked .add-item-btn,
body.offline-locked .item-remove,
body.offline-locked #btn-toggle-draw { opacity: 0.4; cursor: not-allowed; }
/* Status line at the top of Export > Google Drive Backup (was a chip in the menu bar) */
.backup-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.role-chip.backup-pill { margin: 0; }
.backup-pill-bad { background: #ef444426; color: var(--danger); border-color: var(--danger); }
.backup-pill-running { background: #f59e0b26; color: #fbbf24; border-color: #f59e0b; }
.backup-pill-off { background: var(--bg-panel-2); color: var(--text-dim); border-color: var(--border); }
.cuetype-off td:not(:first-child) { opacity: 0.5; }
.backup-times-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 4px; }
.backup-times { border-collapse: collapse; margin-bottom: 8px; max-width: 100%; }
.backup-times th { text-align: left; font-weight: 400; color: var(--text-dim); padding: 3px 16px 3px 0; vertical-align: top; }
.backup-times td { padding: 3px 0; }
.backup-box { max-height: 90vh; overflow-y: auto; }
.backup-note { font-size: 12px; line-height: 1.45; color: var(--text-dim); margin: 0 0 12px; }
.backup-status { font-size: 13px; margin-bottom: 10px; }
.backup-status a { margin-left: 6px; color: var(--accent-text); }
.backup-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.backup-msg { font-size: 12px; color: var(--text-dim); }
.backup-msg.backup-msg-bad { color: var(--danger); }
.backup-setup { border-top: 1px solid var(--border); padding-top: 12px; margin-bottom: 16px; }
.backup-setup summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.backup-step { font-size: 13px; line-height: 1.45; margin: 10px 0 6px; }
.backup-code {
  width: 100%; height: 130px; resize: vertical; box-sizing: border-box; margin-bottom: 8px;
  background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; color: var(--text); font-family: Consolas, "Courier New", monospace; font-size: 11px;
}
.backup-inline { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.panel-toggle-btn.panel-collapsed-active { color: var(--accent); }
.menu { position: relative; }
.menu-btn {
  background: transparent; border: none; color: var(--text);
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.menu-btn:hover { background: var(--bg-panel-2); }
.menu-btn:disabled { opacity: 0.35; cursor: default; }
.menu-btn.icon-only { padding: 6px 10px; font-size: 16px; line-height: 1; }
#btn-toggle-draw.draw-toggle-active { background: #8b5cf61a; color: var(--accent); }

.menu-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; min-width: 220px; box-shadow: 0 8px 24px #00000055;
  display: flex; flex-direction: column;
}
.menu-panel[hidden] { display: none; }
.menu-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: transparent; border: none; color: var(--text);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
  text-align: left; width: 100%;
}
.menu-item:hover { background: var(--bg-panel-2); }
.menu-item[hidden] { display: none; }
.menu-item:disabled { opacity: 0.35; cursor: default; }
.menu-item.active { background: var(--bg-panel-2); font-weight: 600; }
.menu-item.active::after { content: "✓"; color: var(--accent); }
.menu-item kbd {
  font-family: inherit; font-size: 10px; background: #00000033; border-radius: 3px;
  padding: 1px 4px; color: var(--text-dim);
}
.menu-separator { height: 1px; background: var(--border); margin: 4px 2px; }
.menu-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim); padding: 4px 10px 2px;
}
#menu-panel-view { padding: 10px; width: 210px; }
/* View menu items: the view's icon (in its own colour) beside its name */
.menu-item-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-item-nav { color: var(--text); }
.menu-item-nav svg {
  width: 18px; height: 18px; flex: 0 0 auto; display: block; fill: none; stroke: var(--nav-color, currentColor);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Right-click "convert selected text" menu — see handleTextConversionContextMenu */
.text-context-menu {
  position: fixed; z-index: 200;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; min-width: 230px; box-shadow: 0 8px 24px #00000055;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 8px); overflow-y: auto;
}
.text-context-checkbox {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  font-size: 12px; color: var(--text-dim); cursor: pointer;
}
.text-context-checkbox input { margin: 0; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: #00000099;
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; width: 340px; max-width: 90vw; box-shadow: 0 12px 40px #00000066;
}
.modal-message { margin-bottom: 12px; line-height: 1.4; }
.modal-input {
  width: 100%; background: var(--bg-panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text); margin-bottom: 16px;
}
.modal-input:focus { outline: none; border-color: var(--accent); }
.modal-box-lg { width: 640px; }
.modal-textarea {
  width: 100%; height: 50vh; min-height: 240px; resize: vertical;
  background: var(--bg-panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; color: var(--text); margin-bottom: 16px;
  font-family: "Times New Roman", Times, serif; font-size: 14px; line-height: 1.5;
  box-sizing: border-box;
}
.modal-textarea:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: white; }
.btn.danger-solid:hover { background: #c93b3f; }

/* Responsive layout for tablet/phone screens */
@media (max-width: 860px) {
  /* Library top bar: the title and the account chip (name + Sign out) stay on the
     first row; the show buttons sit left and Help right on the second. The
     actions box dissolves (display: contents) so its children lay out in the
     topbar's own grid. */
  .topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 8px; }
  .topbar-actions { display: contents; }
  .topbar h1 { grid-column: 1; grid-row: 1; min-width: 0; }
  .topbar-actions > .account-chip { grid-column: 2; grid-row: 1; margin-left: 0; justify-self: end; }
  .topbar-actions > .topbar-actions-main { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .topbar-actions > .menu { grid-column: 2; grid-row: 2; justify-self: end; }
  /* One row, never wrapping: a wrapped row put the right-hand hamburger on a second line at the left. */
  .menu-bar { flex-wrap: nowrap; }
  .show-title-input { min-width: 140px; max-width: none; }

  .script-pane { padding: 16px; }
  /* Page/cue-margin widths and the cue-stacking switch itself are handled by
     the @container script-pane rule above (it already covers this width,
     accounting for the sidebar/details-pane too) — only the extra padding
     reduction is unique to this breakpoint. */
  #scene-header { padding: 20px 20px 10px; }
  .line-row, .scene-title-input, .scene-title-auto, .scene-empty { padding-left: 20px; padding-right: 20px; }
  /* The line's Add / Move / Delete buttons float above the selected line (the base .line-actions rule), exactly as on a
     wide screen. They used to sit inline beside the text here, which took about 100px off the line's width the moment
     it was tapped, so the text reflowed to half the screen. */
  .line-actions { top: -28px; right: 2px; margin-left: 0; transform: none; }
  /* No 1in margin to sit in at this width for a per-row absolute badge —
     but applyDialogueLineNumberPositions already falls back to the compact
     inline "N"/"N–M" prefix (.line-number-badge-compact) below full A4
     width, which doesn't need that margin, so only the absolute kind needs
     hiding here. */
  .line-number-badge { display: none; }

  .library-list { padding: 16px; }

  /* The chips (and Settings/Help while there's room) ride on the show-name line. */
  .show-title-row { align-items: center; }
  .show-title-row .show-title-input { flex: 1 1 auto; width: auto; min-width: 0; }
  .title-row-tools { flex: 0 0 auto; }
  .title-row-tools .role-chip { flex: 0 1 auto; margin: 0; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
  .title-row-tools .role-chip + .menu, .title-row-tools .role-chip + .view-icon-btn { margin-left: 8px; }

  /* The browser's own dropdown arrow on inputs with a <datalist> (the
     character-name fields) — always visible on touch, and just clutter. The
     autocomplete list still works without it. */
  input[list]::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; pointer-events: none; }
  /* Separate rule on purpose — one unrecognised pseudo in a selector list
     drops the whole rule (this one is the Safari/iOS spelling). */
  input[list]::-webkit-list-button { display: none !important; }

  /* While the on-screen keyboard is up, give the text being edited the room:
     the show-name row and role banner fold away (menu bar stays for undo/Edit). */
  body.kb-open .show-title-row,
  body.kb-open .role-banner { display: none; }

  /* Narrow screens: the side panels are not shown alongside the script. Each ☰
     button opens a column of icons (#mobile-rail — Home, then one per section
     of that panel; built by setupMobilePanels in app.js). Choosing a section
     makes it fill the screen (data-mp="left-open" / "right-open" on .editor,
     with .mp-open on the chosen section); Home goes back to the script.
     The rail overlays the edge of the main pane so the script is not re-laid
     out when it opens. */
  .editor .editor-body { position: relative; flex-direction: row; overflow: hidden; }
  .editor .sidebar, .editor .details-pane { display: none !important; }
  .editor .script-pane { flex: 1 1 100%; width: 100%; min-width: 0; max-height: none; margin: 0; overflow-y: auto; overflow-x: auto; overscroll-behavior-x: contain; }
  /* The script's page never scrolls sideways; a table view (Music Tracker,
     Casting, Cue Summary) scrolls within its own pane. */
  .editor.script-view .script-pane { overflow-x: hidden; }
  .editor[data-mp="left-open"] .sidebar,
  .editor[data-mp="right-open"] .details-pane:not([hidden]) {
    display: block !important; position: absolute; top: 0; bottom: 0; z-index: 30;
    width: 100%; max-height: none; border: none; overflow-y: auto; margin: 0;
    background: var(--bg-panel); padding: 16px;
  }
  .editor[data-mp="left-open"] .sidebar { left: 0; padding-left: 72px; }
  /* (with :not([hidden]) like the rule above, or that rule's padding: 16px wins and the content runs under the icon column) */
  .editor[data-mp="right-open"] .details-pane:not([hidden]) { right: 0; padding-right: 72px; }
  /* Only the chosen section is shown (the title of what is selected stays above it). */
  .editor[data-mp="left-open"] .sidebar .sidebar-section:not(.mp-open) { display: none; }
  .editor[data-mp="right-open"] .details-pane:has(> .details-section) > :not(.mp-open):not(.details-title) { display: none; }
  /* Each section shows in full — collapsing has no use here. */
  .editor .sidebar-collapse-btn { display: none; }
  .editor .sidebar-section.collapsed .sidebar-section-body,
  .editor .details-section.collapsed .details-section-body { display: block; }
  .editor .sidebar-section-header,
  .editor .details-section-header { cursor: default; }

  /* The icon column */
  .mobile-rail {
    position: absolute; top: 0; bottom: 0; z-index: 40; width: 56px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 0; overflow-y: auto; background: var(--bg-panel);
    box-shadow: 0 0 24px #00000066;
  }
  .mobile-rail[hidden] { display: none; }
  .mobile-rail.left { left: 0; border-right: 1px solid var(--border); }
  .mobile-rail.right { right: 0; border-left: 1px solid var(--border); }
  .mobile-rail-btn {
    flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: var(--text-dim); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .mobile-rail-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-rail-btn:hover { background: var(--bg-panel-2); color: var(--text); }
  .mobile-rail-btn.active { background: #a78bfa38; border-color: var(--accent); color: var(--accent-text); }
  .mobile-rail-home { color: var(--accent-text); margin-bottom: 6px; border-color: var(--border); }
  .panel-toggle-btn.mobile-panel-active { color: var(--accent-text); background: #a78bfa38; }
  /* Choosing a page (Settings, Casting, ...) from the column shows only icons there. */
}

/* iOS zooms the page in when a field under 16px gets focus, which would shove
   the field being edited half off-screen — keep the details-pane fields at 16px. */
@media (max-width: 860px) and (pointer: coarse) {
  .note-item textarea, .props-name-input,
  .scene-name-input, .act-title-input, .character-name-input { font-size: 16px; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3f4b; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* Music Tracker / Cue Summary — plain data tables shown in place of the
   script's scene blocks (see renderScriptPane's dispatch in app.js). The
   script view sizes .script-pane-inner to its printed-page content
   (width: fit-content, Times New Roman); these tables want the opposite —
   as much width as the pane actually has, in the normal UI font. */
.script-pane-inner.tracker-view {
  width: 100%;
  max-width: 1700px;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* #scene-header is normally the top inch of the white printed page (see its
   base rule above) — not appropriate for a plain "Music Tracker"/"Cue
   Summary" heading sitting directly on the app's own dark background, so
   both the box styling and the light-page text-color override are undone
   here. */
.script-pane-inner.tracker-view #scene-header {
  width: 100%; background: none; box-shadow: none; border-radius: 0; padding: 0 0 16px;
}
.script-pane-inner.tracker-view #scene-header h2 { color: var(--text); }
/* Music Tracker's own heading stays put while the table scrolls underneath
   it, same idea as the table's own sticky <th> row (.tracker-table th) —
   needs its own opaque background for the same reason that does (nothing
   sticky can just let the page show through), and the table's th row in
   turn needs to stick just BELOW it rather than at top:0, or the two would
   overlap — --mt-header-h is measured and kept current by
   renderMusicTrackerView after every render (its height depends on
   viewport width — see the compact/mobile rules below). */
/* left: 0 too, so scrolling the wide table sideways doesn't carry the heading off the page. */
.script-pane-music-tracker #scene-header {
  padding: 24px 24px 16px; position: sticky; top: 0; left: 0; z-index: 4; background: var(--bg);
  width: var(--mt-pane-w, 100%); box-sizing: border-box;
}
/* The inner box spans the whole table, so the sticky heading has room to stay put while it scrolls. */
.script-pane-music-tracker .script-pane-inner.tracker-view { width: max-content; min-width: 100%; max-width: none; }
/* Same specificity as the plain tracker-view heading rule above (which sets background: none and would
   otherwise win, leaving the sticky heading see-through so table rows showed through it). */
.script-pane-music-tracker .script-pane-inner.tracker-view #scene-header {
  width: var(--mt-pane-w, 100%); padding: 24px 24px 16px; position: sticky; top: 0; left: 0; z-index: 4;
  background: var(--bg); box-sizing: border-box;
}
/* Divided by the table zoom: the heading sits outside the zoomed table, so its (full-size) height
   has to be shrunk/grown the same way the table's own sticky offsets are (see .tracker-table below). */
.script-pane-music-tracker .music-tracker-table th { top: calc(var(--mt-header-h, 0px) / var(--table-zoom, 1)); }
/* On a phone (below the same breakpoint the rest of the mobile layout uses) the heading stays, but takes less room. */
@media (max-width: 860px) {
  .script-pane-music-tracker #scene-header,
  .script-pane-music-tracker .script-pane-inner.tracker-view #scene-header { padding: 8px 12px 6px; }
  .script-pane-music-tracker #scene-header h2 { margin-bottom: 0; }
}
.tracker-table-wrap { overflow-x: auto; }
/* Table zoom (the magnifier −/+ pair in the menu bar — setupViewSize in app.js). The whole
   table scales: text, padding, column widths, inputs. --table-zoom is set on <html>; the heading and
   toolbars above a table stay full size. Only inside the main pane, never a table in a dialog.
   Sticky offsets measured outside the table (the Music heading, the Casting toolbar) are divided by
   the zoom — see the .music-tracker-table th rule and castingLayoutSticky. */
.script-pane-inner.tracker-view .tracker-table { zoom: var(--table-zoom, 1); }
.tracker-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tracker-table th, .tracker-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
}
/* Music Tracker only (other .tracker-table users — Cue Summary, Casting,
   etc. — keep the plain auto layout above, sized to fit their own wrap).
   table-layout: fixed makes every column hold exactly its <colgroup> width
   (see renderMusicTrackerView) instead of shrinking to fit — so once they
   no longer all fit, the table grows past its wrap. */
.music-tracker-table { width: auto; table-layout: fixed; }
.music-tracker-table td { overflow: hidden; }
/* Set from JS (renderMusicTrackerView) below the same 860px breakpoint the
   rest of the app's mobile layout uses — smaller text needs less padding to
   still look balanced, and together with that render's own narrower default
   column widths, more of the table fits on a phone screen without forcing a
   manual resize first. */
.music-tracker-table-compact, .music-tracker-table-compact th, .music-tracker-table-compact td {
  font-size: 11px;
}
.music-tracker-table-compact th, .music-tracker-table-compact td { padding: 4px 5px; }
/* Scrolls within .script-pane itself instead of on its own — same fix, same
   reasoning, as .casting-table-wrap/.casting-table further down this file
   (read that comment for the full explanation): overflow: visible here
   defeats the overflow-x: auto this would otherwise inherit from
   .tracker-table-wrap, so the horizontal scrollbar ends up at the bottom of
   the actual window instead of right under a possibly-short table. Doing
   that puts .tracker-table's own overflow: hidden (there for its rounded
   corners) between the sticky <th>s and their now-relevant scrolling
   ancestor (.script-pane), which breaks position: sticky — undone here the
   same way .casting-table does, with the same rounded-corners trade-off,
   and border-collapse swapped for separate + zero spacing for the same
   sticky-breaking reason, keeping the same flush-border look collapse gave. */
.music-tracker-table-wrap { overflow: visible; }
.music-tracker-table { overflow: visible; border-collapse: separate; border-spacing: 0; }
/* No position:relative needed here — .tracker-table th is already
   position:sticky (higher specificity than this class alone would reach
   anyway), which is itself a valid containing block for the absolutely-
   positioned handle below. */
.tracker-th-resizable { padding-right: 14px; }
.tracker-col-resize-handle {
  position: absolute; top: 0; right: -4px; bottom: 0; width: 8px;
  cursor: col-resize; z-index: 3;
}
.tracker-col-resize-handle:hover, .tracker-col-resize-handle.resizing { background: var(--accent); opacity: 0.5; }
/* Set on <body> for the duration of a drag — keeps the resize cursor (and
   blocks text selection) even when the pointer strays off the thin handle
   mid-drag, the same reasoning any drag-to-resize UI needs this for. */
body.tracker-col-resizing { cursor: col-resize; user-select: none; }
.tracker-table th {
  background: var(--bg-panel-2);
  position: sticky; top: 0; z-index: 2;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim);
  white-space: nowrap;
}
.tracker-table tbody tr:nth-child(even) { background: #ffffff08; }
/* .page-table-wrap — a table that is part of the page (Fly Plot, Cues, Set, Characters, Props …): its header row stays at the
   top of the pane as it scrolls. It scrolls in .script-pane itself (so the page keeps its place when redrawn), which means
   nothing between them may scroll or clip, borders are drawn on the cells (collapsed ones don't travel with a stuck header),
   and the pane has no top padding (a stuck header sits at the padding edge, with rows showing above it). :where() keeps
   these no stronger than the base rules, so each table's own borders still win. */
.tracker-table-wrap.page-table-wrap { overflow: visible; }
:where(.page-table-wrap) .tracker-table { overflow: visible; border-collapse: separate; border-spacing: 0; border: 0; border-radius: 0; }
:where(.page-table-wrap) .tracker-table th, :where(.page-table-wrap) .tracker-table td { border-width: 0 1px 1px 0; }
:where(.page-table-wrap) .tracker-table tr > :where(:first-child) { border-left-width: 1px; }
:where(.page-table-wrap) .tracker-table thead th { border-top-width: 1px; }
.script-pane:not(.script-pane-casting):has(.page-table-wrap) { padding-top: 0; }
.script-pane:not(.script-pane-casting):has(.page-table-wrap) .script-pane-inner { padding-top: 24px; }
@media (max-width: 860px) {
  .script-pane:not(.script-pane-casting):has(.page-table-wrap) .script-pane-inner { padding-top: 16px; }
}
/* The frozen Music Tracker column (Music # / Song Name — see
   TRACKER_FROZEN_COLUMN_KEYS/applyTrackerFrozenColumnOffsets) — sticky on
   the left the same way the header row is sticky on top, `left` set from JS
   per-column since it depends on every frozen column's own current
   (resizable) width. A sticky cell needs its own OPAQUE background to
   actually hide whatever scrolls behind it — the row striping below can't
   just show through like it does for an ordinary, non-sticky cell — so
   every state that changes a row's background (even/odd, selected) needs
   its own matching override here too, or a frozen cell would go stale-
   colored against its own row the moment you scroll it sideways. z-index 1
   keeps these above ordinary body cells (for the corner where a frozen
   column's row scrolls under a still-sticky-on-top header); the header
   cells' own z-index (2, sticky on top already) is bumped to 3 for the ones
   that are ALSO frozen, so those top-left corner cells beat every other
   sticky piece regardless of scroll direction — same scheme
   .casting-table's own sticky corner cells use. */
.music-tracker-table td.tracker-frozen-col {
  position: sticky; z-index: 1; background: var(--bg-panel);
}
.music-tracker-table tbody tr:nth-child(even) td.tracker-frozen-col { background: #262a33; }
.music-tracker-table tbody tr.selected td.tracker-frozen-col { background: #33294f; }
.music-tracker-table th.tracker-frozen-col { z-index: 3; }
/* Marks where the frozen section ends — a shadow (not a border, which
   table cells can't offset outward past their own edge under
   border-collapse: separate) cast over whatever's scrolled underneath. */
.tracker-frozen-col-last { box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.5); }
.tracker-select, .tracker-text-input, .tracker-notes-input, .casting-cell-select, .casting-cell-locked {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: 13px;
}
.tracker-notes-input { min-height: 40px; resize: vertical; }
/* Status colors (see trackerStatusColor) are set inline per-value, always
   bright enough for this one fixed dark text color to stay readable —
   same convention .inline-cue-type uses for cue-type colors. */
.tracker-select-colored { color: #10131a; font-weight: 600; }
.tracker-select-colored:disabled { opacity: 0.85; }
.tracker-checkbox-cell { text-align: center; }
.tracker-checkbox-cell input { width: 16px; height: 16px; }
/* Music # / Song Name, combined into one frozen column (see TRACKER_COLUMNS)
   — the number reads like a fixed label ahead of the editable name, same
   "N:" shape as the Cue Summary's own line numbers. */
.tracker-music-song-cell { display: flex; align-items: center; gap: 6px; }
.tracker-music-song-number { flex: 0 0 auto; color: var(--text-dim); font-weight: 700; }
/* Overrides .tracker-text-input's own width: 100% (of the <td>) — here it
   needs to fill just what's left after the number label, not the whole cell. */
.tracker-music-song-cell .tracker-text-input { flex: 1 1 auto; width: auto; min-width: 0; }
.tracker-people-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 140px; }
/* Song Brief (trackerSongBriefLinksControl): the 🔗 add/edit icon, then the
   actual links themselves underneath — .wham-item-links' own 30px left
   margin is for indenting under a Props character's name, meaningless here
   with no name to align under, so it's reset back to 0. */
.tracker-brief-cell { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.tracker-brief-cell .wham-item-links { margin-left: 0; }
.tracker-person-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 6px 2px 10px; font-size: 12px;
}
.tracker-chip-remove {
  background: transparent; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 11px; padding: 0 2px;
}
.tracker-chip-remove:hover { color: var(--danger); }
.cue-summary-line-cell { min-width: 220px; max-width: 380px; }
.cue-summary-line-text { font-size: 13px; }
.cue-summary-line-number { color: var(--text-dim); margin-right: 4px; }
.tracker-table tr.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.tracker-row-selectable { cursor: pointer; }
/* One song's fields, stacked vertically in the details pane (see
   renderTrackerDetailPane) — same controls as the table's cells, just laid
   out for a narrow 300px column instead of alongside 17 other columns. */
.detail-field { margin-bottom: 14px; }
.detail-field label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); margin-bottom: 4px;
}
.detail-field .tracker-people-cell, .detail-field .tracker-brief-cell { min-width: 0; }
.tracker-people-add { width: auto; }

/* Casting > Blocking and Tracks (see renderCastingBlockingTracksPage) — each
   track column's header is stacked across five rows (designator/Lead/cast
   count/Junior/description) instead of the usual single label row, built by
   one shared headerRow() helper in app.js. */
/* Sticky on both axes so it never moves at all, regardless of scroll
   direction — same .script-pane scrollport as the table below, with zero
   padding on it (.script-pane-casting) so there's no gap for it to visibly
   slide through before locking, the same reasoning as the sticky table
   pieces below. Needs its own opaque background + the highest z-index on the
   page, since table rows now scroll underneath it. Internal padding here is
   fine (unlike padding on .script-pane itself) — it doesn't affect sticky's
   own math, only the scroll container's padding does.
   Its width is set from JS (renderCastingBlockingTracksPage, kept in sync on
   resize via a ResizeObserver), not CSS — it has to equal .script-pane's own
   visible width exactly, not .casting-view's width (which is now the wide
   table's width, per above) and not its own content's width (which would
   leave it too narrow for justify-content: flex-end's right-alignment to
   land at the actual viewport edge). left: 0 is what keeps it from
   scrolling away as you scroll right — right: 0 would be backwards here,
   since the toolbar sits near the START of the scrollable content (like the
   row-label column), not the end. */
.casting-toolbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  position: sticky; top: 0; left: 0; z-index: 5;
  background: var(--bg-panel); padding: 16px; margin-bottom: 0; box-sizing: border-box;
}
/* Two things .tracker-table sets that silently break position: sticky on a
   descendant th/td: border-collapse: collapse, and (more subtly) its own
   overflow: hidden (there to clip content to the table's rounded corners) —
   an ancestor with any overflow other than visible between a sticky element
   and its actual scrolling container becomes ITS containing block instead.
   separate + zero spacing keeps the same visual grid (borders sit flush, no
   double lines); losing the table's own corner-rounding/clipping is the
   accepted trade-off for correct sticky behavior. */
/* width: max-content — the table is only as wide as its columns need (plain auto would still fill the pane, because
   of the 100%-wide controls in its cells), so with few tracks (Show Leads off, say) the label column is no wider than
   its longest item instead of taking up the spare room. */
.casting-table { table-layout: auto; width: max-content; border-collapse: separate; border-spacing: 0; overflow: visible; }
.casting-table th, .casting-table td { white-space: normal; }
/* Casting > Blocking and Tracks scrolls within .script-pane itself — the
   same bounded, flexbox-sized scroll container every other view already
   uses (see #app/.editor-body/.script-pane above), which is what keeps both
   scrollbars within the visible page at ANY window size, including a
   vertically short one, instead of a fixed vh guess that can still run off
   the bottom of a short window. .casting-table-wrap therefore must NOT
   scroll or clip on its own — overflow: visible defeats the overflow-x:
   auto it'd otherwise inherit from .tracker-table-wrap, which would
   otherwise open a second, unbounded-height scroll box nested inside
   .script-pane and reproduce the exact bug this avoids. */
.casting-table-wrap { overflow: visible; }
/* The leftmost column (row labels — Track/Lead/Cast Count/Type/Description
   in the header, each song's own name+rehearsal block in the body) stays put
   during horizontal scroll, the same way .tracker-table th already stays put
   during vertical scroll (position: sticky; top: 0) — both relative to
   .script-pane's own scroll, per the above. The header's row-label cells are
   sticky on BOTH axes at once (they're in <thead>, which is already sticky
   top), so they need the highest z-index of the three to stay above content
   scrolling underneath them from either direction.
   `left: 0` here relies on .script-pane-casting's zero left padding (see
   above) — `left: 0` sticks an element flush with the scroll container's
   PADDING edge, so any left padding there would (a) leave a gap between the
   pane's actual clip boundary and this column, where a scrolled-past,
   non-sticky column (Cast in Number) would peek back through instead of
   staying hidden behind it, and (b) make this column visibly slide that same
   distance before locking in place at the start of every scroll. */
.casting-table th.casting-sticky-col { left: 0; z-index: 3; }
.casting-table td.casting-sticky-col {
  position: sticky; left: 0; z-index: 1; background: var(--bg-panel);
}
/* Rehearsal Block — its own frozen column, right after the row-label one
   (see renderCastingBlockingTracksPage). --sticky-col-2-left is the row-label
   column's real rendered width, measured in JS (not a fixed value: that
   column is only min-width:160px, and a long song title can push it wider),
   so this stays flush against it instead of overlapping or leaving a gap. */
.casting-table th.casting-sticky-col-2 { left: var(--sticky-col-2-left, 160px); z-index: 3; }
.casting-table td.casting-sticky-col-2 {
  position: sticky; left: var(--sticky-col-2-left, 160px); z-index: 1; background: var(--bg-panel);
}
.casting-row-label {
  min-width: 160px; font-size: 12px; text-transform: none; letter-spacing: normal;
  color: var(--text); font-weight: 600;
}
/* Song name, rehearsal block and cast count all sit on one line — see
   renderCastingBlockingTracksPage. */
.casting-row-label-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.casting-row-label-text { flex: 0 0 auto; white-space: nowrap; }
/* A dialogue row (Show Dialogue Scenes) — told apart from the music items by its italic, dimmer name, with a small
   "pre-music M2" / "post-music M2" tag saying which music item it sits beside. */
.casting-dialogue-row .casting-row-label-text { font-style: italic; color: var(--text-dim); }
/* A row's name is a link to its place in the Summary (castingSummaryLink). */
.casting-row-link { cursor: pointer; }
.casting-row-link:hover, .casting-row-link:focus-visible { text-decoration: underline; outline: none; }
.casting-dialogue-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
  padding: 1px 5px; border-radius: 999px; background: var(--bg); color: var(--text-dim);
}
/* "Cast in Number" — its own column (see renderCastingBlockingTracksPage),
   the sum of every assigned track's own Cast Count for that song. */
.casting-cast-count-cell { text-align: center; font-weight: 700; color: var(--text); vertical-align: middle; }
.casting-track-designator { display: flex; align-items: center; gap: 6px; }
.casting-track-number {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px;
  background: var(--bg); font-weight: 700; font-size: 12px; color: var(--text);
}
/* A track's description: always black text in a white box (this input has no .tracker-text-input, so it would
   otherwise take whatever the browser's own default is). */
.casting-track-description-input {
  min-width: 140px; text-transform: none;
  background: #fff; color: #111; caret-color: #111; -webkit-text-fill-color: #111;
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: 13px; font-family: inherit;
}
.casting-track-description-input::placeholder { color: #8a8f99; -webkit-text-fill-color: #8a8f99; }
/* A track's Characters cell (the header's last row): the lead dropdown of a Lead track, and the characters the track
   plays — kept to three lines (the whole list is its tooltip) so the sticky header doesn't take over the screen. */
.casting-track-characters { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.casting-track-character-list {
  font-size: 11px; line-height: 1.3; font-weight: 400; text-transform: none; letter-spacing: normal; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.casting-track-character-none { color: var(--text-dim); }
.casting-lead-select { width: 100%; min-width: 0; }
.casting-header-checkbox {
  display: flex; align-items: center; gap: 4px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); cursor: pointer;
}
.casting-header-checkbox input { margin: 0; }
.casting-count-input { width: 56px; }
.casting-cell-select { width: 100%; min-width: 120px; }
/* A Lead track's own cell — not a control, just its locked-in result (see
   renderCastingCell/applyLeadAcrossTrack) — same font as the editable
   dropdown it replaces (see the shared rule above), just not interactive. */
.casting-cell-locked { min-width: 120px; cursor: default; }
/* Rehearsal block — a colored dot (see rehearsalBlockColor in app.js) plus
   its select, reused by both a Blocking and Tracks row and the Musical
   Numbers sidebar list (dot only there — see renderMusicList). */
.casting-rehearsal-wrap { display: flex; align-items: center; gap: 6px; }
.rehearsal-block-dot {
  flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
}
.rehearsal-block-dot-empty { background: transparent; }
/* A value shown in the look of a tracker drop-down, without being one (no arrow, not clickable). */
.tracker-readonly-block { display: block; box-sizing: border-box; cursor: default; opacity: 0.85; }
.casting-rehearsal-select { width: auto; min-width: 90px; text-transform: none; font-size: 12px; }
/* Casting > Blocking and Tracks' own page wrapper — unlike .settings-view
   below, this fills the available width instead of capping out at 900px, so
   the table has real room as more track columns get added (still
   horizontally scrollable past that via .tracker-table-wrap).
   width: max-content (not 100%) — sizes to fit its widest content (the
   table, which can be much wider than the viewport) instead of staying
   capped at the viewport width; min-width keeps it filling the available
   width when the table doesn't need more. This is specifically what lets
   the sticky toolbar (see .casting-toolbar above) actually work: a
   position: sticky element can only slide within the bounds of its OWN
   containing block, so if .casting-view stayed viewport-width, the
   toolbar's containing block would be exactly as wide as the toolbar
   itself — zero room to slide, so sticky would have nothing to do and it'd
   just scroll away like ordinary content. Widening the container to match
   the table gives it that room. */
.casting-view { width: max-content; min-width: 100%; }

/* Settings page (Numbering / Cue Types / Users / Danger sub-pages) — see
   renderSettingsView. */
.settings-view { max-width: 900px; margin: 0 auto; }
/* Pages that use the whole width, from the left edge (Settings > Security Groups): the list of groups on the left, the permissions table filling the rest. */
.settings-view.settings-view-wide { max-width: none; margin: 0; }
.settings-section { margin-bottom: 24px; }

.settings-add-section { margin-bottom: 20px; }
.settings-add-section .modal-message { color: var(--text-dim); font-size: 13px; }
.settings-search-input { width: 100%; }
.settings-danger-section {
  padding: 16px; border: 1px solid var(--danger); border-radius: var(--radius);
}

/* Settings > Groups — see renderSettingsGroupsPage. Master/detail: a
   searchable group list on the left, the selected group's permissions
   (by category) on the right. */
.permission-groups-layout { display: flex; gap: 20px; align-items: flex-start; }
.permission-groups-list-pane { flex: 0 0 240px; display: flex; flex-direction: column; gap: 10px; }
.permission-groups-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 480px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 4px;
}
/* The group buttons must keep their own height: in this flex column they used to shrink to fit the list's max-height
   (flex-shrink 1 + overflow hidden lets them go to nothing), so the list never overflowed to scroll and each name was
   squashed into its padding. A fixed line-height with equal padding above and below sits the name in the middle of the
   highlight. */
.permission-group-list-item {
  display: block; flex: 0 0 auto; box-sizing: border-box; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); font-size: 13px; line-height: 20px; padding: 7px 10px;
  border-radius: 6px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.permission-group-list-item:hover { background: var(--bg-panel-2); }
.permission-group-list-item.active { background: var(--accent); color: var(--on-accent); }
.permission-groups-detail-pane { flex: 1 1 auto; min-width: 0; }
.permission-group-name-input { font-weight: 600; font-size: 15px; margin-bottom: 16px; }
.permission-category { margin-bottom: 18px; }
.permission-category-heading {
  margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim);
}
.permission-checks { display: flex; flex-direction: column; gap: 8px; }
.permission-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
@media (max-width: 720px) {
  .permission-groups-layout { flex-direction: column; }
  .permission-groups-list-pane { flex-basis: auto; width: 100%; }
  .permission-groups-list { max-height: 220px; }
}

/* Settings > Cue Types — see renderSettingsCueTypesPage. */
.cuetype-color-input {
  width: 28px; height: 24px; padding: 0; border: 1px solid var(--border);
  border-radius: 6px; background: none; cursor: pointer;
}
.cuetype-color-input:disabled { opacity: 0.5; cursor: default; }

.settings-danger-heading { margin: 0 0 8px; font-size: 14px; color: var(--danger); }
.settings-danger-section .modal-message { color: var(--text-dim); font-size: 13px; }

/* Settings sub-page nav, in the left sidebar (#section-settings-nav). */
.settings-nav-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text-dim); font-size: 14px; padding: 8px 10px; margin-bottom: 2px;
  border-radius: 6px; cursor: pointer;
}
.settings-nav-item:hover { background: var(--bg-panel-2); }
.settings-nav-item.active { background: var(--accent); color: var(--on-accent); }

/* ---------- Props Tracks ----------
   Tasks for the props team, drawn in the cue margin (see buildPropsTaskGrid in
   app.js — the same .cue-margin-grid / .cue-margin-go shape a cue block uses,
   so the margin layout and connector lines treat them identically) and managed
   on the Props view's "Props Tracks" page. */
.cue-word-props { color: #0f766e; font-weight: 700; }
.cue-connector-line.props { stroke: #14b8a6; stroke-width: 1.5; }
/* The sidebar's "Tracks" list (Script view) — indented like the cue types. */
#tracks-filter-list .cue-filter-row { margin-left: 8px; }
/* An Issue/Collect task's ✕ (not required) and ↺ (reset) sit side by side. */
.props-task-end { display: flex; align-items: center; gap: 2px; align-self: center; }
.props-task-skipped { opacity: 0.5; }
.props-task-skipped:hover { opacity: 1; }
/* "+ Cue" and "+ Task" sit side by side; layoutCueMargins positions this row
   (not the buttons in it), so the buttons themselves stay in normal flow. */
.cue-add-row { display: none; position: absolute; gap: 6px; align-items: center; }
.cue-margin-cell.show-cue-actions .cue-add-row { display: flex; }
.cue-add-row .inline-cue-add { position: static; }
/* Narrow (stacked) layout: the buttons wrap onto more lines instead of running off the right of the screen. */
.script-pane-inner.stacked-cues .cue-add-row { position: static; align-self: flex-start; flex-wrap: wrap; max-width: 100%; }
/* While its line is on screen but the buttons are not (a very long block of text), they float at the top right of the script pane - updateCueAddFloat in app.js. */
.cue-add-row.cue-add-floating {
  position: fixed !important; top: var(--cue-float-top) !important; right: var(--cue-float-right) !important; left: auto !important; bottom: auto !important;
  z-index: 40; flex-direction: column; align-items: flex-end; gap: 4px; box-sizing: border-box; max-width: calc(100vw - var(--cue-float-right) - 8px);
  padding: 4px 6px; border-radius: 16px; background: var(--bg-panel); border: 1px solid var(--border); box-shadow: 0 4px 14px #0009;
}
/* Wide layout: same horizontal place as the buttons normally sit (the cue margin), just kept on screen. */
.cue-add-row.cue-add-floating.cue-add-floating-natural {
  left: var(--cue-float-left) !important; right: auto !important; flex-direction: row; align-items: center; flex-wrap: nowrap;
  max-width: none; padding: 0; background: none; border: 0; box-shadow: none;
}
.cue-margin-go.props-task {
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: #10131a; cursor: default; min-width: 46px;
}
.cue-margin-go.props-task:hover { filter: none; }
/* One tag per visible track a task is on: the track's pill, then its number
   in that track. */
.props-track-tags { display: flex; flex-direction: column; gap: 4px; align-self: center; }
.props-track-tag { display: flex; align-items: center; gap: 6px; }
.props-track-tag .inline-cue-type { cursor: default; }
.props-task-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-self: center; }
.props-task-title { font-size: 12px; font-weight: 600; color: #e9ebf0; overflow-wrap: anywhere; padding: 0 6px; }
.props-task-who { font-weight: 400; color: #9aa3b2; }
.props-task-kind { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; color: #5eead4; }
/* A WHAM Start/Complete margin marker's Quick Change/Side of Stage callout
   (see buildPropsTaskGrid) — the marker badge itself already splits half
   red (propsTaskMarkerBackground); this is the plain-text echo of it. */
.wham-flag-tag { color: var(--danger); font-weight: 700; }
.props-task-notes { font-style: italic; }
.props-task-notes:focus { font-style: normal; }
.inline-cue-remove.props-task-reset:hover { color: var(--accent); }

/* Props Tracks page. */
.props-tracks-page { display: flex; flex-direction: column; gap: 14px; padding-bottom: 40px; }
.props-tracks-intro { margin: 0; max-width: 760px; font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.props-tracks-strip, .props-tracks-toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.props-track-chip {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 999px; padding: 4px 8px 4px 12px;
}
.props-track-chip-count { font-size: 12px; color: var(--text-dim); }
.props-tracks-filter { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.props-tracks-filter .tracker-select { width: auto; }
/* Its own bounded, independently scrolling box — the header row and Name
   column need to stay fixed while browsing a long cast list alongside
   several measurement columns. Same overflow/border-collapse override
   .music-tracker-table-wrap uses and for the same reason (see its own
   comment above): .tracker-table's default overflow:hidden + border-
   collapse:collapse both defeat position:sticky, by putting the wrong
   (false, non-scrolling) ancestor between the sticky cells and this actual
   scrolling box — same rounded-corners/double-border trade-off accepted. */
.props-task-num { text-align: center; font-weight: 700; color: var(--text-dim); }
.props-task-kind-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  font-size: 11px; font-weight: 700; color: #10131a;
}
.props-task-who-line, .props-task-where-line { font-size: 12px; color: var(--text-dim); }
.props-task-where-auto { font-size: 12px; font-style: italic; color: var(--text-dim); }
.props-task-where { min-width: 200px; max-width: 320px; }
.props-task-tracks { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.props-task-track-box { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; cursor: pointer; }
.props-task-track-box input { cursor: pointer; }
.props-task-actions { white-space: nowrap; }
.props-task-link {
  background: none; border: none; padding: 2px 4px; cursor: pointer;
  font-size: 12px; color: var(--accent);
}
.props-task-link:hover { text-decoration: underline; }
/* WHAM's own "By Character" page (renderWhamCharactersPage) — one section
   per character, one sub-block per scene they appear in. */
/* Export > Restore from Backup… (openRestoreBackupDialog) */
.restore-box { max-height: 86vh; overflow-y: auto; }
.restore-group-head { display: flex; align-items: center; gap: 6px; margin: 14px 0 2px; }
.restore-group-head strong { margin-right: auto; }
.restore-hint { margin-bottom: 4px; font-size: 12px; }
.restore-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.restore-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.restore-row:last-child { border-bottom: none; }
.restore-row:hover { background: var(--bg-panel-2); }
.restore-row input { margin-top: 3px; flex: 0 0 auto; }
.restore-row-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.restore-where { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); }
.restore-now { color: var(--text-dim); }
.restore-text { word-break: break-word; }
/* Find and replace bar (Script and Summary views) — floats over the top-right of the page */
.find-bar {
  position: fixed; z-index: 90; width: min(460px, calc(100vw - 24px)); box-sizing: border-box;
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px #00000066;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text);
}
.find-row { display: flex; align-items: center; gap: 4px; }
.find-replace-row { display: none; }
.find-bar.find-with-replace .find-replace-row { display: flex; }
.find-input {
  flex: 1; min-width: 0; padding: 5px 8px; font-size: 13px; border-radius: 6px;
  background: var(--bg-panel-2); border: 1px solid var(--border); color: var(--text);
}
.find-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.find-btn, .find-toggle {
  flex: 0 0 auto; min-width: 26px; height: 26px; padding: 0 6px; font-size: 12px; line-height: 1;
  background: transparent; border: 1px solid transparent; border-radius: 5px; color: var(--text); cursor: pointer;
}
.find-btn:hover, .find-toggle:hover { background: var(--bg-panel-2); }
.find-toggle { font-weight: 600; border-color: var(--border); }
.find-toggle.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.find-count { flex: 0 0 auto; min-width: 64px; text-align: center; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.find-count.find-none { color: var(--danger); }
.find-replace-row .btn { flex: 0 0 auto; }
@media (max-width: 480px) { .find-count { min-width: 0; } }
.wham-add-item-row { margin: 4px 0 12px; }
.wham-character-section {
  padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.wham-character-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.wham-character-heading { margin: 0 0 10px; font-size: 16px; }
.wham-character-scene { margin-bottom: 14px; padding-left: 8px; border-left: 2px solid var(--border); }
.wham-character-scene:last-child { margin-bottom: 0; }
.wham-character-scene-label { font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.02em; }
/* .inline-cue-desc centers itself (align-self: center) for the cue grid's row
   axis — in this column-flex body that would center it horizontally. */
.props-task-body .inline-cue-desc { align-self: stretch; }
/* The Props / Costumes / Wigs item table: every column is as wide as its text needs and the
   table scrolls sideways inside its wrapper, rather than squeezing to the screen (on a phone
   the item name box and the scene list were crushed to a sliver). */
.props-catalog-table { width: max-content; min-width: 100%; }
.props-catalog-table th { white-space: nowrap; }
.props-catalog-table td { white-space: nowrap; }
.props-catalog-table td:first-child { min-width: 230px; }
.props-catalog-table td:first-child .tracker-text-input { width: 180px; }
.props-catalog-table td.props-where-cell { white-space: normal; min-width: 260px; max-width: 420px; }
.props-catalog-table td:first-child { white-space: nowrap; }
.props-catalog-table tbody tr { cursor: pointer; }
/* A picked row swaps its plain Character text for the box that changes it. */
.props-catalog-table tr:not(.selected) .props-edit-only { display: none; }
.props-catalog-table tr.selected .props-view-only { display: none; }
.props-catalog-table .tracker-select { width: 100%; min-width: 130px; }
/* A phone: the columns shrink to the screen instead of keeping their desktop widths. */
.props-catalog-table.props-catalog-compact { width: 100%; min-width: 0; }
.props-catalog-compact th, .props-catalog-compact td { padding-left: 4px; padding-right: 4px; font-size: 12px; }
.props-catalog-compact td { white-space: normal; }
.props-catalog-compact td:first-child { min-width: 0; }
.props-catalog-compact td:first-child .tracker-text-input { width: 100%; min-width: 0; }
.props-catalog-compact .tracker-select { min-width: 0; font-size: 12px; }
.props-catalog-compact .tracker-number-input, .props-catalog-compact td input[type="number"] { width: 3.2em; min-width: 0; }
/* While fitCatalogColumns measures, every row is laid out as a picked one is (the widest it gets). */
.props-catalog-table.fit-measure tr .props-edit-only { display: revert; }
.props-catalog-table.fit-measure tr .props-view-only { display: none; }
/* Scenes a whole-show item is used in: a list, four rows tall before it scrolls. */
.props-where-list { list-style: none; margin: 0; padding: 0; }
.props-where-list li { display: flex; align-items: center; gap: 4px; height: 1.5em; line-height: 1.5em; white-space: nowrap; overflow: hidden; max-width: 24em; }
.props-where-list .props-where-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* The jump-to-script magnifier beside each scene the Props page lists. */
.props-scene-jump { flex: 0 0 auto; padding: 0 2px; line-height: 1; }
.props-scene-jump svg { width: 15px; height: 15px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.props-where-list.scrolls { max-height: 6em; overflow-y: auto; }
.props-place-card .props-where-list { font-size: 12px; margin: 2px 0; }
.props-notes-wrap { display: flex; align-items: flex-start; gap: 4px; }
.props-notes-box { flex: 1 1 auto; min-width: 0; }
.props-where-wrap { display: flex; align-items: center; gap: 8px; }
.props-where-text { flex: 1 1 auto; }
/* The pencil (change where the item is used): always showing at the right-hand end of Where, beside the scene list
   rather than inside its scroll area. A phone that drops the Where column shows a spare one beside the bin instead. */
.props-where-wrap .props-where-text { min-width: 0; }
.props-where-wrap .props-edit-where-btn { flex: 0 0 auto; margin-left: auto; }
.props-catalog-table:not(.props-where-dropped) .props-where-fallback { display: none; }
/* The pencil and, in the right-hand panel, who has the item one to a line. */
.props-edit-where-btn svg { width: 15px; height: 15px; }
.props-place-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.props-issued-list { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: 13px; }
/* The right-hand panel for the picked Props / Costumes / WHAM item. */
.props-info-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 2px 0; }
.props-info-label { color: var(--text-dim); font-size: 12px; }
.props-info-empty { margin-top: 0; text-align: left; }
.props-place-card { border: 1px solid var(--border); border-radius: 6px; padding: 8px; margin-bottom: 8px; cursor: pointer; }
.props-place-card.current { border-color: var(--accent); background: #8b5cf61a; }
.props-place-who { font-weight: 600; font-size: 13px; }
.props-place-line { font-size: 12px; margin: 2px 0; }
.props-place-card .btn { margin-top: 6px; }
.props-tracks-table td:nth-child(3) { min-width: 150px; }
.props-tracks-table td:nth-child(5) { min-width: 160px; }
#props-page-tracks-list .cue-filter-row { margin-left: 8px; }
/* Department headings (Props / Costumes / Wigs, Hair & Makeup) inside the
   sidebar's "Tracks to Display" list. */
#tracks-filter-list .cue-filter-subhead {
  margin: 10px 0 2px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim);
}
#tracks-filter-list .cue-filter-subhead:first-child { margin-top: 2px; }

/* "Items to View" (merged Cue Types + Tracks — see index.html/updateSidebarForMainView):
   #cuetypes-group and #tracks-group are its two sub-lists, each headed by one of these. */
.cue-filter-subhead-main {
  display: flex; align-items: center; margin: 0 0 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim);
}
.cue-filter-subhead-main .side-icon { color: var(--text-dim); }
#cuetypes-group, #tracks-group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
#display-group .auto-scene-toggle { margin: 4px 0; }
#display-group .auto-scene-toggle:last-of-type { margin-bottom: 2px; }

/* ---------- Casting: Blocking and Tracks (frozen Qty., narrow tracks, panel) ---------- */
/* Rehearsal Block and Qty. are both narrow — no .casting-row-label min-width. */
.casting-table .casting-rehearsal-col { min-width: 0; width: 1%; white-space: nowrap; }
.casting-table .casting-rehearsal-col .casting-rehearsal-select { min-width: 0; width: auto; }
.casting-table .casting-qty-col { min-width: 0; width: 1%; padding-left: 6px; padding-right: 6px; text-align: center; white-space: nowrap; }
/* The third frozen column, right after Rehearsal Block (see
   updateCastingStickyOffsets for --sticky-col-3-left). */
.casting-table th.casting-sticky-col-3 { left: var(--sticky-col-3-left, 350px); z-index: 3; }
.casting-table td.casting-sticky-col-3 {
  position: sticky; left: var(--sticky-col-3-left, 350px); z-index: 1; background: var(--bg-panel);
}
/* Track columns: a fixed width, about two thirds of what they used to be. */
.casting-table th.casting-track-col, .casting-table td.casting-track-col { width: 140px; min-width: 140px; max-width: 140px; }
.casting-track-col .casting-cell-select, .casting-track-col .casting-cell-locked,
.casting-track-col .casting-track-description-input, .casting-track-col .tracker-select { min-width: 0; width: 100%; }
.casting-track-col .casting-cell-select, .casting-track-col .casting-cell-locked { padding-left: 4px; padding-right: 4px; }
/* An Interval between two numbers (a break for the cast): a slim tinted row across the table. */
.casting-table tr.casting-interval-row td { padding-top: 2px; padding-bottom: 2px; background: #38bdf81f; border-color: #38bdf855; }
.casting-table td.casting-interval-cell.casting-sticky-col,
.casting-table td.casting-interval-cell.casting-sticky-col-2,
.casting-table td.casting-interval-cell.casting-sticky-col-3 { background: #1f3340; }
.casting-interval-row .casting-row-label { color: #7dd3fc; font-style: italic; font-weight: 700; }
/* Track header: the number in the exact middle, controls either side. */
.casting-track-head { display: flex; flex-direction: column; gap: 4px; }
.casting-track-designator { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2px; }
.casting-track-side { display: flex; align-items: center; gap: 0; min-width: 0; }
.casting-track-side-right { justify-content: flex-end; }
.casting-track-btn { padding: 0 2px; font-size: 11px; line-height: 1; }
.casting-track-btn:disabled { opacity: 0.25; cursor: default; }
.casting-track-flag {
  font-size: 11px; font-weight: 700; color: #fbbf24; text-align: center; cursor: help;
  background: #fbbf2422; border-radius: 4px; padding: 1px 4px;
}
/* Right-hand panel: rehearsal blocks, character overflow, unassigned characters. */
.casting-report-block { margin-bottom: 12px; }
.casting-report-block-head { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 2px; }
.casting-report-count { margin-left: auto; font-size: 11px; color: var(--text-dim); }
.casting-report-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; padding: 1px 0 1px 16px; }
.casting-report-name { min-width: 0; overflow-wrap: anywhere; }
.casting-report-qty{ flex: 0 0 auto; font-weight: 700; }
.casting-report-empty { padding-left: 16px; font-size: 12px; }

.casting-report-red, .casting-report-red .casting-report-count { color: #f87171; }
.casting-report-red.casting-report-block { background: #f8717118; border-radius: 6px; padding: 4px 6px; }
.casting-table th.casting-rehearsal-col { white-space: normal; }
.casting-table .casting-rehearsal-col { padding-left: 6px; padding-right: 6px; }
.casting-table .casting-rehearsal-col .casting-rehearsal-select { padding-left: 4px; padding-right: 2px; }
.casting-table .casting-rehearsal-col .casting-rehearsal-wrap { gap: 4px; }

/* Casting Tracks status (top left of the Casting page) and the panel's
   Casting Status section. */
.casting-status {
  margin-right: auto; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
  border: 1px solid currentColor; cursor: help; white-space: nowrap;
}
.casting-status-good { color: #34d399; }
.casting-status-bad { color: #f87171; background: #f8717118; }
.casting-report-row.casting-status-good { padding-left: 0; font-weight: 700; }
.casting-report-row.casting-report-red { padding-left: 0; }
/* Wrap instead of overflowing off the left edge in a narrow pane (the status
   indicator sits at the start and must stay visible). */
.casting-toolbar { flex-wrap: wrap; row-gap: 8px; }
/* Blocking and Tracks on a phone / narrow screen (renderCastingBlockingTracksPage sets .casting-narrow and, through a
   <colgroup> in castingFitNarrow, gives the three frozen columns half the screen between them and each track column
   the other half — the table scrolls sideways to the other tracks), as By Character does. */
@media (max-width: 860px) {
  .casting-toolbar { padding: 8px; gap: 6px 10px; }
  .casting-status { font-size: 12px; padding: 3px 10px; }
  .casting-table.casting-narrow { table-layout: fixed; }
  .casting-narrow th, .casting-narrow td { font-size: 11px; line-height: 1.3; padding: 3px 4px; }
  .casting-narrow .casting-row-label { min-width: 0; font-size: 11px; overflow-wrap: anywhere; }
  .casting-narrow .casting-row-label-line { gap: 4px; }
  .casting-narrow .casting-row-label-text { flex: 1 1 auto; min-width: 0; white-space: normal; }
  .casting-narrow .casting-rehearsal-col, .casting-narrow .casting-qty-col { width: auto; white-space: normal; padding-left: 2px; padding-right: 2px; }
  .casting-narrow th.casting-track-col, .casting-narrow td.casting-track-col { width: auto; min-width: 0; max-width: none; }
  .casting-narrow .casting-cell-select, .casting-narrow .casting-cell-locked { min-width: 0; }
  .casting-narrow .casting-rehearsal-wrap { gap: 2px; }
  .casting-narrow .rehearsal-block-dot { width: 7px; height: 7px; }
  .casting-narrow .casting-rehearsal-select { width: 100%; min-width: 0; font-size: 10px; padding-left: 2px; padding-right: 0; }
  .casting-narrow .casting-header-checkbox { font-size: 10px; }
  .casting-narrow .casting-track-flag { font-size: 10px; }
}

/* Settings > Groups permission ticks — bigger and higher contrast: a bright
   outline when off, a solid accent box with a white tick when on (the default
   dark-theme checkbox was hard to tell on from off). */
.permission-check { color: var(--text); align-items: flex-start; line-height: 1.4; cursor: pointer; }
.permission-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto; width: 20px; height: 20px; margin: 0; cursor: pointer;
  border: 2px solid #e8e9ec; border-radius: 4px; background: transparent;
  display: inline-grid; place-content: center;
}
.permission-check input[type="checkbox"]:hover { border-color: #ffffff; background: #ffffff1f; }
.permission-check input[type="checkbox"]:checked {
  background-color: var(--accent); border-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8' fill='none' stroke='%231a1040' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 14px 14px; background-repeat: no-repeat; background-position: center;
}
.permission-check input[type="checkbox"]:focus-visible { outline: 2px solid #fbbf24; outline-offset: 2px; }
/* Read-only (no manageGroups): still clearly on/off, just not clickable. */
.permission-check input[type="checkbox"]:disabled { cursor: default; opacity: 0.75; }
.permission-check input[type="checkbox"]:disabled:hover { background-color: transparent; border-color: #e8e9ec; }
.permission-check input[type="checkbox"]:checked:disabled:hover { background-color: var(--accent); border-color: #ffffff; }
.permission-category-heading { color: #c9cdd6; }
.settings-nav-item[hidden] { display: none; }

/* Casting > Cast List and its confidential columns (see
   renderCastingCastListPage), plus the small Settings pages that go with it
   (Cast Groups, Measurements, Access Log). */
.cast-list-view { padding: 16px; box-sizing: border-box; }
/* Cast > Characters: the character list in the centre panel (buildCharactersList with opts.page). */
.cast-page-heading { margin: 0 0 12px; text-align: center; }
.characters-page-list { max-width: 680px; margin: 0 auto; }
.cast-characters-view .add-scene-row { gap: 8px; margin-bottom: 12px; }
.cast-characters-view .add-scene-row .add-scene-btn { margin-left: 0; border: 1px dashed var(--border); border-radius: 6px; padding: 6px 12px; }
.cast-characters-view .character-row { margin-left: 0; padding: 6px 8px; gap: 10px; border-bottom: 1px solid var(--border); border-radius: 0; }
.cast-characters-view .character-name-input { font-size: 15px; }
.details-cast-character-group .details-cast-name { font-style: italic; }
.cast-list-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cast-list-sort { width: auto; }
.cast-private-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel-2);
}
.cast-private-label { font-weight: 600; }
.cast-private-hint { color: var(--text-dim); font-size: 12px; }
.cast-private-on { border-color: var(--accent); }
.cast-private-th { background: var(--bg-panel-2); white-space: nowrap; }
.cast-private-td { min-width: 96px; }
.cast-private-input { min-width: 80px; }
.cast-private-saving { opacity: 0.6; }
.cast-list-table td:nth-child(2) { min-width: 200px; }
.cast-list-table td:nth-child(3) { min-width: 160px; }
/* Someone marked not In Show: the row is dimmed (the tick itself and the reason stay at full strength). */
.cast-list-table tr.cast-out > td { opacity: 0.65; }
.cast-list-table tr.cast-out > td.cast-inshow-td,
.cast-list-table tr.cast-out > td.cast-out-reason-td { opacity: 1; }
.cast-inshow-td { text-align: center; }
.cast-out-reason-option { display: block; margin: 6px 0; cursor: pointer; }
.cast-out-impact { margin: 8px 0 12px; padding-left: 18px; }
.cast-out-impact li { margin-bottom: 10px; }
.cast-unit-input { flex: 0 0 90px !important; }
.cast-row-actions { white-space: nowrap; }
.cast-log-search { max-width: 260px; }
.cast-log-status { color: var(--text-dim); font-size: 13px; }

/* Casting > Casting (renderCastingAssignPage): cast members in cast tracks. */
.cast-assign-summary { color: var(--text-dim); font-size: 13px; }
.cast-assign-table td { vertical-align: top; }
.cast-assign-track { font-weight: 700; text-align: center; width: 48px; }
.cast-assign-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 260px; }
.cast-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg-panel-2); font-size: 13px;
}
.cast-chip-x { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.cast-chip-x:hover { color: var(--danger); }
.cast-assign-add { width: auto; }

/* "+ Add..." dialog on Casting > Casting: search/filter and a sortable table. */
.cast-picker-box { width: 720px; }
.cast-picker-status { color: var(--accent-text); font-size: 13px; margin-bottom: 10px; }
.cast-picker-status[hidden] { display: none; }
.cast-picker-current { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cast-picker-current-heading { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin-bottom: 6px; }
.cast-picker-current-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cast-picker-search { margin-bottom: 10px; }
.cast-picker-reveal { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
/* Cast selection: the tool in the "+ Add…" box and on the Cast Selection page (see renderCastSelector). */
.cast-picker-box.cast-sel-box { width: min(1100px, 96vw); max-height: 92vh; overflow-y: auto; }
.cast-sel-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cast-sel-field { display: inline-flex; align-items: center; gap: 6px; }
.cast-sel-field > span:first-child { font-weight: 600; }
.cast-sel-count { width: 64px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
.cast-sel-heading { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin: 10px 0 6px; }
.cast-sel-params { display: flex; flex-direction: column; gap: 2px; }
.cast-sel-param { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 3px 0; font-size: 13px; }
.cast-sel-param-label { flex: 0 0 210px; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.cast-sel-param-off .cast-sel-param-label { color: var(--text-dim); }
.cast-sel-moves { display: inline-flex; gap: 0; flex: 0 0 auto; }
.cast-sel-move-on { background: var(--accent); color: #1a1033; border-radius: 6px; }
.cast-sel-move-hint { margin: 0 0 6px; color: var(--accent-text); }
/* while moving a filter: the other rows are click targets (their own controls are switched off) */
.cast-sel-param-moving { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 6px; }
.cast-sel-param-target { cursor: pointer; border-radius: 6px; }
.cast-sel-param-target > * { pointer-events: none; }
.cast-sel-param-target:hover { background: rgba(168, 139, 250, 0.22); }
.cast-sel-param-end { padding: 6px 4px; border-top: 1px dashed var(--border); }
.cast-sel-param-ctl { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cast-sel-param-ctl .tracker-select { width: auto; }
.cast-sel-num { width: 70px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
.cast-sel-weights { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; }
.cast-sel-weight-field { display: inline-flex; flex-direction: column; gap: 1px; font-size: 11px; }
.cast-sel-weight-field .cast-sel-weight { width: 56px; }
.cast-sel-opt { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.cast-sel-options { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin: 12px 0; padding-top: 10px; border-top: 1px solid var(--border); }
.cast-sel-radio { display: inline-flex; align-items: center; gap: 12px; font-size: 13px; }
.cast-sel-radio-title { font-weight: 600; }
.cast-sel-radio label { cursor: pointer; }
.cast-sel-options .cast-picker-search { width: 200px; margin: 0 0 0 auto; }
/* The list takes what it needs (at least 340px); the summary tables sit beside it as wide as their widest table, and drop
   below the list when there isn't room for both. */
.cast-sel-results { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.cast-sel-results > .cast-sel-col { flex: 1 1 340px; min-width: 0; }
.cast-sel-results > .cast-sel-stats { flex: 0 1 auto; width: max-content; max-width: 100%; }
.cast-sel-col { min-width: 0; }
.cast-sel-col > .btn { margin-top: 10px; }
.cast-sel-table-wrap { max-height: 58vh; overflow: auto; }
.cast-sel-box .cast-sel-table-wrap { max-height: 40vh; }
/* On the page the list fills the height of the window and scrolls inside itself, so its header row (sticky) stays in view. */
.cast-sel-page .cast-sel-table-wrap { max-height: max(240px, calc(100vh - 330px)); }
.cast-sel-table th { white-space: nowrap; }
/* (.tracker-table clips with overflow: hidden, which would stop the sticky header row following the list's scroll) */
.cast-sel-table { overflow: visible; }
/* Separate borders drawn on the cells themselves (not collapsed ones, which belong to the table): that way the sticky header
   row carries its own borders and nothing — the column dividers of the rows scrolling beneath, or a pixel of them above — shows through it. */
.cast-sel-table { border-collapse: separate; border-spacing: 0; border: 0; border-radius: 0; }
.cast-sel-table th, .cast-sel-table td { border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cast-sel-table th:first-child, .cast-sel-table td:first-child { border-left: 1px solid var(--border); }
.cast-sel-table thead th { top: 0; border-top: 1px solid var(--border); }
.cast-sel-row.cast-sel-nofit > td { background: rgba(251, 146, 60, 0.14); }
.cast-sel-row.cast-sel-out > td { opacity: 0.55; }
.cast-sel-row.cast-sel-pickable { cursor: pointer; }
.cast-sel-row.cast-sel-pickable:hover > td { filter: brightness(1.25); }
/* ticked people are green (this wins over the shading of someone who doesn't fit) */
.cast-sel-row.cast-sel-picked > td { background: rgba(52, 211, 153, 0.30); }
.cast-sel-nameleft { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.cast-photo-btn { padding: 2px 4px; opacity: 0.85; flex: 0 0 auto; }
.cast-photo-btn:hover { opacity: 1; }
/* The camera inline before a name in running lists (chips, Cast in Scene/Song, the character panel, radio mics, measurements). */
.cast-chip .cast-photo-btn, .details-cast-people .cast-photo-btn, .audio-mic-cast .cast-photo-btn, .cast-assign-person .cast-photo-btn,
.char-family-detail-name .cast-photo-btn { display: inline-flex; vertical-align: middle; padding: 0 4px 0 0; margin: 0; }
.cast-chip .cast-photo-btn svg, .details-cast-people .cast-photo-btn svg, .audio-mic-cast .cast-photo-btn svg, .cast-assign-person .cast-photo-btn svg,
.char-family-detail-name .cast-photo-btn svg { width: 13px; height: 13px; }
.cast-photo-spacer { display: inline-block; width: 23px; flex: 0 0 auto; }
.cast-photo-td { white-space: nowrap; }
.cast-photo-clear { margin-left: 8px; vertical-align: middle; text-transform: none; letter-spacing: 0; }
.cast-photo-td .cast-photo-input { width: 170px; vertical-align: middle; }
.cast-photo-holder { display: inline-block; vertical-align: middle; margin-left: 4px; min-width: 24px; }
.cast-photo-overlay { z-index: 3000; }
.cast-photo-box { width: auto; max-width: 94vw; text-align: center; }
.cast-photo-img { display: block; max-width: 88vw; max-height: 72vh; margin: 8px auto; border-radius: 8px; }
.cast-photo-img[hidden] { display: none; }
/* "Fetching Picture…" while the photo is on its way (see openCastPhoto). */
.cast-photo-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 240px; min-height: 140px; margin: 8px auto; opacity: 0.85; }
.cast-photo-loading[hidden] { display: none; }
.cast-photo-spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: cast-photo-spin 0.8s linear infinite; }
@keyframes cast-photo-spin { to { transform: rotate(360deg); } }
.cast-sel-namecell { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cast-sel-rec { color: #fbbf24; flex: 0 0 auto; }
.cast-sel-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.cast-sel-toolbar .cast-sel-addbtn { margin-left: auto; }
.cast-sel-selstatus { font-size: 13px; margin-bottom: 6px; }
.cast-sel-selstatus.cast-sel-error { font-weight: 700; }
.cast-sel-notes { margin-bottom: 6px; }
/* the summary tables scroll on their own, beside the list, rather than with the page */
.cast-sel-stats { min-width: 310px; max-height: max(240px, calc(100vh - 250px)); overflow-y: auto; padding-right: 4px; }
.cast-sel-box .cast-sel-stats { max-height: 50vh; }
.cast-sel-stats .cast-sel-heading { margin-top: 0; }
.cast-sel-stats-block { margin-bottom: 14px; overflow-x: auto; }
.cast-sel-stats-caption { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 3px; }
.cast-sel-stats-table { width: 100%; font-size: 12px; }
.cast-sel-stats-table th, .cast-sel-stats-table td { text-align: center; }
.cast-sel-stats-table td:first-child, .cast-sel-stats-table th:first-child { text-align: left; }
.cast-sel-stats-total, .cast-sel-stats-totalrow td { font-weight: 700; }
.cast-sel-stats-totalrow td { border-top: 2px solid var(--border); }
.cast-sel-bad { color: #f87171; font-weight: 600; }
.cast-sel-page { max-width: 1200px; }
.cast-criteria-box { width: 460px; max-width: 96vw; }
.cast-criteria-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cast-criteria-checks label { cursor: pointer; }
.cast-criteria-range { display: flex; align-items: center; gap: 8px; }
.cast-criteria-range .modal-input { width: 100px; }
.cast-criteria-table { max-width: 420px; margin-bottom: 14px; }
.casting-criteria-cell { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; text-align: left; }
.casting-criteria-summary { font-size: 12px; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.casting-criteria-none { color: var(--text-dim); }
.casting-criteria-btn { opacity: 0.55; }
.casting-criteria-btn.has-criteria { opacity: 1; color: var(--accent-text); }
@media (max-width: 800px) { .cast-sel-results { grid-template-columns: minmax(0, 1fr); } .cast-sel-stats { max-height: none; overflow-y: visible; } .cast-sel-param-label { flex-basis: 100%; } }
/* The same controls inside the right-hand panel (Cast Selection page): one column, full width. */
.details-pane .cast-sel-top { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 0; }
.details-pane .cast-sel-field { flex-wrap: wrap; }
.details-pane .cast-sel-field .tracker-select { flex: 1 1 100%; margin-top: 0; }
.details-pane .cast-sel-params { gap: 6px; }
.details-pane .cast-sel-param { gap: 4px 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.details-pane .cast-sel-param:last-child { border-bottom: 0; }
.details-pane .cast-sel-param-label { flex: 1 1 0; min-width: 0; }
.details-pane .cast-sel-param-ctl { flex: 1 1 100%; padding-left: 22px; }
.details-pane .cast-sel-param-ctl .tracker-select { width: auto; flex: 1 1 auto; margin-top: 0; min-width: 0; }
.details-pane .cast-sel-num { width: 64px; }
.details-pane .cast-picker-reveal { margin-bottom: 8px; }
.cast-assign-filled { white-space: nowrap; font-weight: 600; }
.cast-assign-heading { margin: 24px 0 8px; }
.cast-assign-unassigned { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.cast-assign-person { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cast-assign-person .tracker-select { width: auto; min-width: 200px; }
.cast-chip-name { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; text-decoration: underline dotted; text-underline-offset: 3px; }
.cast-chip-multi { border-color: var(--accent); }

/* ---- Rehearsal view (state.mainView === "rehearsal") ----
   A plain reading column on the app's dark background — no printed page, no
   cue margin. The toolbar sticks to the top of the scroll pane while the
   script scrolls under it. */
.rehearsal-view { max-width: 860px; margin: 0 auto; padding: 0 0 80px; }
.rehearsal-toolbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg); box-shadow: 0 -40px 0 var(--bg); /* paints over the pane's top padding so scrolled text can't peek out above the bar */
  padding: 10px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.rehearsal-transport { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rehearsal-play { min-width: 96px; justify-content: center; }
.rehearsal-settings { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.rehearsal-scene-select { width: auto; max-width: 320px; }
.rehearsal-status { font-size: 13px; color: var(--text-dim); min-height: 1.3em; }
.rehearsal-options { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 13px; }
.rehearsal-opt { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); }
.rehearsal-opt .tracker-select { width: auto; }
.rehearsal-rate { width: 110px; }
.rehearsal-who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 100%; }
.rehearsal-label { color: var(--text-dim); margin-right: 2px; }
.rehearsal-who-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-panel); cursor: pointer; user-select: none;
}
.rehearsal-who-chip:has(input:checked) { background: #a78bfa45; color: var(--accent-text); border-color: var(--accent) !important; }
.rehearsal-voices { font-size: 13px; color: var(--text-dim); }
.rehearsal-voices summary { cursor: pointer; }
.rehearsal-voice-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.rehearsal-voice-name { flex: 0 0 150px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rehearsal-voice-row .tracker-select { flex: 1 1 auto; min-width: 0; }

.rehearsal-act { margin: 36px 0 4px; font-size: 15pt; text-transform: uppercase; letter-spacing: 0.04em; text-align: center; }
.rehearsal-scene { margin-top: 18px; }
.rehearsal-scene-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.rehearsal-scene-head h3 { margin: 0; font-size: 14pt; }
.rehearsal-direction { margin: 8px 0; color: var(--text-dim); font-style: italic; font-size: 13px; }
.rehearsal-song {
  margin: 10px 0; padding: 4px 10px; text-align: center; font-size: 12px; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.rehearsal-line {
  display: flex; gap: 14px; align-items: baseline; padding: 6px 10px; margin: 2px 0;
  border-radius: var(--radius); border-left: 3px solid transparent; cursor: pointer;
}
.rehearsal-line:hover { background: var(--bg-panel); }
.rehearsal-char { flex: 0 0 130px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; text-align: right; }
.rehearsal-body { flex: 1 1 auto; min-width: 0; }
.rehearsal-text { font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.rehearsal-aside { color: var(--text-dim); font-style: italic; }
.rehearsal-mine { background: #8b5cf61a; }
.rehearsal-you {
  display: inline-block; margin-top: 2px; padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; background: var(--accent); color: var(--on-accent);
}
.rehearsal-note { margin-top: 4px; padding: 3px 8px; font-size: 12px; color: var(--text-dim); background: var(--bg-panel); border-radius: 6px; }
.rehearsal-start { border-left-color: var(--accent); }
.rehearsal-current { background: #fbbf2426; border-left-color: #fbbf24; }
.rehearsal-current.rehearsal-mine { background: #8b5cf640; }
.rehearsal-simul { margin: 6px 0; padding: 4px 0; border: 1px solid var(--border); border-radius: var(--radius); }
.rehearsal-simul-label { padding: 0 10px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
@media (max-width: 640px) {
  .rehearsal-line { flex-direction: column; gap: 2px; }
  .rehearsal-char { flex: none; text-align: left; }
  .rehearsal-scene-select { max-width: 100%; width: 100%; }
}

/* Rehearsal: a fixed (Cast List) part shows as a filled chip, not a checkbox. */
.rehearsal-who-fixed { background: #a78bfa45; color: var(--accent-text); border-color: var(--accent); cursor: default; font-weight: 600; }
/* Cast List > Account column. */
.cast-account-cell { white-space: nowrap; }
.cast-account-cell .tracker-select { width: auto; max-width: 220px; }
.cast-account-cell .btn { margin-left: 6px; }

/* Rehearsal: recordings under a line — who recorded it, hear it, record / re-record. */
.rehearsal-audio { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-top: 4px; font-size: 12px; }
.rehearsal-audio:empty { display: none; }
.rehearsal-rec-label { color: var(--text-dim); }
.rehearsal-rec-stale { color: #fbbf24; }
.rehearsal-rec-dot { color: var(--danger); font-weight: 700; animation: rehearsal-blink 1s steps(2, start) infinite; }
.rehearsal-rec-timer { font-variant-numeric: tabular-nums; color: var(--text); min-width: 3.5em; }
@keyframes rehearsal-blink { to { visibility: hidden; } }
.rehearsal-audio-note { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel); }
.rehearsal-audio-note[hidden] { display: none; }

/* Rehearsal: which lines have a real person's recording. */
.rehearsal-rec-badge { display: inline-block; min-width: 1.2em; margin-left: 6px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.rehearsal-rec-badge:empty { display: none; }
.rehearsal-rec-badge.is-recorded { filter: drop-shadow(0 0 3px #34d39988); }
.rehearsal-rec-badge.is-stale { color: #fbbf24; }
.rehearsal-scene-count { flex: 1 1 auto; margin-left: 12px; font-size: 12px; color: var(--text-dim); }
.rehearsal-scene-count.has-rec { color: #34d399; }
.rehearsal-rec-summary { font-size: 13px; color: var(--text-dim); }
.rehearsal-rec-summary:empty { display: none; }
.rehearsal-diag-body { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; font-size: 12px; color: var(--text-dim); }
.rehearsal-diag-body .btn { align-self: flex-start; }
.rehearsal-diag-cast { display: flex; flex-direction: column; gap: 4px; padding-left: 10px; border-left: 2px solid var(--border); }

/* ---- Second toolbar (Script view): Edit, Draw, Select lines ---- */
.tool-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 2px; padding: 2px 12px 4px; }
.tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.tool-group[hidden] { display: none; }
.tool-sep { width: 1px; height: 18px; background: var(--border); margin: 0 5px; flex: 0 0 auto; }
.tool-icon { padding: 7px 8px; }
.tool-structure { --nav-color: #2dd4bf; --nav-tint: #2dd4bf30; }
.tool-line { --nav-color: #38bdf8; --nav-tint: #38bdf830; }
.tool-text { --nav-color: #4ade80; --nav-tint: #4ade8030; }
.editor .tool-btn.active { background: var(--nav-tint); box-shadow: inset 0 -2px 0 var(--nav-color); }
@media (max-width: 720px) { .tool-label-optional { display: none; } }
.tool-bar[hidden] { display: none; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; line-height: 1.2; }
.tool-btn.multiselect-btn { display: none; }
@media (pointer: coarse), (max-width: 860px) { .tool-btn.multiselect-btn { display: inline-flex; } }
.tool-btn[hidden] { display: none !important; }
.tool-label { font-size: 13px; white-space: nowrap; }
@media (max-width: 340px) { .tool-label { display: none; } }
.editor .tool-btn { color: var(--nav-color, var(--text)); }
.editor .tool-btn:hover { background: var(--nav-tint, var(--bg-panel-2)); }
#btn-toggle-draw, #btn-toggle-multiselect, #btn-find { --nav-color: #f472b6; --nav-tint: #f472b630; }
/* The Script toolbar's icon groups each have a colour of their own — Rehearsal orange, structure teal, line
   types blue, text tools green, formatting violet, Draw / Select lines / Find pink — and a rule between them. */
.tool-format-group .tool-btn { --nav-color: #a78bfa; --nav-tint: #a78bfa30; }
.tool-section-group .tool-btn { --nav-color: #fbbf24; --nav-tint: #fbbf2430; }
#menu-add, #menu-section, #menu-format, .tool-draw-group { padding-left: 10px; border-left: 1px solid var(--border); }
@media (max-width: 720px) { #menu-add { padding-left: 0; border-left: 0; } }
#btn-toggle-draw.draw-toggle-active, #btn-toggle-multiselect.multiselect-active { background: var(--nav-tint); box-shadow: inset 0 -2px 0 var(--nav-color); }

/* ---- Boxes round groups of icons (normal width) ----
   Each run of related icons sits in its own rounded box — the views, Export, the zoom pair, Undo/Redo,
   Messages/Settings/Help on the first bar; Rehearsal, each run of the Edit group, Lyric Tags, formatting and
   Draw/Select/Find on the second — so a full bar reads as a few groups, not one long line. Phones keep their
   plain text menus. In the Edit dropdown the sub-boxes dissolve (display: contents) and the rules show instead. */
.title-icon-group, .tool-subgroup { display: contents; }
@media (min-width: 721px) {
  .view-icons, #menu-export, .view-size, .title-icon-group, #menu-section, #menu-format, .tool-draw-group,
  #tool-group-cues, #tool-group-summary, #menu-add.edit-mode-menu, .edit-mode-labels .tool-subgroup, .edit-mode-icons .tool-subgroup {
    border: 1px solid var(--group-border); border-radius: 9px; padding: 2px;
    background: color-mix(in srgb, var(--bg-panel-2) 45%, transparent);
  }
  .menu-bar { gap: 6px; }
  .menu-bar-sep, .edit-tools:not(.edit-mode-menu) .tool-sep { display: none; }
  .view-icons, .view-size, .title-icon-group, .edit-mode-labels .tool-subgroup, .edit-mode-icons .tool-subgroup { display: flex; align-items: center; gap: 2px; }
  .view-icons, #menu-export, .view-size, #btn-undo, #btn-redo { align-self: stretch; }
  #menu-export { display: flex; }
  .edit-items { gap: 6px; }
  #menu-add { padding: 0; border: 0; }
  #menu-add.edit-mode-menu { padding: 2px; border: 1px solid var(--group-border); }
  #tool-group-summary:empty { display: none; }
  /* Undo and Redo: one box, split by a rule */
  #btn-undo, #btn-redo { border: 1px solid var(--group-border); background: color-mix(in srgb, var(--bg-panel-2) 45%, transparent); }
  #btn-undo { border-radius: 9px 0 0 9px; border-right-width: 0; }
  #btn-redo { border-radius: 0 9px 9px 0; margin-left: -6px; }
  /* Rehearsal is a box by itself */
  .tool-view-btn { border: 1px solid var(--group-border); border-radius: 9px; background: color-mix(in srgb, var(--bg-panel-2) 45%, transparent); }
  #tool-group-script { align-items: stretch; }
}

/* ---- Side-panel icons (sidebar sections, page choices, details sections) ---- */
.side-icon { display: inline-flex; flex: 0 0 auto; margin-right: 8px; color: var(--text-dim); }
.side-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-section-header h2 { display: flex; align-items: center; }
.details-section-header .side-icon { margin: 0 6px 0 2px; }
.settings-nav-item { display: flex; align-items: center; }
.settings-nav-item[hidden] { display: none; }
.settings-nav-item.active .side-icon { color: inherit; }

/* ---- Cast in scene / Cast in song: "Show actual cast" ---- */
.details-cast-toggle { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; cursor: pointer; }
.details-cast-people { font-size: 12px; color: var(--text-dim); padding: 0 0 4px 12px; margin-top: -1px; word-break: break-word; }
/* Phone: the first toolbar (☰ View Export Help ↶ ↷ ☰) always fits on one line, even at 320px. */
@media (max-width: 720px) {
  .menu-bar { padding: 4px 4px; gap: 0; }
  .menu-bar .menu-btn, .menu-bar .btn.icon-only { padding: 6px 5px; font-size: 13px; }
  .menu-bar .btn.icon-only { font-size: 16px; }
  .menu-bar > *, .menu-bar .menu { flex: 0 0 auto; }
  #btn-undo { margin-left: auto; }
  /* The size pair (see .view-size) is squeezed so the bar still fits on one line. */
  .view-size { gap: 0; }
  .menu-bar { padding-left: 2px; padding-right: 2px; }
  .menu-bar .view-size .menu-btn { min-width: 0; padding: 6px 3px; }
  .menu-bar .view-size .view-size-normal { padding: 6px 2px; }
  .menu-bar #btn-messages, .menu-bar #menu-help .menu-btn { padding-left: 3px; padding-right: 3px; }
  .view-size .view-size-text { font-size: 13px; }
}
/* On the narrowest phones the size pair no longer fits beside everything else, so it drops to a row of
   its own, still at the right edge. */
@media (max-width: 369px) {
  .menu-bar { flex-wrap: wrap; }
  .view-size { order: 9; }
}
/* ---- Script toolbar layout: units that wrap whole ----
   #tool-group-script holds three units — Rehearsal, the Edit group (#menu-add) and the Draw / Select
   group — and only ever wraps BETWEEN them (the last unit first), never inside one. fitToolbarTwo() in
   app.js picks the Edit group's mode: edit-mode-labels (icon + short text), edit-mode-icons, or
   edit-mode-menu (an "Edit" dropdown, also used whenever the main toolbar has gone back to menus). */
#tool-group-script { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; gap: 2px 10px; }
.edit-tools, .edit-items, .tool-draw-group { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; flex: 0 0 auto; }
#menu-add[hidden] { display: none !important; }
.edit-items .tool-label { display: none; }
.edit-menu-toggle { display: none; --nav-color: #38bdf8; --nav-tint: #38bdf830; }
.edit-mode-labels .edit-items .tool-label { display: inline; }
.edit-mode-labels .tl-full, .tool-label .tl-short { display: none; }
.edit-mode-labels .tool-label .tl-short { display: inline; }
.edit-mode-labels .tool-icon { padding: 7px 9px; gap: 6px; }
/* the dropdown */
.edit-mode-menu { position: relative; display: block; }
.edit-mode-menu .edit-menu-toggle { display: inline-flex; }
.edit-mode-menu .edit-items {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  flex-direction: column; align-items: stretch; gap: 0; min-width: 230px; padding: 6px;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px #00000055;
}
.edit-mode-menu.open .edit-items { display: flex; }
.edit-mode-menu .edit-items .tool-btn { width: 100%; justify-content: flex-start; padding: 8px 10px; gap: 10px; }
.edit-mode-menu .edit-items .tool-label { display: inline; }
.edit-mode-menu .tl-short { display: none; }
.edit-mode-menu .tl-full { display: inline; }
.edit-mode-menu .tool-sep { width: auto; height: 1px; margin: 4px 2px; }
/* All the second toolbar's text goes before it wraps (see fitToolbarTwo); the Edit dropdown keeps its word. */
#tool-group-script.tools-notext .tool-view-btn .tool-label,
#tool-group-script.tools-notext .tool-draw-group .tool-label,
#tool-group-script.tools-notext .tool-section-group .tool-label,
#tool-group-script.tools-notext #btn-insert-mention .tool-label { display: none; }
/* Pending Approvals (tick) in the Script toolbar's Edit group, and its dialog */
.tool-approve { --nav-color: #4ade80; --nav-tint: #4ade8030; position: relative; }
.tool-badge {
  position: absolute; top: -2px; right: -3px; min-width: 15px; padding: 0 4px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10px; line-height: 15px; text-align: center; font-weight: 600;
}
.tool-badge[hidden] { display: none; }
.edit-mode-menu .tool-badge { position: static; margin-left: auto; }
.modal-box.approvals-box { width: 900px; max-width: 94vw; max-height: 88vh; overflow: auto; }
/* Help > What's New… and the by-itself version after an update (see openReleaseNotes) */
.modal-box.release-notes-box { max-width: 94vw; max-height: 86vh; overflow: auto; }
.release-block { margin: 14px 0 18px; }
.release-block + .release-block { padding-top: 14px; border-top: 1px solid var(--border); }
.release-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.release-title { font-weight: 700; font-size: 15px; }
.release-date { color: var(--text-dim); font-size: 12px; }
.release-current { font-size: 11px; color: #0d9668; border: 1px solid #0d9668; border-radius: 999px; padding: 0 8px; }
.release-list { margin: 6px 0 0; padding-left: 20px; line-height: 1.5; }
.release-list li { margin: 4px 0; }

/* Phone: the first tap on a text field only SELECTS it (no keyboard); tapping the selected one edits it. */
.tap-selected { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
tr.tap-selected-row { background: #a78bfa1f; }
/* A row of dialogue / lyric that is only a (parenthesised direction) shows centred. */
.line-text-display .paren-line { display: block; text-align: center; }
.parallel-row-line.paren-row { text-align: center; }
/* Character notes: the button in the Characters list, and the right-hand panel section */
/* No note yet: a dim grey icon. A character with a note: full colour on a purple tile, so it stands out. */
.character-note-btn { opacity: 0.45; filter: grayscale(1); }
.character-note-btn.has-note { opacity: 1; filter: none; background: #a78bfa; border-radius: 4px; box-shadow: 0 0 0 1px #c4b5fd; }
/* Scene / song summaries in the right-hand panel (renderSceneSummarySection /
   renderSongSummarySection): a labelled box per field, on the dark panel. */
.details-summary-label {
  margin: 10px 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-dim);
}
.details-summary-song-head {
  margin: 16px 0 2px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--text);
}
 .details-section-body > .details-summary-label:first-child { margin-top: 0; }
.details-summary-text {
  display: block; min-height: 56px; box-sizing: border-box; padding: 8px 10px;
  background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 13px; line-height: 1.45; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.details-summary-text:focus { outline: none; border-color: var(--accent); }
.details-summary-text[contenteditable]:empty:before { content: attr(data-placeholder); color: var(--text-dim); }
.details-summary-readonly { min-height: 0; background: transparent; border-color: transparent; padding-left: 0; padding-right: 0; }
.details-summary-empty { font-size: 12px; font-style: italic; color: var(--text-dim); }
.details-summary-chars { font-size: 12px; line-height: 1.45; }
.details-summary-chars-line { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0; }
.details-summary-chars-name { flex: 0 0 auto; padding-top: 5px; }
.details-summary-chars-input, .details-summary-chars-text { flex: 1 1 auto; min-width: 0; font: inherit; color: var(--text); }
.details-summary-chars-input {
  box-sizing: border-box; padding: 4px 6px; background: var(--bg-panel-2); border: 1px solid var(--border);
  border-radius: 6px; resize: none; overflow: hidden; line-height: 1.4;
}
.details-summary-chars-input:focus { outline: none; border-color: var(--accent); }
.details-summary-chars-text { padding-top: 5px; white-space: pre-wrap; }
.details-summary-chars-add { margin-top: 4px; font-size: 12px; color: var(--text-dim); background: var(--bg-panel-2); border: 1px dashed var(--border); border-radius: 6px; padding: 3px 6px; }
/* The pencil beside the Scene Summary heading: turns on the "add" prompts. Only there while the section is open. */
.summary-edit-btn {
  margin-left: 6px; width: 24px; height: 24px; padding: 0; font-size: 14px; line-height: 1;
  background: transparent; border: 1px solid transparent; border-radius: 5px; color: var(--text-dim); cursor: pointer;
}
.summary-edit-btn:hover { background: var(--bg-panel-2); color: var(--text); }
.summary-edit-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.details-section.collapsed .summary-edit-btn { display: none; }
@media (max-width: 860px) { .editor .details-section.collapsed .summary-edit-btn { display: inline-block; } }
/* Nothing written yet: one quiet line that opens the box when clicked */
.details-summary-prompt { margin: 6px 0; padding: 3px 2px; font-size: 13px; font-style: italic; color: var(--text-dim); cursor: pointer; border-radius: 4px; }
.details-summary-prompt:hover, .details-summary-prompt:focus { color: var(--accent-text); outline: none; }

/* Summary view (state.mainView === "summary") — By Character (renderSummaryByCharacterPage)
   is a plain table on the app's dark background, like every other tracker page. */
/* By Character: a fixed-width-column table that scrolls inside .script-pane (zero padding, no
   heading — same as Casting and the Music Tracker, so the sticky header row and first column
   have no gap to slide through). The wrap and table must not clip (overflow: visible,
   separate borders) or position: sticky stops working. Column widths come from the <colgroup>
   (see renderSummaryByCharacterPage), and cells grow to fit their text. */
.script-pane.script-pane-summary-table { padding: 0; }
.summary-character-wrap { overflow: visible; }
.summary-character-table { table-layout: fixed; width: auto; overflow: visible; border-collapse: separate; border-spacing: 0; border-width: 1px 0 0 1px; }
.summary-character-table th, .summary-character-table td { border-width: 0 1px 1px 0; min-width: 0; }
.summary-character-table th { white-space: normal; word-break: break-word; padding-right: 14px; }
.summary-character-table td { overflow: visible; padding: 4px 6px; }
.summary-character-table th.summary-char-sticky { left: 0; z-index: 4; }
.summary-character-table td.summary-char-sticky {
  position: sticky; left: 0; z-index: 1; background: var(--bg-panel);
  box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.5);
}
.summary-character-table tbody tr:nth-child(even) td.summary-char-sticky { background: #262a33; }
.summary-char-label { font-size: 13px; font-weight: 600; color: var(--text); }
/* A character's name at the top of a column opens them on the Characters page. */
.summary-char-th-link { cursor: pointer; }
.summary-char-th-link:hover { color: var(--accent-text); text-decoration: underline; }
/* While a cell is being edited: the button that takes the character out of the item, or why it can't. */
.summary-cell-remove { margin: 6px 0 4px; font-size: 12px; line-height: 1.35; white-space: normal; text-transform: none; letter-spacing: normal; }
.summary-cell-remove-why { display: block; color: var(--text-dim); font-style: italic; font-weight: 400; }
.summary-cell-dialog .summary-cell-remove { margin: 4px 0; }
.summary-char-row { cursor: pointer; }
.summary-char-row:hover td.summary-char-sticky { background: #2d2a45; }
.summary-char-label-head { display: flex; align-items: flex-start; gap: 6px; }
.summary-char-chevron { flex: 0 0 auto; width: 10px; color: var(--text-dim); }
.summary-char-label-text { min-width: 0; word-break: break-word; }
.summary-char-label-song .summary-char-label-text { color: var(--accent-text); }
.summary-char-label-after { padding-left: 20px; }
.summary-char-label-after .summary-char-label-text { font-weight: 500; font-style: italic; color: var(--text-dim); }
.summary-char-detail { margin: 6px 0 2px 16px; font-weight: 400; font-size: 12px; line-height: 1.45; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.summary-char-detail[hidden] { display: none; }
.summary-char-detail-empty { font-style: italic; color: var(--text-dim); }
.summary-char-notes-row td { background: #ffffff05; }
.summary-char-notes-row td.summary-char-sticky { background: var(--bg-panel); }
.summary-char-input { display: block; resize: none; overflow: hidden; min-height: 28px; line-height: 1.35; font-family: inherit; }
.summary-char-noview { color: var(--text-dim); }
/* A character's cell in a scene / item row: blank until clicked, then green "In Scene" / "In Item"
   (in the item's All list); click a green one to write what they do. */
.summary-char-cell[title] { cursor: pointer; }
.summary-char-cell.summary-char-blank[title]:hover { background: #ffffff0d; }
.summary-char-cell-body { min-height: 24px; padding: 2px 4px; white-space: pre-wrap; word-break: break-word; line-height: 1.35; }
.summary-char-cell.summary-char-in { background: rgba(34, 197, 94, 0.18); box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.45); }
.summary-char-cell.summary-char-in[title]:hover { background: rgba(34, 197, 94, 0.28); }
.summary-char-cell-label { color: #86efac; font-size: 12px; font-weight: 600; text-align: center; padding-top: 4px; }
.summary-char-edit-input {
  display: block; width: 100%; box-sizing: border-box; min-height: 28px; padding: 4px 6px; resize: none; overflow: hidden;
  font: inherit; font-size: 13px; line-height: 1.35; color: var(--text);
  background: var(--bg); border: 1px solid #22c55e; border-radius: 6px;
}
.summary-char-edit-input:focus { outline: none; }
/* These description boxes are rich (contenteditable) fields so a character can be mentioned in them. */
.summary-char-edit-input, .summary-doc-chars-input, .details-summary-chars-input { white-space: pre-wrap; word-break: break-word; }
.summary-char-edit-input[contenteditable]:empty:before,
.summary-doc-chars-input[contenteditable]:empty:before,
.details-summary-chars-input[contenteditable]:empty:before { content: attr(data-placeholder); color: var(--text-dim); font-style: normal; }
.summary-doc-chars-input[contenteditable]:empty:before { color: #999999; font-style: italic; }
.summary-char-cell-body .char-ref-token, .summary-char-edit-input .char-ref-token { font-weight: 600; }
/* The "who's in this scene / song?" dialog (openSummaryMembersDialog). */
.summary-members-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; max-height: 50vh; overflow-y: auto; margin: 8px 0 4px; }
.summary-members-item { font-size: 13px; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.summary-members-item input:disabled { cursor: default; }

/* By Scene (buildSummaryDocScene) reads like the script itself: one continuous white A4-ish
   page, Times, dark text — the same house style as the printed page, just without the cue
   margin or the two-column grid (nothing here has cues). */
.summary-doc-page {
  /* width:100% (not just max-width) because #lines-list is a column flex container —
     without an explicit width, this flex item's auto-stretch was resolving to roughly
     half its available space instead of filling it (a flex sizing quirk, not content-
     driven), leaving the "page" much narrower than the Script view's own. */
  width: 100%; max-width: 8.27in; margin: 0 auto; padding: 1in; box-sizing: border-box;
  background: #ffffff; color: #111111; border-radius: 8px; box-shadow: 0 4px 24px #00000055;
  font-family: "Times New Roman", Times, serif; font-size: calc(12pt * var(--text-scale, 1)); line-height: 1.5;
}
.summary-doc-act-heading {
  margin: 40px 0 24px; font-size: calc(16pt * var(--text-scale, 1)); font-weight: 700; text-align: center;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.summary-doc-act-heading-first { margin-top: 0; }
.summary-doc-scene { margin-bottom: 28px; }
.summary-doc-scene-heading {
  font-size: calc(14pt * var(--text-scale, 1)); font-weight: 700; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.summary-doc-scene-heading-left { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.summary-doc-scene-number { white-space: nowrap; }
.summary-doc-scene-subtitle-input {
  font-family: inherit; font-size: calc(14pt * var(--text-scale, 1)); font-weight: 700; color: inherit; background: transparent;
  border: none; border-bottom: 1px solid transparent; padding: 0 2px; flex: 1 1 auto; min-width: 0;
}
.summary-doc-scene-subtitle-input:hover, .summary-doc-scene-subtitle-input:focus { border-bottom-color: #cccccc; outline: none; }
.summary-doc-scene-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
/* Dark enough to read on the white page (was light grey at 60% opacity). */
.summary-doc-scene-move, .summary-doc-scene-remove, .summary-doc-song-move, .summary-doc-song-remove {
  opacity: 1; font-size: 14px; padding: 2px 7px; border: 1px solid #00000033; border-radius: 4px; background: #00000008;
}
.summary-doc-scene-move { color: #374151; }
.summary-doc-scene-move:hover:not(:disabled) { color: #111111; opacity: 1; }
.summary-doc-scene-remove { color: #374151; }
.summary-doc-scene-remove:hover:not(:disabled) { color: #b91c1c; opacity: 1; }
.summary-doc-scene-move:disabled, .summary-doc-scene-remove:disabled { opacity: 0.35; cursor: not-allowed; }
.summary-scene-text, .summary-scene-text-display {
  display: block; width: 100%; box-sizing: border-box; background: transparent; border: none;
  font-family: inherit; font-size: calc(12pt * var(--text-scale, 1)); line-height: 1.5; color: inherit; padding: 0;
  white-space: pre-wrap; word-break: break-word;
}
.summary-scene-text:focus { outline: none; }
.summary-scene-text[contenteditable]:empty:before { content: attr(data-placeholder); color: #8a8a8a; }
/* A character mentioned in a summary (see openCharacterInsertModal/Ctrl+Alt+C) — plain
   text, same as everything around it; contentEditable="false" (not this rule) is what makes
   it a single non-editable, single-backspace-deletable unit. */
.char-ref-token { cursor: pointer; border-radius: 3px; font-weight: 700; }
/* A mention can be clicked to select it (it then shows a highlight), and carries a "(Not in Scene)"
   note in italics when marked as not being there. */
.char-ref-token.selected { background: #8b5cf633; outline: 1px solid #8b5cf6; }
.char-ref-token .char-ref-note { font-style: italic; font-weight: 400; }
.summary-doc-member { display: inline-flex; align-items: center; }
.summary-doc-member-group .summary-doc-member-name { font-style: italic; }
.summary-doc-member-x {
  margin-left: 4px; padding: 0 3px; border: none; background: transparent; cursor: pointer;
  font-size: 10px; line-height: 1; color: #999999; border-radius: 3px;
}
.summary-doc-member-x:hover { color: #b91c1c; background: #dc262622; }
.summary-doc-obj:not(.selected) .summary-doc-member-x { display: none; }
/* The Insert Character modal (openCharacterInsertModal) — existing characters to pick from,
   plus (with Edit Script) a button to add whoever was typed as a brand new one. */
.char-insert-list { max-height: 220px; overflow-y: auto; margin: 4px 0 12px; }
.char-insert-add-new { width: 100%; margin-bottom: 12px; text-align: center; }
/* A musical number within a scene's summary (buildSummaryDocSongPart) — on its own line,
   like the script's own Song Title, dividing "before" from "after"; a real, live line, not
   prose, so its title is editable in place and it carries move/delete controls. */
.summary-doc-song {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 10px 0; padding: 4px 0; border-top: 1px dashed #cccccc; border-bottom: 1px dashed #cccccc;
}
.summary-doc-song-left { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.summary-doc-song-number { font-weight: 700; white-space: nowrap; }
.summary-doc-song-label { font-weight: 700; }
.summary-doc-song-name-input {
  font-family: inherit; font-size: calc(12pt * var(--text-scale, 1)); font-weight: 700; color: inherit; background: transparent;
  border: none; border-bottom: 1px solid transparent; padding: 0 2px; flex: 1 1 auto; min-width: 0;
}
.summary-doc-song-name-input:hover, .summary-doc-song-name-input:focus { border-bottom-color: #cccccc; outline: none; }
.summary-doc-song-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.summary-doc-song-move { color: #374151; }
.summary-doc-song-move:hover:not(:disabled) { color: #111111; opacity: 1; }
.summary-doc-song-remove { color: #374151; }
.summary-doc-song-remove:hover:not(:disabled) { color: #b91c1c; opacity: 1; }
.summary-doc-song-move:disabled, .summary-doc-song-remove:disabled { opacity: 0.35; cursor: not-allowed; }
/* The By Scene page shows only what is written until you click a scene or a song (see
   selectSummaryObject): then that object — and only that one — gets its prompts and buttons
   (empty boxes to write in, "+ Add character…", move / delete) and a tint with a bar down the
   side. Its text stays editable either way. */
.summary-doc-obj { margin: 0 -10px; padding: 2px 10px; border-left: 3px solid transparent; border-radius: 6px; }
.summary-doc-obj.selected { background: #8b5cf617; border-left-color: #8b5cf6; }
.summary-doc-obj:not(.selected) .summary-doc-scene-actions,
.summary-doc-obj:not(.selected) .summary-doc-song-actions,
.summary-doc-obj:not(.selected) .summary-doc-chars-add,
.summary-doc-obj:not(.selected) .summary-doc-empty,
.summary-doc-obj:not(.selected) .summary-doc-scene-subtitle-input:placeholder-shown { display: none; }
.summary-doc-obj:not(.selected) .summary-doc-chars:not(:has(.summary-doc-chars-line)) { display: none; }
/* A blank line between a song's own summary and its "what happens next" text. */
.summary-doc-after-gap { margin-top: 1.5em; }
/* The characters in a scene / song, in a row under its name with a divider between each; click to edit the list. */
.summary-doc-members { display: flex; flex-wrap: wrap; align-items: center; margin: 2px 0 8px; font-size: calc(11pt * var(--text-scale, 1)); line-height: 1.5; color: #333333; border-radius: 4px; }
/* A divider before every name and after the last, so the list reads | A | B | C | (and | A | for one). */
.summary-doc-member { padding: 0 10px; border-left: 1px solid #b5b5b5; }
.summary-doc-member:last-child { border-right: 1px solid #b5b5b5; }
.summary-doc-members-prompt { font-style: italic; color: #888888; }
.summary-doc-members-editable { cursor: pointer; }
.summary-doc-members-editable:hover { background: #8b5cf61a; }
.summary-doc-obj:not(.selected) .summary-doc-members-empty { display: none; }
/* The row of who is present after a song sits above its "what happens next" text, after a blank line;
   the text's own gap is dropped when that row is showing so the blank line isn't doubled. */
.summary-doc-members-label { margin-right: 8px; font-style: italic; color: #777777; }
.summary-doc-members-after { margin-top: 1.5em; }
.summary-doc-members-after + .summary-doc-after-gap { margin-top: 0; }
.summary-doc-obj:not(.selected) .summary-doc-members-after.summary-doc-members-empty + .summary-doc-after-gap { margin-top: 1.5em; }
/* What each character does, right after the text for its area (buildCharSummaryEditor). */
.summary-doc-chars { margin: 2px 0 10px 18px; font-size: calc(11pt * var(--text-scale, 1)); color: #444444; }
.summary-doc-chars-line { display: flex; align-items: baseline; gap: 6px; margin: 2px 0; }
.summary-doc-chars-name { flex: 0 0 auto; font-style: normal; }
.summary-doc-chars-input, .summary-doc-chars-text {
  flex: 1 1 auto; min-width: 0; font: inherit; font-style: italic; color: inherit; line-height: 1.4;
}
.summary-doc-chars-input {
  background: transparent; border: none; border-bottom: 1px solid transparent; padding: 0 2px;
  resize: none; overflow: hidden; display: block;
}
.summary-doc-chars-input:hover, .summary-doc-chars-input:focus { border-bottom-color: #cccccc; outline: none; }
.summary-doc-chars-text { white-space: pre-wrap; }
.summary-doc-chars-add { margin-top: 2px; font: inherit; font-size: calc(10pt * var(--text-scale, 1)); color: #666666; background: transparent; border: 1px dashed #bbbbbb; border-radius: 4px; padding: 1px 4px; }
/* On a phone the page's 1 inch margins (96px a side) would leave only a sliver for the text,
   so they shrink to a small gutter and the text uses the width there is. */
@media (max-width: 860px) {
  .summary-doc-page { padding: 18px 12px; border-radius: 6px; font-size: calc(11pt * var(--text-scale, 1)); }
  .summary-doc-act-heading { font-size: calc(14pt * var(--text-scale, 1)); margin: 28px 0 16px; }
  .summary-doc-scene-heading { font-size: calc(12.5pt * var(--text-scale, 1)); flex-wrap: wrap; }
  .summary-doc-scene-subtitle-input { font-size: calc(12.5pt * var(--text-scale, 1)); }
  .summary-scene-text, .summary-scene-text-display, .summary-doc-song-name-input { font-size: calc(11pt * var(--text-scale, 1)); }
  .summary-doc-obj { margin: 0 -6px; padding: 2px 6px; }
  .summary-doc-chars { margin-left: 6px; }
  .summary-doc-chars-line { flex-wrap: wrap; gap: 2px 6px; }
  .summary-doc-chars-input, .summary-doc-chars-text { flex-basis: 12em; }
}

.character-note-block { margin-bottom: 12px; }
.character-note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.character-note-name { font-weight: 700; font-size: 13px; }
.character-note-text { font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; color: var(--text); background: var(--bg-panel-2); border-radius: 6px; padding: 8px 10px; }

/* The By Character cell that has focus — it acts on the next click (see gateClick). */
.summary-character-table td.summary-char-cell:focus { outline: 2px solid #8b5cf6; outline-offset: -2px; }

/* By Character on a phone / narrow screen (renderSummaryByCharacterPage sets .summary-character-narrow and
   gives the row-title column and one character column half the screen each — the table scrolls sideways to
   the other characters): smaller text, and no column resizing. */
@media (max-width: 860px) {
  .summary-character-narrow .summary-character-table th,
  .summary-character-narrow .summary-character-table td { font-size: 11px; line-height: 1.3; }
  .summary-character-narrow .summary-character-table th { padding: 4px 6px; }
  .summary-character-narrow .summary-character-table td { padding: 3px 4px; }
  .summary-character-narrow .summary-char-label { font-size: 11px; }
  .summary-character-narrow .summary-char-label-head { gap: 3px; }
  .summary-character-narrow .summary-char-label-after { padding-left: 8px; }
  .summary-character-narrow .summary-char-cell-body { font-size: 11px; padding: 1px 2px; }
  .summary-character-narrow .summary-char-cell-label { font-size: 10px; }
  .summary-character-narrow .summary-char-detail { font-size: 10.5px; margin-left: 8px; }
  .summary-character-narrow .summary-char-input { font-size: 11px; min-height: 22px; }
  .summary-character-narrow .tracker-col-resize-handle { display: none; }
}
/* The box a By Character cell is edited in on a narrow screen: the full width of the screen and a third of its
   height, along the top (buildCellDialog). */
.summary-cell-dialog-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, 0.4); }
.summary-cell-dialog {
  position: absolute; top: 0; left: 0; width: 100%; height: 33.34vh; height: 33.34dvh; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--bg-panel); border-bottom: 2px solid #22c55e; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.summary-cell-dialog-head { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.summary-cell-dialog-title { flex: 1 1 auto; min-width: 0; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-cell-dialog-input {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; box-sizing: border-box; padding: 6px 8px;
  font: inherit; font-size: 16px; line-height: 1.4; color: var(--text);
  background: var(--bg); border: 1px solid #22c55e; border-radius: 6px;
  white-space: pre-wrap; word-break: break-word;
}
.summary-cell-dialog-input:focus { outline: none; }
.summary-cell-dialog-input[contenteditable]:empty:before { content: attr(data-placeholder); color: var(--text-dim); }
.summary-cell-dialog-input .char-ref-token { font-weight: 600; }

/* Summary view > Characters list: the tick box saying whether the character has a column in By Character. */
/* The Bold / Italic / Underline buttons are a group of their own on the second toolbar. */
.tool-format-group { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; flex: 0 0 auto; }
.tool-section-group { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; flex: 0 0 auto; }
.tool-section-group .tool-btn { padding: 7px 9px; gap: 6px; }
.tool-format-group[hidden], #menu-format[hidden], .tool-section-group[hidden], #menu-section[hidden] { display: none !important; }
.tool-format-group .tool-label { display: none; }
.tool-format-group #btn-insert-mention .tool-label { display: inline; }
.tool-format-group #btn-insert-mention { --nav-color: #34d399; --nav-tint: #34d39930; }
.tool-format-group #btn-insert-mention { padding: 7px 9px; gap: 6px; }
/* A cast mention (a character's name put in with Insert Character): the text of its line on the page, bold gold
   while that line is being edited. */
.rich-line:focus .char-mention { font-weight: 700; color: #c8960c; }
/* Settings > Lyric Tags */
.lyric-tags-list { display: flex; flex-direction: column; gap: 6px; max-width: 520px; margin-top: 12px; }
.lyric-tag-row { display: flex; align-items: center; gap: 6px; }
.lyric-tag-row .tracker-text-input { flex: 1 1 auto; min-width: 0; }
.lyric-tag-number { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; cursor: pointer; }

.parallel-spacer { display: block; height: 0; margin: 0; padding: 0; pointer-events: none; user-select: none; }

/* ===== Audio view (Sound Script, Radio Mic Allocation, Snapshots) ===== */
/* The Sound Script is one fixed page at a time: the pane neither pads nor scrolls (see audioPaginate). */
.script-pane.script-pane-audio { padding: 0; overflow: hidden; display: flex; }
.script-pane-audio .script-pane-inner { max-width: none; width: 100%; min-height: 0; height: 100%; flex: 1 1 auto; }
.script-pane-audio #scene-header { display: none; }
.script-pane-audio #lines-list { min-height: 0; flex: 1 1 0; }
.audio-view {
  --audio-scale: var(--text-scale, 1); /* the shared text size — the A−/A+ pair in the menu bar */
  flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: transparent; color: #111;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.audio-topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; background: var(--bg-panel); border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text);
}
.audio-title { font-weight: 700; font-size: 14pt; white-space: nowrap; }
.audio-barhint { flex: 1 1 auto; min-width: 0; color: var(--accent-text); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-tools { display: flex; gap: 6px; }
.audio-topbar { position: relative; z-index: 6; }
.audio-banner { position: absolute; top: 100%; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 6px 14px; background: var(--accent-2); color: #fff; font-size: 14px; box-shadow: 0 4px 12px #00000066; }
.audio-banner[hidden] { display: none; }
.audio-hint { flex: 0 0 auto; padding: 6px 14px; font-size: 13px; color: var(--text-dim); background: #14161b; border-bottom: 1px solid var(--border); }
.audio-viewport { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; touch-action: pan-y; }
/* The page: laid out like the script's — a white A4-style page, with the cue margin in a dark panel to its right. */
.audio-page-body {
  --lm: 15em;        /* left margin: the DCAs, then the snapshots and notes */
  --dcaw: 7.4em;
  --rm: 3em;         /* white space to the right of the text */
  --gap: 1.75em;
  --cuecol: 21em;
  position: relative; box-sizing: border-box; min-height: 100%;
  width: 100%; max-width: 80em; margin: 0 auto;
  font-family: "Times New Roman", Times, serif; font-size: calc(12pt * var(--audio-scale)); line-height: 1.3; color: #111;
}
.audio-page-body::before {
  content: ""; position: absolute; z-index: 0; top: 0; bottom: 0; left: 0; right: calc(var(--gap) + var(--cuecol));
  background: #fff; box-shadow: 0 4px 24px #00000055;
}
.audio-page-body::after {
  content: ""; position: absolute; z-index: 0; top: 0; bottom: 0; right: 0; width: var(--cuecol);
  background: #0c0d10; border-radius: 8px;
}
.audio-editing .audio-page-body::before { box-shadow: 0 0 0 3px #8b5cf6aa, 0 4px 24px #00000055; }
.audio-b { position: relative; z-index: 1; box-sizing: border-box; padding: 2px 0 17px; }
.audio-off { display: none !important; }
.audio-b-act, .audio-b-scene { padding-right: calc(var(--gap) + var(--cuecol)); }
.audio-b-act { text-align: center; font-size: 16pt; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 1.1em; padding-bottom: .9em; }
.audio-b-scene { font-size: 14pt; font-weight: 700; text-transform: uppercase; line-height: 1.4; padding-left: var(--lm); padding-top: 4px; padding-bottom: 12px; }
.audio-scene-label { margin-right: 4px; }
.audio-line { display: grid; grid-template-columns: var(--lm) minmax(0, 1fr) calc(var(--rm) + var(--gap)) var(--cuecol); align-items: start; }
.audio-margin { grid-column: 1; display: grid; grid-template-columns: var(--dcaw) minmax(0, 1fr); align-items: stretch; align-self: stretch; padding-left: .6em; box-sizing: border-box; }
.audio-main { grid-column: 2; min-width: 0; position: relative; }
.audio-cuecell { grid-column: 4; position: relative; align-self: start; }
/* The DCAs can use the whole margin — they spill over into the snapshot column — and a snapshot or note that would
   land on them is moved down below them (audioLayoutMargins). */
.audio-snapzone { position: relative; min-width: 0; grid-column: 2; grid-row: 1; }
.audio-dcazone { min-width: 0; grid-column: 1 / -1; grid-row: 1; position: relative; z-index: 1; pointer-events: none; }
.audio-dcazone > * { pointer-events: auto; }
/* Dialogue, lyrics and directions as the script has them */
.audio-name { text-align: center; text-transform: uppercase; font-size: 12pt; padding: 2px 0; }
.audio-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: 2px 0; margin: 0 12px; }
.audio-lyric { text-transform: uppercase; letter-spacing: 0.02em; }
.audio-parallel { display: grid; row-gap: 0; align-items: start; }
.audio-parallel .audio-text { margin: 0; }
.audio-part-sep { border-left: 1px solid #00000022; padding-left: 12px; }
.audio-direction { text-align: center; font-style: italic; color: #555; white-space: pre-wrap; padding: 2px 0; }
.audio-direction .audio-text { margin: 0; padding: 0; }
.audio-songtitle { padding-left: 60px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; }
.audio-songtitle .audio-text { display: inline; margin: 0; padding: 0; }
.audio-musicend { padding-left: 60px; text-align: right; font-style: italic; }
.audio-musicend .audio-text { display: inline; margin: 0; padding: 0; }
.audio-t-songtitle .audio-main { padding-top: 6px; }
.audio-dir-hidden .audio-direction { opacity: .4; text-decoration: line-through; }
.audio-paren { display: none; }
.audio-paren-hidden { opacity: .4; text-decoration: line-through; }
.audio-eye { position: absolute; right: -2.7em; top: 0; width: 2.5em; padding-left: 0; padding-right: 0; text-align: center; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 11px; font-style: normal; padding-top: 1px; padding-bottom: 1px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-panel-2); color: var(--text); cursor: pointer; }
/* Words that carry a cue (green), a snapshot (red) or a note (purple), as the script colours a cue's word */
.audio-w-cue { color: #0d9668; font-weight: 700; }
.audio-w-snap { color: #dc2626; font-weight: 700; }
.audio-w-note { color: #7c3aed; font-weight: 700; }
.audio-w-end { display: inline-block; position: relative; width: .9em; margin-right: -.9em; height: 1em; vertical-align: baseline; pointer-events: none; }
.audio-editing .audio-w-end { pointer-events: auto; }
.audio-editing .audio-w-end::after { content: "•"; position: absolute; left: .1em; bottom: 0; color: #999; }
.audio-w-end-marked { width: .7em; margin-left: .25em; margin-right: 0; height: .9em; border-bottom: 3px solid currentColor; }
.audio-w-end-marked::after { content: none !important; }
.audio-w-end.audio-w-cue { color: #0d9668; } .audio-w-end.audio-w-snap { color: #dc2626; } .audio-w-end.audio-w-note { color: #7c3aed; }
.audio-editing .audio-w, .audio-editing .audio-snapitem, .audio-editing .audio-note { cursor: pointer; }
.audio-editing .audio-w:hover { background: #00000014; border-radius: 3px; }
.audio-moving .audio-w:hover { background: #8b5cf655; border-radius: 3px; }
/* "Add a page point": any line or heading can be picked */
.audio-pointing .audio-b { cursor: pointer; }
.audio-pointing .audio-b:hover { outline: 2px dashed #8b5cf6; outline-offset: -2px; background: #8b5cf61f; }
/* DCA circles — one set for each speaker; hidden (but still holding their space) while the same speaker carries on */
.audio-dcas, .audio-dca-set { display: flex; align-items: flex-start; flex-wrap: wrap; gap: .2em; max-width: 100%; }
.audio-dcas { row-gap: .15em; justify-content: flex-end; }
/* The numbers sit against the dialogue (right-justified in the margin) with their circles level along each row, whatever is written under them; snapshots stay left-justified. */
.audio-dca-set { justify-content: flex-end; margin-left: auto; row-gap: .25em; width: 100%; }
.audio-dcas-same:not(.audio-force) { visibility: hidden; }
/* A long dialogue or lyric split over several blocks (audioLineBlock / audioSplitOversize): a piece that goes on
   after a blank line leaves that blank line's space under it; one cut mid-way does not. The speaker's name is only
   repeated (with "(cont.)") where a page opens in the middle of the line. */
.audio-seg-more { padding-bottom: 1.3em; }
.audio-seg-more.audio-seg-mid { padding-bottom: 2px; }
.audio-name-cont:not(.audio-force) { display: none; }
.audio-dca {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 2.05em; height: 2.05em; border-radius: 50%; border: .1em solid #15803d; color: #14532d;
  background: #bbf7d0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-weight: 800; font-size: .95em; line-height: 1;
}
.audio-dca-missing { border-style: dashed; color: #777; border-color: #999; background: #fff; }
/* A DCA circle with its short label underneath (the voice types, or an abbreviated character name). */
.audio-dca-item { display: inline-flex; flex-direction: column; align-items: center; gap: .1em; flex: 0 0 auto; }
.audio-dca-abbr {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-weight: 700; font-size: .9em; line-height: 1;
  color: #14532d; white-space: nowrap; text-align: center;
}
/* More than one letter: turned 90° counter-clockwise, reading upwards. */
.audio-dca-abbr-turned { writing-mode: vertical-rl; transform: rotate(180deg); line-height: 1.1; }
/* A simultaneous line: each part's DCAs sit beside that part's own character name. */
.audio-name-par { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: .15em .5em; }
.audio-name-par .audio-name-text { align-self: center; }
.audio-name-par .audio-dcas { justify-content: flex-start; flex: 0 0 auto; width: auto; }
.audio-name-par .audio-dca-set { width: auto; margin-left: 0; justify-content: flex-start; }
/* "Leave the DCAs on": a green line down the left of the DCA numbers, first line to last */
.audio-group-line { fill: none; stroke: #16a34a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.audio-group-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: none; }
.audio-editing .audio-group-hit { pointer-events: stroke; cursor: pointer; }
.audio-snap {
  display: inline-flex; flex-direction: column; max-width: 100%; box-sizing: border-box;
  border: .12em solid #dc2626; background: #fff1f1; color: #b91c1c; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 800; font-size: .72em; padding: .1em .45em; border-radius: 3px; line-height: 1.25; letter-spacing: .02em;
}

.audio-snapitem { max-width: 100%; box-sizing: border-box; padding-bottom: 2px; }
.audio-note {
  display: inline-block; max-width: 100%; box-sizing: border-box; margin: .12em 0; padding: .05em .5em; border-radius: 3px;
  background: #f3e8ff; border: 1px solid #8b5cf6; color: #4c1d95; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: .72em; line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere;
}
.audio-note-above, .audio-note-below { display: block; width: fit-content; margin-left: 12px; }
/* The cue margin: the real script's own pieces (see .cue-margin-grid) with the description as text */
.audio-cuecell { padding: 8px 10px; }
.audio-cue-desc { align-self: center; min-width: 0; padding: 3px 6px; font-size: 12px; color: #e9ebf0; overflow-wrap: anywhere; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.audio-go { cursor: default; align-self: stretch; display: flex; align-items: center; }
.audio-cuecell .cue-margin-grid { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.audio-connectors { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; z-index: 2; }
.audio-connector { fill: none; stroke-width: 1.5; }
.audio-connector-snap { stroke: #dc2626; }
.audio-connector-note { stroke: #7c3aed; }
/* Too narrow for the margin beside the page: the cues go under the line, as the script does. */
.audio-stacked { --lm: 7.6em; --dcaw: 100%; --rm: 0em; --gap: 0em; --cuecol: 0em; }
.audio-stacked::before { right: 0; }
.audio-stacked::after { display: none; }
/* White space to the right of the text, as on the wide page (wider while editing, for the show/hide button that sits in it). */
.audio-stacked .audio-b { padding-right: 1.4em; }
.audio-editing .audio-stacked .audio-b { padding-right: 3em; }
.audio-stacked .audio-b-scene { padding-left: .8em; }
.audio-stacked .audio-line { grid-template-columns: var(--lm) minmax(0, 1fr); }
.audio-stacked .audio-margin { display: flex; flex-direction: column; gap: 3px; }
.audio-stacked .audio-dcazone, .audio-stacked .audio-snapzone { grid-column: auto; grid-row: auto; }
.audio-stacked .audio-cuecell { grid-column: 2; margin: 4px 0 4px; background: #0c0d10; border-radius: 6px; display: flex; flex-direction: column; gap: 6px; }
.audio-stacked .audio-cuecell:empty { display: none; padding: 0; }
.audio-stacked .audio-snapzone { display: flex; flex-direction: column; gap: 3px; }
.audio-pagebar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-panel); border-top: 1px solid var(--border); color: var(--text); }
.audio-pagebtn, .audio-eye, .audio-tools .btn { touch-action: manipulation; }
.audio-pagebtn { flex: 0 0 auto; min-width: 150px; min-height: 52px; font-size: 18px; white-space: nowrap; }
.audio-pagemid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; color: var(--text-dim); }
.audio-status { text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-jump { width: auto; max-width: 100%; font-size: 13px; }
.audio-menu {
  position: fixed; z-index: 3000; min-width: 200px; max-height: 70vh; overflow-y: auto; padding: 4px;
  background: var(--bg-panel); border: 1px solid #444b5a; border-radius: 8px; box-shadow: 0 8px 28px #000a;
}
.audio-menu-item { display: block; width: 100%; text-align: left; padding: 8px 12px; border: none; border-radius: 5px; background: none; color: var(--text); font-size: 14px; cursor: pointer; }
.audio-menu-item:hover { background: var(--bg-panel-2); }
.audio-menu-item:disabled { opacity: .4; cursor: default; }
.audio-menu-head { padding: 6px 12px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }/* dialogs */
.audio-dialog-hint { margin-bottom: 10px; line-height: 1.4; }
/* The window shown while the radio mics are filled in automatically (audioOpenProgress): a bar that slides to and fro
   to show something is going on — it can't say how far along it is. */
.audio-progress-bar { position: relative; height: 6px; border-radius: 3px; background: var(--bg-panel-2); overflow: hidden; margin: 6px 0 12px; }
.audio-progress-bar span { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 3px; background: var(--accent); animation: audio-progress-slide 1.2s ease-in-out infinite alternate; }
@keyframes audio-progress-slide { from { left: 0; } to { left: 65%; } }
@media (prefers-reduced-motion: reduce) { .audio-progress-bar span { animation: none; left: 0; width: 100%; opacity: 0.5; } }
.audio-dialog-actions { flex-wrap: wrap; }
.audio-dialog-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--text-dim); }
.audio-dialog-select { width: 100%; }
.audio-dialog-check { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 10px; font-size: 13px; }
.audio-place-choices { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0 14px; font-size: 14px; }

.audio-auto-list { max-height: 46vh; overflow-y: auto; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.audio-auto-row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.audio-auto-row:last-child { border-bottom: none; }
.audio-auto-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* Settings > Audio and the empty states */
.audio-setting-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 14px; }
.audio-setting-label { min-width: 180px; }
.audio-count-input { width: 90px; margin: 0; }
.audio-nomics { margin: 10px 0 16px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 8px; color: var(--text-dim); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Radio Mic Allocation */
.modal-box .audio-dialog-hint { font-size: 12.5px; color: var(--text-dim); }
.audio-mic-table { border-collapse: separate; border-spacing: 0; }
.audio-mic-table th.audio-mic-rowhead, .audio-mic-table .audio-mic-colhead { text-transform: none; letter-spacing: normal; }
.audio-mic-table th.audio-mic-rowhead { position: sticky; left: 0; z-index: 2; min-width: 240px; max-width: 300px; text-align: left; background: var(--bg-panel); font-weight: 600; vertical-align: top; }
.audio-mic-table thead th { background: var(--bg-panel); }
.audio-mic-table thead th.audio-mic-rowhead { z-index: 3; }
.audio-mic-colhead { min-width: 130px; text-align: left; }
.audio-mic-acthead td { background: var(--bg-panel-2); color: var(--accent-text); font-weight: 700; padding: 6px 10px; }
/* The act's name cell is held at the left like the item names; its text may run on over the cell beside it. */
.audio-mic-acthead td.audio-mic-actname { position: sticky; left: 0; z-index: 2; white-space: nowrap; overflow: visible; }
.modal-box:focus { outline: none; }
.audio-mic-label { display: block; padding-right: 26px; }
.audio-mic-scene { display: block; font-weight: 400; }
.audio-mic-row th { position: relative; }
.audio-mic-plus { position: absolute; right: 4px; top: 4px; opacity: .55; }
.audio-mic-row:hover .audio-mic-plus { opacity: 1; }
.audio-mic-custom th { font-weight: 400; background: #20232b; }
.audio-mic-custom .audio-mic-change-name { width: calc(100% - 52px); min-width: 120px; }
.audio-mic-changeicon { color: var(--accent-text); margin-right: 6px; }
.audio-mic-cell { min-width: 130px; vertical-align: top; font-size: 13px; border-left: 1px solid var(--border); padding: 4px 8px; }
.audio-mic-editable { cursor: pointer; }
.audio-mic-editable:hover { background: var(--bg-panel-2); }
.audio-mic-editable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.audio-mic-cell { position: relative; }
.audio-mic-manual::after { content: "✎"; position: absolute; top: 3px; right: 6px; font-size: 11px; color: var(--accent-text); opacity: .7; }
.audio-mic-changecell { color: var(--accent-text); font-style: italic; font-weight: 600; }
.audio-mic-interval th, .audio-mic-interval td { background: var(--bg-panel-2); color: var(--text-dim); }
.audio-dialog-check { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; }
.audio-dialog-problem { margin-top: 10px; padding: 8px 10px; border-radius: 6px; background: #7f1d1d55; color: #fecaca; font-size: 13px; }
.audio-mic-dup { background: #7f1d1d55; }
.audio-mic-who { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.audio-mic-dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); }
.audio-mic-cast { margin-left: 15px; color: var(--text-dim); font-size: 12px; }
.audio-mic-undecided { color: #fbbf24; }
.audio-assign-select { width: auto; max-width: 100%; margin: 4px 0 2px 16px; font-size: 12px; }
/* Snapshots */
.audio-snap-table td, .audio-snap-table th { vertical-align: top; }
.audio-snap-first { white-space: nowrap; }
.audio-snap-table .tracker-text-input { min-width: 110px; }
.audio-snap-dcahead { min-width: 110px; }
.audio-snap-dca { min-width: 110px; border-left: 1px solid var(--border); }
.audio-snap-where { min-width: 180px; max-width: 260px; }
.audio-snap-wherelabel { font-weight: 600; }
.audio-snap-tools { display: flex; gap: 2px; margin-top: 4px; }
.audio-snap-tools .icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; }
.audio-snap-show svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.audio-snap-static { font-size: 12px; cursor: default; }
.audio-snap-actions { white-space: nowrap; }
.audio-snap-orphan td { color: var(--text-dim); }
.audio-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 3px 2px 0; padding: 1px 4px 1px 3px; border-radius: 12px; background: var(--bg-panel-2); border: 1px solid var(--border); font-size: 12px; }
.audio-chip-mic { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.audio-chip-unset { color: var(--text-dim); font-style: italic; }
.audio-chip-x { background: none; border: none; padding: 0 3px; color: var(--text-dim); font-size: 11px; cursor: pointer; }
.audio-chip-x:hover { color: var(--text); }
.audio-chip-add { margin: 2px 0; padding: 0 8px; border: 1px dashed var(--border); border-radius: 10px; background: none; color: var(--text-dim); font-size: 12px; cursor: pointer; }
.audio-chip-add:hover { border-color: var(--accent); color: var(--text); }
@media (max-width: 860px) {
  .audio-pagebtn { min-width: 0; flex: 0 0 auto; font-size: 15px; padding-left: 12px; padding-right: 12px; }
  .audio-pagebar { gap: 8px; padding: 8px 10px; }
  .audio-pagemid { flex: 1 1 0; }
  .audio-pagemid .audio-jump { display: none; }
  .audio-barhint { display: none; }
}

/* Radio Mic Allocation and Snapshots: the table scrolls inside the page, with its first row and column held. */
.script-pane.script-pane-audio-table { overflow: hidden; display: flex; }
.script-pane-audio-table .script-pane-inner { height: 100%; min-height: 0; flex: 1 1 auto; }
.script-pane-audio-table #lines-list { min-height: 0; flex: 1 1 0; }
.audio-mics-page, .audio-snaps-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.audio-table-scroll { flex: 1 1 0; min-height: 0; overflow: auto; }
.audio-mic-table, .audio-snap-table { overflow: visible; border-collapse: separate; border-spacing: 0; }
.audio-mic-table thead th, .audio-snap-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-panel); }
.audio-mic-table thead th.audio-mic-rowhead { z-index: 4; }
.audio-snap-table th.audio-snap-first { position: sticky; left: 0; z-index: 4; }
.audio-snap-table td.audio-snap-first { position: sticky; left: 0; z-index: 1; background: var(--bg-panel); }
/* The Where column is held too, just right of the first (whose width is fixed so it knows where). */
.audio-snap-table .audio-snap-first { width: 112px; min-width: 112px; max-width: 112px; box-sizing: border-box; }
.audio-snap-table thead th:nth-child(2), .audio-snap-table tbody td.audio-snap-where { position: sticky; left: 112px; box-shadow: 4px 0 6px -4px #000a; }
.audio-snap-table thead th:nth-child(2) { z-index: 4; }
.audio-snap-table tbody td.audio-snap-where { z-index: 1; background: var(--bg-panel); }
/* View size — the magnifier (table zoom) or A−/A+ (text size) pair at the right of the menu bar, just left of
   Undo/Redo (setupViewSize in app.js). It takes over the "push to the far edge" margin Undo normally has,
   so Undo/Redo and the details toggle still ride along beside it. */
.view-size { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: 0 0 auto; }
.view-size[hidden] { display: none; }
.view-size:not([hidden]) + #btn-undo { margin-left: 0; }
.view-size .menu-btn { min-width: 34px; justify-content: center; }
.view-size .menu-btn:disabled { opacity: 0.35; cursor: default; }
.view-size .view-size-text { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 15px; line-height: 1; }
.view-size .view-size-text small { font-size: 11px; }
/* The dot between the pair: filled in the accent colour at normal size (100%), an empty ring otherwise. */
.view-size .view-size-normal { min-width: 0; padding: 6px 6px; }
.view-size-dot {
  display: block; width: 9px; height: 9px; border-radius: 50%; box-sizing: border-box;
  border: 1.5px solid var(--text-dim); background: transparent;
}
.view-size-normal:hover .view-size-dot { border-color: var(--text); }
.view-size-normal.at-normal .view-size-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px #a78bfa33; }
/* Character families (Cast > Characters: the family headings and the Family column). --fam-color is the family's colour. */
.char-family-chip {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  line-height: 1.5; vertical-align: middle; white-space: nowrap; color: var(--fam-color, var(--text-dim));
  border: 1px solid var(--fam-color, var(--border)); background: color-mix(in srgb, var(--fam-color, #9ca3af) 14%, transparent);
}
.wham-character-heading .char-family-chip { font-size: 12px; }
/* The Characters list, grouped under each family's name. */
.character-family-heading {
  margin: 10px 0 2px 8px; padding: 2px 0 2px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fam-color, var(--text-dim)); border-left: 3px solid var(--fam-color, var(--border));
}
.character-family-heading-none { color: var(--text-dim); }
.details-cast-family { margin: 8px 0 2px 0; }
/* A family's name folds its characters away when clicked (familyFold in app.js): a ▾ / ▸ in front of the name. */
.family-fold-head { cursor: pointer; user-select: none; }
.family-fold-head:hover { background: var(--bg-panel-2); }
.family-fold-chevron { display: inline-block; flex: 0 0 auto; width: 12px; margin-right: 2px; text-transform: none; }
.family-folded { display: none !important; }
/* The family names in the "Who's in this …?" box (a grid) run across all its columns. */
.summary-members-family { grid-column: 1 / -1; margin: 6px 0 0 0; }
.summary-members-family:first-child { margin-top: 0; }
.cast-characters-view .character-family-heading { margin-left: 0; margin-top: 16px; font-size: 12px; }
.character-family-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; }
.character-row .char-family-select { flex: 0 0 auto; width: auto; max-width: 150px; font-size: 12px; }
.char-family-swatch { flex: 0 0 auto; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid var(--bg-panel-2); cursor: pointer; }
.char-family-swatch:disabled { cursor: default; }
.char-family-palette { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px 34px; }
.char-family-palette[hidden] { display: none; }
.char-family-palette-swatch { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.char-family-palette-swatch:hover { border-color: var(--text); }
.char-family-palette-swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-panel); }
.char-family-member-x { padding: 0 6px; font-size: 15px; line-height: 1.2; color: var(--text-dim); background: transparent; border: none; border-radius: 999px; cursor: pointer; }
.char-family-member-x:hover { color: var(--danger); background: #ffffff14; }
.char-family-elsewhere { color: var(--text-dim); font-style: italic; font-size: 12px; }

/* A family's name in the Characters list: an input styled as the heading, so a click edits it. */
.character-family-heading-input {
  width: calc(100% - 4px); padding: 1px 4px; margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit;
  color: inherit; background: transparent; border: 1px solid transparent; border-radius: 4px; cursor: text;
}
.character-family-heading-input:hover, .character-family-heading-input:focus { background: var(--bg-panel-2); border-color: var(--border); outline: none; }
/* A selected character's right-hand panel: the groups and family lists. */
.char-family-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px solid var(--border); }
.char-family-detail-row:first-child { border-top: none; }
.char-family-detail-name { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.details-character-head .character-family-dot { margin-right: 8px; align-self: center; }
.details-character-head .character-family-dot { display: inline-block; vertical-align: middle; }

.char-family-filter { margin: 4px 0 8px; font-weight: 600; color: var(--fam-color, var(--text)); }
.char-family-filter-note { margin-top: 0; }

/* The line count beside a character is a button: click it for the scenes and songs those lines are in. */
button.character-line-count { border: 1px solid transparent; font-family: inherit; line-height: 1.3; cursor: pointer; }
button.character-line-count:hover:not(:disabled) { color: var(--accent-text); border-color: var(--accent); }
button.character-line-count:disabled { cursor: default; }
.char-lines-list { display: flex; flex-direction: column; gap: 2px; max-height: 55vh; overflow-y: auto; margin: 6px 0 12px; }
.char-lines-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  padding: 6px 10px; font: inherit; font-size: 14px; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.char-lines-row:hover, .char-lines-row:focus-visible { background: var(--bg-panel-2); border-color: var(--accent); outline: none; }
.char-lines-scene { font-weight: 700; margin-top: 6px; }
.char-lines-scene:first-child { margin-top: 0; }
.char-lines-song { padding-left: 28px; font-weight: 400; color: var(--accent-text); }
.char-lines-label { min-width: 0; overflow-wrap: anywhere; }
.char-lines-count { flex: 0 0 auto; font-size: 12px; font-weight: 400; color: var(--text-dim); }

/* Cast > Characters: the Cast column (requested or actual) and the switch above the list. */
.character-cast-toolbar { margin: 0 0 8px; }
.character-cast-count {
  flex: 0 0 auto; min-width: 58px; padding: 1px 8px; font-size: 12px; text-align: center; white-space: nowrap;
  color: var(--text); background: var(--bg-panel-2); border-radius: 10px;
}
.character-cast-count.none { color: var(--text-dim); }
.cast-characters-view .character-row .char-family-select { max-width: 112px; }
.cast-characters-view .character-name-wrap { min-width: 90px; }

/* Cast > Characters as a table (buildCharactersList with opts.page): fixed columns so the names, families, counts and
   buttons line up. The family drop-down becomes an icon button (and a dialog) when the page is narrow. */
.characters-page-list { max-width: 980px; }
.cast-characters-view { container-type: inline-size; container-name: charchars; }
.characters-table { table-layout: auto; width: 100%; }
.characters-table td { vertical-align: middle; padding: 5px 8px; }
.characters-table th { white-space: nowrap; }
.characters-table .ct-head-sub { margin-left: 6px; font-size: 10px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--accent-text); }
.characters-table .ct-name { min-width: 150px; }
.characters-table .ct-family { width: 150px; }
.characters-table .ct-cast { width: 84px; text-align: center; }
.characters-table .ct-lines { width: 64px; text-align: center; }
.characters-table .ct-prerec { width: 84px; text-align: center; }
.characters-table td.ct-prerec input { width: 16px; height: 16px; vertical-align: middle; cursor: pointer; }
.characters-table .ct-actions { width: 1%; white-space: nowrap; text-align: right; }
.characters-table td.ct-name { display: table-cell; }
.characters-table .character-name-wrap { display: flex; flex-direction: column; min-width: 0; }
.characters-table .ct-name .character-family-dot { display: inline-block; margin-right: 8px; vertical-align: middle; }
.characters-table td.ct-name > * { vertical-align: middle; }
.characters-table td.ct-name { white-space: nowrap; }
.characters-table td.ct-name .character-name-wrap { display: inline-flex; vertical-align: middle; width: calc(100% - 20px); }
.characters-table tr.character-row { display: table-row; margin: 0; padding: 0; border-radius: 0; cursor: pointer; }
.characters-table tr.character-row:hover td { background: var(--bg-panel-2); }
.characters-table tr.character-row.selected td { background: #8b5cf61a; }
.characters-table .character-name-input { width: 100%; font-size: 14px; }
.characters-table .char-family-select { width: 100%; max-width: none; }
.characters-table .character-cast-count, .characters-table .character-line-count { display: inline-block; }
.characters-table .ct-actions > * { vertical-align: middle; margin-left: 4px; }
.characters-heading-row td { padding: 12px 4px 4px; background: transparent; border: none; }
.characters-heading-row .character-family-heading { margin: 0; }
.characters-table-wrap { overflow-x: auto; }
.char-family-pick-btn { display: none; align-items: center; justify-content: center; width: 30px; height: 28px; padding: 0; color: var(--text-dim); }
.char-family-pick-btn.has-family { color: var(--fam-color, var(--text)); }
.char-family-pick-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@container charchars (max-width: 640px) {
  .characters-table .char-family-select { display: none; }
  .characters-table .char-family-pick-btn { display: inline-flex; }
  .characters-table .ct-family { width: 44px; text-align: center; }
  .characters-table td { padding: 5px 5px; }
}
.char-family-pick-label { display: flex; align-items: center; gap: 8px; }
.char-family-pick-row.current { border-color: var(--accent); }
.character-family-dot.none { background: transparent; border: 1.5px solid var(--text-dim); box-sizing: border-box; }
@container charchars (max-width: 640px) {
  .characters-table .ct-name { min-width: 90px; }
  .characters-table .ct-family { width: 34px; }
  .characters-table .ct-cast { width: 52px; }
  .characters-table .ct-lines { width: 40px; }
  .characters-table .ct-prerec { width: 58px; }
  .characters-table th.ct-prerec { white-space: normal; font-size: 10px; }
  .characters-table .ct-actions { width: 96px; white-space: normal; }
  .characters-table td, .characters-table th { padding-left: 3px; padding-right: 3px; }
  .characters-table .ct-actions > * { margin-left: 2px; }
  .characters-table .character-cast-count { min-width: 0; padding: 1px 5px; }
  .characters-table .ct-head-sub { display: none; }
}
@container charchars (max-width: 640px) {
  .characters-table .ct-actions { width: 1%; white-space: nowrap; }
  .characters-table .character-makegroup-btn, .characters-table .character-group-btn { min-width: 24px; padding: 0 4px; }
}
/* The requested / actual cast switch sits at the right-hand end, above the table. */
.character-cast-toolbar { justify-content: flex-end; }

/* Character family headings on the Characters page: click the name to edit it; its colour, add-characters and delete buttons show while it is being edited. */
.character-family-heading-editable { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.character-family-heading-editable .character-family-heading-input { flex: 1 1 140px; width: auto; min-width: 0; }
.character-family-heading-actions { display: none; align-items: center; gap: 6px; flex: 0 0 auto; text-transform: none; letter-spacing: normal; font-weight: 400; }
.character-family-heading-editable:focus-within .character-family-heading-actions { display: inline-flex; }
.character-family-heading-editable .char-family-palette { flex: 1 0 100%; margin: 4px 0 2px; }
.characters-empty-family-row td { padding: 6px 12px; font-size: 12px; font-style: italic; color: var(--text-dim); border: none; background: transparent; }
.cast-characters-view .add-scene-row { flex-wrap: wrap; }
.cast-characters-view .add-scene-row .add-scene-btn { white-space: nowrap; }

/* A selected character's right-hand panel (renderCharacterDetailsPane): where they appear, groups, family, cast. */
.char-detail-hint { margin: 0 0 6px; font-size: 12px; }
.details-pane .char-lines-list { max-height: none; margin: 0 0 6px; }
.details-pane .char-lines-row { font-size: 13px; padding: 4px 6px; }
.details-pane .char-lines-song { padding-left: 18px; }
.details-pane .tracker-select { width: 100%; margin-top: 6px; }
.details-pane .details-section-body > .btn.small { margin-top: 6px; }

/* In the right-hand panel the scene and song links are quieter, so the section headings above them stand out. */
.details-pane .char-lines-scene { font-weight: 400; color: #aab0bb; margin-top: 2px; }
.details-pane .char-lines-song { color: #9b92c8; }
.details-pane .char-lines-count { color: #7f8592; }
.details-pane .char-lines-row:hover .char-lines-label { color: var(--text); }
/* The "this track or a new track?" window when changing who is cast as a character. */
.cast-change-box { max-width: 560px; }
.cast-change-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel-2); cursor: pointer; }
.cast-change-option:hover:not(.disabled) { border-color: var(--accent); }
.cast-change-option.disabled { opacity: 0.55; cursor: default; }
.cast-change-option input[type="radio"] { margin-top: 4px; }
.cast-change-option .meta { font-size: 12px; margin-top: 2px; }
.cast-change-note { margin-top: 4px; font-size: 12px; color: var(--text-dim); }
.cast-change-bad { color: #fca5a5; }
.cast-change-warn { margin: 10px 0 4px; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; }
.cast-change-warn.ok { background: #34d39922; color: #6ee7b7; }
.cast-change-warn.bad { background: #f8717122; color: #fca5a5; }
.cast-change-warn ul { margin: 6px 0 0 18px; padding: 0; }

/* Casting > Enter Cast Details / Scores / Measurements (see renderCastEntryPage) */
.cast-entry-help { margin-bottom: 10px; }
.cast-entry-reveal { margin-bottom: 14px; }
.cast-entry-layout { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.cast-entry-pick { flex: 1 1 280px; min-width: 240px; max-width: 400px; }
.cast-entry-form { flex: 2 1 340px; min-width: 280px; max-width: 580px; }
.cast-entry-label { display: block; font-weight: 600; margin-bottom: 4px; }
.cast-entry-search { width: 100%; box-sizing: border-box; }
.cast-entry-list {
  margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel);
  max-height: max(240px, calc(100vh - 360px)); overflow-y: auto;
}
.cast-entry-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.cast-entry-row:last-child { border-bottom: 0; }
.cast-entry-row:hover { background: var(--bg-panel-2); }
.cast-entry-row.cast-entry-current { border-left: 3px solid var(--accent); padding-left: 7px; font-weight: 600; }
.cast-entry-row.cast-entry-hi, .cast-entry-row.cast-entry-hi:hover { background: var(--accent); color: var(--on-accent); }
.cast-entry-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.cast-entry-meta { flex: 0 0 auto; font-size: 12px; opacity: 0.75; }
.cast-entry-saved { flex: 0 0 auto; font-size: 12px; color: #34d399; }
.cast-entry-row.cast-entry-hi .cast-entry-saved { color: inherit; }
.cast-entry-empty { padding: 10px; }
.cast-entry-who { font-size: 16px; margin-bottom: 12px; }
.cast-entry-field { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 10px; }
.cast-entry-field > label { font-weight: 600; }
.cast-entry-ctl { width: 100%; box-sizing: border-box; }
.cast-entry-ctl.cast-entry-tick { width: 20px; height: 20px; justify-self: start; margin: 0; }
.cast-entry-ctl:focus, .cast-entry-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.cast-entry-error { color: #f87171; min-height: 1.2em; margin: 4px 0; }
.cast-entry-status { min-height: 1.2em; margin-bottom: 8px; }
.cast-entry-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cast-entry-actions .btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) {
  .cast-entry-field { grid-template-columns: 1fr; gap: 4px; }
  .cast-entry-pick, .cast-entry-form { max-width: none; }
}.cast-entry-chain { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; cursor: pointer; }
.cast-entry-chain input { width: 16px; height: 16px; }
.cast-entry-chain input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cast List: the table scrolls inside its own box, so the horizontal scroll bar is always at the bottom of what is on screen
   (not at the foot of a long table, out of sight) and the header row stays in view (same approach as .cast-sel-table). */
.cast-list-wrap { max-height: max(260px, calc(100vh - 300px)); overflow: auto; }
.cast-list-table { overflow: visible; border-collapse: separate; border-spacing: 0; border: 0; border-radius: 0; }
.cast-list-table th, .cast-list-table td { border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cast-list-table th:first-child, .cast-list-table td:first-child { border-left: 1px solid var(--border); }
.cast-list-table thead th { top: 0; border-top: 1px solid var(--border); }

/* Cast List: the # and Name columns stay put while the table scrolls sideways (the header row already stays on top). The frozen
   cells are opaque so what scrolls beneath doesn't show through; the corner cells sit above both. */
.cast-list-table th:nth-child(1), .cast-list-table td:nth-child(1) { width: 40px; min-width: 40px; max-width: 40px; box-sizing: border-box; position: sticky; left: 0; }
.cast-list-table th:nth-child(2), .cast-list-table td:nth-child(2) { position: sticky; left: 40px; box-shadow: 3px 0 4px -2px rgba(0, 0, 0, 0.45); }
.cast-list-table td:nth-child(1), .cast-list-table td:nth-child(2) { z-index: 1; background: var(--bg-panel); }
.cast-list-table tbody tr:nth-child(even) td:nth-child(1), .cast-list-table tbody tr:nth-child(even) td:nth-child(2) { background: #262a33; }
.cast-list-table th:nth-child(1), .cast-list-table th:nth-child(2) { z-index: 4; }
/* (someone not in the show is dimmed with opacity on the cells; a frozen cell must stay opaque, so its contents are dimmed instead) */
.cast-list-table tr.cast-out > td:nth-child(1), .cast-list-table tr.cast-out > td:nth-child(2) { opacity: 1; }
.cast-list-table tr.cast-out > td:nth-child(1) > *, .cast-list-table tr.cast-out > td:nth-child(2) > * { opacity: 0.65; }

/* Cast List on a phone: narrower frozen # and Name columns, so more of the scrolling columns shows beside them. */
@media (max-width: 720px) {
  .cast-list-table th:nth-child(1), .cast-list-table td:nth-child(1) { width: 28px; min-width: 28px; max-width: 28px; padding-left: 4px; padding-right: 4px; }
  .cast-list-table th:nth-child(2), .cast-list-table td:nth-child(2) { left: 28px; width: 110px; min-width: 110px; max-width: 110px; padding-left: 4px; padding-right: 4px; }
  .cast-list-table td:nth-child(2) .tracker-text-input { padding-left: 6px; padding-right: 6px; }
}

/* ---------- costume pieces and Costume Progress ---------- */
.costume-supplied-box { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.costume-supplied-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-dim); font-size: 11px; font-weight: 400; white-space: nowrap; }
.costume-piece-who { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.costume-was-for { color: var(--text-dim); font-size: 12px; font-style: italic; }
.costume-needs-flag { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.cast-needs-td { white-space: nowrap; }
.cast-needs-td .btn { margin-left: 8px; }
.costume-status-text { white-space: nowrap; }
.costume-status-issued { color: #16a34a; }
.costume-status-notNeeded { color: var(--text-dim); }
.costume-progress-search { width: 240px; max-width: 100%; margin: 0; }
.costume-progress-table { width: 100%; }
.costume-progress-table .costume-progress-group th { text-align: left; position: static; padding-top: 14px; white-space: normal; }
.costume-progress-summary { margin-left: 10px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-dim); }
/* Each level steps in: family, character, costume, performer (one step less in a show with no character families). */
.costume-progress-table { --cp-step: 28px; --cp-base: 10px; }
.costume-progress-table .costume-progress-family th { text-align: left; position: static; white-space: normal; padding-top: 16px; padding-left: var(--cp-base); color: var(--fam-color, var(--text-dim)); border-left: 3px solid var(--fam-color, var(--border)); font-size: 13px; }
.costume-progress-table .costume-progress-group th { padding-left: var(--cp-base); }
.costume-progress-table td.costume-progress-name { padding-left: calc(var(--cp-base) + var(--cp-step)); }
.costume-progress-table td.costume-progress-itemcell { padding-left: calc(var(--cp-base) + var(--cp-step) * 2); }
.costume-progress-table td.costume-progress-performer { padding-left: calc(var(--cp-base) + var(--cp-step) * 2 + 6px); }
.costume-progress-table.has-families .costume-progress-group th { padding-left: calc(var(--cp-base) + var(--cp-step)); }
.costume-progress-table.has-families td.costume-progress-name { padding-left: calc(var(--cp-base) + var(--cp-step) * 2); }
.costume-progress-table.has-families td.costume-progress-itemcell { padding-left: calc(var(--cp-base) + var(--cp-step) * 3); }
.costume-progress-table.has-families td.costume-progress-performer { padding-left: calc(var(--cp-base) + var(--cp-step) * 3 + 6px); }
.costume-progress-note { padding-left: 50px; }
.costume-progress-tick { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; vertical-align: middle; cursor: pointer; }
.costume-progress-group th .costume-progress-tick { margin-right: 8px; }
.costume-progress-line { display: flex; align-items: center; gap: 8px; }
.costume-piece-who .cast-photo-btn, .costume-photo-space { display: inline-flex; flex: 0 0 22px; width: 22px; justify-content: center; padding: 0; margin: 0; }
/* (a long "Not yet cast" wraps beside the photo space, not under it) */
.costume-photo-space + .meta { flex: 1 1 0; min-width: 0; }
.costume-when .props-where-list { margin: 0; }
/* The name column keeps its own width (the other columns share what is left), so long names wrap inside it. */
.costume-progress-table.cp-fixed { table-layout: fixed; }
.costume-progress-table col.cp-col-name { width: clamp(290px, 22vw, 380px); }
.costume-progress-table col.cp-col-status { width: 250px; }
.costume-progress-table.cp-measured col.cp-col-status { width: 180px; }
.costume-progress-table.cp-fixed td { overflow-wrap: anywhere; }
.costume-progress-table .costume-status { max-width: 100%; }
.costume-progress-performer .costume-piece-who { display: flex; }
.costume-progress-performer .costume-who-name { max-width: calc(100% - 50px); }
@media (max-width: 700px) {
  .costume-progress-table { --cp-step: 12px; --cp-base: 8px; }
  .costume-progress-note { padding-left: 0; }
  .costume-progress-table td.costume-progress-name .props-where-list li { max-width: 31vw; }
  .costume-progress-table col.cp-col-name { width: 190px; }
  /* (with no measurements showing, the two columns share the screen) */
  .costume-progress-table:not(.costume-without-table) { table-layout: fixed; }
  .costume-progress-table:not(.costume-without-table) td { overflow-wrap: anywhere; }
  .costume-progress-table .costume-status { width: 124px; padding-left: 4px; padding-right: 2px; }
}

/* Costumes: "Add costume items" - who and where on the left, the items and the cast on the right */
.modal-box.costume-add-box { width: 760px; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; }
.costume-add-title { flex: 0 0 auto; font-weight: 700; font-size: 16px; }
.costume-add-columns { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; align-items: start; }
.costume-add-heading { margin: 6px 0; font-weight: 700; font-size: 13px; }
.costume-add-column .who-has-list { margin-top: 0; }
.costume-add-column .who-has-scenes { margin-top: 0; }
.costume-add-column select.modal-input { margin-bottom: 8px; }
.costume-add-item { margin-bottom: 6px; }
.costume-add-line { display: flex; align-items: center; gap: 6px; }
.costume-add-line .modal-input { flex: 1 1 auto; min-width: 0; margin: 0; }
.costume-add-note { font-size: 12px; margin-top: 2px; }
.costume-add-more { margin-bottom: 10px; }
.costume-add-cast .meta { font-size: 12px; margin-bottom: 6px; }
.costume-add-sort { display: flex; align-items: center; gap: 8px; position: sticky; top: -4px; z-index: 1; background: var(--bg-panel); padding: 4px 10px; margin-top: -4px; border-bottom: 1px solid var(--border); }
.costume-add-sort button { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); cursor: pointer; text-align: left; }
.costume-add-sort button.on { color: var(--text); }
.costume-add-sort-name { flex: 1 1 auto; margin-left: 21px; }
.costume-add-sort-gender { flex: 0 0 76px; }
.costume-add-who { flex: 1 1 auto; min-width: 0; }
.costume-add-gender { flex: 0 0 76px; font-size: 12.5px; color: var(--text-dim); }
.costume-add-box .modal-actions { flex: 0 0 auto; align-items: center; padding-top: 10px; }
.costume-add-hint { margin-right: auto; font-size: 12px; }
@media (max-width: 720px) {
  .costume-add-columns { grid-template-columns: minmax(0, 1fr); }
}

/* A drop-down with tick boxes (Costume Progress: statuses) */
.tick-drop { position: relative; }
.tick-drop-button { cursor: pointer; text-align: left; white-space: nowrap; }
.tick-drop-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 200px; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px 0; box-shadow: 0 12px 30px #00000066; }
.tick-drop-panel[hidden] { display: none; }

/* A performer's status with the bin that takes them off the item; "+ Add cast" puts them back. */
.costume-status-cell { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.costume-status-cell > select { min-width: 0; }
.costume-status-cell .costume-cast-remove { flex: 0 0 auto; margin-left: auto; }
.costume-add-cast-btn { margin-top: 6px; }
.modal-box.costume-cast-box { width: 440px; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; }
.costume-cast-box .costume-add-cast { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.costume-cast-box .who-has-list { margin-top: 0; }
.costume-cast-box .modal-actions { flex: 0 0 auto; padding-top: 10px; }

/* Marking an item Cast supplied in the Add prompt; editing one from Costume Progress; "Who has no costume?". */
.costume-add-supplied { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.costume-rename-note { margin-top: 6px; }
.costume-progress-line .costume-edit-item { flex: 0 0 auto; }
@media (max-width: 720px) {
  .costume-progress-line { gap: 6px; }
  .costume-progress-table.has-families td.costume-progress-name .props-where-list li { max-width: 27vw; }
  .costume-progress-buttons .costume-show-btn { padding: 3px 8px; }
  .costume-progress-line .costume-edit-item { padding-left: 0; padding-right: 0; }
}
.costume-without-table td { vertical-align: top; }
.costume-without-name { font-weight: 600; margin-bottom: 4px; }
.costume-without-table .costume-supplied-tag { display: inline-block; margin: 0; }
.costume-without-table .costume-add-cast-btn { padding: 3px 10px; font-size: 12.5px; }
.costume-without-who { padding: 2px 0; }
.costume-without-who .costume-piece-who { display: flex; }

/* Costumes and their items */
.costume-progress-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.costume-progress-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.costume-progress-buttons .costume-show-btn { padding: 2px 10px; font-size: 12px; }
.costume-progress-costume td { vertical-align: top; border-top: 2px solid var(--border); }
.costume-progress-counts { margin-top: 4px; font-size: 12px; }
.costume-progress-itemname { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.costume-progress-itemname .costume-supplied-tag { margin-left: 0; }
.costume-progress-table .costume-progress-cast-row.deeper td.costume-progress-performer { padding-left: calc(var(--cp-base) + var(--cp-step) * 3 + 6px); }
.costume-progress-table.has-families .costume-progress-cast-row.deeper td.costume-progress-performer { padding-left: calc(var(--cp-base) + var(--cp-step) * 4 + 6px); }
.costume-overall { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; font-size: 12px; font-weight: 600; white-space: nowrap; }
.costume-overall-none { color: var(--text-dim); }
.costume-overall-part { color: #d97706; }
.costume-overall-done { color: #16a34a; }
.costume-flags { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.costume-add-name { width: 100%; margin: 0; }
.modal-box.costume-bulk-box { width: 460px; max-width: 94vw; }
.costume-bulk-list { margin: 8px 0; padding-left: 18px; max-height: 40vh; overflow-y: auto; font-size: 13px; }
/* Costume Progress: buttons that stay side by side, the search list, and the view by item */
.search-drop { position: relative; }
.search-drop-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; width: max-content; min-width: 100%; max-width: min(340px, 90vw); max-height: min(320px, 45vh); overflow-y: auto; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px 0; box-shadow: 0 12px 30px #00000066; }
.search-drop-panel[hidden] { display: none; }
.search-drop-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; width: 100%; padding: 6px 12px; border: 0; background: none; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.search-drop-row .meta { flex: 0 0 auto; font-size: 11px; }
.search-drop-row:hover, .search-drop-row.active { background: var(--bg-panel-2); }
.costume-progress-table .costume-progress-group th .costume-add-character { margin-left: 10px; padding: 2px 8px; font-size: 11px; text-transform: none; letter-spacing: 0; vertical-align: middle; }
.costume-progress-table.cp-byitem col.cp-col-character { width: 220px; }
.costume-progress-table.cp-byitem td.costume-progress-name { padding-left: var(--cp-base); }
.costume-progress-table.cp-byitem td.costume-progress-performer { padding-left: calc(var(--cp-base) + var(--cp-step)); }
.costume-use { display: flex; align-items: flex-start; gap: 6px; }
.costume-use + .costume-use { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.costume-use-words { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.costume-use .icon-btn { flex: 0 0 auto; }
.costume-progress-performer > .costume-use { margin-top: 4px; font-size: 12px; }
/* (a phone: a character's count goes under the name and its Add button) */
@media (max-width: 700px) { .costume-progress-table .costume-progress-group th .costume-progress-summary { display: block; margin: 4px 0 0 24px; } }
/* Costume Items: its buttons on the app's second toolbar, boxed in groups like the others there */
#tool-group-costumes { flex: 1 1 auto; min-width: 0; }
.costume-menubar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; min-width: 0; }
.costume-tool-group { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 2px; }
.costume-tool { white-space: nowrap; }
.costume-tool:disabled { opacity: 0.4; }
.costume-tool-search { display: inline-flex; align-items: center; gap: 6px; padding: 1px 4px 1px 8px; }
.costume-search-icon { display: flex; color: #94a3b8; }
.costume-search-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.costume-tool-search .costume-progress-search { border: 0; background: transparent; padding: 4px; margin: 0; width: 230px; font-size: 13px; }
@media (min-width: 721px) {
  .costume-tool-group, .costume-tool-search { border: 1px solid var(--group-border); border-radius: 9px; padding: 2px; background: color-mix(in srgb, var(--bg-panel-2) 45%, transparent); }
  .costume-tool-search { padding: 2px 4px 2px 8px; }
}
.costume-row-notes { margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--text-dim); }
.costume-row-note-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; }
.costume-row-notes .note-link { display: block; overflow-wrap: anywhere; }
.costume-edit-link { margin-bottom: 6px; font-size: 12px; overflow-wrap: anywhere; }
.costume-no-cast .costume-progress-tick { display: none; }
/* (the names beside the icons only where there is room) */
@media (max-width: 1100px) { .costume-tool .costume-tool-label { display: none; } .costume-tool.tick-drop-button .costume-tool-label { display: inline; } }
@media (max-width: 720px) {
  .costume-menubar { gap: 2px; }
  .costume-tool { padding: 6px 7px; }
  .costume-tool.tick-drop-button .costume-tool-label { display: none; }
  .costume-tool-search { flex: 1 1 150px; min-width: 0; padding-left: 4px; }
  .costume-tool-search .search-drop { flex: 1 1 auto; min-width: 0; }
  .costume-tool-search .costume-progress-search { width: 100%; font-size: 12px; }
}
.costume-add-measure { margin-bottom: 6px; padding: 3px 10px; font-size: 12.5px; }
/* The costume window: the cast across its whole width, wider while measurements show */
.modal-box.costume-add-box.wide { width: min(1200px, 96vw); max-width: 96vw; }
.costume-cast-section { grid-column: 1 / -1; min-width: 0; border-top: 1px solid var(--border); margin-top: 8px; }
.costume-measure-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.costume-measure-choices { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; }
.costume-measure-choices[hidden] { display: none; }
.costume-cast-wrap { margin-bottom: 6px; }
.costume-cast-table { width: 100%; }
.costume-cast-table th { white-space: normal; text-transform: none; letter-spacing: 0; }
.costume-cast-table td, .costume-cast-table th { vertical-align: middle; }
.costume-cast-table .costume-cast-tick { width: 28px; text-align: center; }
.costume-cast-name { cursor: pointer; display: block; }
.costume-sort-head { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.costume-add-box textarea.costume-edit-notes { resize: vertical; font-family: inherit; }
.costume-add-box .costume-edit-notes, .costume-add-box .costume-items-list .modal-input { width: 100%; }
.costume-add-box .costume-items-list .costume-add-line .modal-input { width: auto; }
/* Measurements: each with its name, wrapping; under the performer when that would take more than two lines */
.costume-measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 3px 6px; }
.costume-measure { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.costume-measure-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; overflow-wrap: anywhere; }
.costume-measure-value { font-size: 12.5px; overflow-wrap: anywhere; }
.costume-progress-table .costume-measure-block td { border-top: 0; padding-top: 0; }
.costume-cast-table .costume-cast-measures td { border-top: 0; padding-top: 0; }
/* The costume window: an item's ticks beside its name; the items and the cast each scroll */
@media (min-width: 701px) {
  .modal-box.costume-add-box { width: min(1060px, 96vw); max-width: 96vw; }
  .modal-box.costume-add-box.wide { width: min(1200px, 96vw); }
  .costume-add-box .costume-add-columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.costume-item-line { flex-wrap: wrap; }
.costume-add-box .costume-item-line .modal-input { flex: 1 1 180px; min-width: 0; width: auto; }
.costume-item-line .costume-flags { flex: 0 0 auto; margin: 0; }
.costume-items-scroll { overflow-y: auto; padding-right: 4px; }
.costume-cast-wrap { max-height: 38vh; overflow: auto; }
.costume-cast-table th { position: sticky; top: 0; z-index: 1; background: var(--bg-panel-2); }
.costume-cast-table.measured { table-layout: fixed; }
.costume-cast-table.measured td { overflow-wrap: anywhere; }
.costume-cast-col-tick { width: 36px; }
.costume-cast-col-name { width: 200px; }
.costume-cast-col-gender { width: 76px; }
.modal-box.costume-item-box { width: 440px; max-width: 94vw; }
.costume-area-top { grid-column: 1 / -1; }
.costume-needs-marker { background: none; border: 0; padding: 0 2px; margin: 0 0 0 -3px; font: inherit; font-size: 16px; font-weight: 700; line-height: 1; color: #fbbf24; cursor: pointer; }
.cast-name-with-mark { display: flex; align-items: center; gap: 4px; }
.cast-name-with-mark .costume-needs-marker { margin: 0; }
/* Costume Items on a narrow screen: the "i" that brings out notes and where something is used */
.costume-progress-buttons .costume-info-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 24px; align-self: center; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 999px; }
.costume-progress-buttons .costume-info-btn.has-notes { color: #fbbf24; border-color: #fbbf24; }
.costume-progress-buttons .costume-info-btn.open { background: var(--border); }
.costume-info-costume { margin-top: 6px; }
@media (max-width: 720px) { .costume-progress-buttons { gap: 4px; } .costume-progress-buttons .costume-show-btn { padding-left: 5px; padding-right: 5px; } }
.costume-progress-table thead th { white-space: normal; }
/* Costume Items: Not Required (crossed out and greyed), extra items */
.costume-off .costume-who-name, .costume-off .costume-piece-who > .meta, .costume-use-off .costume-use-words { text-decoration: line-through; color: var(--text-dim); }
.costume-off .costume-use-name { text-decoration: line-through; }
.costume-off .costume-progress-performer, .costume-off .costume-use-words { color: var(--text-dim); }
.costume-off .cast-photo-btn { opacity: .45; }
.costume-use-off .costume-use-words .meta { text-decoration: line-through; }
.costume-use .costume-add-cast-btn { margin: 0; padding: 2px 8px; font-size: 12px; flex: 0 0 auto; }
.costume-extra-tag { margin-left: 6px; text-decoration: none; }
.costume-piece-who .costume-add-extra { margin: 0; padding: 1px 7px; font-size: 11.5px; white-space: nowrap; }
.costume-extra-box .costume-flags { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; }
.costume-extra-box .modal-input { width: 100%; }
.costume-who-name .costume-needs-marker { margin: 0 0 0 3px; padding: 0; vertical-align: baseline; }
