/* Shot list (shl-). A flat working surface: scene list on the left, the grid in the middle, the
   script on the right when asked for. Colour carries meaning only:
   - a scene's strip colour (data-color = scene.stripColor: INT/EXT and time of day, as on the
     stripboard) marks scenes, their shots and frames: soft body, saturated edge tab;
   - status colours are fixed: to do gray, ready blue, shot green, cut red.
   Everything else stays neutral ink. */

.shl-layout {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

/* ----- scene list ----- */

.shl-scenes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 260px;
  width: 260px;
  min-height: 0;
  overflow: auto;
  padding: var(--s-2);
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.shl-scene {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 7px 8px 7px 12px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: var(--bw) solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.shl-scene::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  bottom: 7px;
  width: 5px;
  background: var(--c);
  border-radius: 3px;
}
.shl-scene:not([data-color])::before { display: none; }
.shl-scene:hover { background: var(--hover); }
.shl-scene.is-active {
  background: var(--surface-2);
  border-color: var(--line);
  box-shadow: 2px 2px 0 0 var(--shadow-color);
}
.shl-scene:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.shl-scene.is-omitted { opacity: 0.55; }
.shl-scene-num {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 28px;
  height: 24px;
  padding: 0 5px;
  font: 600 13px/1 var(--font-display);
  color: var(--text);
  background: var(--c-soft);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-xs);
}
.shl-scene-num.is-all { background: var(--surface-sunken); }
.shl-scene.is-active { background: var(--c-soft); }
.shl-scene.is-active:not([data-color]) { background: var(--surface-2); }
.shl-scene-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.shl-scene-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shl-scene-sub { font-size: 11.5px; color: var(--text-muted); }
.shl-scene-bar { display: block; margin-top: 3px; }
.shl-scene-count { flex: none; font-size: 11.5px; font-weight: 800; color: var(--text-2); padding-top: 3px; }
.shl-scene-select { display: none; }

/* ----- main column ----- */

.shl-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; min-height: 0; }
.shl-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--s-4) var(--s-5) var(--s-6); }
.shl-selbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 10px;
  background: var(--c-soft);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
}

/* ----- table ----- */

.shl-table-wrap { position: relative; }
.shl-table { table-layout: fixed; }
.shl-table td { vertical-align: top; }
.shl-table thead th { z-index: 2; }
.shl-table tbody td { padding-top: 4px; padding-bottom: 4px; }
.shl-table tr.is-cut td:not(.shl-num-cell):not(.shl-actions-cell) { opacity: 0.5; }
.shl-table tr.is-cut .shl-cell-text { text-decoration: line-through; }
.shl-table tr.is-selected > td,
.shl-table tr.is-selected:hover > td { background: var(--surface-sunken); }
.shl-table td.shl-num-cell { box-shadow: inset 5px 0 0 0 var(--c); padding-left: 10px; }
.shl-table tr.is-selected > td.shl-num-cell { box-shadow: inset 5px 0 0 0 var(--c), inset 8px 0 0 0 var(--text); }
.shl-table tr.is-flash > td { animation: shl-flash 1.3s ease-out; }
@keyframes shl-flash { 0%, 30% { background: var(--hover); } 100% { background: transparent; } }
.shl-table tr[data-dnd-item] { cursor: default; }
.shl-table tr.is-dragging { opacity: 0.4; }

.shl-table .shl-group > td { font-size: 13px; background: var(--c-soft); box-shadow: inset 5px 0 0 0 var(--c); padding-left: 12px; }
.shl-group-num {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  margin-right: 6px;
  padding: 0 5px;
  font: 600 13px/1 var(--font-display);
  color: var(--text);
  background: var(--c-soft);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-xs);
  box-shadow: inset 4px 0 0 0 var(--c);
}

