/* ===== Settings page ===== */
.settings-page {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: var(--s-12);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-6) 0 var(--s-4);
  margin-bottom: var(--s-2);
}

.settings-greeting h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}

.settings-sub {
  display: block;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}

.settings-section {
  margin-bottom: var(--s-6);
}

.settings-section-head {
  margin-bottom: var(--s-3);
  padding: 0 var(--s-1);
}

.settings-section-head h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}

.settings-section-head p {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
}

/* ===== Interface prefs (language + display) ===== */
.settings-prefs-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  padding: 12px 14px;
}

.settings-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.settings-pref-label {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.settings-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-2);
  min-width: 0;
}

.settings-seg-btn {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s var(--ease-out),
    color 0.12s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

.settings-seg-btn:hover:not(.is-active):not(:disabled) {
  color: var(--text);
  background: var(--surface-hover);
}

.settings-seg-btn.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.1),
    0 1px 1px rgba(0, 0, 0, 0.06);
}

.settings-seg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-network-card {
  grid-template-columns: 1fr;
}

.settings-network-seg {
  flex: 1;
}

/* Which model directs the scenes — under the key tiles. */
.api-director-row {
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.settings-pref-note {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--warning, var(--text-2));
}

@media (max-width: 540px) {
  .settings-prefs-card {
    grid-template-columns: 1fr;
  }

  .settings-seg {
    flex: 1;
  }
}

.data-panel {
  padding: var(--s-3);
}

.data-panel:hover {
  box-shadow: var(--shadow-xs);
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.data-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-width: 0;
  min-height: 100%;
}

.data-tile--danger {
  background: rgba(214, 69, 69, 0.04);
  border-color: rgba(214, 69, 69, 0.18);
}

.data-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.data-tile-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-tile-note {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.data-tile--danger .data-tile-note {
  color: var(--red);
}

.data-tile-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
  flex: 1;
}

.data-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.data-tile-actions .btn-sm {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.data-delete-btn {
  color: var(--red);
}

.data-delete-btn:hover {
  background: rgba(214, 69, 69, 0.08);
}

/* legacy row layout (unused after tile redesign) */
.data-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.data-actions-delete-btn {
  margin-inline-start: auto;
}

.data-lbl-short {
  display: none;
}

@media (max-width: 640px) {
  .data-grid {
    grid-template-columns: 1fr;
  }

  .data-tile-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* ===== Usage & Cost section ===== */
.usage-card {
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.usage-card:hover {
  box-shadow: var(--shadow-xs);
}

/* Period tabs */
.usage-tabs-bar {
  display: flex;
  align-self: flex-start;
  background: var(--surface-pressed);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}

.usage-tab {
  padding: 6px 18px;
  border-radius: calc(var(--r-sm) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition:
    color 0.12s,
    background 0.12s,
    box-shadow 0.12s;
  font-family: inherit;
  white-space: nowrap;
}

.usage-tab:hover:not(.active) {
  color: var(--text-2);
}

.usage-tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Day group header inside history table */
.usage-day-row .usage-day-header {
  padding: 10px 12px 5px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--divider);
}

.usage-month-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--s-2);
}

/* Month chip selector */
.usage-month-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--s-3);
}

.usage-month-chip {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
  white-space: nowrap;
}

.usage-month-chip:hover:not(.active) {
  border-color: var(--border-strong);
  color: var(--text-2);
}

.usage-month-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.usage-month-stats-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: var(--s-2);
}

/* Stats grid */
.usage-stats-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: var(--s-3);
}

.usage-stat-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.usage-stat-cost {
  background: var(--accent-soft);
  border-color: rgba(0, 113, 227, 0.18);
}

.usage-stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.usage-stat-cost .usage-stat-value {
  color: var(--accent);
}

.usage-stat-sub {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  line-height: 1;
  opacity: 0.75;
}

.usage-stat-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

/* History */
.usage-history-section {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.usage-history-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px var(--s-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.usage-history-head .usage-tabs-bar {
  margin-inline-start: auto;
  padding: 2px;
  gap: 1px;
}

.usage-history-head .usage-tab {
  padding: 3px 10px;
  font-size: 12px;
}

.usage-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.usage-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.usage-filter-select {
  margin-inline-start: auto;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  max-width: 220px;
  cursor: pointer;
}

.usage-filter-select:disabled {
  opacity: 0.55;
  cursor: default;
}

.usage-stat-box.is-clickable {
  cursor: pointer;
}

.usage-stat-box.is-clickable:hover {
  border-color: var(--border-strong);
}

.usage-stat-box.is-active-filter {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.usage-history-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.usage-history-count {
  font-size: 11px;
  background: var(--surface-hover);
  color: var(--text-3);
  padding: 1px 7px;
  border-radius: var(--r-pill);
}

.usage-history {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--text-2);
}

.usage-history th {
  text-align: start;
  font-weight: 600;
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.usage-th-cost {
  text-align: end;
}

.usage-history-row td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.usage-history-row:last-child td {
  border-bottom: none;
}

.usage-history-row:hover td {
  background: var(--surface-hover);
}

.usage-td-time {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.usage-type-badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-weight: 500;
  white-space: nowrap;
}

.usage-type-image {
  background: rgba(0, 180, 130, 0.1);
  color: #009966;
}

.usage-type-video {
  background: rgba(130, 80, 220, 0.1);
  color: #8050dc;
}

.usage-type-text {
  background: var(--accent-soft);
  color: var(--accent);
}

.usage-type-speech {
  background: rgba(230, 120, 40, 0.12);
  color: #c45a10;
}

.usage-td-model {
  font-weight: 500;
  color: var(--text);
}

.usage-td-detail {
  color: var(--text-3);
  font-size: 12px;
}

.usage-cost-cell {
  font-weight: 600;
  color: var(--text);
  text-align: end;
  font-feature-settings: "tnum";
  white-space: nowrap;
}

.usage-cost-ils {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  margin-inline-start: 4px;
}

.usage-empty {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: var(--s-5) 0;
  margin: 0;
}

/* Footer */
.usage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
}

.usage-rate-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

@media (max-width: 768px) {
  .usage-card {
    padding: var(--s-3);
    gap: var(--s-3);
  }

  .usage-month-selector {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: var(--s-2);
    padding-bottom: 2px;
  }

  .usage-month-selector::-webkit-scrollbar {
    display: none;
  }

  .usage-month-chip {
    flex-shrink: 0;
  }

  /* Keep all stat boxes in one row - compact */
  .usage-stats-grid {
    grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .usage-stat-cost {
    grid-column: auto;
  }

  .usage-stat-box {
    padding: var(--s-2);
    min-width: 0;
  }

  .usage-stat-value {
    font-size: 15px;
  }

  .usage-stat-label {
    font-size: 10px;
  }

  /* Table stays a table - scroll horizontally if needed */
  .usage-history-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .usage-history {
    min-width: 460px;
  }

  .usage-filter-select {
    margin-inline-start: 0;
    max-width: none;
    flex: 1 1 140px;
  }

  .usage-history th,
  .usage-history-row td {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* ===== Choice pills (radio-like) ===== */
.choice-pills {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.choice-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s var(--ease-out);
  font-family: inherit;
}

.choice-pill:hover {
  border-color: var(--border-strong);
}

.choice-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.choice-pill-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.choice-pill.active .choice-pill-label {
  color: var(--accent);
}

.choice-pill-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ===== Settings panel (legacy, inside workspace) ===== */
.settings-panel {
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* ===== Form sheet =====
   The shell behind the app's "fill this in" windows - פרויקט חדש, קבוצה חדשה.
   Fixed header, one scrolling body of section cards, footer pinned to the
   bottom. Shared on purpose: these windows are the first thing a user meets,
   and two private copies of the same shell drift within a week. Each window
   adds one class of its own for its width. */
.modal:has(.form-sheet),
.modal.modal-lg:has(.form-sheet) {
  max-height: min(92vh, 900px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    180deg,
    var(--surface-2) 0%,
    var(--surface) 34%,
    var(--surface) 100%
  );
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

/* New project: same width as the new-group sheet. */
.modal:has(.np-modal),
.modal.modal-lg:has(.np-modal) {
  width: min(980px, 96vw);
  max-width: min(980px, 96vw);
}

/* New project: «איך בונים את הסרטון?» — text, song, or no planning. */
.np-route-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .np-route-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* New group: name, film settings, and three photo categories. */
.modal:has(.ng-modal),
.modal.modal-lg:has(.ng-modal) {
  width: min(980px, 96vw);
  max-width: min(980px, 96vw);
}

/* Group library — the new-group sheet and the group page share this. */
.group-settings-body {
  overflow: auto;
  padding: 16px 18px 32px;
}

.gsetup {
  width: min(1080px, 100%);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ngroup-name-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ngroup-name-row .ngroup-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.ngroup-name-row .ngroup-avatar .gpick-initial {
  font-size: 22px;
}

.gsetup-cats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.gsetup-cat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--r-md) + 2px);
  background: var(--surface);
}

.gsetup-cat-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gsetup-cat-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gsetup-cat-sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
}

.gsetup-tiles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.gsetup-empty {
  font-size: 12px;
  color: var(--text-3);
  padding: 8px 2px 4px;
}

.gsetup-tile,
.gsetup-composer {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.gsetup-composer {
  grid-template-columns: 48px minmax(0, 1fr);
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.gsetup-composer-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.gsetup-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.gsetup-name {
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: start;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}

.gsetup-name-input {
  min-width: 0;
  height: 32px;
  font-size: 13px;
}

.gsetup-tile .gsetup-name-input {
  width: 100%;
}

.form-sheet-heading.form-sheet-heading--icon {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.form-sheet-title-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  flex-shrink: 0;
}

.form-sheet-heading-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.form-sheet-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.gsetup-namebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.gsetup-namebar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
}

.gsetup-namebar-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.gsetup-namebar-row .input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.btn.btn-ghost.gsetup-namebar-delete {
  width: 46px;
  height: auto;
  min-height: 0;
  padding: 0;
  align-self: stretch;
  border-radius: var(--r-md);
  color: var(--red);
  flex-shrink: 0;
}

.btn.btn-ghost.gsetup-namebar-delete:hover,
.gsetup-pchip-delete:hover {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 14%, transparent);
}

.gsetup-projects {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-top: 26px;
  margin-top: -22px;
  padding-bottom: 2px;
}

.gsetup-pchip {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: 0 0 auto;
  max-width: 176px;
  height: 26px;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
}

.gsetup-pchip-open {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 8px 0 2px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.gsetup-pchip-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  flex-shrink: 0;
}

.gsetup-pchip-delete svg {
  width: 12px;
  height: 12px;
}

.gsetup-pchip:hover {
  color: var(--text);
  border-color: var(--accent-soft-2);
  background: var(--accent-soft);
}

.gsetup-pchip-thumb {
  width: 22px;
  height: 16px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}

.gsetup-pchip-thumb img,
.gsetup-pchip-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gsetup-pchip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
}

.gsetup-addbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gsetup-addbar .btn {
  flex: 1 1 auto;
}

@media (max-width: 860px) {
  .gsetup-cats {
    grid-template-columns: 1fr;
  }
}

.form-sheet {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

/* ── Header ── */
.form-sheet-header {
  flex-shrink: 0;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 0;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--divider);
}

.form-sheet-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-sheet-header .modal-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.form-sheet-sub {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.4;
}

/* ── Body: one scroll, stacked section cards ── */
.form-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 18px;
}

.form-sheet-sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--r-md) + 2px);
  background: var(--surface);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 4%, transparent);
}

/* display:flex would otherwise beat [hidden] when a group is chosen. */
.form-sheet-sec[hidden] {
  display: none;
}

/* A section that is only a label and its field. */
.form-sheet-sec--tight {
  gap: 7px;
}

.form-sheet-sec-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.form-sheet-sec-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.form-sheet-sec-sub {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.4;
}

/* ── Pills ── */
.form-sheet-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.form-sheet-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  transition:
    border-color 0.15s var(--ease-out),
    background 0.15s var(--ease-out),
    color 0.15s var(--ease-out);
  white-space: nowrap;
}

.form-sheet-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.form-sheet-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ── Note: the one line worth reading before pressing the button ── */
.form-sheet-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}

.form-sheet-note[hidden] {
  display: none;
}

.form-sheet-note .ui-icon {
  color: var(--accent);
  margin-top: 1px;
}

/* ── Footer ── */
.form-sheet-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding: 12px 18px max(12px, env(safe-area-inset-bottom, 12px));
  border-top: 1px solid var(--divider);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

/* ===== New Project window =====
   Assembled from the style tab's own components (.style-choice, .elem-tile)
   so the window a project is BORN in matches the window it is edited in.
   Only the modal-sized spacing tweaks live here. */

/* ── Style block: modal-sized spacing for the shared style-tab controls ── */
.np-sec--style .style-choice-grid--styles {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.np-sec--style .style-choice {
  min-height: 46px;
  padding: 8px 10px;
}

.np-sec--style .style-choice--with-swatch {
  min-height: 52px;
  gap: 10px;
  padding: 7px 10px;
}

.np-sec--style .style-choice-swatch {
  width: 46px;
  height: 34px;
  border-radius: 7px;
}

.np-sec--style .style-choice--aspect {
  min-height: 62px;
  padding: 8px 6px;
}

.np-sec--style .style-prefs-grid {
  gap: 12px;
  padding-top: 12px;
}

.np-sec--style .style-section--instructions {
  padding-top: 12px;
}

.np-sec--style .style-instructions-input {
  min-height: 62px;
}

/* ===== Style Tab ===== */
/* Dual-panel fill under project header (planning-tab language). */
.content-area:has(.style-tab) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* +20px for both style panels (refs + settings), same idea as shots. */
  padding-bottom: max(0px, calc(var(--s-8) - 20px));
}

.workspace-root:has(.style-tab) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.workspace-root:has(.style-tab) > .project-header {
  flex-shrink: 0;
}

.style-tab {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: var(--s-3);
  padding-bottom: calc(var(--s-2) + env(safe-area-inset-bottom, 0px));
}

/* RTL: refs (1st) on the right, settings (2nd) on the left */
.style-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 1.15fr);
  gap: var(--s-3);
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.style-layout > .style-panel {
  min-height: 0;
  height: 100%;
}

.style-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
  min-height: 0;
  padding: var(--s-5);
  box-shadow: none;
  overflow: hidden;
}

.style-panel:hover {
  box-shadow: none;
}

.style-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  flex-shrink: 0;
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--divider);
}

.style-panel-titles {
  min-width: 0;
}

.style-panel-titles .card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.style-panel-titles .card-subtitle {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
}

.style-count-badge {
  flex-shrink: 0;
  min-width: 30px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
}

.style-panel-head-actions {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

/* ── "בדוק מה נשלח": the bytes as the image model receives them ── */
.ref-check-grid {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: var(--s-3) 0;
  max-height: 60vh;
  overflow-y: auto;
}

.ref-check-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2);
  border: 1px solid var(--divider);
  border-radius: var(--r-2);
}

.ref-check-row--bad {
  border-color: var(--danger, #e5484d);
  background: color-mix(in srgb, var(--danger, #e5484d) 8%, transparent);
}

.ref-check-thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: var(--r-2);
  /* A checkerboard makes an all-white reference obvious instead of blending
     into the modal background — the whole point of this panel. */
  background: repeating-conic-gradient(
      var(--surface-3, #ccc) 0% 25%,
      transparent 0% 50%
    )
    50% / 12px 12px;
}

.ref-check-thumb--none {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}

.ref-check-info {
  min-width: 0;
  flex: 1;
}

.ref-check-fix {
  flex-shrink: 0;
}

.ref-check-name {
  font-weight: 700;
  font-size: 13px;
}

.ref-check-detail {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
}

.ref-check-row--bad .ref-check-detail {
  color: var(--danger, #e5484d);
}

/* ── Following images (right panel) ── */
/* Avatar-style cards: round photo + clear name under it. */
.style-panel--refs {
  gap: 12px;
  padding: var(--s-4);
}

.style-panel--refs .style-panel-head {
  padding-bottom: 8px;
}

.style-panel--refs .style-panel-titles .card-title {
  font-size: 14px;
}

.style-panel--refs .style-panel-titles .card-subtitle {
  margin-top: 1px;
  font-size: 11px;
}

.style-panel--refs .style-refs-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
  margin: -2px;
}

.style-panel--refs .elem-tiles-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 8px;
  justify-content: start;
  align-content: start;
}

.style-panel--refs .elem-tile {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  box-shadow: none;
  transition: none;
}

.style-panel--refs .elem-tile:hover {
  border: none;
  box-shadow: none;
  transform: none;
}

.style-panel--refs .elem-tile-img {
  aspect-ratio: 1;
  width: min(72px, 100%);
  height: auto;
  max-width: 72px;
  border-radius: 50%;
  background: var(--surface-pressed);
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
  transition:
    border-color 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

.style-panel--refs .elem-tile:hover .elem-tile-img {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.style-panel--refs .elem-tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.style-panel--refs .elem-tile-img-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-3);
  width: 100%;
  height: 100%;
}

/* The empty / re-add state lands on the SAME element as .elem-tile-img here,
   not inside it, so the `height: 100%` above beats the avatar's aspect-ratio.
   Any tile whose neighbour wraps to a second line then stretches the circle
   into an ellipse. Restore the square explicitly; `auto` keeps it responsive
   (polish.css narrows these to 64px on small screens). */
.style-panel--refs .elem-tile-img.elem-tile-img-empty,
.style-panel--refs .elem-tile-img.elem-tile-img-readd {
  height: auto;
  aspect-ratio: 1;
}

.style-panel--refs .elem-tile-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 0 2px;
  background: transparent;
  border: none;
}

.style-panel--refs .elem-tile-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.25;
}

.style-panel--refs .elem-tile-name-hint {
  color: var(--text-3) !important;
  font-weight: 500;
}

.style-panel--refs .elem-remove-btn {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.style-panel--refs .elem-tile-add .elem-tile-img {
  border-style: dashed;
  border-width: 1.5px;
  background: var(--surface-2);
  box-shadow: none;
}

.style-panel--refs .elem-tile-add:hover .elem-tile-img {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

.style-panel--refs .elem-tile-add .elem-tile-footer {
  justify-content: center;
}

/* The add tile, split: a person on one half, a place on the other. Each half
   is its own target, so the half — not the whole circle — lights on hover. */
.style-panel--refs .elem-tile-img.elem-tile-add-split {
  display: flex;
  flex-direction: row;
  padding: 0;
}
.style-panel--refs .elem-tile-add:hover .elem-tile-img.elem-tile-add-split {
  background: var(--surface-2);
}
.style-panel--refs .elem-tile-add-half {
  flex: 1 1 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  color: var(--text-3);
  transition:
    background 0.15s var(--ease-out),
    color 0.15s var(--ease-out);
}
.style-panel--refs .elem-tile-add-half + .elem-tile-add-half {
  border-inline-start: 1.5px dashed var(--border);
}
.style-panel--refs .elem-tile-add-half:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.style-panel--refs .elem-tile-add-half-icon {
  display: inline-flex;
}
.style-panel--refs .elem-tile-add-half-label {
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.1;
}

/* A place is a rounded square; a person stays a circle. The shape is what tells
   the two apart in one grid. */
.style-panel--refs .elem-tile--place .elem-tile-img {
  border-radius: 14px;
}
.style-panel--refs .elem-tile--place .elem-tile-img img {
  object-position: center;
}
.style-panel--refs .elem-tile-kind {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--text-3);
}

/* A room reads wide, not as a head-and-shoulders square. */
.add-char-preview.add-char-preview--place {
  width: 240px;
  height: 150px;
}
.add-char-hint {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-3);
  align-self: stretch;
  margin-top: -6px;
}

/* ── Visual style settings (left panel) ── */
/* One screen: gallery, prefs, aspect and notes share the panel. No inner scroll. */
.style-panel--settings {
  overflow: hidden;
  gap: 8px;
  padding: 12px 14px 10px;
}

