/* ── PALLETS STORY MODULE CSS ──
   Styles for Script, Breakdown, and Boards tabs.
   Depends on: base.css
   ─────────────────────────────────────────────── */

/* ── STORY PANELS ── */
.story-panel {
  display: none;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.story-panel.active { display: flex; }

/* ── SCRIPT ── */
.script-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.script-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  background: var(--ws-bg);
}

.screenplay-page {
  background: #fff;
  width: 680px;
  min-height: 880px;
  padding: 72px 72px 72px 96px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.667;
  color: #1a1714;
  position: relative;
  box-shadow: 0 2px 12px rgba(26, 23, 20, 0.08);
  flex-shrink: 0;
}

.page-number {
  position: absolute;
  top: 36px;
  right: 72px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: #888;
}

.se-scene-heading { text-transform: uppercase; font-weight: 700; letter-spacing: 0.02em; }
.se-action        { white-space: pre-wrap; }
.se-character     { margin-left: 208px; text-transform: uppercase; font-weight: 700; }
.se-parenthetical { margin-left: 160px; margin-right: 120px; }
.se-dialogue      { margin-left: 120px; margin-right: 100px; white-space: pre-wrap; }
.se-transition    { text-align: right; text-transform: uppercase; font-weight: 700; }
.se-blank         { display: block; }
.page-break-hint  { width: 680px; text-align: center; font-size: 10px; color: rgba(26,23,20,0.25); font-family: var(--font-ui); letter-spacing: 0.1em; user-select: none; }

/* ── QUICK BREAKDOWN ── */
.quick-breakdown {
  width: 264px;
  flex-shrink: 0;
  background: var(--ws-surface);
  border-left: 1px solid var(--ws-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.qb-header { padding: 1rem 1rem 0.75rem; border-bottom: 1px solid var(--ws-border); flex-shrink: 0; }
.qb-title  { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-on-ws-2); }
.qb-body   { flex: 1; overflow-y: auto; padding: 0.75rem 1rem; }
.qb-footer { flex-shrink: 0; padding: 0.75rem 1rem; border-top: 1px solid var(--ws-border); display: flex; flex-direction: column; gap: 0.5rem; }

.qb-stat-label-sm { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-on-ws-2); margin-bottom: 0.3rem; }
.qb-stat { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0; border-bottom: 1px solid var(--ws-border); font-size: 12px; }
.qb-stat:last-of-type { border-bottom: none; }
.qb-stat-key { color: var(--text-on-ws-2); }
.qb-stat-val { font-weight: 600; color: var(--text-on-ws); }
.qb-stat-val.accent { color: var(--accent-text); }

.qb-scene-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--ws-border); cursor: pointer; }
.qb-scene-row:last-of-type { border-bottom: none; }
.qb-scene-row:hover .qb-scene-name { color: var(--accent-text); }
.qb-scene-num  { font-size: 9px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); width: 18px; height: 18px; border-radius: 3px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qb-scene-name { font-size: 11px; font-weight: 500; color: var(--text-on-ws); flex: 1; line-height: 1.3; }
.qb-scene-badge { font-size: 9px; font-weight: 600; padding: 2px 5px; border-radius: 3px; flex-shrink: 0; }
.int-badge { background: rgba(46,125,79,0.1); color: #2e7d4f; }
.ext-badge { background: rgba(20,90,160,0.1); color: #1a5fa0; }
.qb-char-pill { display: inline-block; font-size: 10px; font-weight: 500; padding: 3px 8px; border-radius: 4px; background: var(--ws-bg); color: var(--text-on-ws); border: 1px solid var(--ws-border); margin: 0 4px 4px 0; }

.qb-btn { font-family: var(--font-ui); font-size: 11px; font-weight: 500; padding: 7px 12px; border-radius: var(--radius-sm); cursor: pointer; text-align: center; border: 1px solid var(--ws-border); background: none; color: var(--text-on-ws-2); width: 100%; position: relative; overflow: hidden; isolation: isolate; }
.qb-btn span { position: relative; z-index: 1; pointer-events: none; }
.qb-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── BREAKDOWN ── */
.breakdown-section-label { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-on-ws-2); margin-bottom: 1rem; }
.breakdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.scene-card { background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--radius-lg); overflow: hidden; transition: box-shadow var(--transition-fast); }
.scene-card:hover { box-shadow: 0 4px 16px rgba(26,23,20,0.08); }
.scene-card-header { padding: 0.85rem 1rem; border-bottom: 1px solid var(--ws-border); display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.scene-card-num   { font-size: 10px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); padding: 2px 7px; border-radius: 4px; letter-spacing: 0.05em; flex-shrink: 0; }
.scene-card-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text-on-ws); line-height: 1.25; flex: 1; }