.shl-num-cell { white-space: nowrap; }
.shl-num-cell > * { vertical-align: middle; }
.shl-grip { display: inline-grid; place-items: center; width: 14px; color: var(--text-muted); cursor: grab; }
tr:not(:hover) .shl-grip { opacity: 0.35; }
.shl-pick { display: inline-grid; place-items: center; width: 20px; height: 22px; cursor: pointer; }
.shl-pick input { width: 14px; height: 14px; margin: 0; cursor: pointer; }
.shl-label {
  display: inline-block;
  min-width: 28px;
  margin-left: 2px;
  font: 600 15px/1.2 var(--font-display);
  color: var(--text);
}

.shl-cell-text {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 4px 6px;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  resize: none;
  overflow: hidden;
}
.shl-cell-text::placeholder { color: var(--text-muted); opacity: 0.7; }
.shl-cell-text:hover { background: var(--field-bg); border-color: var(--border); }
.shl-cell-text:focus { background: var(--field-bg); border-color: var(--field-line); outline: 2px solid var(--focus); outline-offset: -1px; }
.shl-c-description .shl-cell-text { font-weight: 600; }

.shl-cell-select { position: relative; display: block; min-width: 0; }
.shl-cell-select select {
  display: block;
  width: 100%;
  height: 28px;
  padding: 0 18px 0 6px;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
  cursor: pointer;
}
.shl-cell-select::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 12px;
  border: 4px solid transparent;
  border-top-color: var(--text-muted);
  pointer-events: none;
  opacity: 0;
}
.shl-cell-select:hover::after,
.shl-cell-select:focus-within::after { opacity: 1; }
.shl-cell-select select:hover { background: var(--field-bg); border-color: var(--border); }
.shl-cell-select select:focus { background: var(--field-bg); border-color: var(--field-line); outline: 2px solid var(--focus); outline-offset: -1px; }
.shl-c-size select { font-weight: 800; }

.shl-lens { display: flex; align-items: center; gap: 2px; min-width: 0; }
.shl-lens .shl-cell-select { flex: 1 1 auto; }
.shl-lens-help {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  cursor: pointer;
}
.shl-lens-help:hover,
.shl-lens-help.is-active { color: var(--surface); background: var(--text); border-color: var(--line); }
.shl-lens-help:focus-visible { outline: 2px solid var(--focus); }

.shl-sound {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
}
.shl-sound:hover { background: var(--hover); }
.shl-sound.is-mos { color: var(--warn-text); border-style: dashed; }
.shl-time { width: 100%; }
.shl-time .input { height: 28px; }

.shl-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px 0 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--c-ink);
  background: var(--c-soft);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
  cursor: pointer;
}
.shl-status:active { transform: translate(1px, 1px); box-shadow: none; }
.shl-status:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.shl-status[data-status="shot"] { color: var(--on-candy); background: var(--c); }
.shl-status-dot { display: inline-block; flex: none; width: 8px; height: 8px; background: var(--c); border: 1px solid var(--line); border-radius: 50%; }
.shl-status.is-lg { height: 34px; padding: 0 14px; font-size: 14px; }

.shl-thumb-btn {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-xs);
  cursor: pointer;
}
.shl-thumb-btn:hover { box-shadow: 2px 2px 0 0 var(--shadow-color); }
.shl-thumb-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.shl-thumb { display: block; width: 100%; height: 100%; }
.shl-thumb.is-auto { opacity: 0.55; }
.shl-thumb-btn:hover .shl-thumb.is-auto { opacity: 0.9; }
.shl-actions-cell { text-align: right; }

/* ----- camera helper ----- */