.style-panel--settings .style-panel-head {
  padding-bottom: 8px;
}

.style-panel--settings .style-panel-titles .card-subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.style-panel--settings .style-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, auto) auto auto;
  align-content: start;
  gap: 8px;
  padding-inline-end: 0;
}

.style-panel--settings .style-body > .style-section:first-child {
  min-height: 0;
  overflow: auto;
}

.style-panel--settings .style-section {
  gap: 4px;
  flex-shrink: 0;
}

.style-panel--settings .style-choice-grid {
  gap: 6px;
}

.style-panel--settings .style-prefs-grid {
  gap: 6px;
  padding: 8px 10px;
  flex-shrink: 0;
}

.style-panel--settings .style-choice {
  min-height: 0;
  padding: 4px 8px;
}

.style-panel--settings .style-choice--with-swatch {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  padding: 5px 10px;
  gap: 10px;
  text-align: start;
  border-radius: 12px;
}

.style-panel--settings .style-choice-swatch {
  width: 44px;
  height: 34px;
  border-radius: 8px;
}

.style-panel--settings .style-choice-label {
  font-size: 12px;
}

.style-panel--settings .style-choice-hint {
  font-size: 10px;
}

.style-panel--settings .style-choice--aspect {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  gap: 8px;
}

/* Notes stay a short field. Leftover panel space is not poured into the textarea. */
.style-panel--settings .style-section--instructions {
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 0;
  padding-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.style-panel--settings .style-instructions-input {
  flex: 0 0 auto;
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  resize: none;
  font-size: 13px;
  line-height: 1.4;
  padding: 8px 12px;
}

.style-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.style-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.02em;
  text-transform: none;
}

.style-choice-grid {
  display: grid;
  gap: 8px;
}

.style-choice-grid--styles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.style-choice-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.style-choice-grid--aspect {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.style-prefs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  padding-top: var(--s-1);
  border-top: 1px solid var(--divider);
}

/* A hairline between the three preference columns. Without it the people,
   language and community groups read as one run-on row of buttons. Season and
   aspect each span the full width on their own row, so they are excluded. */
.style-prefs-grid
  > .style-section
  + .style-section:not(.style-section--aspect):not(.style-section--season) {
  border-inline-start: 1px solid var(--divider);
  padding-inline-start: var(--s-4);
}

.style-prefs-grid .style-section--aspect,
.style-prefs-grid .style-section--season {
  grid-column: 1 / -1;
}

/* Five season values on one line. A 2-up grid inside a third of the panel
   wrapped "לפי הסצנה" and stretched the row until the sections below were
   clipped. Whole chips wrap only when the panel itself is too narrow. */
.style-choice-grid--season {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.style-choice-grid--season > .style-choice {
  flex: 1 1 0;
  min-width: max-content;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  min-height: 40px;
  padding: 8px 12px;
}

.style-choice-grid--season .style-choice-label {
  white-space: nowrap;
}

/* Visual style panel: a 4-up sample board, then one labeled settings tray.
   Hints stay on the button title so the rows stay one line tall. */
.style-panel--settings .style-choice-grid--styles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.style-panel--settings .style-choice-text {
  align-items: flex-start;
  width: auto;
  flex: 1;
  gap: 2px;
}

.style-panel--settings .style-choice--with-swatch .style-choice-label {
  width: 100%;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  text-align: start;
  white-space: nowrap;
  display: block;
  -webkit-line-clamp: unset;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 0;
}

.style-panel--settings .style-choice--with-swatch .style-choice-hint {
  display: block;
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.style-panel--settings .style-choice-grid--2 .style-choice-hint,
.style-panel--settings .style-choice--aspect .style-choice-hint {
  display: none;
}

.style-panel--settings .style-choice--with-swatch {
  background: color-mix(in srgb, var(--surface) 55%, var(--surface-2));
  box-shadow: var(--shadow-xs);
}

.style-panel--settings .style-choice--with-swatch:hover {
  background: var(--surface);
}

.style-panel--settings .style-choice--with-swatch.active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.style-panel--settings .style-prefs-grid {
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
  padding: 8px 10px;
  gap: 6px;
}

.style-panel--settings .style-prefs-grid > .style-section {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
}

.style-panel--settings
  .style-prefs-grid
  > .style-section
  + .style-section:not(.style-section--aspect):not(.style-section--season),
.style-panel--settings .style-prefs-grid > .style-section--season {
  border-inline-start: 0;
  padding-inline-start: 0;
  border-top: 0;
  padding-top: 0;
}

.style-panel--settings .style-prefs-grid .style-section-label {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.style-panel--settings .style-choice-grid--2 .style-choice {
  min-height: 40px;
  padding: 8px 14px;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--surface);
}

.style-panel--settings .style-choice-grid--2 .style-choice-label,
.style-panel--settings .style-choice--aspect .style-choice-label {
  width: auto;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.style-panel--settings .style-choice-grid--season {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}

.style-panel--settings .style-choice-grid--season > .style-choice {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  flex: 1 1 auto;
  min-height: 40px;
  min-width: max-content;
  padding: 6px 14px;
  border-radius: 6px;
}

.style-panel--settings .style-choice-grid--season .style-choice-label {
  font-size: 13px;
  font-weight: 600;
}

.style-panel--settings .style-choice-grid--season > .style-choice:hover {
  border-color: transparent;
  background: var(--surface-hover);
}

.style-panel--settings .style-choice-grid--season > .style-choice.active {
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: none;
}

.style-panel--settings .style-choice--aspect {
  min-height: 44px;
  background: var(--surface);
}

.style-panel--settings .style-choice--aspect .style-aspect-icon {
  width: 18px;
  height: 12px;
}

.style-panel--settings .style-aspect-icon--16x9 {
  width: 20px;
  height: 11px;
}

.style-panel--settings .style-aspect-icon--9x16 {
  width: 10px;
  height: 16px;
}

.style-panel--settings .style-aspect-icon--1x1 {
  width: 13px;
  height: 13px;
}

.style-panel--settings .style-aspect-icon--4x3 {
  width: 16px;
  height: 12px;
}

.style-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: start;
  font-family: inherit;
  transition:
    border-color 0.15s var(--ease-out),
    background 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

.style-choice--with-swatch {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  min-height: 58px;
}

.style-choice-swatch {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  width: 52px;
  height: 40px;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--border-strong) 55%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  background-size: cover;
  background-position: center;
}

.style-choice-swatch::before,
.style-choice-swatch::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.style-choice-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

/* Each swatch is a tiny picture of that look, not a random color blob. */
.style-choice-swatch--none {
  background: var(--surface-2);
  border-style: dashed;
}

.style-choice-swatch--none::before {
  inset: 8px;
  border-radius: 3px;
  border: 1.5px solid color-mix(in srgb, var(--text-3) 55%, transparent);
}

.style-choice-swatch--realistic {
  background: linear-gradient(#7ec8ee 0 46%, #8fad6a 46% 68%, #5f7d45 68%);
}

.style-choice-swatch--realistic::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  top: 5px;
  inset-inline-end: 6px;
  background: #ffe08a;
  box-shadow: 0 0 0 2px rgba(255, 224, 138, 0.45);
}

.style-choice-swatch--realistic::after {
  left: 6px;
  bottom: 10px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 12px solid #2f4a30;
}

.style-choice-swatch--cinematic {
  background:
    radial-gradient(
      ellipse at 32% 62%,
      rgba(242, 184, 104, 0.95),
      transparent 48%
    ),
    linear-gradient(#1c2a3d, #101820 72%);
  box-shadow:
    inset 0 6px 0 #07080c,
    inset 0 -6px 0 #07080c;
}

.style-choice-swatch--cgi {
  background: linear-gradient(155deg, #312e81, #0f172a 70%);
}

.style-choice-swatch--cgi::before {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  top: 8px;
  left: 14px;
  background:
    radial-gradient(circle at 35% 32%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 40% 38%, #bae6fd, #6366f1 55%, #1e1b4b 78%);
  box-shadow: 0 3px 0 rgba(15, 23, 42, 0.45);
}

.style-choice-swatch--vintage {
  background: linear-gradient(165deg, #efd3a8, #c48b5a 48%, #7a5340);
  box-shadow:
    inset 8px 0 0 #1c1917,
    inset -8px 0 0 #1c1917;
}

.style-choice-swatch--vintage::before,
.style-choice-swatch--vintage::after {
  top: 3px;
  bottom: 3px;
  width: 3px;
  background: repeating-linear-gradient(#f6ead8 0 3px, #1c1917 3px 6px);
}

.style-choice-swatch--vintage::before {
  left: 2px;
}

.style-choice-swatch--vintage::after {
  right: 2px;
}

.style-choice-swatch--watercolor {
  background:
    radial-gradient(
      ellipse at 18% 32%,
      rgba(56, 189, 248, 0.8),
      transparent 58%
    ),
    radial-gradient(
      ellipse at 78% 22%,
      rgba(244, 114, 182, 0.7),
      transparent 52%
    ),
    radial-gradient(
      ellipse at 58% 82%,
      rgba(52, 211, 153, 0.65),
      transparent 56%
    ),
    #f6f1e7;
}

.style-choice-swatch--oil {
  background: repeating-linear-gradient(
    118deg,
    #7c2d12 0 3px,
    #b45309 3px 6px,
    #f2b35a 6px 8px,
    #9a3412 8px 12px
  );
}

.style-choice-swatch--illustration {
  background:
    linear-gradient(#f43f5e, #f43f5e) 12% 62% / 14px 14px no-repeat,
    linear-gradient(#38bdf8, #38bdf8) 42% 22% / 22px 10px no-repeat,
    radial-gradient(circle at 78% 70%, #eab308 0 7px, transparent 8px),
    #f8fafc;
}

.style-choice.active .style-choice-swatch {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 2px var(--accent-soft);
}

.style-choice:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.style-choice.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.style-choice-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.style-choice.active .style-choice-label {
  color: var(--accent);
}

.style-choice-hint {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.3;
}

.style-choice--aspect {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 72px;
  padding: 10px 6px;
  gap: 5px;
}

.style-aspect-icon {
  width: 22px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid var(--text-3);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  flex-shrink: 0;
}

.style-choice.active .style-aspect-icon {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.style-aspect-icon--16x9 {
  width: 26px;
  height: 15px;
}

.style-aspect-icon--9x16 {
  width: 13px;
  height: 22px;
}

.style-aspect-icon--1x1 {
  width: 18px;
  height: 18px;
}

.style-aspect-icon--4x3 {
  width: 22px;
  height: 16px;
}

.style-section--instructions {
  flex-shrink: 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-instructions-input {
  min-height: 72px;
  resize: vertical;
  line-height: 1.45;
  font-size: 13px;
}

/* Legacy pills (new-project / other surfaces) */
.style-pills-grid {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.style-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  gap: 2px;
  min-width: 0;
}

.style-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.style-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.style-pill-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.style-pill.active .style-pill-label {
  color: var(--accent);
}

.style-pill-hint {
  font-size: 10px;
  color: var(--text-3);
  line-height: 1.2;
}

.style-row {
  display: flex;
  align-items: stretch;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.style-instructions-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.style-instructions-field .input {
  flex: 1;
}

.aspect-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.aspect-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
}

.aspect-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.aspect-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.aspect-pill-ratio {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.aspect-pill.active .aspect-pill-ratio {
  color: var(--accent);
}

.aspect-pill-hint {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 1200px) {
  .style-layout {
    grid-template-columns: minmax(0, 0.95fr) minmax(340px, 1.1fr);
  }
}

@media (max-width: 960px) {
  .content-area:has(.style-tab) {
    display: block;
    overflow-y: auto;
    padding-bottom: var(--s-8);
  }

  .workspace-root:has(.style-tab) {
    height: auto;
    overflow: visible;
  }

  .style-tab {
    flex: none;
    min-height: 0;
    height: auto;
    overflow: visible;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .style-layout {
    grid-template-columns: 1fr;
    flex: none;
    min-height: 0;
  }

  .style-panel {
    overflow: visible;
    min-height: 0;
  }

  .style-panel--refs .style-refs-scroll,
  .style-panel--settings .style-body {
    flex: none;
    overflow: visible;
    min-height: 0;
  }

  .style-prefs-grid {
    grid-template-columns: 1fr;
  }

  /* Stacked: the divider has to lie between rows, not beside them.
     Same :not() list as the desktop rule so this override wins on specificity. */
  .style-prefs-grid
    > .style-section
    + .style-section:not(.style-section--aspect):not(.style-section--season) {
    border-inline-start: 0;
    padding-inline-start: 0;
    border-top: 1px solid var(--divider);
    padding-top: var(--s-3);
  }

  .style-prefs-grid > .style-section--season {
    border-inline-start: 0;
    padding-inline-start: 0;
    border-top: 1px solid var(--divider);
    padding-top: var(--s-3);
  }

  .style-choice-grid--aspect {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .style-choice-grid--styles {
    grid-template-columns: 1fr;
  }

  /* The settings panel keeps the desktop gallery: two swatch cards a row.
     One column turns the eight styles into a long stack. */
  .style-panel--settings .style-choice-grid--styles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .style-panel--settings .style-choice-swatch {
    width: 36px;
    height: 28px;
  }

  .style-panel--settings .style-choice--with-swatch {
    gap: 8px;
    padding: 8px;
    min-height: 52px;
  }

  .style-choice-grid--aspect {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .style-panel {
    padding: var(--s-3) var(--s-4);
  }

  .style-panel--settings .style-prefs-grid {
    padding: 10px;
    gap: 10px;
  }

  /* Five nowrap chips do not fit a phone. "לפי הסצנה" takes the first row;
     the four seasons share the second, still inside the same rail. */
  .style-panel--settings .style-choice-grid--season {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .style-panel--settings .style-choice-grid--season > .style-choice {
    min-width: 0;
    min-height: 40px;
    padding: 8px 4px;
  }

  .style-panel--settings
    .style-choice-grid--season
    > .style-choice:first-child {
    grid-column: 1 / -1;
  }
}

/* Persistent Elements */
.elements-empty {
  padding: var(--s-5) var(--s-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  text-align: center;
}

.elements-empty-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
}

.elements-empty-hint {
  font-size: 12px;
  color: var(--text-3);
  /* max-width: 320px; */
  line-height: 1.5;
}

/* Add-element inline form */
.elem-add-form {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-top: 1px solid var(--border);
}

.elem-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-hover);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  flex-shrink: 0;
  text-align: center;
  gap: 4px;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.elem-upload-area:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.elem-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.elem-preview-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.elem-add-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.elem-add-actions {
  display: flex;
  gap: var(--s-2);
}

/* Element tiles */
.elem-tiles-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4) var(--s-4);
}

.elem-tile {
  width: 96px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}

.elem-tile-img {
  width: 100%;
  aspect-ratio: 1;
  background-color: var(--surface-pressed);
  overflow: hidden;
}

.elem-tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.elem-tile-img-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-3);
}

/* Recoverable "image missing" tile: click to re-attach a picture in place. */
.elem-tile-img-readd {
  flex-direction: column;
  gap: 4px;
  font-size: 16px;
  cursor: pointer;
  border: 1px dashed var(--border);
  transition:
    border-color 0.15s,
    color 0.15s;
}
.elem-tile-img-readd:hover {
  border-color: var(--accent);
  color: var(--text-2);
}
.elem-tile-readd-label {
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  padding: 0 4px;
}

.elem-tile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 7px;
  gap: 4px;
}

.elem-tile-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  cursor: text;
  border-radius: 3px;
  padding: 1px 2px;
  margin: -1px -2px;
  transition: background 0.12s;
}

.elem-tile-name:hover {
  background: var(--surface-hover);
}

.elem-remove-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition:
    background 0.1s,
    color 0.1s;
}

.elem-remove-btn:hover {
  background: var(--danger-soft, #fef2f2);
  color: var(--danger, #ef4444);
}

/* ===== API keys — compact tile grid ===== */
.api-keys-card {
  padding: var(--s-3);
  background: var(--surface);
}

.api-keys-card:hover {
  box-shadow: var(--shadow-xs);
}

/* Waiting for the server: the tiles are drawn at once and only the parts that
   wait for the answer (badge, key row, balance) sweep - the same glow band as
   loading pictures («פס זוהר», polish.css media-loading-shimmer). */
.api-key-sk {
  display: block;
  flex: none;
  border-radius: var(--r-sm);
  background-color: #e3e6ec;
  background-image: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.95) 50%,
    rgba(255, 255, 255, 0) 80%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: media-loading-shimmer 1s linear infinite;
}

.api-key-sk--badge {
  width: 48px;
  height: 20px;
  border-radius: var(--r-pill);
}

.api-key-sk--control {
  height: 32px;
}

.api-key-sk--balance {
  width: 110px;
  max-width: 60%;
  height: 12px;
  border-radius: 4px;
}

/* the waiting tile's balance row keeps an invisible «טען קרדיטים» so it is
   exactly as tall as the real row */
.api-key-sk-ghost {
  visibility: hidden;
}

:root[data-theme="dark"] .api-key-sk {
  background-color: rgba(255, 255, 255, 0.08);
  background-image: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 20%,
    rgba(255, 255, 255, 0.16) 50%,
    rgba(255, 255, 255, 0) 80%
  );
}

.api-keys-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.api-key-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-width: 0;
  transition:
    border-color 0.15s var(--ease-out),
    background 0.15s var(--ease-out);
}

.api-key-tile:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.api-key-tile--set {
  background: rgba(31, 157, 99, 0.04);
  border-color: rgba(31, 157, 99, 0.18);
}

.api-key-tile--set:hover {
  border-color: rgba(31, 157, 99, 0.28);
  background: rgba(31, 157, 99, 0.06);
}

.api-key-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.api-key-tile-heading {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.api-key-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* The company's mark beside its name (js/provider-marks.js). */

.api-key-mark svg {
  display: block;
}

/* «במאי וכותב»: the company's mark before the model's name. */
.style-choice-label > .style-choice-mark {
  display: inline-flex;
  vertical-align: -2px;
  margin-inline-end: 5px;
  color: var(--text);
  line-height: 0;
}

.api-key-role {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
  min-height: 1.4em;
}

.api-key-control {
  min-width: 0;
  margin-top: 2px;
}

/* Remaining credit + top-up deep link. Sits between the role line and the key
   control, so the tile reads: what it does → what's left → how to change it. */
.api-key-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
}

.api-key-balance-value {
  color: var(--text-2);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-balance--low {
  border-color: rgba(255, 149, 0, 0.4);
  background: rgba(255, 149, 0, 0.07);
}

.api-key-balance--low .api-key-balance-value {
  color: #b25c00;
}

:root[data-theme="dark"] .api-key-balance--low .api-key-balance-value {
  color: #ffb44d;
}

.api-key-balance .badge {
  flex-shrink: 0;
}

.api-key-topup {
  margin-inline-start: auto;
  flex-shrink: 0;
  white-space: nowrap;
  text-decoration: none;
}

.api-help-link {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.85;
}

.api-help-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.api-key-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.api-key-input-row .input {
  flex: 1;
  min-width: 0;
  min-height: 32px;
  padding-block: 5px;
  padding-inline: 10px;
  font-size: 12px;
  background: var(--surface);
}

.api-key-input-row--set {
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}

.api-key-secured {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
  min-width: 0;
}

.api-key-secured .ui-icon {
  flex-shrink: 0;
  color: var(--green);
}

.api-key-input-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.api-key-input-actions .btn-sm {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
}

.api-key-remove-btn {
  color: var(--red);
}

/* legacy class kept for render-server / other sections */
.api-key-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.api-key-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.api-provider-name {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  font-size: 14px;
}

.api-role-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface-pressed);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

.api-key-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.api-warning {
  padding: var(--s-3) var(--s-4);
  background: rgba(255, 149, 0, 0.08);
  border: 1px solid rgba(255, 149, 0, 0.2);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}

@media (max-width: 640px) {
  .api-keys-grid {
    grid-template-columns: 1fr;
  }

  .api-key-input-row {
    flex-wrap: nowrap;
  }

  .api-key-input-row .input {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* ===== Render server — status + connection tiles ===== */
.render-panel {
  padding: var(--s-3);
}

.render-panel:hover {
  box-shadow: var(--shadow-xs);
}

.render-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.render-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-width: 0;
  min-height: 100%;
}

.render-tile--ok {
  background: rgba(31, 157, 99, 0.04);
  border-color: rgba(31, 157, 99, 0.18);
}

.render-tile--warn {
  background: rgba(232, 109, 47, 0.05);
  border-color: rgba(232, 109, 47, 0.2);
}

.render-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.render-tile-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.render-tile-note {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.render-server-meta {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}

.render-server-caps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.render-cap-plain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}

.render-cap-plain .ui-icon {
  color: var(--text-3);
  flex-shrink: 0;
}

.render-mirror-line {
  margin: 0;
}

.render-server-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
}

.render-server-hint--error {
  color: var(--red);
  font-weight: 500;
}

.render-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.render-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.render-field .input {
  width: 100%;
  min-height: 32px;
  padding-block: 5px;
  padding-inline: 10px;
  font-size: 12px;
  background: var(--surface);
}

.render-tile-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.render-tile-actions .btn-sm {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
}

/* Status-tile footer: pin sync to bottom (visual left in RTL). */
.render-tile-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.render-tile-foot .btn-sm {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
}

.render-server-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.render-proxy-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 2px 0;
  flex-wrap: wrap;
}

.render-proxy-label-text {
  font-weight: 500;
  font-size: 13px;
}

.render-proxy-label .render-server-hint {
  flex-basis: 100%;
  margin-top: 2px;
}

@media (max-width: 720px) {
  .render-grid {
    grid-template-columns: 1fr;
  }
}

/* Settings page key rows */
.settings-key-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.settings-key-info {
  flex: 1;
}

.settings-key-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.settings-key-role {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ===== Lightbox ===== */
.lightbox {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: fit-content;
  max-width: 100%;
}

.lightbox .modal-header {
  padding-bottom: var(--s-3);
  /* Title must not widen the lightbox past the media box. */
  width: 0;
  min-width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.lightbox .modal-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.lightbox .lightbox-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.lightbox .lightbox-model-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: 2px 7px;
  line-height: 1.3;
  white-space: nowrap;
}

.lightbox-body {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  overflow: hidden;
  min-height: 0;
  width: fit-content;
  max-width: 100%;
}

.lightbox-body .vplayer-wrap {
  flex-shrink: 0;
}

.lightbox-media {
  display: block;
  max-width: 100%;
  max-height: calc(85vh - 80px);
  width: auto;
  height: auto;
  border-radius: var(--r-md);
}

.lightbox-media-wrap {
  position: relative;
  display: inline-flex;
}

.lightbox-res-badge {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  z-index: 2;
}

.lightbox-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: center;
  flex-wrap: wrap;
}

.prompt-preview {
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-3);
  font-family: "SF Mono", Consolas, monospace;
  line-height: 1.5;
  border: 1px solid var(--border);
  direction: ltr;
  text-align: left;
}

/* ===== Docs ===== */
.docs-content {
  max-width: 760px;
  margin: 0 auto;
}

.docs-content h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: var(--s-8);
  margin-bottom: var(--s-3);
  color: var(--text);
}

.docs-content h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: var(--s-5);
  margin-bottom: var(--s-2);
  color: var(--text);
}

.docs-content p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: var(--s-3);
}

.docs-content ul,
.docs-content ol {
  padding-inline-start: var(--s-5);
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: var(--s-3);
}

.docs-content li {
  margin-bottom: 6px;
}

.docs-content code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.docs-content .callout {
  background: var(--accent-soft);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-4) 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

/* ===== Planning Tab ===== */
.planning-tab {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-height: 0;
  height: 100%;
  padding-bottom: calc(var(--s-2) + env(safe-area-inset-bottom, 0px));
}

.planning-steps {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  padding: 0 2px;
}

.planning-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.planning-step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-3);
  border: 1px solid var(--border);
}

.planning-step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}

