/* The producer workspace: the back of house, where everything the client
   room displays is authored. Same design system, denser, because this is a
   surface that gets operated rather than read. */

/* ---- The stage rail ------------------------------------------------------ */

.ws-header {
  padding: 20px 32px 0;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface-app);
  position: sticky;
  top: 0;
  z-index: 15;
}

.ws-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* One click between authoring and seeing what the client sees. This is
   primary navigation, so it reads as a control rather than a link. */
.ws-toggle {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 3px;
  flex: none;
}
.ws-toggle a {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font: 450 10px / 1 var(--font);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-meta);
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.ws-toggle a:hover { color: var(--text-primary); }
.ws-toggle a[aria-current="page"] {
  background: var(--surface-light);
  color: var(--surface-app);
}

.stage-rail {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stage-rail::-webkit-scrollbar { display: none; }

.stage-tab {
  flex: 1;
  min-width: 132px;
  padding: 12px 4px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  border-bottom: 2px solid transparent;
  transition: border-color var(--dur-fast) var(--ease);
}
.stage-tab:hover { border-bottom-color: var(--border-strong); }
.stage-tab[aria-current="page"] { border-bottom-color: var(--text-primary); }

/* The bar carries the state; the label stays quiet. */
.stage-bar {
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--border-hairline);
}
.stage-tab.complete .stage-bar { background: var(--status-ok); }
.stage-tab.current  .stage-bar { background: var(--gradient-1); }

.stage-tab .stage-name {
  font: 450 12px / 1.25 var(--font);
  color: var(--text-meta);
  display: flex;
  align-items: center;
  gap: 7px;
}
.stage-tab.complete .stage-name,
.stage-tab.current .stage-name { color: var(--text-primary); }
.stage-tab[aria-current="page"] .stage-name { font-weight: 500; }

/* ---- The gate ------------------------------------------------------------ */

.gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-radius: var(--radius-card);
  background: var(--surface-panel);
  border: 1px solid var(--border-hairline);
}
.gate.open { border-color: var(--status-ok-border); }

/* ---- Editors ------------------------------------------------------------- */

.ws-body { padding: 26px 32px 48px; display: flex; flex-direction: column; gap: 24px; }

.ws-split { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.ws-split-even { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

.editor {
  width: 100%;
  min-height: 420px;
  padding: 22px 24px;
  border-radius: var(--radius-media);
  border: 1px solid var(--border-hairline);
  background: var(--surface-app);
  color: var(--text-body);
  font: 400 14px / 1.7 var(--font-mono);
  letter-spacing: 0;
  resize: vertical;
  tab-size: 2;
}
.editor:focus { border-color: var(--border-strong); }

/* ---- Grids (budget, shots, spec) ----------------------------------------- */

.grid-table { display: grid; width: 100%; }
.grid-table > .gt-head {
  font: 450 10px / 1.2 var(--font);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-meta);
  padding: 0 8px 10px;
  border-bottom: 1px solid var(--border-hairline);
  align-self: end;
}
.grid-table > .gt-cell {
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-hairline);
  font: 400 13px / 1.45 var(--font);
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid-table > .gt-cell.num {
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
}
.grid-table > .gt-head.num { text-align: right; justify-self: end; }
.grid-table > .gt-cell.stack-cell { flex-direction: column; align-items: flex-start; gap: 2px; }

/* An input that only looks like one when you are in it, so a dense grid
   still reads as a document. */
.cell-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  padding: 6px 8px;
  margin: -6px -8px;
  font: 400 13px / 1.45 var(--font);
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.cell-input:hover { border-color: var(--border-hairline); }
.cell-input:focus {
  border-color: var(--status-warn-border);
  background: var(--surface-app);
  outline: none;
}
.cell-input.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-input::placeholder { color: var(--text-placeholder); }

select.cell-input { cursor: pointer; }

/* ---- Storyboard ---------------------------------------------------------- */

.frames {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.frame {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-media);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.frame-well {
  aspect-ratio: 16 / 9;
  background: var(--surface-well);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.frame-number {
  position: absolute;
  top: 10px;
  left: 12px;
  font: 500 11px / 1 var(--font-mono);
  letter-spacing: 0;
  color: var(--text-meta);
}
.frame-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }

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

.day-card {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.day-shots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.shot-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-input);
  background: var(--surface-app);
  border: 1px solid var(--border-hairline);
  font: 400 12px / 1.35 var(--font);
  width: 100%;
  text-align: left;
}
.shot-chip:hover { border-color: var(--border-strong); }
.shot-chip .n {
  font: 500 11px / 1 var(--font-mono);
  letter-spacing: 0;
  color: var(--text-meta);
  min-width: 24px;
}

/* ---- Cascade flags -------------------------------------------------------- */

.flag {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 15px 18px;
  border-radius: var(--radius-media);
  background: var(--status-warn-tint);
  border: 1px solid var(--status-warn-border);
}
.flag .dot { margin-top: 5px; }

/* ---- Countdown ------------------------------------------------------------ */

.countdown-row {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--border-hairline);
}
.countdown-row:first-of-type { border-top: 0; }