.shl-helper { display: flex; flex-direction: column; gap: 10px; padding: 12px; font-size: 13px; }
.shl-helper-head { display: flex; align-items: center; gap: 10px; }
.shl-helper-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  color: var(--text);
  background: var(--surface-sunken);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  transform: rotate(-4deg);
}
.shl-helper-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.shl-helper-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shl-helper-lenses { display: flex; flex-wrap: wrap; gap: 4px; }
.shl-helper-lenses button {
  min-width: 34px;
  height: 24px;
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
}
.shl-helper-lenses button:hover { background: var(--hover); }
.shl-helper-lenses button.is-active { color: var(--surface); background: var(--text); border-color: var(--text); }
.shl-helper-out {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.shl-helper-out > div { display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; background: var(--surface); }
.shl-helper-out dt { color: var(--text-2); font-size: 11.5px; }
.shl-helper-out dd { margin: 0; font-size: 14px; font-weight: 700; }

/* ----- cards ----- */

.shl-cards-wrap { display: flex; flex-direction: column; gap: var(--s-5); }
.shl-cards-head {
  display: flex;
  align-items: center;
  margin-bottom: var(--s-3);
  padding: 6px 10px 6px 12px;
  font: 600 17px/1.2 var(--font-display);
  background: var(--c-soft);
  border: 1px solid var(--strip-rule);
  border-radius: var(--r-sm);
  box-shadow: inset 6px 0 0 0 var(--c);
}
.shl-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--s-4);
  align-items: start;
}
.shl-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.shl-card:hover { box-shadow: var(--shadow-md); }
.shl-card.is-selected { background: var(--surface-sunken); box-shadow: 0 0 0 3px var(--text); }
.shl-card-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 8px 3px 12px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  background: var(--c-soft);
  border-bottom: 1px solid var(--strip-rule);
  box-shadow: inset 6px 0 0 0 var(--c);
}
.shl-card-strip b { font: 600 13px/1 var(--font-display); }
.shl-card.is-cut { opacity: 0.6; }
.shl-card.is-dragging { opacity: 0.4; }
.shl-card-img {
  display: block;
  width: 100%;
  padding: 0;
  background: var(--paper);
  border: 0;
  border-bottom: var(--bw) solid var(--line);
  cursor: pointer;
}
.shl-card-img:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.shl-card-top { display: flex; align-items: center; gap: 6px; padding: 8px 6px 0 10px; }
.shl-card-label { font: 600 26px/1 var(--font-display); letter-spacing: -0.01em; }
.shl-card-pick { width: 22px; }
.shl-card-desc {
  display: -webkit-box;
  margin: 6px 10px 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.shl-card-desc.is-empty { color: var(--text-muted); font-weight: 500; font-style: italic; }
.shl-card-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px 0; }
.shl-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-sunken);
  border-radius: var(--r-pill);
}
.shl-chip.is-size { color: var(--surface); background: var(--text); font-weight: 800; }
.shl-chip.is-move { color: var(--text); background: var(--surface-sunken); border: 1px solid var(--border); }
.shl-chip.is-lens { font-variant-numeric: tabular-nums; }
.shl-card-subject { display: flex; align-items: center; gap: 5px; padding: 6px 10px 10px; font-size: 12px; color: var(--text-2); }
.shl-card-chips:last-child { padding-bottom: 10px; }

/* ----- totals ----- */

.shl-totals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px var(--s-4);
  flex: none;
  padding: 8px var(--s-5);
  font-size: 13px;
  background: var(--surface-2);
  border-top: var(--bw) solid var(--line);
}
.shl-total { display: inline-flex; align-items: center; gap: 5px; }
.shl-total b { font-size: 15px; }
.shl-total-status { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.shl-total-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  font-size: 12px;
  color: var(--c-ink);
  background: var(--c-soft);
  border-radius: var(--r-pill);
}
.shl-total-project { margin-left: auto; }

/* ----- script panel ----- */

.shl-script {
  display: flex;
  flex-direction: column;
  flex: 0 0 340px;
  width: 340px;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.shl-script-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 4px 14px; }