.planning-step.is-active .planning-step-num {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

.planning-step.is-active .planning-step-label {
  color: var(--text);
  font-weight: 600;
}

.planning-step.is-done .planning-step-num {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.planning-step.is-done .planning-step-label {
  color: var(--text-2);
}

.planning-step-line {
  flex: 1;
  height: 1px;
  min-width: 12px;
  margin: 0 8px;
  background: var(--divider);
}

.planning-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.4fr);
  gap: var(--s-3);
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.planning-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.planning-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1;
  min-height: 0;
  padding: var(--s-3) var(--s-4);
  box-shadow: none;
}

.planning-panel:hover {
  box-shadow: none;
}

.planning-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  flex-shrink: 0;
}

.planning-panel-titles {
  min-width: 0;
}

.planning-panel-titles .card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.planning-panel-titles .card-subtitle {
  margin-top: 1px;
  font-size: 11px;
}

.planning-panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.planning-structure-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.planning-raw,
.planning-brief {
  width: 100%;
  resize: vertical;
  font-family: inherit;
}

.planning-raw {
  flex: 1;
  min-height: 120px;
  max-height: 36vh;
  line-height: 1.5;
  background: var(--bg);
  border-color: var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  padding: 10px 12px;
}

.planning-raw:focus {
  background: var(--surface);
  border-color: var(--accent);
}

.planning-raw-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.planning-ai-btn {
  flex: 1.5 1 0;
  min-width: 0;
  min-height: 32px;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
}

.planning-extract-btn {
  flex-shrink: 0;
  min-height: 32px;
}

.planning-gap-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 32px;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
}

.planning-more-btn {
  flex: 0 0 auto;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  justify-content: center;
}

.planning-raw-actions .btn:not(.planning-more-btn) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-raw-actions .planning-more-btn {
  order: -1;
}

.planning-overflow-menu {
  max-width: 280px;
}

/* Fixed height so filter changes (empty lists) don't resize the dialog. */
.modal:has(.planning-gen-dialog),
.modal.modal-lg:has(.planning-gen-dialog) {
  max-width: min(840px, calc(100vw - 32px));
  width: min(840px, calc(100vw - 32px));
  height: min(78vh, 680px);
  max-height: min(90vh, 920px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--s-5);
}

.modal:has(.planning-gen-dialog) > div,
.modal.modal-lg:has(.planning-gen-dialog) > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
}

.modal:has(.planning-gen-dialog) .modal-header,
.modal.modal-lg:has(.planning-gen-dialog) .modal-header {
  flex-shrink: 0;
  margin-bottom: var(--s-3);
}

.modal:has(.planning-gen-dialog) .modal-body,
.modal.modal-lg:has(.planning-gen-dialog) .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.modal:has(.planning-gen-dialog) .modal-footer,
.modal.modal-lg:has(.planning-gen-dialog) .modal-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding-top: var(--s-4);
  background: var(--surface);
  position: relative;
  z-index: 2;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.planning-gen-dialog {
  display: flex;
  flex-direction: column;
  gap: var(--s-3, 10px);
  margin-top: 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
}

.planning-gen-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-shrink: 0;
}

.planning-gen-model {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  /* Visual left in RTL (and physical left in LTR). */
  margin-inline-start: auto;
}

.planning-gen-model .duration-label {
  flex-shrink: 0;
}

.planning-gen-res {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.planning-gen-res .duration-label {
  flex-shrink: 0;
}

/* The shared advanced-controls panel inside "הרץ הכל": it must not push the shot
   list out of the dialog, so it stays a fixed-height block that scrolls itself
   once it is opened. */
.planning-gen-advanced {
  flex-shrink: 0;
}
.planning-gen-advanced .video-advanced {
  margin: 0;
}
.planning-gen-advanced .video-advanced-body {
  max-height: min(42vh, 420px);
  overflow-y: auto;
}
.batch-controls-status {
  padding: 6px 2px 0;
}
.batch-controls-status.is-on {
  color: var(--accent);
}

.planning-gen-apply-summary {
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
}

.planning-apply-preserve {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.planning-apply-preserve input {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.planning-apply-preserve--footer {
  align-items: center;
  max-width: min(280px, 46vw);
  /* Pin to the visual right; buttons stay on the other side. */
  margin-inline-end: auto;
}

.planning-apply-preserve--footer span {
  line-height: 1.3;
}

.planning-gen-pick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.planning-gen-pick-meta {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
  flex: 1 1 auto;
  min-width: 0;
}

.planning-gen-pick-meta.is-warn {
  color: color-mix(in srgb, #c90 70%, var(--text));
  font-weight: 600;
}

.planning-gen-select-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.planning-gen-select-actions .btn {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
}

.planning-gen-pick-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--r-xs, 6px);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2, var(--bg));
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

/* The image sits in a wrapper so a load failure paints its ribbon on the 44px
   tile instead of across the whole picker row. */
.planning-gen-pick-thumb--img {
  overflow: hidden;
  padding: 0;
}

.planning-gen-pick-thumb--img > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.planning-gen-pick-thumb--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-sizing: border-box;
  padding: 3px 2px;
  background: color-mix(in srgb, var(--text) 4%, var(--surface));
  border-style: dashed;
  border-color: color-mix(in srgb, var(--border) 90%, transparent);
  color: var(--text-3);
}

.planning-gen-pick-thumb--empty .ui-icon {
  opacity: 0.7;
}

.planning-gen-pick-thumb-label {
  font-size: 8px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  white-space: pre-line;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

.planning-gen-pick-actions {
  display: flex;
  flex: 1 1 auto;
  min-width: min(100%, 280px);
  max-width: 420px;
  gap: 2px;
  flex-wrap: nowrap;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-pressed, var(--surface-2));
  box-sizing: border-box;
}

.planning-gen-filter-btn {
  flex: 1 1 0;
  min-width: 0;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: calc(var(--r-md) - 2px);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  line-height: 1.3;
}

.planning-gen-filter-btn:hover {
  color: var(--text);
}

.planning-gen-filter-btn.is-active,
.planning-gen-filter-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.06));
}

.planning-gen-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 240px;
  overflow-y: auto;
  padding: 2px;
  position: relative;
}

.planning-gen-pick-empty {
  display: none;
  flex: 1 1 auto;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.45;
}

.planning-gen-pick-list.is-empty .planning-gen-pick-empty {
  display: flex;
}

/* display:flex on rows would otherwise override the [hidden] UA rule */
.planning-gen-pick-seg.is-filtered-out,
.planning-gen-pick-part.is-filtered-out,
.planning-gen-pick-frame.is-filtered-out,
.planning-gen-pick-seg[hidden],
.planning-gen-pick-part[hidden],
.planning-gen-pick-frame[hidden] {
  display: none !important;
}

.planning-gen-pick-part {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
}

.planning-gen-pick-part-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--divider);
}

.planning-gen-pick-part-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.planning-gen-pick-part-stats {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
}

.planning-gen-pick-seg-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.planning-gen-pick-seg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.planning-gen-pick-seg--stills {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  cursor: default;
}

.planning-gen-pick-seg:hover {
  border-color: var(--border);
  background: var(--surface);
}

.planning-gen-pick-seg.is-new {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
}

.planning-gen-pick-seg.is-new:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.planning-gen-pick-seg.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.planning-gen-pick-seg.is-disabled:hover,
.planning-gen-pick-seg.is-disabled.is-new {
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
  background: var(--surface);
}

.planning-gen-pick-seg:has(input:checked):not(.is-disabled) {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.planning-gen-pick-seg input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.planning-gen-pick-seg-head {
  min-width: 0;
}

.planning-gen-pick-frames {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.planning-gen-pick-frame {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: color-mix(
    in srgb,
    var(--surface-2, var(--bg)) 40%,
    var(--surface)
  );
  cursor: pointer;
}

.planning-gen-pick-frame:hover {
  border-color: var(--border);
}

.planning-gen-pick-frame.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.planning-gen-pick-frame:has(input:checked):not(.is-disabled) {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface));
}

.planning-gen-pick-badge--frames {
  color: var(--text-3);
}

.planning-gen-pick-seg-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.planning-gen-pick-seg-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-bottom: 1px;
}

.planning-gen-pick-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  user-select: none;
}

.planning-gen-pick-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  background: var(--surface);
  color: var(--text-2);
}

.planning-gen-pick-badge--new {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
  font-weight: 600;
}

.planning-gen-pick-badge--existing {
  color: var(--text-2);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--border) 90%, transparent);
}

.planning-gen-pick-badge--no-img {
  color: var(--text-2);
  background: color-mix(in srgb, #c90 8%, var(--surface));
  border-color: color-mix(in srgb, #c90 28%, var(--border));
}

.planning-gen-pick-badge--has-img {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 16%, var(--border));
}

.planning-gen-pick-seg-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.planning-gen-pick-seg-detail {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.planning-gen-pick-seg-chars {
  font-size: 11px;
  color: var(--text-3);
  -webkit-line-clamp: 1;
}

.planning-gen-pick-seg-meta {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

/* Run-all dialog: same chrome as the other workspace sheets
   (header, toolbar strip, scrolling list, pinned footer). */
.modal.modal-lg:has(.run-all-modal) {
  width: min(840px, calc(100vw - 32px));
  max-width: min(840px, calc(100vw - 32px));
  height: min(86vh, 820px);
  max-height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  min-height: 0;
}

.run-all-modal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}

.run-all-header {
  flex-shrink: 0;
  margin: 0;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  align-items: flex-start;
  gap: 12px;
}

.run-all-heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.run-all-title-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
}

.run-all-title-copy {
  min-width: 0;
  flex: 1;
}

.run-all-header .modal-title {
  line-height: 1.2;
}

.run-all-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.run-all-chrome {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
  border-bottom: 1px solid var(--divider);
}

.run-all-chrome .planning-gen-toolbar {
  align-items: center;
}

.run-all-hint {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.run-all-chrome .planning-gen-advanced .video-advanced {
  background: var(--surface);
}

.run-all-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 16px 12px;
  background: var(--bg);
}

.run-all-body .planning-gen-pick-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}

.run-all-body .planning-gen-pick-seg-list {
  padding: 6px;
}

.run-all-body .planning-gen-pick-seg-copy {
  flex: 1 1 auto;
  min-width: 0;
  align-items: stretch;
}

.run-all-body .planning-gen-pick-seg-title,
.run-all-body .planning-gen-pick-seg-meta {
  width: 100%;
  max-width: 100%;
  text-align: right;
}

.run-all-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--divider);
  background: var(--surface);
}

.run-all-confirm {
  min-width: 140px;
}

.planning-gap-fill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: min(50vh, 360px);
  overflow: auto;
  padding: 2px;
}

.modal:has(.planning-gap-fill-list) .modal-footer {
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
}

.modal:has(.planning-gap-fill-list) .modal-footer > .btn,
.modal:has(.planning-gap-fill-list) .modal-footer-extra-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.25;
  font-size: 13px;
  padding-block: 10px;
  padding-inline: 8px;
}

.planning-gap-direction-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  min-width: min(100%, 420px);
}

.planning-gap-direction {
  width: 100%;
  min-height: 96px;
  resize: vertical;
}

.planning-gap-direction-hint {
  font-size: 12px;
  line-height: 1.4;
}

.planning-gap-fill-row.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.planning-gap-fill-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--divider);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.planning-gap-fill-row input {
  margin-top: 3px;
  flex-shrink: 0;
}

.planning-gap-fill-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.planning-gap-fill-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.planning-gap-fill-reason {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}

.planning-gap-fill-where {
  font-size: 11px;
  color: var(--text-3, var(--text-2));
  opacity: 0.9;
}

.planning-brief-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--divider);
  flex-shrink: 0;
}

.planning-story-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 4px;
  border-top: 1px solid var(--divider);
  flex-shrink: 0;
  min-height: 0;
}

.planning-story-preview[hidden] {
  display: none !important;
}

.planning-story-preview-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.planning-story-preview-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.planning-story-preview-sub {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
}

.planning-story {
  min-height: 96px;
  max-height: 180px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.5;
}

.planning-story-notes {
  min-height: 52px;
  max-height: 110px;
  resize: vertical;
  font-size: 12px;
}

.planning-story-cast-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.planning-story-cast-label-row .field-label {
  margin: 0;
  flex: 0 0 auto;
}

.planning-story-cast-label-row .planning-story-sets-add {
  margin-inline-start: auto;
  height: 24px;
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}

.planning-story-cast-model {
  flex: 0 0 auto;
  min-width: 0;
  margin-inline-start: auto;
}

.planning-story-cast-model .cselect-trigger {
  width: auto;
  height: 24px;
  padding: 0 6px;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: none;
}

.planning-story-cast-model .cselect-trigger-chevron svg {
  width: 10px;
  height: 10px;
}

.cselect-menu--cast-look {
  padding: 3px;
  max-height: 220px;
}

.cselect-menu--cast-look .cselect-option {
  padding: 5px 8px;
  font-size: 12px;
}

.planning-story-cast {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow: auto;
}

.planning-story-cast-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 3px 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, var(--surface));
}

.planning-story-cast-head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.planning-story-cast-name,
.planning-story-cast-role {
  width: 100%;
  min-width: 0;
  height: 1.35em;
  min-height: 0;
  max-height: 1.35em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 0 2px;
  margin: 0;
  border-radius: 3px;
  line-height: 1.35;
  box-sizing: border-box;
}

.planning-story-cast-role {
  font-weight: 500;
  color: var(--text-2);
  font-size: 11px;
  height: auto;
  max-height: none;
  min-height: 1.3em;
  line-height: 1.3;
  margin-top: 0;
}

.planning-story-cast-name:focus,
.planning-story-cast-role:focus {
  outline: none;
  border-color: var(--border);
  background: var(--surface);
}

.planning-story-cast-look.textarea,
.planning-story-cast-look {
  font-size: 11px;
  line-height: 1.3;
  min-height: 32px !important;
  max-height: 64px;
  height: auto;
  resize: vertical;
  margin: 2px 0 0;
  padding: 3px 6px !important;
  box-shadow: none;
}

.planning-story-cast-look-wrap {
  position: relative;
  margin: 2px 0 0;
}

.planning-story-cast-look-wrap .planning-story-cast-look {
  margin: 0;
}

.planning-story-cast-look-wrap.is-he-loading .planning-story-cast-look {
  color: transparent;
  caret-color: transparent;
}

.planning-story-cast-look-skel {
  position: absolute;
  inset: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.planning-story-cast-look-skel .skeleton {
  display: block;
  height: 7px;
  width: 72%;
}

.planning-story-cast-look-skel .skeleton:last-child {
  width: 46%;
}

.planning-story-cast-card.is-photo-locked {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(
    in srgb,
    var(--accent-soft, var(--surface-2)) 55%,
    var(--surface)
  );
}

.planning-story-cast-photo-badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
  background: var(--accent-soft, var(--surface-2));
  padding: 1px 5px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}

.planning-story-cast-photo-unlock {
  flex-shrink: 0;
  height: 18px;
  min-height: 18px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  color: var(--text-2);
}

.planning-story-cast-photo-lock {
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-3, var(--text-2));
  padding: 0 2px 1px;
}

/*
 * The יהודי mark. Jewish is the default, so the default state is deliberately
 * almost invisible - a faint glyph that comes up under the mouse - and only the
 * exception is spelled out as a readable "לא יהודי" chip. Same button, same
 * place, both states; see castJewishToggle in shot-fields.js.
 */
.cast-jewish-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 18px;
  min-width: 18px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-3, var(--text-2));
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.28;
  transition:
    opacity 0.12s ease,
    background 0.12s ease,
    color 0.12s ease;
}

.planning-story-cast-card:hover .cast-jewish-toggle,
.cast-jewish-toggle:hover,
.cast-jewish-toggle:focus-visible {
  opacity: 1;
}

.cast-jewish-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}

.cast-jewish-toggle.is-off {
  opacity: 1;
  padding: 0 7px;
  color: var(--text-2);
  background: var(--surface-2);
  border-color: var(--border);
}

.cast-jewish-toggle[disabled] {
  cursor: default;
}