/* ---- Drop zone ------------------------------------------------------------ */

.upload-zone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  padding: 34px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.upload-zone.over {
  border-color: var(--status-ok);
  background: var(--status-ok-tint);
}

.progress-track {
  height: 4px;
  width: 100%;
  border-radius: var(--radius-pill);
  background: var(--border-hairline);
  overflow: hidden;
}
.progress-track > span {
  display: block;
  height: 100%;
  background: var(--gradient-1);
  border-radius: var(--radius-pill);
  transition: width 120ms linear;
}

@media (max-width: 1100px) {
  .ws-split, .ws-split-even { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .ws-header { padding: 16px 20px 0; }
  .ws-body { padding: 20px; }
  .stage-tab { min-width: 118px; }
}

/* ---- Production calendar ---------------------------------------------------
   Six fixed rows so the grid does not jump height month to month, and a
   minimum width so a busy week is scrolled rather than squeezed. */

.cal-scroll { overflow-x: auto; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  overflow: hidden;
  min-width: 940px;
}

.cal-weekday {
  padding: 12px 12px 10px;
  font: 450 10px / 1.2 var(--font);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-meta);
  background: var(--surface-page);
  border-bottom: 1px solid var(--border-hairline);
}

.cal-day {
  min-height: 118px;
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-hairline);
  border-left: 1px solid var(--border-hairline);
  background: var(--surface-app);
}
.cal-day:nth-child(7n + 1) { border-left: 0; }
.cal-day.outside { background: var(--surface-page); }
.cal-day.outside .cal-date { opacity: .35; }
.cal-day.today { background: rgba(252, 167, 37, .06); }

.cal-date {
  font: 500 13px / 1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.cal-day.today .cal-date {
  color: var(--status-warn);
  font-weight: 700;
}

.cal-entries { display: flex; flex-direction: column; gap: 4px; }

.cal-entry {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-input);
  border: 1px solid transparent;
  font: 450 11px / 1.25 var(--font);
  overflow: hidden;
  transition: filter var(--dur-fast) var(--ease);
}
.cal-entry:hover { filter: brightness(1.15); }
.cal-entry-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-warn {
  width: 5px; height: 5px; flex: none;
  border-radius: var(--radius-pill);
  background: var(--status-risk);
}

/* ---- Files ------------------------------------------------------------------ */

.file-row {
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius-media);
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
}
.file-row.shared { border-color: var(--status-ok-border); }

.file-kind {
  width: 40px; height: 40px;
  border-radius: var(--radius-input);
  background: var(--surface-well);
  display: flex; align-items: center; justify-content: center;
  font: 450 9px / 1 var(--font);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-meta);
  flex: none;
  overflow: hidden;
}
.file-kind img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Setup groups on the shot list -------------------------------------------- */

.setup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 8px 10px;
  border-bottom: 1px solid var(--border-hairline);
}

/* Drag to reorder. The shot list's order IS the shooting order. */
.drag-row { transition: opacity var(--dur-fast) var(--ease); }
.drag-row.dragging { opacity: .35; }
.drag-row.drop-above { box-shadow: inset 0 2px 0 0 var(--status-warn); }
.drag-row.drop-below { box-shadow: inset 0 -2px 0 0 var(--status-warn); }

.grip {
  cursor: grab;
  color: var(--text-placeholder);
  font: 400 14px / 1 var(--font);
  letter-spacing: -2px;
  user-select: none;
}
.grip:active { cursor: grabbing; }

/* ---- Print: the crew-facing documents ------------------------------------------ */

@media print {
  .sidebar, .ws-header, .screen-header, .gate, .toasts, .no-print { display: none !important; }
  body { background: #fff; }
  .printable, .printable * {
    background: #fff !important;
    color: #111 !important;
    border-color: rgba(17, 17, 17, .18) !important;
  }
  .printable { padding: 0; }
  .frame-well { background: #f2f2f2 !important; }
  .console { display: block; }
}

/* ---- The AV script grid --------------------------------------------------- */

.av-head, .av-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr) 148px 76px 20px;
  gap: 14px;
  align-items: start;
}
.av-head { padding: 6px 0 8px; border-bottom: 1px solid var(--border-strong); }
.av-row { padding: 14px 0; border-bottom: 1px solid var(--border-hairline); }
.av-row[draggable="true"] { cursor: grab; }
.av-num {
  font: 500 14px / 1 var(--font-mono);
  color: var(--text-primary);
}
.av-row .cell-input {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font: 400 13.5px / 1.55 var(--font);
}
.av-row input.cell-input { min-height: 0; }
.av-well {
  width: 148px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-input);
  background: var(--surface-well);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