.scene-card-title-input {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-on-ws);
  line-height: 1.25;
  flex: 1;
  min-width: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 1px 4px;
  margin: -1px -4px;
  outline: none;
  width: 100%;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.scene-card-title-input::placeholder { color: var(--text-on-ws-2); opacity: 0.5; font-style: italic; }
.scene-card-title-input:hover { border-color: var(--ws-border); }
.scene-card-title-input:focus { border-color: rgba(240,95,0,0.35); background: rgba(255,255,255,0.5); }
.scene-card-body  { padding: 0.85rem 1rem; }
.scene-card-meta  { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.scene-card-row   { display: flex; gap: 0.35rem; align-items: center; margin-bottom: 0.35rem; font-size: 12px; }
.scene-card-row-label { font-weight: 600; color: var(--text-on-ws-2); min-width: 72px; flex-shrink: 0; }
.scene-card-row-val   { color: var(--text-on-ws); line-height: 1.4; }
.scene-card-footer { padding: 0.65rem 1rem; border-top: 1px solid var(--ws-border); display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.scene-card-footer-left { display: flex; align-items: center; gap: 0.4rem; }
.pages-pill-label { font-size: 10px; font-weight: 600; color: var(--text-on-ws-2); }
.pages-input { font-family: var(--font-ui); font-size: 11px; font-weight: 600; color: var(--text-on-ws); background: none; border: 1px solid transparent; border-radius: 3px; padding: 2px 5px; width: 52px; outline: none; transition: border-color var(--transition-fast); -moz-appearance: textfield; }
.pages-input::-webkit-outer-spin-button, .pages-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pages-input:focus { border-color: rgba(240,95,0,0.35); background: rgba(255,255,255,0.03); }
.scene-card-action { font-size: 10px; font-weight: 600; color: var(--accent-text); cursor: pointer; letter-spacing: 0.04em; white-space: nowrap; }
.scene-card-action:hover { text-decoration: underline; }

/* Editable inline fields inside breakdown cards */
.scene-card-input {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-on-ws);
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 5px;
  outline: none;
  width: 100%;
  min-width: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  line-height: 1.4;
}
.scene-card-input::placeholder { color: var(--text-on-ws-2); opacity: 0.5; }
.scene-card-input:hover { border-color: var(--ws-border); }
.scene-card-input:focus { border-color: rgba(240,95,0,0.35); background: rgba(255,255,255,0.03); }

.tag { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px; letter-spacing: 0.04em; }
.tag-int     { background: rgba(46,125,79,0.1); color: #2e7d4f; }
.tag-ext     { background: rgba(20,90,160,0.1); color: #1a5fa0; }
.tag-day     { background: rgba(212,133,10,0.12); color: #a06008; }
.tag-night   { background: rgba(80,60,140,0.1); color: #5a3ea0; }
.tag-default { background: var(--accent-soft); color: var(--accent-text); }

/* ── BOARDS ── */
.boards-layout     { display: flex; flex: 1; height: 100%; overflow: hidden; }
.boards-scene-list { width: 220px; flex-shrink: 0; border-right: 1px solid var(--ws-border); overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; background: var(--ws-surface); }
.boards-main       { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.boards-scene-item { background: var(--ws-bg); border: 1px solid var(--ws-border); border-radius: var(--radius-md); padding: 0.75rem; cursor: pointer; transition: border-color var(--transition-fast); }
.boards-scene-item:hover  { border-color: rgba(240,95,0,0.3); }
.boards-scene-item.active { border-color: var(--accent); background: rgba(240,95,0,0.04); }
.boards-scene-num  { font-size: 9px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); display: inline-block; padding: 2px 6px; border-radius: 3px; margin-bottom: 0.35rem; }
.boards-scene-name { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--text-on-ws); line-height: 1.3; }
.boards-scene-sub  { font-size: 10px; color: var(--text-on-ws-2); margin-top: 0.2rem; }

.boards-panel-header { background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--radius-lg); padding: 0.85rem 1.25rem; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.boards-panel-title  { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text-on-ws); }
.boards-panel-meta   { font-size: 11px; color: var(--text-on-ws-2); margin-top: 0.15rem; }
.boards-header-right { display: flex; align-items: center; gap: 0.75rem; }

.ai-toggle    { display: flex; align-items: center; gap: 0.5rem; font-size: 11px; font-weight: 500; color: var(--text-on-ws-2); }
.toggle-switch { width: 32px; height: 18px; background: var(--ws-border); border-radius: 9px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.toggle-switch.on { background: var(--accent); }
.toggle-knob   { width: 12px; height: 12px; background: #fff; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: left 0.2s; }
.toggle-switch.on .toggle-knob { left: 17px; }

.panels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; align-items: start; }

.panel-card { background: var(--ws-surface); border: 1px solid var(--ws-border); border-radius: var(--radius-md); overflow: hidden; cursor: pointer; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.panel-card:hover    { border-color: rgba(240,95,0,0.4); box-shadow: 0 2px 12px rgba(26,23,20,0.08); }
.panel-card.dragging { opacity: 0.4; border-style: dashed; }
.panel-card.drag-over{ border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

.panel-frame { aspect-ratio: 16/9; background: #1a1814; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.panel-shot-svg   { width: 100%; height: 100%; opacity: 0.18; }
.panel-shot-label { font-size: 9px; font-weight: 700; color: rgba(245,239,230,0.2); letter-spacing: 0.12em; text-transform: uppercase; position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; }

.panel-generating-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; width: 100%; height: 100%; }
.panel-gen-spinner { width: 20px; height: 20px; border: 2px solid rgba(245,239,230,0.1); border-top-color: rgba(240,95,0,0.6); border-radius: 50%; animation: spin 0.8s linear infinite; }
.panel-gen-label   { font-size: 10px; font-weight: 500; color: rgba(245,239,230,0.4); letter-spacing: 0.06em; }

.panel-upload-btn { position: absolute; bottom: 6px; right: 6px; background: rgba(14,13,11,0.75); border: 1px solid rgba(245,239,230,0.15); border-radius: 4px; padding: 3px 7px; font-size: 9px; font-weight: 600; color: rgba(245,239,230,0.5); cursor: pointer; font-family: var(--font-ui); transition: all var(--transition-fast); backdrop-filter: blur(4px); }
.panel-upload-btn:hover { border-color: var(--accent); color: var(--accent-text); }

.panel-info       { padding: 0.55rem 0.7rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.panel-info-left  { flex: 1; min-width: 0; }
.panel-num        { font-size: 9px; font-weight: 700; color: var(--accent-text); letter-spacing: 0.08em; margin-bottom: 0.15rem; }
.panel-desc       { font-size: 11px; color: var(--text-on-ws); line-height: 1.4; margin-bottom: 0.3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel-tags       { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.panel-tag        { font-size: 9px; font-weight: 600; padding: 2px 5px; border-radius: 3px; background: var(--ws-bg); color: var(--text-on-ws-2); }
.panel-ai-btn     { flex-shrink: 0; background: none; border: 1px solid var(--ws-border); border-radius: 4px; padding: 3px 7px; font-size: 9px; font-weight: 600; color: var(--text-on-ws-2); cursor: pointer; transition: all var(--transition-fast); margin-top: 1px; }
.panel-ai-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.panel-ai-btn.generating { border-color: var(--accent-soft); color: var(--accent-text); animation: pulse 1.5s ease-in-out infinite; }

.add-panel-wrap { aspect-ratio: 16/9; position: relative; }
.add-panel-btn  { position: absolute; inset: 0; border: 2px dashed var(--ws-border); border-radius: var(--radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; cursor: pointer; background: none; width: 100%; height: 100%; transition: border-color var(--transition-fast), background var(--transition-fast); }
.add-panel-btn:hover { border-color: var(--accent); background: rgba(240,95,0,0.03); }
.add-panel-icon { font-size: 22px; color: var(--ws-border); line-height: 1; transition: color var(--transition-fast); }
.add-panel-btn:hover .add-panel-icon { color: var(--accent); }
.add-panel-text { font-size: 10px; font-weight: 600; color: var(--text-on-ws-2); letter-spacing: 0.04em; }

.boards-empty      { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 3rem; }
.boards-empty-icon { font-size: 36px; opacity: 0.15; }
.boards-empty-title{ font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-on-ws); opacity: 0.5; }
.boards-empty-sub  { font-size: 12px; color: var(--text-on-ws-2); text-align: center; max-width: 240px; line-height: 1.5; }
.boards-empty-btn  { margin-top: 0.5rem; font-family: var(--font-ui); font-size: 11px; font-weight: 600; padding: 8px 18px; border-radius: var(--radius-sm); background: var(--accent); border: none; color: #fff; cursor: pointer; }

/* ── LIGHTBOX ── */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(10,9,8,0.88); z-index: 200; display: none; align-items: center; justify-content: center; padding: 2rem; }
.lightbox-overlay.open { display: flex; }

.lightbox { background: var(--modal-dark-bg); border: 1px solid var(--modal-dark-border); border-radius: var(--radius-lg); width: min(900px, 95vw); max-height: 90vh; display: flex; overflow: hidden; }

.lb-frame-col { width: 55%; flex-shrink: 0; background: #0e0d0b; display: flex; flex-direction: column; }
.lb-frame     { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; min-height: 200px; }
.lb-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.lb-frame-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; position: relative; }
.lb-frame-footer { padding: 0.65rem 1rem; border-top: 1px solid var(--modal-dark-border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.lb-panel-num { font-size: 10px; font-weight: 700; color: var(--accent-text); letter-spacing: 0.08em; }
.lb-nav       { display: flex; gap: 0.5rem; }
.lb-nav-btn   { background: none; border: 1px solid var(--modal-dark-border); border-radius: 4px; color: var(--text-on-shell-2); font-size: 14px; width: 28px; height: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast); }
.lb-nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.lb-detail-col    { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.lb-detail-header { padding: 1rem 1.25rem 0.75rem; border-bottom: 1px solid var(--modal-dark-border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.lb-scene-label   { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-on-shell-2); }
.lb-close         { background: none; border: none; color: var(--text-on-shell-2); font-size: 20px; cursor: pointer; line-height: 1; padding: 0; transition: color var(--transition-fast); }
.lb-close:hover   { color: var(--text-on-shell); }
.lb-detail-body   { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.lb-field-label   { font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-on-shell-2); margin-bottom: 0.35rem; }

.lb-shot-select { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lb-shot-opt    { font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--modal-dark-border); background: none; color: var(--text-on-shell-2); cursor: pointer; transition: all var(--transition-fast); font-family: var(--font-ui); }
.lb-shot-opt:hover  { border-color: rgba(240,95,0,0.4); color: var(--text-on-shell); }
.lb-shot-opt.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.lb-textarea { width: 100%; font-family: var(--font-ui); font-size: 12px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--modal-dark-border); background: rgba(255,255,255,0.04); color: var(--text-on-shell); resize: none; outline: none; line-height: 1.5; transition: border-color var(--transition-fast); }
.lb-textarea:focus { border-color: rgba(240,95,0,0.4); }

.lb-tags-wrap  { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 6px 8px; border: 1px solid var(--modal-dark-border); border-radius: var(--radius-sm); background: rgba(255,255,255,0.03); cursor: text; }
.lb-tag-input  { background: none; border: none; outline: none; color: var(--text-on-shell); font-family: var(--font-ui); font-size: 11px; min-width: 80px; flex: 1; padding: 2px 0; }
.lb-tag-input::placeholder { color: var(--text-on-shell-2); }
.lb-tag-chip   { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 3px; background: rgba(240,95,0,0.15); color: var(--accent-text); display: flex; align-items: center; gap: 4px; }
.lb-tag-x      { cursor: pointer; opacity: 0.6; font-size: 11px; line-height: 1; }
.lb-tag-x:hover{ opacity: 1; }

.lb-detail-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--modal-dark-border); display: flex; gap: 0.5rem; flex-shrink: 0; flex-wrap: wrap; }
.lb-btn       { font-family: var(--font-ui); font-size: 11px; font-weight: 600; padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--modal-dark-border); background: rgba(255,255,255,0.05); color: var(--text-on-shell); transition: all var(--transition-fast); flex: 1; text-align: center; }
.lb-btn:hover  { background: rgba(255,255,255,0.1); }
.lb-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.lb-btn.accent:hover { background: var(--accent-hover); }
.lb-btn.danger { border-color: rgba(192,57,43,0.4); color: #e74c3c; }
.lb-btn.danger:hover { background: rgba(192,57,43,0.15); }

/* ── SCRIPT EMPTY STATE ── */
.script-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 4rem 2rem;
  text-align: center;
  flex: 1;
}

.script-empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-on-ws);
  opacity: 0.5;
}

.script-empty-sub {
  font-size: 12px;
  color: var(--text-on-ws-2);
  max-width: 280px;
  line-height: 1.5;
}

.script-empty-btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  background: var(--accent);
  color: #fff;
  margin-top: 0.25rem;
  transition: background var(--transition-fast);
}

.script-empty-btn:hover { background: var(--accent-hover); }

.script-empty-btn.secondary {
  background: none;
  border: 1px solid var(--ws-border);
  color: var(--text-on-ws-2);
}

.script-empty-btn.secondary:hover {
  background: var(--ws-surface);
  color: var(--text-on-ws);
}

/* ── DIFF OVERLAY ── */
.diff-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: var(--ws-bg);
  z-index: 100;
  flex-direction: column;
  overflow: hidden;
}

.diff-overlay.open { display: flex; }

.diff-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--ws-surface);
  border-bottom: 1px solid var(--ws-border);
  flex-shrink: 0;
}

.diff-header-left { flex: 1; min-width: 0; }

.diff-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-on-ws);
  margin-bottom: 0.2rem;
}