.planning-story-cast-head .planning-icon-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
}

.planning-story-cast-lookdev {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-rows: 28px 28px;
  gap: 5px 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  align-items: stretch;
}

.planning-story-cast-lookdev.is-place {
  grid-template-columns: 72px minmax(0, 1fr);
}

.planning-story-cast-lookdev.is-place .planning-story-cast-lookdev-thumb {
  width: 72px;
}

.planning-story-cast-lookdev-thumb {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 54px;
  height: 100%;
  min-height: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0;
  color: var(--text-3, var(--text-2));
  cursor: zoom-in;
}

.planning-story-cast-lookdev-thumb.is-empty {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.planning-story-cast-lookdev-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.planning-story-cast-lookdev-controls {
  grid-column: 2;
  min-width: 0;
  display: grid;
  grid-template-rows: 28px 28px;
  gap: 5px;
}

.planning-story-cast-lookdev-actions,
.planning-story-cast-lookdev-notes-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  height: 28px;
}

.planning-story-cast-lookdev .btn {
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  border-radius: 6px;
  box-shadow: none;
  white-space: nowrap;
}

.planning-story-cast-lookdev-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
}

.planning-story-cast-lookdev-lock {
  overflow: hidden;
  text-overflow: ellipsis;
}

.planning-story-cast-lookdev-notes {
  flex: 1;
  min-width: 0;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  margin: 0;
  padding: 0 8px !important;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  line-height: 26px;
  box-shadow: none;
}

.planning-story-cast-lookdev-notes:focus {
  outline: none;
  border-color: var(--accent);
}

.planning-story-cast-lookdev-revise {
  flex: 0 0 auto;
  justify-content: center;
}

.planning-story-beats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow: auto;
}

.planning-story-beats:empty,
.planning-story-beats-label:has(+ .planning-story-beats:empty) {
  display: none;
}

.planning-story-beat {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 20px;
  gap: 6px;
  align-items: start;
}

.planning-story-beat-remove {
  width: 20px;
  height: 20px;
  padding: 0;
  opacity: 0.55;
}

.planning-story-beat-remove:hover {
  opacity: 1;
}

.planning-story-beat-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-soft, var(--surface-2));
  color: var(--accent);
}

.planning-story-beat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.planning-story-beat-summary {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.4;
}

/* The beat, editable.
   The outline is a beat the user can FIX one line of, instead of re-rolling
   the whole story to change a word. The fields are quiet until focused so the
   list still reads as an outline rather than a form. */
.planning-story-beat-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.planning-story-beat-title-input,
.planning-story-beat-summary-input,
.planning-story-beat-must-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 6px;
  color: var(--text);
  font: inherit;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}

.planning-story-beat-title-input {
  font-size: 12px;
  font-weight: 600;
}

.planning-story-beat-summary-input,
.planning-story-beat-must-input {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-2);
  resize: vertical;
  min-height: 2.4em;
}

.planning-story-beat-title-input:hover,
.planning-story-beat-summary-input:hover,
.planning-story-beat-must-input:hover {
  background: var(--surface-2);
}

.planning-story-beat-title-input:focus,
.planning-story-beat-summary-input:focus,
.planning-story-beat-must-input:focus {
  background: var(--surface-1, var(--surface-2));
  border-color: var(--accent);
  outline: none;
}

/* The promise. Marked out from the notes above it because this is the field
   that blocks paid generation when no shot delivers it. */
.planning-story-beat-must {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 6px;
  margin-top: 2px;
}

.planning-story-beat-must-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft, var(--surface-2));
  border-radius: 4px;
  padding: 3px 6px;
  white-space: nowrap;
}

.planning-story-beat-must-input {
  color: var(--text);
}

.planning-story-beat-fact {
  font-size: 10px;
  color: var(--text-3, var(--text-2));
  opacity: 0.85;
  padding-inline-start: 6px;
  word-break: break-word;
}

.planning-story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.planning-story-run-btn {
  flex: 1 1 auto;
}

.planning-story-prompts-only {
  align-self: flex-start;
  opacity: 0.85;
}

.planning-story-empty {
  margin: 0;
  font-size: 12px;
}

.planning-brief-summary {
  list-style: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  padding: 2px 0;
  user-select: none;
}

.planning-brief-summary::-webkit-details-marker {
  display: none;
}

.planning-brief-block[open] .planning-brief-summary {
  color: var(--text-2);
  margin-bottom: 2px;
}

.planning-brief {
  min-height: 40px;
  max-height: 80px;
  resize: none;
  background: var(--bg);
  line-height: 1.4;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}

.planning-mobile-nav {
  display: none;
}

.planning-panel--structure {
  background: var(--surface);
}

.planning-structure-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1px 2px 4px 1px;
  scrollbar-gutter: stable;
}

.planning-structure-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-height: 140px;
  padding: var(--s-5) var(--s-4);
  text-align: center;
  color: var(--text-2);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}

.planning-empty-icon {
  color: var(--text-3);
  opacity: 0.7;
}

.planning-empty-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.planning-muted {
  margin: 0;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
  max-width: 30ch;
}

.planning-part {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.planning-part-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--divider);
  cursor: grab;
}

.planning-part-head:active {
  cursor: grabbing;
}

.planning-part-badge {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: grab;
  user-select: none;
}

.planning-part-title {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  padding: 2px 0;
}

.planning-part-title::placeholder {
  color: var(--text-3);
  font-weight: 500;
}

.planning-part-title:focus {
  outline: none;
}

.planning-seg-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.planning-seg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  transition:
    border-color 0.15s,
    background 0.15s,
    opacity 0.15s,
    box-shadow 0.15s;
  cursor: grab;
}

.planning-seg-row:active {
  cursor: grabbing;
}

.planning-seg-row:hover {
  border-color: var(--border);
}

.planning-seg-row:focus-within,
.planning-seg-row.is-expanded {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--surface);
  box-shadow: none;
}

.planning-seg-row.is-dragging {
  opacity: 0.45;
}

.planning-seg-row.drag-over {
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.planning-seg-row.drag-over-after {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.planning-part.is-dragging {
  opacity: 0.5;
}

.planning-part.drag-over {
  box-shadow: inset 0 3px 0 0 var(--accent);
}

.planning-part.drag-over-after {
  box-shadow: inset 0 -3px 0 0 var(--accent);
}

.planning-seg-top {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto 26px;
  gap: 6px;
  align-items: center;
}

.planning-seg-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
  cursor: grab;
  user-select: none;
}

.planning-seg-title {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
}

.planning-seg-notes {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 11px;
  padding: 2px 6px;
}

.planning-seg-notes:hover,
.planning-seg-notes:focus {
  background: var(--bg);
  border-color: var(--border);
}

.planning-seg-title:focus,
.planning-seg-notes:focus,
.planning-seg-prompt:focus {
  outline: none;
  border-color: var(--accent);
}

/* Spoken lines, in the open beside the beat. The film could always write
   dialogue, but only in the editor - after the stills and clips were already
   generated, with the frame composed by someone who did not know a word would
   be said in it. Folding this behind a disclosure would keep it unwritten. */
.planning-seg-dialogue {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 0;
}

.planning-dlg-row {
  display: grid;
  grid-template-columns: minmax(56px, 0.28fr) 1fr auto;
  gap: 4px;
  align-items: center;
}

.planning-dlg-char.cselect-trigger {
  width: 100%;
  min-width: 0;
  gap: 4px;
  box-shadow: none;
  cursor: pointer;
}

.planning-dlg-char:not(.pd-inline),
.planning-dlg-line:not(.pd-inline) {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  font-size: 11px;
  padding: 2px 6px;
}

.planning-dlg-char:not(.pd-inline) {
  color: var(--text-3);
  font-weight: 600;
}

.planning-dlg-line:not(.pd-inline) {
  color: var(--text-2);
}

.planning-dlg-char:not(.pd-inline):hover,
.planning-dlg-line:not(.pd-inline):hover,
.planning-dlg-char:not(.pd-inline):focus,
.planning-dlg-line:not(.pd-inline):focus {
  background: var(--bg);
  border-color: var(--border);
}

.planning-dlg-char:not(.pd-inline):focus,
.planning-dlg-line:not(.pd-inline):focus {
  outline: none;
  border-color: var(--accent);
}

.planning-dlg-add:not(.pd-group-link) {
  align-self: flex-start;
  font-size: 10.5px;
  color: var(--text-3);
  padding: 1px 6px;
  opacity: 0.75;
}

.planning-dlg-add:not(.pd-group-link):hover {
  opacity: 1;
  color: var(--text-2);
}

/* How long the line takes vs how long the shot is. Quiet by default — it is
   arithmetic, not a finding — and only earns a colour when the words do not
   fit, because a slot that loses that race cuts the last word off the take. */
.planning-dlg-fit {
  align-self: flex-start;
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-3);
  opacity: 0.8;
  padding: 1px 6px;
}

.planning-dlg-fit.is-tight {
  color: var(--warn, #d98324);
  opacity: 1;
  font-weight: 600;
}

.planning-seg-prompt-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.planning-seg-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  padding-inline: 2px;
}

.planning-seg-prompt-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.planning-seg-regen {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
}

.planning-seg-regen:disabled {
  opacity: 0.6;
  cursor: default;
}

.planning-seg-hint {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg);
  color: var(--text-2);
  font-size: 11px;
  padding: 5px 8px;
}

.planning-seg-hint::placeholder {
  color: var(--text-3);
}

.planning-seg-hint:focus {
  outline: none;
  border-color: var(--accent);
}

.planning-seg-prompt {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.4;
  padding: 6px 8px;
  resize: vertical;
  min-height: 52px;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
}

.planning-seg-prompt-peek {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: start;
  border: 1px dashed var(--border);
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--text-2);
  padding: 5px 8px;
  cursor: pointer;
  font: inherit;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.planning-seg-prompt-peek:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
}

.planning-seg-prompt-peek.is-empty {
  color: var(--text-3);
}

.planning-seg-prompt-peek-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.planning-seg-prompt-peek-text {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  text-align: left;
}

.planning-seg-notes::placeholder,
.planning-seg-prompt::placeholder {
  color: var(--text-3);
}

.planning-seg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.planning-seg-chars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  border: none;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  padding: 2px 7px;
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.planning-seg-chars:hover {
  filter: brightness(0.97);
}

.planning-seg-chars svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.planning-char-picker {
  position: fixed;
  z-index: 5000;
  min-width: 160px;
  max-width: min(280px, calc(100vw - 16px));
  max-height: min(240px, 50vh);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow:
    0 4px 6px color-mix(in srgb, var(--text) 6%, transparent),
    0 12px 28px color-mix(in srgb, var(--text) 14%, transparent);
  display: flex;
  flex-direction: column;
  gap: 2px;
  isolation: isolate;
  -webkit-overflow-scrolling: touch;
}

.planning-char-picker-item {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  text-align: right;
  border: none;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  z-index: 1;
}

.planning-char-picker-item:hover {
  background: var(--accent-soft);
}

.planning-char-picker-item.is-current {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
}

/* Add-a-character chip: quieter than a linked character so the row still reads
   as "these are the characters", with the + as an affordance beside them. */
.planning-seg-chars-add {
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--border);
  font-weight: 600;
}

.planning-seg-chars-add:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  filter: none;
}

.planning-seg-chars-add svg {
  opacity: 1;
}

.planning-char-picker-remove {
  color: var(--danger, #d14343);
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  margin-top: 2px;
}

.planning-char-picker-remove:hover {
  background: color-mix(in srgb, var(--danger, #d14343) 12%, transparent);
}

.planning-chars-banner {
  flex-shrink: 0;
}

.planning-chars-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  line-height: 1.35;
}

.planning-chars-banner--ok {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
}

.planning-chars-banner--warn {
  background: color-mix(in srgb, #c90 8%, var(--surface));
  border: 1px solid color-mix(in srgb, #c90 28%, var(--border));
  color: var(--text-2);
  justify-content: space-between;
}

.planning-chars-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.planning-chars-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.planning-char-chip {
  font-size: 10px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
  border-radius: var(--r-pill);
  padding: 1px 7px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-chars-link {
  margin-inline-start: auto;
  flex-shrink: 0;
}

.planning-chars-banner-text {
  flex: 1;
  min-width: 0;
}

.planning-add-seg {
  align-self: flex-start;
  color: var(--text-2);
  min-height: 26px;
  font-size: 11px;
  padding: 2px 8px;
}

.planning-icon-btn {
  padding: 2px 4px;
  color: var(--text-3);
  opacity: 0.65;
}

.planning-icon-btn:hover {
  color: var(--danger, #c44);
  opacity: 1;
}

.planning-seg-top > .planning-icon-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--r-xs);
}

.planning-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: none;
  position: sticky;
  bottom: 0;
  z-index: 6;
}

.planning-footer-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.planning-footer-kicker {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.planning-footer-meta {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.35;
}

.planning-apply-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

.planning-apply-actions .btn {
  min-width: 0;
  min-height: 32px;
  justify-content: center;
  font-size: 12px;
  padding: 6px 12px;
}

.planning-apply-actions .planning-more-btn {
  padding: 0;
}

.planning-apply-btn {
  flex: 0 1 auto;
}

.planning-apply-actions .planning-gen-btn {
  flex: 1 1 auto;
}

.planning-gen-btn {
  font-weight: 600;
}

@media (max-width: 960px) {
  .planning-tab {
    height: auto;
    min-height: 0;
    gap: var(--s-2);
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .planning-steps {
    display: none;
  }

  .planning-mobile-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    flex-shrink: 0;
    padding: 3px;
    border-radius: var(--r-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 7;
  }

  .planning-mobile-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    border: none;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-3);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .planning-mobile-nav-btn.is-active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
  }

  .planning-mobile-nav-num {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text-3);
  }

  .planning-mobile-nav-btn.is-active .planning-mobile-nav-num {
    background: var(--accent);
    color: var(--text-on-accent);
  }

  .planning-grid {
    display: block;
    flex: none;
    min-height: 0;
  }

  .planning-col {
    display: none;
    min-height: 0;
  }

  .planning-col.is-mobile-active {
    display: flex;
  }

  .planning-panel {
    padding: var(--s-3);
    border-radius: var(--r-md);
  }

  .planning-panel-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  .planning-panel-head .planning-mode-toggle {
    flex: 1 1 100%;
  }

  .planning-overflow-menu {
    max-width: min(280px, calc(100vw - 16px));
  }

  .planning-overflow-menu .frame-slot-actions-menu-item {
    min-height: 40px;
    font-size: 13px;
  }

  .planning-panel-titles .card-subtitle {
    display: none;
  }

  .planning-panel--source {
    min-height: 0;
  }

  .planning-raw {
    flex: 1;
    min-height: 100px;
    max-height: none;
    font-size: 15px;
    line-height: 1.45;
    padding: 10px 12px;
  }

  .planning-raw-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .planning-brief {
    font-size: 14px;
    min-height: 52px;
  }

  .planning-brief-summary {
    min-height: 28px;
    display: flex;
    align-items: center;
    font-size: 12px;
  }

  .planning-ai-btn {
    min-height: 36px;
    font-size: 12px;
    flex: 1.4 1 0;
    width: auto;
  }

  .planning-extract-btn {
    min-height: 36px;
    justify-content: center;
    flex: 1 1 0;
    width: auto;
  }

  .planning-structure-body {
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding-bottom: 6px;
  }

  .planning-structure-empty {
    min-height: 140px;
    padding: var(--s-5) var(--s-3);
  }

  .planning-muted {
    max-width: 28ch;
    font-size: 12px;
  }

  .planning-part {
    padding: 8px;
    gap: 6px;
  }

  .planning-part-title {
    font-size: 14px;
    min-height: 32px;
  }

  .planning-seg-row {
    padding: 8px;
    gap: 5px;
    border-radius: var(--r-sm);
  }

  .planning-seg-top {
    grid-template-columns: 18px minmax(0, 1fr) auto 36px;
    gap: 6px;
  }

  .planning-seg-title {
    min-height: 0;
    font-size: 13px;
    padding: 6px 8px;
  }

  .planning-seg-notes {
    min-height: 0;
    font-size: 12px;
    padding: 4px 6px;
    background: var(--bg);
    border-color: var(--border);
  }

  .planning-seg-prompt-peek {
    min-height: 0;
    padding: 6px 8px;
  }

  .planning-seg-prompt {
    min-height: 56px;
    font-size: 12px;
    padding: 8px;
  }

  .planning-seg-top > .planning-icon-btn {
    width: 30px;
    height: 30px;
  }

  .planning-seg-row > .keyframe-plan-label {
    margin-inline-start: 24px;
    font-size: 10px;
    flex-wrap: wrap;
    white-space: normal;
    overflow: visible;
  }

  .planning-add-seg {
    min-height: 28px;
    padding-inline: 8px;
  }

  .planning-chars-banner-inner {
    padding: 6px 8px;
  }

  .planning-footer {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    margin: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 16px rgba(10, 22, 40, 0.06);
  }

  .planning-footer-copy {
    display: none;
  }

  .planning-apply-actions {
    display: grid;
    grid-template-columns: 36px 1fr 1.35fr;
    gap: 6px;
    width: 100%;
  }

  .planning-more-btn {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .planning-apply-btn,
  .planning-gen-btn {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    font-size: 12px;
    border-radius: var(--r-sm);
  }

  .planning-gen-btn {
    font-weight: 650;
  }
}

@media (max-width: 480px) {
  .planning-structure-meta {
    display: none;
  }

  .planning-tab {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .planning-panel--source {
    min-height: 0;
  }

  .planning-raw {
    min-height: 88px;
  }

  .planning-apply-actions {
    grid-template-columns: 34px 1fr 1.25fr;
  }

  .planning-apply-btn,
  .planning-gen-btn {
    order: unset;
    min-height: 34px;
    font-size: 12px;
  }

  .planning-mobile-nav-btn {
    font-size: 11px;
    gap: 4px;
    min-height: 30px;
  }

  .planning-raw-actions {
    gap: 5px;
  }

  .planning-raw-actions .btn:not(.planning-more-btn) {
    white-space: normal;
    line-height: 1.2;
    padding-inline: 8px;
  }

  .planning-chars-banner--warn {
    flex-direction: column;
    align-items: stretch;
  }

  .planning-chars-link {
    margin-inline-start: 0;
    align-self: flex-start;
  }
}

.planning-seg-head-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.planning-seg-row > .keyframe-plan-label {
  max-width: 100%;
  min-width: 0;
  margin-inline-start: 24px;
  flex-wrap: wrap;
  white-space: normal;
  overflow: visible;
}

.planning-seg-decisions-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
}

.planning-seg-decisions-btn:hover,
.planning-seg-decisions-btn.is-open {
  background: var(--accent-soft);
  color: var(--accent);
}

.planning-seg-decisions-pop {
  position: fixed;
  z-index: 5000;
  box-sizing: border-box;
  width: min(320px, calc(100vw - 16px));
  max-height: min(320px, calc(100vh - 16px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow:
    0 4px 6px color-mix(in srgb, var(--text) 6%, transparent),
    0 12px 28px color-mix(in srgb, var(--text) 14%, transparent);
  display: flex;
  flex-direction: column;
  gap: 6px;
  direction: rtl;
}

.planning-seg-decisions-pop-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}

.planning-seg-decisions-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.psd-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 6px;
  font-size: 11px;
  align-items: baseline;
}

.psd-k {
  color: var(--text-3);
  font-weight: 600;
}
.psd-v {
  color: var(--text-2);
}

/* The beat's other half: which shot it became, and how far that shot has got.
   All of it was already computed by buildPlanGenRowMeta — it was only ever
   shown inside the apply dialog, so the plan and the storyboard were two lists
   of the same thing with no visible link between them. */
.planning-seg-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex-shrink: 0;
  min-height: 22px;
  padding: 0 4px 0 2px;
  border: none;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.planning-seg-link svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.planning-seg-link:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.planning-seg-link:hover svg {
  opacity: 1;
}

.planning-seg-link.is-empty {
  color: var(--text-2);
}

.planning-seg-link.is-empty:hover {
  background: var(--surface-2);
  color: var(--text);
}

.planning-seg-link.is-new {
  background: transparent;
  color: var(--text-3);
  border: 1px dashed var(--border);
  cursor: default;
  font-weight: 600;
  padding: 0 7px;
}

.planning-seg-link.is-new:hover {
  background: transparent;
  color: var(--text-3);
}

/* Beat fields: one labelled row each.
   Dashed frame + small accent tag — same language as the prompt peek. */
.seg-field {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  padding: 3px 8px;
}

.seg-field:focus-within {
  border-style: solid;
  border-color: var(--accent);
  background: var(--surface);
}

.seg-field.is-empty {
  border-color: color-mix(in srgb, var(--border) 60%, transparent);
  background: transparent;
}

.seg-field-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-field.is-empty .seg-field-label {
  color: var(--text-3);
}

.seg-field-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  padding: 2px 0;
  font-family: inherit;
}

.seg-field-input:focus {
  outline: none;
}

.seg-field-input::placeholder {
  color: var(--text-3);
  opacity: 0.75;
}

.seg-field--multiline {
  align-items: start;
}

.seg-field--multiline .seg-field-label {
  padding-top: 4px;
}

textarea.seg-field-input {
  display: block;
  min-height: 0;
  margin: 0;
  field-sizing: content;
  line-height: 1.55;
  resize: none;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.seg-field--block {
  align-items: start;
  padding: 5px 8px;
}

.seg-field--block .seg-field-label {
  padding-top: 3px;
}

.seg-field--scene {
  grid-template-columns: 3.6rem minmax(0, 1fr);
}

.seg-field--scene .seg-field-label {
  font-size: 9.5px;
}

.planning-scene-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.planning-seg-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

@media (max-width: 720px) {
  .planning-scene-fields,
  .planning-seg-fields {
    grid-template-columns: 1fr;
  }
}

/* Scene bed uses the same field chrome as the beats — it just sits on the
   part, one step above them. */
.planning-scene-sound {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 3px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.planning-scene-sound:focus-within {
  border-style: solid;
  border-color: var(--accent);
  background: var(--surface);
}

.planning-scene-sound.is-empty {
  border-color: color-mix(in srgb, var(--border) 60%, transparent);
  background: transparent;
}

.planning-scene-sound .seg-field-label {
  font-size: 9.5px;
}

/* ── World of the film + director conversation (director-panel.js) ───────── */
.world-card,
.director-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  margin-top: 10px;
}

.world-card[hidden] {
  display: none !important;
}

.world-card-head,
.director-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.world-card-stale {
  font-size: 12px;
  color: var(--text-2, var(--text));
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 6px 8px;
}

.world-mode-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.world-mode-btn {
  flex: 1 1 140px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.world-mode-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.world-mode-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.world-logline {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

.world-setting {
  font-size: 12px;
  color: var(--text-3, var(--text-muted));
}

.world-card-section {
  font-size: 12px;
  line-height: 1.5;
  border-top: 1px solid var(--divider, var(--border));
  padding-top: 4px;
}

.world-card-section summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.world-card-section ul {
  margin: 4px 0 2px;
  padding-inline-start: 18px;
  color: var(--text-2, var(--text));
}

.director-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  min-height: 60px;
  overflow-y: auto;
  padding: 4px 2px;
}

.director-empty {
  font-size: 12px;
  color: var(--text-3, var(--text-muted));
  line-height: 1.5;
}

.director-msg {
  max-width: 92%;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.director-msg.is-user {
  align-self: flex-start;
  background: var(--accent-soft);
}

.director-msg.is-director {
  align-self: flex-end;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.director-msg.is-thinking {
  color: var(--text-3, var(--text-muted));
  font-style: italic;
}

.director-text {
  white-space: pre-wrap;
}

.director-options,
.director-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.director-quick[hidden] {
  display: none !important;
}

.director-chip {
  border: 1px solid var(--accent-soft-2);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  text-align: start;
}

.director-chip:hover {
  background: var(--accent-soft);
}

.director-apply {
  align-self: flex-start;
}

.director-compose {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.director-input {
  flex: 1;
  min-height: 44px;
  resize: vertical;
  font-size: 13px;
}

/* An existing picture made for an earlier version of the shot (gen picker). */
.planning-gen-pick-badge--stale {
  color: #9a5b00;
  background: rgba(214, 140, 0, 0.12);
  border-color: rgba(214, 140, 0, 0.35);
  font-weight: 600;
}

:root[data-theme="dark"] .planning-gen-pick-badge--stale {
  color: #f0b45a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .planning-gen-pick-badge--stale {
    color: #f0b45a;
  }
}

.world-mode-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2, var(--text));
}

.world-mode-hint-note {
  color: var(--text-3, var(--text-muted));
}

/* ── The film's costume plan, inside the world card (director-panel.js) ──── */
.world-costumes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--divider, var(--border));
  padding-top: 8px;
}

.world-costume-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.world-costume-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* ── End-frame window: "from the plan" or "free" (frame-slot.js) ─────────── */
.end-source {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.end-source-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.end-source-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2, var(--text));
}

.end-source-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 14px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.end-source-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.end-source-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.end-source-hint {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-3, var(--text-muted));
}