.shl-script-hint { padding: 0 14px 8px; }
.shl-script-text {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0 8px;
  padding: 14px 16px;
  font-family: var(--font-script);
  font-size: 13px;
  line-height: 1.5;
  color: var(--paper-ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.shl-script-text ::selection { background: color-mix(in srgb, var(--focus) 35%, transparent); color: var(--paper-ink); }
.shl-sl { position: relative; margin: 0 0 10px; padding-right: 22px; }
.shl-sl.is-scene { font-weight: 700; text-transform: uppercase; }
.shl-sl.is-character { margin: 12px 0 0; padding-left: 34%; text-transform: uppercase; }
.shl-sl.is-parenthetical { margin: 0; padding-left: 26%; }
.shl-sl.is-dialogue { padding-left: 14%; padding-right: 14%; }
.shl-sl.is-transition { text-align: right; text-transform: uppercase; }
.shl-sl-add {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  font: 800 15px/1 var(--font-ui);
  color: var(--paper-ink);
  background: var(--paper);
  border: 1px solid var(--strip-rule);
  border-radius: 50%;
  opacity: 0;
  cursor: pointer;
}
.shl-sl:hover .shl-sl-add,
.shl-sl-add:focus-visible { opacity: 1; }
.shl-sl-add:hover { color: var(--paper); background: var(--paper-ink); border-color: var(--paper-ink); }
.shl-script-foot { padding: 10px; }

/* ----- shoot mode ----- */

.shl-shoot { display: flex; flex-direction: column; gap: var(--s-4); max-width: 920px; margin: 0 auto; }
.shl-shoot-bar {
  position: sticky;
  top: calc(-1 * var(--s-4));
  z-index: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.shl-shoot-day { display: flex; flex-direction: column; gap: 3px; flex: 1 1 220px; min-width: 0; }
.shl-shoot-count { display: flex; flex-direction: column; }
.shl-shoot-big { font: 600 26px/1 var(--font-display); }
.shl-shoot-progress { flex: 1 1 100%; }
.shl-shoot-scene { display: flex; flex-direction: column; gap: 8px; }
.shl-shoot-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 12px;
  font: 600 17px/1.2 var(--font-display);
  background: var(--c-soft);
  border: 1px solid var(--strip-rule);
  border-radius: var(--r-sm);
  box-shadow: inset 6px 0 0 0 var(--c);
}
.shl-shoot-none { padding-left: 4px; }
.shl-shoot-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
  padding: 8px 10px 8px 16px;
  box-shadow: inset 6px 0 0 0 var(--c);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
}
.shl-shoot-row.is-done { background: var(--surface-sunken); border-color: var(--border); }
.shl-shoot-row.is-done .shl-shoot-text { opacity: 0.6; }
.shl-shoot-row.is-done .shl-shoot-desc { text-decoration: line-through; }
.shl-shoot-thumb {
  display: block;
  flex: none;
  width: 96px;
  overflow: hidden;
  background: var(--paper);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-xs);
}
.shl-shoot-text { flex: 1 1 auto; min-width: 0; }
.shl-shoot-label { font: 600 22px/1.1 var(--font-display); }
.shl-shoot-cam { margin-left: 6px; font: 700 12px/1 var(--font-ui); color: var(--text-2); }
.shl-shoot-desc { margin-top: 3px; font-size: 14px; line-height: 1.35; }
.shl-shoot-min { flex: none; }
.shl-done {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  min-width: 132px;
  min-height: 52px;
  padding: 0 16px;
  font: 600 16px/1 var(--font-display);
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.shl-done:hover { background: var(--hover); }
.shl-done:active { transform: translate(2px, 2px); box-shadow: none; }
.shl-done.is-done { color: var(--on-candy); background: var(--green); }
.shl-done:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ----- AI ----- */

.shl-ai { display: flex; flex-direction: column; gap: var(--s-3); }
.shl-ai-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow: auto; padding: 2px; }
.shl-ai-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.shl-ai-item.is-on { background: var(--c-soft); border-color: var(--line); }
.shl-ai-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.shl-ai-foot { align-items: center; }

/* ----- narrow screens: the scene list becomes a select, shoot mode fills the width ----- */

@media (max-width: 860px) {
  .shl-scenes { display: none; }
  .shl-scene-select { display: inline-flex; }
  .shl-script { display: none; }
  .shl-scroll { padding: var(--s-3); }
  .shl-total-project { margin-left: 0; }
}
@media (max-width: 560px) {
  .shl-shoot-thumb { display: none; }
  .shl-shoot-row { flex-wrap: wrap; }
  .shl-shoot-text { flex-basis: calc(100% - 60px); }
  .shl-done { flex: 1 1 100%; }
  .shl-helper-grid { grid-template-columns: 1fr 1fr; }
}