.diff-sub {
  font-size: 11px;
  color: var(--text-on-ws-2);
  line-height: 1.5;
}

.diff-header-right {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
}

.diff-btn {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ws-border);
  background: none;
  color: var(--text-on-ws-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.diff-btn span { position: relative; z-index: 1; }
.diff-btn:hover { background: var(--ws-bg); color: var(--text-on-ws); }
.diff-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.diff-btn.accent:hover { background: var(--accent-hover); }
.diff-btn.danger { border-color: rgba(192,57,43,0.35); color: #c0392b; }
.diff-btn.danger:hover { background: rgba(192,57,43,0.08); }

.diff-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.diff-stats {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.diff-stat {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.diff-stat.removed { background: rgba(192,57,43,0.1); color: #c0392b; }
.diff-stat.added   { background: rgba(46,125,79,0.1); color: #2e7d4f; }
.diff-stat.kept    { background: var(--accent-soft); color: var(--accent-text); }

.diff-script {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--ws-border);
  padding: 2rem 2.5rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.8;
}

/* Diff line base */
.diff-line {
  position: relative;
  padding: 1px 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-height: 1.8em;
}

.diff-line.blank { min-height: 0.9em; }

/* Type-based indentation (mirrors screenplay layout) */
.diff-line.diff-type-scene_heading { font-weight: 700; text-transform: uppercase; }
.diff-line.diff-type-character     { padding-left: 208px; font-weight: 700; text-transform: uppercase; }
.diff-line.diff-type-parenthetical { padding-left: 160px; }
.diff-line.diff-type-dialogue      { padding-left: 120px; }
.diff-line.diff-type-transition    { justify-content: flex-end; font-weight: 700; text-transform: uppercase; }
.diff-line.diff-type-action        { white-space: pre-wrap; }

/* Status colours */
.diff-line.added   { background: rgba(46,125,79,0.06); border-radius: 3px; }
.diff-line.removed { background: rgba(192,57,43,0.08); border-left: 3px solid rgba(192,57,43,0.5); padding-left: 8px; border-radius: 0 3px 3px 0; }
.diff-line.dismissed { display: none; }

.diff-badge {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
  align-self: center;
}

.diff-badge.removed { background: rgba(192,57,43,0.15); color: #c0392b; }
.diff-badge.added   { background: rgba(46,125,79,0.15); color: #2e7d4f; }

.diff-line-text { flex: 1; min-width: 0; }

.diff-line-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.diff-line:hover .diff-line-actions { opacity: 1; }

.diff-line-btn {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all var(--transition-fast);
}

.diff-line-btn.keep   { border: 1px solid rgba(46,125,79,0.4); color: #2e7d4f; background: none; }
.diff-line-btn.keep:hover { background: rgba(46,125,79,0.12); }
.diff-line-btn.remove { border: 1px solid rgba(192,57,43,0.4); color: #c0392b; background: none; }
.diff-line-btn.remove:hover { background: rgba(192,57,43,0.12); }

/* ── EXPORT MODAL BODY STYLES ── */
.export-section { display: flex; flex-direction: column; gap: 0.75rem; }
.export-section-label { font-size: 9px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-on-shell-2); }
.export-divider { height: 1px; background: var(--modal-dark-border); margin: 0.25rem 0; }
.export-option-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.export-option-row.stacked { flex-direction: column; align-items: stretch; }
.export-option-info { flex: 1; min-width: 0; }
.export-option-title { font-size: 13px; font-weight: 500; color: var(--text-on-shell); }
.export-option-sub { font-size: 11px; color: var(--text-on-shell-2); margin-top: 0.15rem; line-height: 1.4; }
.export-btn {
  font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  padding: 7px 16px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--modal-dark-border); background: rgba(255,255,255,0.06);
  color: var(--text-on-shell); white-space: nowrap; flex-shrink: 0;
  transition: background var(--transition-fast);
}
.export-btn span { position: relative; z-index: 1; }
.export-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.export-btn.accent:hover { background: var(--accent-hover); }
.export-controls { display: flex; flex-direction: column; gap: 0.75rem; }
.export-control-group { display: flex; flex-direction: column; gap: 0.35rem; }
.export-control-label { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-on-shell-2); }
.export-toggle-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.export-toggle {
  font-family: var(--font-ui); font-size: 11px; font-weight: 500;
  padding: 4px 12px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--modal-dark-border); background: none;
  color: var(--text-on-shell-2); transition: all var(--transition-fast);
}
.export-toggle:hover { border-color: rgba(240,95,0,0.4); color: var(--text-on-shell); }
.export-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── BOARDS PANEL HEADER REDESIGN ── */
.boards-panel-header {
  padding: 1rem 1.25rem 0.75rem;
  background: var(--ws-surface);
  border-bottom: 1px solid var(--ws-border);
  flex-shrink: 0;
}

.boards-panel-header-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.boards-panel-num {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--accent);
  color: #fff;
  padding: 2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
}

.boards-panel-name-input {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-on-ws);
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 5px;
  outline: none;
  flex: 1;
  min-width: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.boards-panel-name-input:hover { border-color: var(--ws-border); }
.boards-panel-name-input:focus { border-color: rgba(240,95,0,0.35); background: rgba(255,255,255,0.5); }

.boards-scene-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.boards-bd-row { display: flex; gap: 0.35rem; align-items: baseline; font-size: 11px; }
.boards-bd-label { font-weight: 600; color: var(--text-on-ws-2); white-space: nowrap; }
.boards-bd-val { color: var(--text-on-ws); }

/* ── PANEL CARD ACTIONS ── */
.panel-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.panel-action-btn {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid rgba(245,239,230,0.15);
  background: rgba(245,239,230,0.06);
  color: rgba(245,239,230,0.6);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.panel-action-btn:hover { background: rgba(245,239,230,0.12); color: var(--text-on-shell); }

/* ── BREAKDOWN CARD SPACING FIX ── */
.scene-card-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.scene-card-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 12px;
  min-height: 24px;
}

.scene-card-row-label {
  font-weight: 600;
  color: var(--text-on-ws-2);
  min-width: 76px;
  flex-shrink: 0;
  font-size: 11px;
}

.scene-card-row-val {
  color: var(--text-on-ws);
  line-height: 1.4;
  font-size: 12px;
}

/* ── MOBILE STORY MODULE FIXES ── */
@media (max-width: 768px) {
  /* Tabbar — scrollable, compact */
  .tabbar { padding: 0 0.5rem; gap: 0; }
  .tab { padding: 0.7rem 0.6rem; font-size: 11px; }
  .tabbar-right { gap: 0.25rem; flex-shrink: 0; }
  .tab-action-btn { padding: 4px 8px; font-size: 9px; }

  /* Hide QB on mobile — it overlaps the script */
  .quick-breakdown { display: none !important; }
  .script-layout { flex-direction: column; }
  .script-scroll { flex: 1; }

  /* Screenplay page — narrow */
  .screenplay-page { padding: 1rem; font-size: 10px; line-height: 1.5; }
  .se-character { padding-left: 40%; }
  .se-parenthetical { padding-left: 30%; }
  .se-dialogue { padding-left: 20%; max-width: 100%; }

  /* Breakdown grid — single column */
  .breakdown-grid { grid-template-columns: 1fr !important; gap: 0.75rem; }

  /* Boards — stack scene list above panels */
  .boards-layout { flex-direction: column; }
  .boards-scene-list {
    width: 100%;
    max-height: 120px;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--ws-border);
  }
  .boards-scene-item {
    min-width: 120px;
    border-bottom: none;
    border-right: 1px solid var(--shell-border);
    padding: 0.5rem 0.75rem;
    flex-shrink: 0;
  }
  .boards-scene-breakdown { flex-direction: column; gap: 0.2rem; }

  /* Lightbox — stack vertically */
  .lightbox { flex-direction: column; max-height: 92vh; overflow-y: auto; }
  .lb-frame-col { width: 100%; height: 200px; flex-shrink: 0; }
  .lb-detail-col { flex: 1; }
  .lb-detail-footer { flex-wrap: wrap; gap: 0.35rem; }
}