/* ===== Planning: the details | the chapters | the director =====
 * The same three white panels as the shots and editing tabs (.shots-layout):
 * the details panel (empty until something is clicked), the four chapters in
 * the middle with one open at a time, and the director as a conversation that
 * is always open. js/views/workspace/plan-chapters.js explains the parts.
 */

/* Anything hidden in the planning tab stays hidden — several pieces here set
   their own display, which would otherwise outrank the attribute. */
.planning-tab [hidden] {
  display: none !important;
}

.planning-tab.pc-page {
  height: auto;
  min-height: 0;
  gap: 0;
}

.pc-app {
  /* The shots tab's column height (--shots-col-h), so the tabs line up. */
  --pc-col-h: calc(100vh - var(--topbar-h) - 80px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: var(--s-3);
  align-items: stretch;
  min-height: var(--pc-col-h);
}

/* A film without planning: no director column — the chapter and the details. */
.pc-app.pc-app--manual {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.pc-main,
.pd-side,
.pc-director {
  height: var(--pc-col-h);
  max-height: var(--pc-col-h);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

/* ── the director: its conversations, and what it changed ──────────────── */

.director-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* The open conversation's name - text, not a control (the clock opens the list). */
.director-chat-name {
  max-width: 100%;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.director-icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.director-icon-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.director-icon-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* The conversations: a list that drops down from the header OVER the chat
   (the chat stays where it was), and goes away on a pick, Escape or a press
   outside. */
.director-card .director-head {
  position: relative;
}

.director-history {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: director-history-in 140ms ease-out;
}

@keyframes director-history-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .director-history {
    animation: none;
  }
}

.director-history[hidden],
.director-log[hidden] {
  display: none;
}

.director-history-head {
  padding: 2px 4px 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
}

.director-icon-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent);
}

.director-history-list {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
}

.director-history-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-inline-end: 4px;
}

.director-history-row + .director-history-row {
  border-top: 1px solid var(--divider);
}

.director-history-row:hover {
  background: var(--surface-hover);
}

.director-history-row.is-active {
  background: var(--accent-soft);
}

.director-history-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.director-history-title {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.director-history-meta {
  font-size: 11px;
  color: var(--text-3);
}

.director-history-delete {
  width: 26px;
  height: 26px;
  color: var(--text-3);
}

.director-history-delete:hover:not(:disabled) {
  color: var(--danger, var(--ember));
}

.director-history-empty {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
}

/* What the director changed, under its reply: one line per change. */
.director-changes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: var(--r-md);
  background: var(--surface);
}

.director-changes.has-failed {
  border-color: color-mix(in srgb, var(--ember) 40%, var(--border));
}

.director-changes.is-undone {
  opacity: 0.7;
}

.director-changes-head {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.director-changes.has-failed .director-changes-head {
  color: var(--ember);
}

.director-changes.is-undone .director-changes-head {
  color: var(--text-3);
}

.director-changes-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.director-changes-list > li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}

.director-change-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.director-changes-list > li.is-failed .director-change-ico,
.director-changes-list > li.is-cut .director-change-ico,
.director-changes-list > li.is-warn .director-change-ico {
  background: var(--ember-soft);
  color: var(--ember);
}

.director-changes-list > li.is-running .director-change-ico {
  background: transparent;
}

.director-change-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.director-change-paid {
  margin-inline-start: 6px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
}

.director-change-detail {
  display: block;
  color: var(--ember);
  font-size: 11.5px;
}

.director-changes-foot {
  display: flex;
}

/* ── the chapters: a step bar with one chapter visible at a time ─────── */

.pc-main {
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.pc-stage-nav {
  position: sticky;
  top: 0;
  z-index: 4;
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.pc-stage-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.pc-stage-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.pc-stage-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.pc-stage-btn[aria-current="step"] {
  background: var(--accent-soft);
  color: var(--accent);
}
.pc-stage-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-pressed);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
}
.pc-stage-btn.is-done .pc-stage-num {
  background: var(--accent-soft);
  color: var(--accent);
}
.pc-stage-btn[aria-current="step"] .pc-stage-num {
  background: var(--accent);
  color: var(--text-on-accent);
}
.pc-stage-title {
  font-size: 11.5px;
  line-height: 1.4;
  font-weight: 600;
}

.pc-chapter {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.pc-chapter[hidden] {
  display: none !important;
}

.pc-chapters {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

.pc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--s-4);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  border-bottom: 1px solid var(--divider);
}

/* The shot rail's number (.rail-num): one look across the site. */
.pc-num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-pressed);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.pc-chapter.is-done .pc-num {
  background: var(--accent-soft);
  color: var(--accent);
}

.pc-chapter.is-current .pc-num {
  background: var(--accent);
  color: var(--text-on-accent);
}

.pc-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.pc-title {
  margin: 0;
  flex: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pc-summary {
  min-width: 0;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-summary:empty {
  display: none;
}

.pc-state {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--ember-soft);
  color: var(--ember);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pc-state:empty {
  display: none;
}

.pc-body {
  padding: var(--s-4);
}

/* Each chapter keeps its own actions directly after its content. */
.pc-story > .pc-actions,
.pc-look > .pc-actions,
.pc-shots > .pc-actions,
.pv-preview > .pc-actions {
  position: static;
  margin: 4px calc(-1 * var(--s-4)) calc(-1 * var(--s-4));
  padding: 10px var(--s-4);
  border-top: 1px solid var(--divider);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(6px);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ── the director: a conversation, always open ────────────────────────── */

.pc-director .director-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.pc-director .director-log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.pc-director-context {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  font-size: 11.5px;
  color: var(--text-2);
}

.pc-director-context-label {
  font-weight: 700;
  color: var(--accent);
}

/* Keep the planning panel's palette and frame; give the conversation its own rhythm. */
.director-card .director-head {
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.director-head > div:not(.director-avatar) {
  flex: 1;
  min-width: 0;
}
.director-head .card-subtitle {
  margin-top: 3px;
  font-size: 11.5px;
}
.director-avatar,
.director-empty-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.director-card .director-log {
  gap: 14px;
  padding: 12px 2px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-gutter: stable;
}

.director-card .director-empty {
  margin: auto 0;
  padding: 24px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  line-height: 1.7;
}
.director-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
}
.director-empty strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}
.director-empty p {
  margin: 0;
}
.director-card .director-msg {
  flex: none;
  min-width: 0;
  max-width: 96%;
  padding: 10px 12px;
  gap: 8px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.director-card .director-msg.is-user {
  border-start-start-radius: 4px;
  background: var(--accent);
  color: #fff;
}
.director-card .director-msg.is-user .director-msg-meta,
.director-card .director-msg.is-user .director-msg-meta > span {
  color: rgba(255, 255, 255, 0.8);
}
.director-card .director-msg.is-director {
  border-start-end-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
}
.director-card .director-text {
  text-align: start;
  font-size: 13px;
  line-height: 1.75;
}
.director-card .director-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  margin-top: 2px;
  border-top: 1px solid var(--border);
}
.director-options-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3, var(--text-muted));
}
.director-options .director-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 12px;
  align-items: start;
  gap: 7px;
  width: 100%;
  padding: 10px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: start;
  font-size: 12px;
  line-height: 1.65;
  background: var(--surface);
  transition:
    background 0.15s,
    border-color 0.15s;
}
.director-option-number {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding-top: 2px;
}
.director-option-text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.director-option > .ui-icon {
  margin-top: 4px;
  color: var(--text-3);
}
.director-options .director-option:hover,
.director-options .director-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.director-msg .director-apply {
  max-width: 100%;
  white-space: normal;
  text-align: start;
  line-height: 1.5;
}
.director-msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 10.5px;
  color: var(--text-3, var(--text-muted));
}
.director-msg-meta > span {
  font-weight: 600;
  color: var(--text-2, var(--text));
}
.director-msg-meta time {
  direction: ltr;
  font-size: 10px;
}
.director-card .director-quick {
  flex: none;
  gap: 6px;
}
.director-quick .director-chip {
  width: 100%;
  border-radius: var(--r-sm);
  padding: 8px 10px;
}
.director-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.director-chip:disabled {
  opacity: 0.5;
  cursor: default;
}
/* The composer: the message, and under it the model and «שלח» side by side. */
.director-card .director-compose {
  position: relative;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 5px;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  background: var(--surface);
  transition: border-color 0.15s;
}
.director-card .director-compose:focus-within {
  border-color: var(--accent);
}
.director-compose .director-input {
  scrollbar-width: thin;
  scrollbar-gutter: auto;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 32px;
  max-height: 144px;
  padding: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  resize: none;
  line-height: 1.6;
}
.director-compose .director-send {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 8px;
  padding: 0;
}
.director-compose-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

/* Who talks with you: the model's mark and name, beside «שלח». */
.director-model-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  height: 28px;
  padding-block: 0;
  padding-inline: 7px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.director-model-btn:hover,
.director-model-btn.is-on {
  background: var(--surface-hover);
  color: var(--text);
}
.director-model-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.director-model-btn-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.director-model-btn > .ui-icon:last-child {
  flex: none;
  color: var(--text-3);
  transition: transform 0.15s;
}
.director-model-btn.is-on > .ui-icon:last-child {
  transform: rotate(180deg);
}

.director-model-mark {
  flex: none;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  line-height: 0;
}
.director-model-mark svg {
  display: block;
}
.director-model-mark.is-film {
  color: var(--accent);
}

/* The list opens upward over the conversation, as wide as the composer. */
.director-model-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  inset-inline: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  max-height: 440px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: director-model-in 140ms ease-out;
}
.director-model-menu[hidden] {
  display: none;
}
@keyframes director-model-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .director-model-menu {
    animation: none;
  }
}
.director-model-menu-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}
/* One line a model: mark · name · about what a message costs. The chosen one
   is its highlight, no ✓. */
.director-model-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.director-model-row:hover,
.director-model-row:focus-visible {
  background: var(--surface-hover);
  outline: none;
}
.director-model-row.is-on {
  background: var(--accent-soft);
}
.director-model-row > .director-model-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.director-model-row-name {
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.director-model-row-price {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  white-space: nowrap;
}
.director-model-row.is-missing .director-model-mark,
.director-model-row.is-missing .director-model-row-name {
  opacity: 0.5;
}
.director-model-row.is-missing .director-model-row-price {
  font-size: 11px;
  color: #9a5b00;
}
:root[data-theme="dark"]
  .director-model-row.is-missing
  .director-model-row-price {
  color: #f0b45a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])
    .director-model-row.is-missing
    .director-model-row-price {
    color: #f0b45a;
  }
}
.director-model-sep {
  flex: none;
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
}
.pc-director .pc-director-context {
  flex: none;
  background: transparent;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 2px 2px;
  font-size: 10.5px;
}
.director-card .director-msg.is-thinking {
  flex-direction: row;
  align-items: center;
  font-style: normal;
  font-size: 12px;
}
.director-typing {
  display: flex;
  gap: 3px;
}
.director-typing i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: director-typing 1.2s ease-in-out infinite;
}
.director-typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.director-typing i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes director-typing {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .director-typing i {
    animation: none;
  }
}

.pc-idea,
.pc-story,
.pc-look,
.pc-shots {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: -6px;
}

.pc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.pc-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.pc-section-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.pc-empty {
  margin: 0;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-3);
}

.pc-muted {
  font-size: 12px;
  color: var(--text-3);
}

.pc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.pc-actions-note {
  flex: 1;
  min-width: 160px;
  font-size: 12px;
  color: var(--text-3);
}

.pc-details > summary,
.pc-understanding > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  padding: 4px 0;
}

.pc-details[open] > summary,
.pc-understanding[open] > summary {
  margin-bottom: 8px;
}

.pc-understanding .world-card {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}

/* ── the change box ───────────────────────────────────────────────────── */

.pc-change {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 8px;
  border: 1px dashed var(--accent-soft-2);
  border-radius: var(--r-md);
  background: var(--accent-soft);
}

.pc-change-input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  max-height: 120px;
  resize: none;
  padding: 7px 8px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
}

.pc-change-input::placeholder {
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-change-send {
  flex: none;
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

.pc-change-send:hover:not(:disabled) {
  background: var(--accent-hover);
}

.pc-change.is-busy {
  opacity: 0.75;
}

/* ── chapter 1: the idea and the look ─────────────────────────────────── */

.pc-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.pc-understood {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.pc-understood-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
}

.pc-understood-text {
  font-size: 13.5px;
  color: var(--text);
}

.pc-understood-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}

.pc-understood .world-card {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}

.pc-look-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.pc-look-line:hover {
  background: var(--surface-hover);
}

.pc-look-label {
  flex: none;
  font-size: 13px;
  font-weight: 700;
}

.pc-look-text {
  grid-column: 1 / -1;
  grid-row: 2;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-2);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.pc-look-edit {
  grid-column: 2;
  grid-row: 1;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
}

.pc-look-line.is-open .pc-look-edit svg {
  transform: rotate(180deg);
}

.pc-look-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 2px 2px 4px;
}

.pc-look-panel .style-panel {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}

.pc-look-panel .style-panel-head {
  display: none;
}

.pc-rules {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pc-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-2);
}

.pc-rule > span:first-child {
  flex: 1;
  min-width: 0;
}

.pc-rule > .btn,
.pc-rule > .pc-chip {
  flex: none;
}

/* A decision being rewritten: the field takes the row. */
.pc-rule--editing > .pd-input {
  flex: 1;
  min-width: 0;
}

/* The details panel is narrow: the text on its own line, its tags and
   buttons under it. */
.pd-side .pc-rule:not(.pc-rule--editing) {
  flex-wrap: wrap;
  row-gap: 4px;
}

.pd-side .pc-rule:not(.pc-rule--editing) > .pc-rule-text {
  flex: 1 0 100%;
}

.pc-rule-add {
  display: flex;
  gap: 6px;
}

/* ── chips, pictures, cards ───────────────────────────────────────────── */

.pc-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-chip.is-ok {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}

.pc-chip.is-warn {
  background: var(--ember-soft);
  color: var(--ember);
}

.pc-chip.is-busy,
.pc-chip.is-promise {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Characters and places are compact rows — a small picture, the name, its
   state — not full-width posters: the whole cast should fit on one screen.
   The picture itself opens large in the details panel. */
.pc-faces {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.pc-faces > .pc-empty {
  grid-column: 1 / -1;
}

.pc-face {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-areas:
    "pic name"
    "pic status"
    "wear wear";
  align-items: center;
  column-gap: 10px;
  row-gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  min-width: 0;
  transition:
    border-color 0.15s var(--ease-out),
    background 0.15s var(--ease-out);
}

.pc-face--place {
  grid-template-columns: 64px minmax(0, 1fr);
}

.pc-face:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.pc-face.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pc-face > .pc-pic {
  grid-area: pic;
  width: 44px;
  height: 44px;
  aspect-ratio: auto;
  border-radius: 50%;
}

.pc-face--place > .pc-pic {
  width: 64px;
  height: 44px;
  border-radius: var(--r-sm);
}

.pc-face > .pc-face-name {
  grid-area: name;
}

.pc-face-meta {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pc-face-meta > .btn {
  padding: 2px 10px;
  min-height: 0;
  font-size: 12px;
}

.pc-face-count {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.pc-face-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
}

.pc-face-name b {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-face-wear {
  grid-area: wear;
  margin-top: 3px;
  padding-top: 5px;
  border-top: 1px solid var(--divider);
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-pic {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.pc-pic--place {
  aspect-ratio: 16 / 10;
}

button.pc-pic {
  cursor: zoom-in;
}

.pc-pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pc-pic.is-empty {
  display: grid;
  place-items: center;
}

.pc-pic-empty {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-3);
  opacity: 0.75;
}

.pd-body > .pc-pic .pc-pic-empty {
  font-size: 26px;
}

.pc-pic-busy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--overlay);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

/* A small picture shows only the spinner. */
.pc-face .pc-pic-busy > span {
  display: none;
}

.pc-look-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pc-model {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}

.pc-model-label {
  font-size: 12px;
  color: var(--text-3);
}

.pc-costumes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── rows: the story's scenes ─────────────────────────────────────────── */

.pc-rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.pc-rows > .pc-empty {
  padding: 10px 12px;
}

.pc-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface);
  cursor: pointer;
}

.pc-row + .pc-row {
  border-top: 1px solid var(--divider);
}

.pc-row:hover {
  background: var(--surface-hover);
}

.pc-row.is-selected {
  background: var(--accent-soft);
}

.pc-row-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 700;
}

.pc-row-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.pc-row-sub {
  font-size: 12.5px;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pc-row-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 220px;
}

/* ── chapter 4: scenes and shots ──────────────────────────────────────── */

.pc-scenes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-scene {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.pc-scene.is-dragging {
  opacity: 0.5;
}

.pc-scene.drag-over {
  box-shadow: 0 -3px 0 var(--accent);
}

.pc-scene.drag-over-after {
  box-shadow: 0 3px 0 var(--accent);
}

.pc-scene-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.pc-scene-head.is-selected {
  background: var(--accent-soft);
}

.pc-scene-num {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
}

.pc-scene-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.pc-scene-titles b {
  font-size: 13.5px;
}

.pc-scene-meta {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-shot {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--divider);
  cursor: pointer;
}

.pc-shot:hover {
  background: var(--surface-hover);
}

.pc-shot.is-selected {
  background: var(--accent-soft);
}

.pc-shot.is-dragging {
  opacity: 0.45;
}

.pc-shot.drag-over {
  box-shadow: inset 0 2px 0 var(--accent);
}

.pc-shot.drag-over-after {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.pc-shot-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.pc-shot-copy {
  min-width: 0;
}

.pc-shot-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-shot-title.is-empty {
  color: var(--text-3);
  font-weight: 500;
}

.pc-shot-sub {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-shot-chips {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 260px;
}

.pc-shot-state {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
}

.pc-shot-state.is-image {
  border-color: var(--accent);
  background: var(--accent);
}

.pc-shot-state.is-video {
  border-color: var(--green);
  background: var(--green);
}

.pc-add-shot {
  margin: 4px 8px 6px;
}

/* ── the details panel: empty until something is clicked ──────────────── */

.pd-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--s-6);
  text-align: center;
  color: var(--text-3);
}

.pd-empty-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.pd-empty-hint {
  max-width: 240px;
  font-size: 12px;
  line-height: 1.5;
}

.pd-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
}

.pd-titles {
  flex: 1;
  min-width: 0;
}

.pd-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.pd-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
}

.pd-close {
  flex: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.pd-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.pd-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pd-side .style-choice-grid--aspect {
  /* Four aspect tiles do not fit the details panel in one row. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pd-body > * {
  /* A scrolling column: its sections keep their height and the column
     scrolls, instead of squeezing them into each other. */
  flex-shrink: 0;
}

.pd-body > .pc-pic {
  max-height: 200px;
}

.pd-body > .pc-pic--face {
  max-width: 150px;
  align-self: center;
}

.pd-body .style-panel {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}

/* Compact film settings belong to the details panel; shared style cards keep their layout. */
.pd-body .style-panel--compact .style-body {
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.pd-body .style-panel--compact .style-body > .style-section:first-child {
  overflow: visible;
}
.pd-body .style-panel--compact .style-choice--with-swatch {
  height: 48px;
  min-height: 48px;
  padding: 5px 6px;
  gap: 6px;
}
.pd-body .style-panel--compact .style-choice-swatch {
  flex: none;
  width: 24px;
  height: 28px;
}
.pd-body .style-panel--compact .style-choice-text {
  min-width: 0;
}
.pd-body .style-panel--compact .style-choice--with-swatch .style-choice-label {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: 12px;
  line-height: 1.3;
}
.pd-body .style-panel--compact .style-prefs-grid {
  padding: 8px;
  gap: 7px;
}
.pd-body .style-panel--compact .style-prefs-grid > .style-section {
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 6px;
}
.pd-body .style-panel--compact .style-prefs-grid .style-choice {
  height: 32px;
  min-height: 32px;
  padding: 3px 5px;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
.pd-body .style-panel--compact .style-prefs-grid .style-choice-label {
  white-space: normal;
  font-size: 12px;
  line-height: 1.15;
  overflow: visible;
  text-overflow: clip;
}
.pd-body .style-panel--compact .style-choice-grid--season {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}
.pd-body .style-panel--compact .style-choice-grid--season > .style-choice {
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface);
}
.pd-body
  .style-panel--compact
  .style-choice-grid--season
  > .style-choice.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pd-body > .pc-idea {
  flex: 1 0 auto;
}
.pd-body .pc-idea > .planning-raw {
  min-height: 240px;
}

.pd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.pd-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}

.pd-input {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
}

.pd-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

textarea.pd-input {
  resize: vertical;
}

textarea.pd-growing-input {
  display: block;
  min-height: 0;
  field-sizing: content;
  resize: none;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.pd-select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  text-align: start;
}

.pd-select .cselect-trigger-label {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

/* Every dropdown in the details panel: one trigger, one menu. */
.pd-body .cselect-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: none;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  cursor: pointer;
}

.pd-body .cselect-trigger:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.pd-body .cselect-trigger.open,
.pd-body .cselect-trigger:focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-focus);
  outline: none;
}

.pd-body .cselect-trigger.pd-select--placeholder .cselect-trigger-label {
  color: var(--text-3);
}

.pd-select-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pd-costume-head > .cselect-trigger,
.pd-body .pc-model .cselect-trigger {
  width: auto;
  flex: 1 1 auto;
  min-width: 140px;
}

.cselect-menu.cselect-menu--planning {
  width: 240px;
  max-width: calc(100vw - 16px);
  max-height: min(320px, 52vh);
  padding: 4px;
  border-radius: var(--r-sm);
}

.cselect-menu--planning .cselect-option {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12.5px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cselect-menu--planning .cselect-option-label {
  flex: none;
  min-width: 0;
  max-width: 100%;
  line-height: 1.45;
}

.cselect-menu--planning .cselect-option-hint {
  flex: none;
  min-width: 0;
  white-space: normal;
  max-width: none;
  overflow: visible;
  overflow-wrap: break-word;
  text-overflow: clip;
  font-size: 11px;
  line-height: 1.45;
}

.cselect-menu--planning .cselect-option-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
  flex: none;
}

.cselect-menu--planning .cselect-option--danger,
.cselect-menu--planning .cselect-option--danger .cselect-option-label {
  color: var(--danger, #d14343);
}

.cselect-menu--planning .cselect-option--danger:hover,
.cselect-menu--planning .cselect-option--danger.active {
  color: var(--danger, #d14343);
  background: color-mix(in srgb, var(--danger, #d14343) 12%, transparent);
}

.pd-context-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.pd-group.pd-group--context,
.pd-group.pd-group--dialogue {
  gap: 6px;
  padding: 8px 0;
}

.pd-group--context .pd-group-head,
.pd-group--dialogue .pd-group-head {
  min-height: 18px;
}

.pd-context-fields > .pd-field {
  padding: 0;
}

.pd-context-fields .pd-inline-field {
  align-items: stretch;
}

.pd-context-fields .pd-select .cselect-trigger-label {
  white-space: nowrap;
}

.pd-context-fields .pd-who {
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text-2);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.pd-context-fields .pd-who-add {
  border-style: dashed;
  border-color: var(--border);
  background: transparent;
}

.pd-context-fields .pd-who:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pd-context-fields .pd-chips {
  gap: 4px;
}

.pd-context-fields .pd-stepper {
  align-self: flex-start;
  justify-content: space-between;
  width: min(144px, 100%);
  min-width: 0;
  min-height: 30px;
  gap: 2px;
  padding: 1px 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.pd-context-fields .pd-stepper .pd-icon-btn {
  width: 24px;
  height: 24px;
  font-size: 13px;
}

.pd-context-fields .pd-stepper-value {
  min-width: 0;
  font-size: 12.5px;
}

.pd-context-fields .pd-text {
  font-size: 12.5px;
}

.pd-group--dialogue .seg-field--dialogue-compact {
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
  border: 0;
  background: transparent;
}

.seg-field--dialogue-compact > .seg-field-label {
  display: none;
}

.seg-field--dialogue-compact .planning-seg-dialogue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  padding: 0;
}

.seg-field--dialogue-compact .planning-dlg-labels,
.seg-field--dialogue-compact .planning-dlg-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(108px, 0.46fr) minmax(0, 1fr) 24px;
  gap: 5px;
  align-items: start;
}

.seg-field--dialogue-compact .planning-dlg-row {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.seg-field--dialogue-compact .planning-dlg-row .pd-inline {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.seg-field--dialogue-compact .planning-dlg-row .pd-inline:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.seg-field--dialogue-compact .planning-dlg-row .planning-dlg-char {
  border-inline-end: 0;
}

.seg-field--dialogue-compact textarea.planning-dlg-line {
  display: block;
  max-height: 74px;
  margin: 0;
  field-sizing: content;
  resize: none;
  overflow-y: auto;
  overflow-wrap: anywhere;
}

.seg-field--dialogue-compact .planning-dlg-add {
  justify-self: start;
}

.seg-field--dialogue-compact .pd-icon-btn {
  width: 24px;
}

.seg-field--dialogue-compact .planning-dlg-fit-host {
  align-self: center;
  min-width: 0;
  text-align: end;
}

.planning-dlg-fit-host:empty {
  display: none;
}

.pd-prompt {
  font-size: 12px;
}

.pd-seg-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pd-field > .cast-jewish-toggle {
  align-self: flex-start;
}

.pd-field .planning-story-cast-look {
  width: 100%;
  /* The old card capped it at 64px; in the drawer it is the main field. */
  min-height: 96px !important;
  max-height: 240px;
  resize: vertical;
}

.pd-hint {
  font-size: 11.5px;
  color: var(--text-3);
}

.pd-text {
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-wrap;
}
.pd-text--warn {
  color: var(--warning, #b45309);
}

/* «קול» on a character's card (new films): the voice list, then the two ways to make one. */
.pd-voice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.pd-voice .cselect-trigger {
  width: 100%;
}
.pd-voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pd-source {
  max-height: 260px;
  overflow-y: auto;
}

.pd-actions,
.pd-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pd-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.pd-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pd-row {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.45;
}

.pd-row-k {
  flex: none;
  min-width: 70px;
  max-width: 45%;
  color: var(--text-3);
}

.pd-row-v {
  min-width: 0;
  color: var(--text-2);
}

.pd-row--link {
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.pd-row--link:hover {
  background: var(--surface-hover);
}

.pd-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pd-stepper-value {
  min-width: 52px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pd-more > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.pd-more-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.pd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.pd-danger {
  color: var(--red);
  margin-inline-start: auto;
}

/* ── chapter 5: the preview ───────────────────────────────────────────── */

.pv-preview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pv-missing {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--ember) 30%, transparent);
  border-radius: var(--r-md);
  background: var(--ember-soft);
}

.pv-missing-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.pv-missing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pv-missing-text {
  font-size: 13px;
  color: var(--text-2);
}

.pv-keys-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pv-keys-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.pv-keys-sub {
  font-size: 12px;
  color: var(--text-3);
}

.pv-keys {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.pv-key {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.pv-key-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--pv-aspect, 16 / 9);
  padding: 0;
  border: 0;
  background: var(--surface-2);
  cursor: zoom-in;
}

.pv-key-thumb.is-empty {
  cursor: default;
}

.pv-key-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pv-key-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 12px;
}

.pv-key-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  font-size: 13px;
}

.pv-key-num {
  color: var(--text-3);
  font-weight: 600;
}

.pv-key-meta {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-key-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

/* ── narrower screens: the shots tab's breakpoints ─────────────────────── */

@media (max-width: 1280px) {
  .pc-app {
    grid-template-columns: 250px minmax(0, 1fr) 290px;
  }

  .pc-app.pc-app--manual {
    grid-template-columns: minmax(0, 1fr) 290px;
  }
}

@media (max-width: 1024px) {
  .pc-app,
  .pc-app.pc-app--manual {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The chapters first; the details open as a sheet; the director below. */
  .pc-main {
    order: -1;
  }

  .pc-main,
  .pd-side,
  .pc-director {
    height: auto;
    max-height: none;
  }

  .pc-main {
    overflow: visible;
  }

  .pc-director {
    height: 460px;
  }

  .pd-side:not(.has-item) {
    display: none;
  }

  .pd-side.has-item {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 60;
    max-height: 82dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--shadow-lg);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (max-width: 600px) {
  .pc-titles {
    flex-direction: column;
    gap: 0;
  }

  .pc-summary {
    white-space: normal;
  }

  .pc-shot {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .pc-shot-chips {
    grid-column: 2;
    justify-content: flex-start;
    max-width: none;
  }

  .pc-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .pc-row-chips {
    grid-column: 2;
    justify-content: flex-start;
    max-width: none;
  }

  .pd-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .pc-model {
    margin-inline-start: 0;
  }
}

/* ── one scene, listed once; costumes read per character and moment ───── */

.pc-scenes-moved {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-2);
}

.pd-section {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

/* ── the costume editor: one block per outfit (a character's details,
   «תלבושות הסרט», the extras) — when, what is worn, what is not ── */

.pd-costumes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pd-costume {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.pd-costume.is-photo {
  border-color: color-mix(in srgb, var(--green) 35%, var(--border));
}

.pd-costume-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

/* When it is worn: the same details dropdown, sized to the outfit head. */
.pd-costume-moment {
  max-width: 100%;
  cursor: pointer;
}

.pd-costume-when {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.pd-costume-remove {
  margin-inline-start: auto;
}

/* Long values under their labels, one under the other. */
.pd-inline-fields--labelled.pd-inline-fields--stacked {
  grid-template-columns: minmax(0, 1fr);
}

.pd-costume-add {
  justify-content: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}

.pd-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}

/* What the face wears, under the picture. */
.pd-outfit-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  align-self: stretch;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

.pd-outfit-note > svg {
  flex: none;
  margin-top: 3px;
}

.pd-outfit-note.is-warn {
  background: var(--ember-soft);
  color: var(--ember);
}

/* ── chapter 1: the source opens in details, the story stays in the middle ── */

.pc-story-chapter {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-brief-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pc-brief-block .pc-field-label {
  margin: 0;
}
.pc-idea-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.pc-idea-block:hover {
  background: var(--surface-hover);
}
.pc-idea-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pc-idea-preview {
  grid-column: 1 / -1;
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
}

/* A shared hierarchy for the four planning stages, using the site's palette. */
.pc-page .pc-body {
  padding: 14px;
}
.pc-page .pc-main {
  overflow: hidden;
}
.pc-page .pc-chapters {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.pc-stage-actions {
  flex: none;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.pc-stage-actions:not(:has(> .pc-actions:not([hidden]))) {
  display: none;
}
.pc-stage-actions > .pc-actions {
  margin: 0;
  padding: 0;
  border: 0;
  gap: 8px;
}
.pc-progress {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}
.pc-progress[hidden] {
  display: none;
}
.pc-progress-icon {
  display: flex;
  flex: none;
  color: var(--accent);
}
.pc-progress-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.5;
}
.pc-progress-copy b {
  color: var(--text);
  font-weight: 600;
}
.pc-progress.is-warning .pc-progress-icon {
  color: var(--warning, #b7791f);
}
.pc-page .pc-title {
  font-size: 15px;
  font-weight: 700;
}
.pc-purpose {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}
.pc-page .pc-summary {
  white-space: normal;
  line-height: 1.5;
}
.pc-page .pc-head {
  align-items: flex-start;
}
.pc-page .pc-head > .pc-num {
  margin-top: 2px;
}
.pc-page .pc-state {
  margin-top: 3px;
}
.pc-story-chapter,
.pc-page .pc-look,
.pc-page .pc-shots,
.pc-page .pv-preview {
  gap: 14px;
}
.pc-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.pc-section > .pc-section-head {
  margin: 0;
  align-items: flex-start;
  flex-wrap: wrap;
}
.pc-section-titles {
  flex: 1;
  min-width: 140px;
}
.pc-section .pc-section-title {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}
.pc-section-hint {
  display: block;
  margin: 2px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
  font-weight: 400;
}
.pc-section-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.pc-section .pc-section-tools {
  min-width: 0;
  gap: 4px;
}
.pc-page .pc-section-tools .btn-sm {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}
.pc-page .pc-look-line,
.pc-page .pc-idea-block {
  background: var(--surface-2);
  border-color: transparent;
  padding: 10px 12px;
}
.pc-page .pc-look-line:hover,
.pc-page .pc-idea-block:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.pc-page .pc-look-line.is-selected,
.pc-page .pc-idea-block.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pc-page .pc-look-text {
  font-size: 12px;
  line-height: 1.7;
}
.pd-body > .pc-model {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-inline-start: 0;
}
.pc-page .planning-story {
  min-height: 140px;
  line-height: 1.8;
  font-size: 13.5px;
}
.pc-page .pc-brief-block textarea {
  min-height: 72px;
  line-height: 1.7;
  font-size: 13px;
}
.pc-empty-state {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  min-width: 0;
}
.pc-empty-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
}
.pc-empty-copy b {
  display: block;
  color: var(--text-2);
  font-size: 13px;
}
.pc-empty-copy p {
  margin: 3px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.7;
}
.pc-empty-state > .btn {
  grid-column: 2;
  justify-self: start;
}
.pc-faces > .pc-empty-state {
  grid-column: 1 / -1;
}
.pc-page .pc-faces {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 8px;
}
.pc-page .pc-face {
  text-align: start;
  font: inherit;
  color: var(--text);
  padding: 10px;
}
.pc-page .pc-face-name b {
  white-space: normal;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.pc-face-name > svg {
  flex: none;
  color: var(--text-3);
}
.pc-page .pc-face-meta {
  gap: 6px;
  flex-wrap: wrap;
}
.pc-page .pc-face .pc-chip {
  font-size: 10.5px;
  padding: 1px 6px;
}
.pc-page .pc-face-wear {
  white-space: normal;
  line-height: 1.6;
}
.pc-detail-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  text-align: start;
  font: inherit;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.pc-detail-link:hover {
  background: var(--surface-hover);
}
.pc-detail-link > span {
  min-width: 0;
}
.pc-detail-link > svg {
  flex: none;
}
.pc-change-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.pc-change-wrap > .pc-field-label {
  margin: 0;
  font-size: 12px;
}
.pc-page .pc-change {
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.pc-page .pc-change:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.pc-page .pc-change-input {
  font-size: 13px;
}
.pc-page .pc-story-chapter > .pc-actions,
.pc-page .pc-look > .pc-actions,
.pc-page .pc-shots > .pc-actions,
.pc-page .pv-preview > .pc-actions {
  margin: 0;
  padding: 12px 0 0;
  background: transparent;
  backdrop-filter: none;
  gap: 8px;
}
.pc-page .pc-actions > .btn {
  font-size: 12.5px;
  min-height: 36px;
  padding: 7px 12px;
}
.pc-page .pc-scene-head {
  padding: 10px;
  gap: 8px;
}
.pc-page .pc-scene-titles {
  gap: 3px;
}
.pc-page .pc-scene-meta {
  white-space: normal;
  line-height: 1.5;
}
.pc-page .pc-shot {
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 4px 8px;
  padding: 10px;
}
.pc-page .pc-shot-num {
  align-self: start;
  padding-top: 2px;
}
.pc-page .pc-shot-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.pc-page .pc-shot-sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  line-height: 1.6;
  margin-top: 2px;
}
.pc-page .pc-shot-chips {
  grid-column: 2;
  justify-content: flex-start;
  max-width: none;
  margin-top: 2px;
}
.pc-page .pc-shot-chips .pc-chip {
  font-size: 10.5px;
}
.pc-page .pv-missing {
  padding: 12px;
  border-color: var(--border);
  background: var(--surface);
  gap: 0;
}
.pc-page .pv-missing-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}
.pc-page .pv-missing-row {
  padding: 7px 0;
  border-top: 1px solid var(--divider);
  align-items: flex-start;
}
.pc-page .pv-missing-text {
  font-size: 12px;
  line-height: 1.7;
}
.pc-page .pv-missing-row .btn {
  flex: none;
  min-height: 28px;
  font-size: 12px;
  padding: 3px 8px;
}
.pv-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.pv-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}
.pv-progress-copy span {
  color: var(--text-3);
}
.pv-progress progress {
  display: block;
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  accent-color: var(--accent);
}
.pv-progress progress::-webkit-progress-bar {
  background: var(--border);
  border-radius: 5px;
}
.pv-progress progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 5px;
}
.pv-progress progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 5px;
}
.pc-page .pv-keys {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 10px;
}
.pc-page .pv-key-thumb.is-empty {
  opacity: 1;
}
.pc-page .pv-key-copy {
  padding: 10px;
  gap: 5px;
  line-height: 1.6;
}
.pc-page .pv-key-copy > b {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.pc-page .pv-key-meta {
  white-space: normal;
  font-size: 11.5px;
  line-height: 1.6;
}
.pc-page .pv-key-actions {
  margin-top: auto;
  flex-wrap: wrap;
  gap: 4px;
}
.pc-page .pv-key-actions .btn {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 11.5px;
}
.pc-page
  :is(
    .pc-face,
    .pc-detail-link,
    .pc-scene-head,
    .pc-shot,
    .pv-key-thumb
  ):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
@media (max-width: 1024px) {
  .pc-page .pc-main {
    overflow: visible;
  }
  .pc-page .pc-chapters {
    flex: none;
    overflow: visible;
  }
}
@media (max-width: 600px) {
  .pc-page .pc-body {
    padding: 10px;
  }
  .pc-page .pc-chapters {
    padding: 8px;
  }
  .pc-section {
    padding: 10px;
  }
  .pc-page .pc-head {
    flex-wrap: wrap;
    padding: 12px;
    gap: 8px;
  }
  .pc-page .pc-head > .pc-state {
    margin-inline-start: 32px;
  }
  .pc-page .pc-title {
    font-size: 14px;
  }
  .pc-page .pc-purpose {
    font-size: 11.5px;
  }
  .pc-page .pc-actions > .btn {
    padding: 7px 10px;
    font-size: 12px;
  }
  .pc-page .pv-keys {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 440px) {
  .pc-page .pv-keys {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pc-idea-label {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* ══ Planning, chapter 1 and the details panel — one design language ═══════
 * The chapter fits one screen; the details panel speaks in groups (a small
 * heading, the content) and in editable lists (a line you click to edit, a
 * pencil and a delete beside it, «הוסף» as the last line). The toggles are
 * the site's own segmented control (.planning-mode-toggle).
 */

/* ── the step bar carries what the chapter heading used to say ───────────── */

/* What a step still lacks is a dot on its number's corner — no words on the
   bar (the user: "a dot without text, like on the phone"). The words are in
   the step's tooltip. */
.pc-stage-mark {
  position: relative;
  display: inline-grid;
}

.pc-stage-state {
  position: absolute;
  top: -2px;
  inset-inline-start: calc(100% - 9px);
  width: 10px;
  height: 10px;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface);
  background: var(--ember);
  font-size: 0;
  color: transparent;
}

.pc-stage-state:empty {
  display: none;
}

/* ── chapter 1: one screen, no scrolling ─────────────────────────────────── */

.pc-page .pc-chapter[data-chapter="story"]:not([hidden]) {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.pc-page .pc-chapter[data-chapter="story"] > .pc-body {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.pc-page .pc-story-chapter {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* The two inputs, one row each: icon · name · what is set now · the way in. */
.pc-source-tiles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pc-page .pc-source-tiles > .pc-look-line,
.pc-page .pc-source-tiles > .pc-idea-block {
  display: grid;
  grid-template-columns: auto 92px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.pc-page .pc-source-tiles > .pc-look-line:hover,
.pc-page .pc-source-tiles > .pc-idea-block:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.pc-page .pc-source-tiles > .is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pc-tile-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
}

.pc-source-tiles .pc-look-label,
.pc-source-tiles .pc-idea-label {
  grid-column: 2;
  grid-row: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.pc-source-tiles .pc-look-edit {
  grid-column: 4;
  grid-row: 1;
  color: var(--text-3);
}

.pc-source-tiles .pc-look-text,
.pc-source-tiles .pc-idea-preview {
  grid-column: 3;
  grid-row: 1;
  display: block;
  overflow: hidden;
  min-width: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The story takes whatever height is left. */
.pc-story-section {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.pc-story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pc-story-head .pc-section-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
}

.pc-story-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.pc-story-link:hover {
  background: var(--accent-soft);
}

.pc-page .pc-story-section > .pc-story:not([hidden]) {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pc-page .pc-story-section .planning-story {
  flex: 1 1 auto;
  min-height: 150px;
  max-height: none;
  height: 0;
  resize: none;
  font-size: 13.5px;
  line-height: 1.8;
}

/* On a phone the page scrolls, so there is no height left to fill: the story
   gets half the screen of its own (over the old phone cap of 72–140px). */
@media (max-width: 768px) {
  .pc-page .pc-story-section .planning-story {
    flex: none;
    min-height: 220px !important;
    height: 50vh;
  }
}

.pc-page .pc-story-section > .pc-empty-state {
  flex: 1 0 auto;
  align-content: center;
  justify-items: start;
  padding: 24px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}

/* The change line: one row, its label inside. */
.pc-change {
  align-items: center;
}

.pc-change-label {
  flex: none;
  padding-inline: 4px 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── chapters 2–4 in chapter 1's language (2026-10-05) ─────────────────────
 *
 * The user: "do the other windows with the nice design you made here". The
 * language: the chapter is the box; inside it a section is a heading with its
 * actions beside it (quiet links), then its content; a list is ONE framed
 * block with a line per item (no card per item); explanations live in
 * tooltips. Nothing here changes what a click does.
 */

.pc-page .pc-look,
.pc-page .pc-shots,
.pc-page .pv-preview {
  gap: 18px;
}

.pc-page .pc-section {
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.pc-page .pc-section > .pc-section-head {
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 28px;
  margin: 0;
}

.pc-page .pc-section-titles {
  flex: 1 1 auto;
  min-width: 0;
}

.pc-page .pc-section .pc-section-title,
.pc-page .pc-costumes .pc-section-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
}

.pc-page .pc-section-content:empty {
  display: none;
}

/* A section's actions: quiet text links, like «מה ה-AI הבין מהטקסט». The one
   that is the next step (secondary / primary) keeps its weight. */
.pc-page .pc-section-tools {
  gap: 2px;
}

.pc-page .pc-section-tools .btn-ghost {
  min-height: 28px;
  padding: 3px 8px;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: none;
}

.pc-page .pc-section-tools .btn-ghost:hover:not(:disabled) {
  background: var(--accent-soft);
}

.pc-page .pc-section-tools .btn-secondary {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 12.5px;
}

/* ── characters and places: the picture and the name under it, side by side
   (the user: "not a list one under the other"; people round, places a
   rectangle; what they wear only in the details) ── */

.pc-page .pc-faces:has(> .pc-face) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
}

.pc-page .pc-faces--places:has(> .pc-face) {
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
}

.pc-page .pc-faces > .pc-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}

.pc-page .pc-faces > .pc-face:hover {
  background: var(--surface-hover);
}

.pc-page .pc-faces > .pc-face.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pc-face-frame {
  position: relative;
  display: block;
}

.pc-page .pc-face--place > .pc-face-frame {
  width: 100%;
}

.pc-page .pc-face .pc-pic {
  width: 64px;
  height: 64px;
  aspect-ratio: auto;
  border-radius: 50%;
}

.pc-page .pc-face--place .pc-pic {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-sm);
}

/* No picture yet: an empty frame, plainly empty. */
.pc-page .pc-face .pc-pic.is-empty {
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
}

/* "This one needs a hand" — a portrait to approve, a description missing. */
.pc-face-dot {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 2px var(--surface);
}

.pc-face--place .pc-face-dot {
  top: 5px;
  inset-inline-end: 5px;
}

.pc-face-label {
  max-width: 100%;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The costumes: a heading and one tile, like the tiles of chapter 1. */
.pc-page .pc-costumes {
  gap: 8px;
}

.pc-page .pc-detail-link {
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.pc-page .pc-detail-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.pc-page .pc-detail-link b {
  font-size: 13px;
  color: var(--text);
}

.pc-page .pc-detail-link .pc-section-hint {
  display: inline;
  margin: 0 8px 0 0;
}

/* ── scenes and shots: the scene is a divider that names it (its details
   hold what all its shots share); the shots are the pictures, side by side —
   the user: "the shot is the main thing, the scene is a division" ── */

.pc-page .pc-scenes {
  gap: 0;
  /* The chapter scrolls, not this list. As its own scroller (the old
     .planning-structure-body: overflow-y auto + a stable scrollbar gutter)
     it clipped whatever touched its sides — on a classic Windows scrollbar
     the first tile's frame and the scene head's edge (the user's
     screenshots, 2026-10-05). */
  overflow: visible;
  padding: 0;
  scrollbar-gutter: auto;
}

.pc-page .pc-scene {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.pc-page .pc-scene:first-child {
  padding-top: 2px;
}

.pc-page .pc-scene + .pc-scene {
  border-top: 1px solid var(--divider);
}

.pc-page .pc-scene-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
}

.pc-page .pc-scene-head:hover {
  background: var(--surface-hover);
}

.pc-page .pc-scene-head.is-selected {
  background: var(--accent-soft);
}

.pc-page .pc-scene-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-scene-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pc-page .pc-scene-num {
  flex: none;
  min-width: 0;
  height: auto;
  padding: 1px 8px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.pc-page .pc-scene-titles b {
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-page .pc-scene-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}

.pc-scene-fact {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pc-scene-open {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

/* The shots: picture, number, name and length — tiles, like the cast. */
.pc-page .pc-shot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px 6px;
}

.pc-page .pc-shot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  cursor: pointer;
}

.pc-page .pc-shot:hover {
  background: var(--surface-hover);
}

.pc-page .pc-shot.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pc-page .pc-shot.drag-over {
  border-inline-start: 3px solid var(--accent);
}

.pc-page .pc-shot.drag-over-after {
  border-inline-end: 3px solid var(--accent);
}

.pc-shot-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: var(--shot-aspect, 16 / 9);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.pc-shot-frame.is-empty {
  border: 1px dashed var(--border-strong);
}

.pc-shot-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pc-shot-frame-empty {
  display: grid;
  color: var(--text-3);
  opacity: 0.55;
}

.pc-page .pc-shot-frame .pc-shot-num {
  position: absolute;
  top: 4px;
  inset-inline-start: 4px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.6;
}

.pc-shot-play {
  position: absolute;
  bottom: 4px;
  inset-inline-start: 4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.pc-shot-frame .pc-face-dot {
  top: 5px;
  inset-inline-end: 5px;
}

.pc-page .pc-shot-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pc-shot-meta {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-shot-meta:empty {
  display: none;
}

/* «+ קטע»: an empty frame at the end of its scene. */
.pc-page .pc-add-shot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
  margin: 0;
  align-self: start;
  padding: 5px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--accent);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.pc-add-shot-frame {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: var(--shot-aspect, 16 / 9);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
}

.pc-page .pc-add-shot:hover .pc-add-shot-frame,
.pc-page .pc-add-shot.drag-over .pc-add-shot-frame {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* A shot dragged onto «+ קטע» lands at the end of that scene. */
.pc-page .pc-add-shot.drag-over .pc-add-shot-frame {
  border-style: solid;
  border-width: 2px;
}

/* ── the preview ── */

.pc-page .pv-progress {
  padding: 10px 12px;
  border-color: transparent;
  background: var(--surface-2);
}

.pc-page .pv-missing {
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.pc-page .pv-missing-title {
  align-items: center;
  margin: 0;
  padding: 8px 12px;
  background: var(--surface-2);
  font-size: 13px;
}

.pc-page .pv-missing-row {
  align-items: center;
  padding: 4px 6px 4px 12px;
  border-top: 1px solid var(--divider);
}

.pc-page .pv-missing-text {
  font-size: 12.5px;
  line-height: 1.6;
}

.pc-page .pv-missing-row .btn {
  min-height: 28px;
  padding: 3px 10px;
  border-color: transparent;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.pc-page .pv-missing-row .btn:hover {
  background: var(--accent-soft);
}

/* The two ways to the film's images: check first, or everything now. */
.pv-ways-intro {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

.pv-ways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 8px;
}

.pv-way {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.pv-way--recommended {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
}

.pv-way--done {
  background: var(--surface-2);
}

.pv-way-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.pv-way-text {
  flex: 1;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
}

.pv-way-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* Key frames: small cards, several to a row. */
.pc-page .pv-keys {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.pc-page .pv-key-copy {
  gap: 2px;
  padding: 7px 9px 8px;
}

.pc-page .pv-key-copy > b {
  font-size: 12.5px;
  -webkit-line-clamp: 1;
}

.pc-page .pv-key-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-page .pv-key-actions {
  margin-top: 4px;
}

.pc-page .pv-key-actions .btn {
  min-height: 26px;
  padding: 2px 6px;
  border-color: transparent;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}

.pc-page .pv-key-actions .btn:hover:not(:disabled) {
  background: var(--accent-soft);
}

/* ── the details panel: groups ───────────────────────────────────────────── */

.pd-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--divider);
}

.pd-body > .pd-group:first-child,
.pd-body > :first-child .pd-group:first-child,
.pw-intro + .pd-group {
  padding-top: 2px;
  border-top: 0;
}

/* Shot and scene details share the same compact grey cards. */
.pd-body:is([data-kind="part"], [data-kind="beat"], [data-kind="shot"])
  > .pd-group:has(> .pd-group-head) {
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.pd-body:is([data-kind="part"], [data-kind="beat"], [data-kind="shot"])
  > .pd-group
  > .pd-group-head {
  margin: -8px -10px 0;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--surface-hover);
}

.pd-body:is([data-kind="part"], [data-kind="beat"], [data-kind="shot"])
  > .pd-group
  > .pd-field
  + .pd-field {
  padding-top: 4px;
  border-top: 1px solid var(--divider);
}

.pd-group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 22px;
}

.pd-group-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.pd-group-hint {
  margin: -2px 0 2px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

/* A quiet text action in a group's heading or foot. */
.pd-group-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pd-group-link:hover:not(:disabled) {
  background: var(--accent-soft);
}

.pd-group-link:disabled {
  opacity: 0.6;
  cursor: default;
}

.pd-group-head > .pw-revert {
  margin-inline-start: auto;
}

/* ── a character's or a place's details: the picture first, then groups ── */

.pd-picture {
  align-items: center;
  gap: 10px;
}

.pd-picture > .pc-pic--face {
  width: 128px;
  height: 128px;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 50%;
}

.pd-picture > .pc-pic--place {
  width: 100%;
  max-height: 220px;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md);
}

.pd-picture > .pc-pic.is-empty {
  border: 1px dashed var(--border-strong);
}

.pd-picture .pc-pic-empty {
  font-size: 28px;
}

.pd-picture-actions {
  justify-content: center;
}

.pd-model-row {
  display: flex;
  justify-content: center;
}

.pd-model-row > .pc-model {
  margin: 0;
}

.pd-picture > .pc-change-wrap {
  align-self: stretch;
}

.pd-side .cast-jewish-segmented {
  align-self: stretch;
  margin-top: 2px;
}

.pd-side .cast-jewish-segmented > .planning-mode-btn {
  flex: 1;
}

.pd-group > .planning-story-cast-look,
.pd-group > .planning-story-cast-look-wrap {
  width: 100%;
}

.pd-group .planning-story-cast-look {
  min-height: 96px !important;
  max-height: 240px;
  resize: vertical;
}

/* A new place: «הוסף מקום» and «ביטול» together at the foot. */
.pd-footer--form {
  justify-content: flex-start;
}

/* A shot's details: its picture first, in the film's frame shape. */
.pd-shot-picture {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: var(--shot-aspect, 16 / 9);
  max-height: 240px;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}

button.pd-shot-picture {
  cursor: zoom-in;
}

.pd-shot-picture.is-empty {
  border: 1px dashed var(--border-strong);
}

.pd-shot-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pd-shot-picture-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 80%;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

/* A scene's shots, one line each, opening the shot. */
.pd-list-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: start;
  cursor: pointer;
}

.pd-list-link:hover {
  background: var(--surface-hover);
}

.pd-list-link-k {
  flex: none;
  min-width: 26px;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.pd-list-link-v {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-list-link > svg {
  flex: none;
  color: var(--text-3);
}

/* The director's card of a scene: read-only, changed through the change box. */
.pd-directing-row {
  display: grid;
  grid-template-columns: minmax(84px, max-content) 1fr;
  gap: 4px 10px;
  padding: 3px 0;
  font-size: 12.5px;
  line-height: 1.55;
}

.pd-directing-k {
  font-weight: 600;
  color: var(--text-3);
}

.pd-directing-v {
  color: var(--text);
  min-width: 0;
}

.pd-directing-shots {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.pd-directing-shot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 12px;
  font-size: 12.5px;
  line-height: 1.5;
}

.pd-directing-shot + .pd-directing-shot {
  border-top: 1px solid var(--divider);
}

.pd-directing-shot-k {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.pd-directing-shot-v {
  color: var(--text);
}

@media (max-width: 540px) {
  .pd-directing-row {
    grid-template-columns: 1fr;
  }
}

/* ── editable lists: every line is edited where it stands ────────────────── */

.pd-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.pd-list > * + * {
  border-top: 1px solid var(--divider);
}

.pd-list-row {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  padding: 3px 4px 3px 6px;
  transition: background 0.12s;
}

.pd-list-row:hover {
  background: var(--surface-hover);
}

.pd-list-row:focus-within {
  background: var(--accent-soft);
}

.pd-inline-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 1px 0;
}

/* The words are the field: quiet until clicked, then a framed box. */
.pd-inline {
  display: block;
  width: 100%;
  min-height: 0;
  field-sizing: content;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.55;
  resize: none;
  overflow: hidden;
  cursor: text;
}

.pd-inline::placeholder {
  color: var(--text-3);
}

.pd-inline:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.pd-inline--sub {
  padding-block: 1px 4px;
  font-size: 12px;
  color: var(--text-2);
}

.pd-inline-fields > .pd-list-sub {
  padding: 0 7px 3px;
}

.pd-list-sub {
  font-size: 11px;
  color: var(--text-3);
}

/* Short values under their labels (where and when). */
/* Their fields are framed already: no frame around the frames, no row tint. */
.pd-list:has(> .pd-inline-row > .pd-inline-fields--labelled) {
  border: 0;
  background: transparent;
  overflow: visible;
}

.pd-list > .pd-inline-row:has(> .pd-inline-fields--labelled) {
  padding: 0;
  background: transparent;
}

.pd-inline-fields--labelled {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  padding: 0;
}

.pd-inline-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}

.pd-inline-field > span {
  padding-inline-start: 7px;
}

.pd-inline-fields--labelled .pd-inline {
  border-color: var(--border);
  background: var(--surface);
  font-weight: 400;
}

.pd-inline-fields--labelled .pd-inline:focus {
  border-color: var(--accent);
}

.pd-icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}

.pd-icon-btn:hover {
  background: var(--surface-pressed);
  color: var(--text);
}

.pd-icon-btn--danger:hover {
  background: var(--danger-soft, var(--ember-soft));
  color: var(--danger, var(--ember));
}

.pd-list-add {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}

.pd-list-add:hover {
  background: var(--accent-soft);
}

.pd-list-add[hidden] {
  display: none;
}

/* ── «הגדרות הסרט»: the style card in the details panel ─────────────────── */

.pd-side .style-panel--compact {
  display: flex;
  flex-direction: column;
}

.pd-side .style-panel--compact > .pd-group:first-child {
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}

.pd-side .style-panel--compact .style-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
}

.pd-side .style-panel--compact .style-section + .style-section {
  margin-top: 6px;
}

.pd-side .style-panel--compact .style-section-label-row {
  margin: 0;
}

.pd-side .style-panel--compact .style-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.pd-side .style-panel--compact .style-section--bare > .style-section-label-row {
  display: none;
}

/* The style tiles: two columns, a swatch and a name. */
.pd-side .style-panel--compact .style-choice-grid--styles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pd-side .style-panel--compact .style-choice--with-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  text-align: start;
}

.pd-side .style-panel--compact .style-choice--with-swatch .style-choice-swatch {
  flex: none;
  width: 26px;
  height: 26px;
}

.pd-side .style-panel--compact .style-choice--with-swatch .style-choice-label {
  font-size: 12.5px;
  line-height: 1.3;
  white-space: normal;
}

/* Every other choice: the site's segmented toggle. */
.pd-side .style-panel--compact .style-choice-grid--seg {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-pressed);
}

.pd-side .style-panel--compact .style-choice-grid--seg > .style-choice {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: calc(var(--r-md) - 2px);
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.pd-side .style-panel--compact .style-choice-grid--seg > .style-choice.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.pd-side .style-panel--compact .style-choice-grid--seg .style-choice-label {
  font-size: 12px;
}

.pd-side .style-panel--compact .style-choice-grid--seg .style-aspect-icon {
  transform: scale(0.8);
}

/* «אורך הסרט»: six choices, three to a row (wrapping by width gave 4 + 2). */
.pd-side .style-panel--compact .style-choice-grid--seg.style-choice-grid--3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* «במאי וכותב»: each model with its price on a second line. */
.style-panel--compact
  .style-choice-grid--seg.style-choice-grid--priced
  > .style-choice {
  flex-direction: column;
  gap: 1px;
  padding: 5px 8px;
  white-space: nowrap;
}

.style-panel--compact .style-choice-grid--priced .style-choice-hint {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-3);
}

.pd-side .style-panel--compact .style-instructions-input {
  min-height: 56px;
  resize: vertical;
  font-size: 12.5px;
  line-height: 1.6;
}

.pd-side .pd-group--mode .planning-mode-toggle,
.pd-side .pw-mode-row {
  align-self: stretch;
}

.pd-side .pd-group--mode .planning-mode-btn {
  flex: 1;
}

/* ── «הרעיון»: the text fills the window, the button at its foot ────────── */

.pd-body > .pc-idea {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}

.pd-body > .pc-idea > .planning-raw {
  flex: 1 1 auto;
  min-height: 260px;
  max-height: none;
  height: 0;
  resize: none;
  font-size: 13.5px;
  line-height: 1.8;
}

.pd-body > .pc-idea > .pc-idea-foot {
  position: sticky;
  bottom: -14px;
  margin: 0 -14px -14px;
  padding: 10px 14px;
  border-top: 1px solid var(--divider);
  background: var(--surface);
  justify-content: space-between;
}

.pc-idea-count {
  font-size: 12px;
  color: var(--text-3);
}

.pc-idea-count:empty {
  display: none;
}

/* ── «מה ה-AI הבין מהטקסט» ────────────────────────────────────────────────── */

.pw-page {
  display: flex;
  flex-direction: column;
}

.pw-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-bottom: 12px;
}

.pw-stale {
  align-self: stretch;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--ember-soft);
  color: var(--text);
  font-size: 12px;
}

.pw-mode-row {
  display: flex;
}

.pw-mode-row > .planning-mode-btn {
  flex: 1;
}

.pw-rules-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  font-size: 12px;
  color: var(--text-3);
}

/* ── «בדיקת התוכנית»: one card per problem ─────────────────────────────── */
.pf-summary {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}

.pf-fix {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 12px;
  border-radius: var(--r-md, 10px);
  background: var(--accent-soft);
}

.pf-fix-hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-2);
}

.pf-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pf-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--text-3);
  border-radius: var(--r-md, 10px);
  background: var(--surface);
}

.pf-card.is-fixable {
  border-inline-start-color: var(--accent);
}

.pf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.pf-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.pf-badge {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pf-why,
.pf-todo {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.pf-todo b {
  color: var(--text);
}

.pf-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pf-shot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.pf-shot:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pf-shot-num {
  font-weight: 700;
  color: var(--accent);
}

.pf-shot-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.pf-tech {
  width: 100%;
  font-size: 11px;
  color: var(--text-3);
}

.pf-tech summary {
  cursor: pointer;
  user-select: none;
}

.pf-tech p {
  margin: 6px 0 0;
  line-height: 1.5;
  word-break: break-word;
}

/* A scene's story text edited after its shots exist: one bar, one choice. */
.pd-draft-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md, 10px);
  background: var(--accent-soft);
}

.pd-draft-bar[hidden] {
  display: none;
}

.pd-draft-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}

.pd-draft-actions {
  display: flex;
  gap: 6px;
}

/* Chapters 2 and 3: the story moved and what stands on it did not (or, before
   the first approval, chapter 2 waits for it). Same voice as the draft bar. */
.pc-story-sync {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--r-md, 10px);
  background: var(--accent-soft);
}

.pc-story-sync[hidden] {
  display: none;
}

.pc-story-sync-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.pc-story-sync-actions {
  display: flex;
  gap: 6px;
  margin-inline-start: auto;
}

.pc-look.is-waiting-story > :not(.pc-story-sync) {
  display: none;
}

/* ── Chapter 1 of a film made from the planning rebuild on (plan-rules.js) ──
   The user, 2026-11-13: no tiles — «הגדרות הסרט» stay open in the details
   column — and the idea is written here, at the top of the chapter, in the
   same card as the story under it, with the way of working beside
   «בנה סיפור». Every colour is the site's own token. */
.pc-page .pc-story-chapter--idea > .pc-idea-section {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--rf-grey, var(--surface-2));
}

.pc-page .pc-idea-section > .planning-raw {
  flex: none;
  min-height: 96px;
  max-height: 30vh;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--rf-card, var(--surface));
  box-shadow: none;
  font-size: 14.5px;
  line-height: 1.8;
  resize: vertical;
}

.pc-page .pc-idea-section > .planning-raw:focus {
  box-shadow: 0 0 0 1.5px var(--accent);
}

.pc-idea-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* The way of working: the site's segmented choice, the chosen one white and raised. */
.pc-idea-row > .pc-idea-mode {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--rf-grey-2, var(--surface-hover));
}

.pc-idea-row > .pc-idea-mode > .planning-mode-btn {
  min-height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.pc-idea-row > .pc-idea-mode > .planning-mode-btn:hover:not(.is-active) {
  color: var(--text);
}

.pc-idea-row > .pc-idea-mode > .planning-mode-btn.is-active {
  background: var(--rf-card, var(--surface));
  color: var(--text);
  box-shadow: var(--rf-raise, 0 0 0 1px var(--border));
}

/* The foot: what «אשר ובנה הכול לבד» builds and what costs, on the far side of the buttons. */
.pc-page .pc-actions > .pc-foot-note {
  margin-inline-end: auto;
  color: var(--text-3);
  font-size: 12px;
}

@media (max-width: 768px) {
  .pc-idea-row > .pc-idea-mode {
    flex: 1 1 100%;
  }
  .pc-idea-row > .pc-idea-mode > .planning-mode-btn {
    flex: 1;
    padding: 0 8px;
  }
  .pc-page .pc-actions > .pc-foot-note {
    flex: 1 1 100%;
    margin: 0;
  }
}

/* The notice under a change line of a new film: one line, right under the
   line, no frame and no background (the user, 2026-11-13) — a round mark for
   its kind, the words, small white buttons with teal words. */
.pc-change-wrap > .pc-line-note {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 13px;
}

.pc-line-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted, var(--text-3));
  color: var(--text-on-accent, #fff);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
}

.pc-line-note.is-done > .pc-line-mark,
.pc-line-note.is-ask > .pc-line-mark,
.pc-line-note.is-busy > .pc-line-mark {
  background: var(--accent);
}

.pc-line-note.is-warn > .pc-line-mark {
  background: var(--ember, #e07642);
}

.pc-line-note.is-error > .pc-line-mark {
  background: var(--red, #c0392b);
}

.pc-line-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-line-note.is-error > .pc-line-text {
  color: var(--red, #c0392b);
}

.pc-line-actions {
  flex: none;
  display: flex;
  gap: 6px;
}

.pc-line-btn {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--rf-card, var(--surface));
  box-shadow: var(--rf-raise, 0 0 0 1px var(--border));
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pc-line-btn:hover {
  background: var(--rf-grey, var(--surface-2));
}

.pc-line-btn.is-go {
  background: var(--accent);
  box-shadow: none;
  color: var(--text-on-accent, #fff);
}

.pc-line-btn.is-go:hover {
  background: var(--accent-hover, var(--accent));
}

.pc-line-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted, var(--text-3));
  cursor: pointer;
}

.pc-line-close:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

/* ── A new film's character and place windows (the user, 2026-11-13: "make
   something beautiful") ──────────────────────────────────────────────────
   Two zones. On top a soft light-blue hero: the picture framed in white, the
   two actions as a pair of pills, a quiet caption, the model, and the change
   line as a white field two lines tall. Under it a calm form: each field
   under its small title, one rhythm of space, «יהודי» a plain row with its
   switch. No price, no extra boxes. */
body.rf .pd-side .pd-group.pd-picture--hero,
.pd-side .pd-group.pd-picture--hero {
  gap: 12px;
  margin: 2px 0 10px;
  padding: 20px 14px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--rf-grey, var(--surface-2));
}

/* The picture: white-framed, no dashed line. */
.pd-picture--hero > .pc-pic {
  border: 0;
  background: var(--rf-card, var(--surface));
  box-shadow: 0 0 0 4px var(--rf-card, var(--surface)), 0 6px 18px rgba(14, 28, 48, 0.1);
}

.pd-picture--hero > .pc-pic--face {
  width: 116px;
  height: 116px;
  margin-bottom: 4px;
}

.pd-picture--hero > .pc-pic--place {
  border-radius: 12px;
}

.pd-picture--hero > .pc-pic.is-empty {
  border: 0;
}

.pd-picture--hero .pc-pic-empty {
  color: var(--accent);
  opacity: 0.45;
}

/* The two actions, a pair of pills. */
.pd-picture--hero > .pd-picture-actions {
  flex-wrap: nowrap;
  gap: 8px;
}

.pd-picture--hero > .pd-picture-actions > .btn {
  flex: none;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
}

.pd-picture--hero > .pd-picture-actions > .btn-ghost {
  background: var(--rf-card, var(--surface));
  box-shadow: var(--rf-raise, 0 0 0 1px var(--border));
  color: var(--text);
}

.pd-picture--hero > .pd-picture-actions > .btn-ghost:hover:not(:disabled) {
  background: var(--rf-card, var(--surface));
  color: var(--accent);
}

/* The costume note: a quiet caption under the actions. */
.pd-outfit-note.is-quiet {
  justify-content: center;
  padding: 0 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 11.5px;
  text-align: center;
}

/* The model: its small name over a white choice the width of the hero. */
.pd-picture--hero > .pd-model-row {
  align-self: stretch;
}

.pd-picture--hero > .pd-model-row > .pc-model {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  margin: 0;
}

.pd-picture--hero .pc-model-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
}

.pd-body .pd-picture--hero .pc-model .cselect-trigger {
  min-width: 0;
  border: 0;
  border-radius: 10px;
  background: var(--rf-card, var(--surface));
  box-shadow: var(--rf-raise, 0 0 0 1px var(--border));
}

/* The change line: a white field, two lines tall. */
body.rf .pc-page .pd-picture--hero > .pc-change-wrap > .pc-change,
.pd-picture--hero > .pc-change-wrap > .pc-change {
  border: 0;
  border-radius: 12px;
  background: var(--rf-card, var(--surface));
  box-shadow: var(--rf-raise, 0 0 0 1px var(--border));
}

.pd-picture--hero > .pc-change-wrap .pc-change-input {
  min-height: 52px;
}

.pd-picture--hero > .pc-change-wrap .pc-change-input::placeholder {
  white-space: normal;
}

/* The character's «יהודי / לא יהודי» switch, alone under the look. */
.pd-side .pd-group.pd-group--toggle {
  padding-top: 0;
}

/* A new film's «יהודי»: one switch, on or off — the site's switch (the one of
   «לא להציג קטע זה בעורך»). */
.pd-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 2px;
  border-block: 1px solid var(--rf-line, var(--border));
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.pd-switch-row > input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 30px;
  height: 18px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background:
    radial-gradient(circle at calc(100% - 9px) 50%, var(--text-on-accent, #fff) 6px, transparent 6.5px),
    color-mix(in srgb, var(--text) 18%, transparent);
  transition: background 0.15s;
}

.pd-switch-row > input:checked {
  background:
    radial-gradient(circle at 9px 50%, var(--text-on-accent, #fff) 6px, transparent 6.5px),
    var(--accent);
}

.pd-switch-row > input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── The top of «קטעים» for a film made from the planning rebuild on: the
   film's pictures, all at once (film-images-bar.js). The columns below give
   it its height back. */
.film-images-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--rf-card, var(--surface));
  box-shadow: var(--rf-shadow, var(--shadow-xs));
}

.film-images-info,
.film-images-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.film-images-info {
  font-size: 14px;
}

.film-images-count {
  color: var(--text-3);
  font-size: 13px;
}

.film-images-missing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--ember-soft, var(--surface-2));
  color: var(--ember, var(--text));
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.film-images-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.workspace-root--film-bar .shots-layout {
  --shots-col-h: calc(100vh - var(--topbar-h) - 80px - 58px);
}

@media (min-width: 769px) {
  body.rf .workspace-root--film-bar .shots-layout {
    --shots-col-h: calc(var(--rf-col-h) - 58px);
  }
}

/* «תמונת סיום» of a new film's shot — under its two pictures in «קטעים», and
   in its window in planning: the switch, and who decided. */
.shot-end-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 0 4px;
}

/* In «קטעים» it is the last row of the two pictures' card. */
.frame-chooser > .shot-end-row {
  grid-column: 1 / -1;
  margin-top: 0;
  padding: 0 6px;
}

.frame-chooser > .shot-end-row .shot-end-by {
  background: var(--rf-card, var(--surface));
}

.shot-end-row > .pd-switch-row {
  flex: 1;
  border: 0;
  padding: 6px 2px;
}

.shot-end-by {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--rf-grey, var(--surface-2));
  color: var(--text-3);
  font-size: 12px;
}

.shot-end-by.is-you {
  background: var(--accent-soft);
  color: var(--rf-teal-ink, var(--accent));
}

/* «אורך» beside «משך» in a new film's shot card. */
.duration-group--slot .duration-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.duration-group--slot .duration-value-name {
  font-weight: 600;
  color: var(--text-muted);
}

/* The notice under a shot card's «שינוי» line (a new film). */
.video-prompt-block > .pc-line-note--card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 2px 10px 6px;
  font-size: 13px;
}

/* «פתח בתכנון» in the shot card's head. */
.stage-card-head > .shot-open-plan {
  margin-inline-start: auto;
  margin-inline-end: 8px;
}

/* «פרטי התמונה» in a new film's picture window: the shot card's grey fold. */
.ai-modal-picture-details {
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--rf-grey, var(--surface-2));
}

.ai-modal-picture-details > summary {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.ai-modal-picture-details > summary:hover {
  background: var(--rf-grey-2, var(--surface-2));
  border-radius: 12px;
}

.ai-modal-picture-details[open] > summary:hover {
  border-radius: 12px 12px 0 0;
}

.ai-modal-picture-details[open] > .shot-brief-fields {
  gap: 6px;
  margin: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--rf-line, var(--divider));
}

/* Three classes: the shot fold's own row rule (workspace-tools.css) loads later. */
.ai-modal-picture-details .shot-brief-fields .ai-modal-detail-row,
.ai-modal-picture-details .shot-brief-fields .ai-modal-detail-row:hover {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--rf-card, var(--surface));
}

.ai-modal-picture-details .shot-brief-fields .ai-modal-detail-row > .seg-field-label {
  flex: 0 0 76px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.ai-modal-detail-row > .custom-select {
  flex: 0 1 260px;
}

.ai-modal-who {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-modal-who-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--rf-line-2, var(--divider));
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ai-modal-who-chip:hover {
  border-color: var(--accent);
}

.ai-modal-who-chip.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--rf-teal-ink, var(--accent));
  font-weight: 600;
}

.ai-modal-who-chip:disabled {
  opacity: 0.5;
  cursor: default;
}

.ai-modal-wears {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text);
}

.ai-modal-wears b {
  font-weight: 600;
}

.ai-modal-detail-empty {
  font-size: 13px;
  color: var(--text-muted);
}

/* In planning's shot window the «תמונת סיום» row is one of the window's cards. */
.pd-body > .shot-end-row {
  margin-top: 0;
  padding: 6px 14px;
  border-radius: 14px;
  background: var(--rf-grey, var(--surface-2));
}

.pd-body > .shot-end-row .shot-end-by {
  background: var(--rf-card, var(--surface));
}

/* ── A new film's story step: what it offers under the story (js/brain/story.js) ──
   The fix note, the real-person warning, the three directions to pick from and
   the three moments to add. Quiet rows on the page's own ground; the story's
   card above stays the one card. */
.pc-offers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pc-offers-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pc-offers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pc-offers-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2, var(--text));
}

.pc-offer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--rf-line, var(--divider));
  border-radius: 12px;
  background: var(--rf-card, var(--surface));
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  text-align: start;
}

.pc-offer-text {
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}

.pc-offer > .pc-line-btn {
  flex: none;
}

button.pc-offer--pick {
  width: 100%;
  cursor: pointer;
}

button.pc-offer--pick:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pc-offer-act {
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--rf-teal-ink, var(--accent));
}

.pc-offers-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-size: 13px;
  color: var(--text-2, var(--text));
}

.pc-offers-note > .ui-icon {
  flex: none;
  color: var(--text-muted);
}

.pc-offers-note.is-warn > .ui-icon {
  color: var(--warning, #c77700);
}

.pc-offers-note-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* «זמן אחר» of «אורך הסרט»: a small minutes-and-seconds field under the row of lengths (style-tab.js ownFilmLengthField). */
.style-own-length {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}
.style-own-length[hidden] {
  display: none;
}
.style-own-length-part {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted, inherit);
}
.style-own-length-input {
  width: 68px;
  text-align: center;
}
.style-own-length-note {
  font-size: 12.5px;
  color: var(--danger, #b3261e);
}

/* «מקום אחר» of «איפה הסרט קורה»: one short text field under the row of countries. */
.style-own-place-input {
  inline-size: min(100%, 22ch);
}

/* «תקופה אחרת» of «מתי הסרט קורה»: the same field, a little wider for a period's name. */
.style-own-time-input {
  inline-size: min(100%, 30ch);
}
