:root {
  color-scheme: light;
  --background: #f5f7f8;
  --panel: #ffffff;
  --ink: #182026;
  --muted: #61717c;
  --line: #d8e0e5;
  --accent: #0d7f71;
  --accent-dark: #075f55;
  --danger-bg: #fff0f0;
  --danger: #9f1d1d;
  --page-gutter: clamp(16px, 1.5vw, 32px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--ink);
}

.shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  width: calc(100% - var(--page-gutter) - var(--page-gutter));
  margin: 32px auto;
  align-items: start;
}

.composer,
.response {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(25, 39, 52, 0.08);
}

.title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 13px;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  background: #fbfcfd;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.user-request {
  min-height: 240px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-option input {
  width: auto;
  margin: 0;
}

.video-options {
  display: grid;
  gap: 14px;
}

.paired-prompt-title {
  margin: 24px 0 12px;
  font-size: 1.1rem;
}

.prompt-download {
  margin-top: 16px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(13, 127, 113, 0.18);
  border-color: var(--accent);
}

.file-input input {
  padding: 10px;
  background: #fff;
}

.reference-upload-list,
.reference-slot {
  display: grid;
  gap: 12px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--accent-dark);
  background: #fff;
  font-size: 0.85rem;
}

.secondary-button:hover {
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.drive-library {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5f9f8;
}

.drive-library .helper-text { margin: 0 0 12px; }
.drive-library .helper-text:last-child { margin: 12px 0 0; }

button:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:disabled:hover {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
}

.image-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f4;
}

.image-preview img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.upload-status {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f4;
  object-fit: cover;
}

.helper-text {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.alert {
  border: 1px solid #f0bcbc;
  border-radius: 6px;
  margin-bottom: 18px;
  padding: 12px 14px;
  color: var(--danger);
  background: var(--danger-bg);
  font-weight: 700;
}

.response {
  min-height: 520px;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #23313a;
  font: 0.98rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.generated-image {
  display: grid;
  gap: 16px;
}

.generated-image img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f4;
}

.download-button {
  display: inline-grid;
  min-height: 42px;
  justify-self: start;
  place-items: center;
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.download-button:hover {
  background: var(--accent-dark);
}

.empty-state {
  display: grid;
  min-height: 400px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    margin-top: 16px;
  }

  .composer,
  .response {
    padding: 18px;
  }
}

a { color: var(--accent-dark); }
h2 { margin-top: 0; font-size: 1.25rem; }
h3 { font-size: 1rem; }
p, h1, h2, h3, a { overflow-wrap: anywhere; }
.page-width { width: calc(100% - var(--page-gutter) - var(--page-gutter)); margin: 24px auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px var(--page-gutter); background: white; border-bottom: 1px solid var(--line); }
.site-header nav, .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.site-header nav { font-size: .9rem; }
.brand { font-weight: 800; text-decoration: none; }
.auth-card { width: calc(100% - var(--page-gutter) - var(--page-gutter)); margin: 56px auto; }
.auth-card h1 { font-size: 2rem; line-height: 1.15; }
.auth-card > p { line-height: 1.6; }
.page-heading { margin: 32px 0; }
.page-heading h1 { margin: 16px 0; line-height: 1.15; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, 1fr); gap: 24px; align-items: start; }
.shell > *, .workspace-grid > *, .master-bible-forms > * { min-width: 0; }
.workspace-grid.production-grid { grid-template-columns: minmax(0, 1fr); }
.production-actions { margin: 0 0 24px; }
.request-types { border: 0; padding: 0; margin: 0; min-width: 0; }
.request-types legend { color: var(--muted); font-size: 0.9rem; font-weight: 700; margin-bottom: 10px; }
.request-type-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.request-type-option { position: relative; cursor: pointer; }
.request-type-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.request-type-option span { padding: 12px 8px; text-align: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.request-type-option input:checked + span { color: var(--accent-dark); border-color: var(--accent); background: #eaf6f2; }
.request-type-option input:focus-visible + span { outline: 3px solid rgba(13, 127, 113, 0.25); outline-offset: 2px; }
#video-output-options small { display: block; }
.audio-player { display: block; width: 100%; margin-top: 16px; }
.video-player { display: block; width: 100%; max-height: 70vh; margin-top: 16px; background: #000; }
.project-list { display: grid; gap: 16px; }
.project-card { display: block; padding: 24px; background: white; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.project-card:hover, .output-row:hover { border-color: var(--accent); background: #f3faf8; }
.project-card h2 { margin: 10px 0; }
.project-card p { color: var(--muted); white-space: pre-wrap; }
.empty-state.compact { min-height: 180px; }
.output-row { display: block; border: 1px solid var(--line); border-radius: 6px; padding: 18px; color: var(--ink); text-decoration: none; }
.output-row h3 { margin: 8px 0; font-weight: 600; line-height: 1.5; }
.output-list { display: grid; gap: 12px; }
.member-list { list-style: none; padding: 0; margin: 0 0 26px; }
.member-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.member-list small { color: var(--muted); margin-left: 8px; }
.actions { margin-top: 14px; }
.notice { background: #eaf7f1; border: 1px solid #b8dfd2; border-radius: 6px; padding: 14px; color: var(--accent-dark); margin-bottom: 18px; }
.console-project { display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.output-detail > section { margin: 24px 0; }
.output-detail .page-heading label { margin-top: 24px; }
.pagination { justify-content: space-between; }
.saved-upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 18px; }
.saved-upload { margin: 0; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.saved-upload img { display: block; width: 100%; height: 220px; object-fit: contain; background: #edf2f4; }
.saved-upload figcaption { display: grid; gap: 8px; padding: 14px; overflow-wrap: anywhere; }
.step-eyebrow { margin-top: 24px; }
.project-step-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 24px 0; }
.project-step-link { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); font-size: .9rem; font-weight: 700; text-decoration: none; }
.project-step-link:hover, .project-step-link.active { color: var(--accent-dark); border-color: var(--accent); background: #eaf7f1; }
.step-number { display: inline-grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; background: #edf2f4; font-size: .8rem; }
.active .step-number { color: white; background: var(--accent); }
.project-stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stage-card { padding: 20px; }
.stage-card h2 { font-size: 1.1rem; }
.stage-card p { min-height: 48px; font-size: .9rem; line-height: 1.5; }
.step-state { display: inline-block; padding: 5px 9px; border-radius: 20px; background: #edf5f2; color: var(--accent-dark); font-size: .75rem; font-weight: 700; }
.step-document { margin: 0; }
.step-document .response-header { margin-bottom: 24px; }
.step-document .response-header h2 { margin-bottom: 8px; }
.storyboard-version-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.storyboard-version-form label { flex: 1 1 220px; min-width: 0; }
.storyboard-add-asset { margin-top: 20px; }
.storyboard-add-asset summary { cursor: pointer; font-weight: 700; }
.storyboard-add-asset form { margin-top: 16px; }
.storyboard-media-content { flex: 1; min-width: 0; width: 100%; }
.asset-list-description { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.storyboard-image-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.storyboard-image-previews img { display: block; max-width: 100%; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.storyboard-scene-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.storyboard-scene-image { margin: 0; max-width: 160px; }
.storyboard-voice-preview { max-width: 360px; }
.master-sheet-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px; margin-top: 24px; }
.master-sheet-gallery figure { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.master-sheet-gallery img { display: block; width: 100%; height: 200px; object-fit: contain; background: var(--panel); }
.master-sheet-gallery figcaption { padding: 10px; overflow-wrap: anywhere; }
.master-sheet-gallery .delete-master-sheet { color: var(--danger); }
.rich-text-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.rich-text-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); background: #f5f9f8; }
.rich-text-toolbar select { width: auto; max-width: 160px; min-height: 34px; padding: 5px 8px; }
.rich-text-content { min-height: 360px; padding: 24px; outline: none; }
.rich-text-content:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.rich-text-content:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.document-prose { font-size: 1rem; line-height: 1.75; overflow-wrap: anywhere; }
.document-prose p, .document-prose div { margin: 0 0 1em; }
.document-prose h2 { margin: 1.2em 0 .5em; font-size: 1.6rem; }
.document-prose h3 { margin: 1.2em 0 .5em; font-size: 1.2rem; }
.document-prose blockquote { margin: 1em 0; border-left: 3px solid var(--accent); padding-left: 18px; color: var(--muted); }
.saved-document { min-height: 200px; padding: 8px 0; }
.step-save-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.step-save-row .actions { margin: 0; }
.step-empty p { margin-bottom: 20px; }
.bible-workspace { display: grid; gap: 24px; margin-bottom: 24px; }
.master-bible-forms { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.master-bible-forms h2 { margin-bottom: 10px; }
.master-bible-forms form { margin-top: 20px; }
.master-bible-forms form .helper-text { margin: 0; }
.master-bible-notes { margin: 28px 0; }
.master-bible-notes > summary { cursor: pointer; color: var(--accent-dark); font-weight: 700; padding: 14px 0; }
.master-bible-notes .step-document { max-width: none; }
.script-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.script-row h3 { margin: 8px 0; }
.script-row .helper-text { margin: 6px 0; }
.script-row .actions { flex-shrink: 0; }
.button-link { display: inline-flex; align-items: center; text-decoration: none; }
.script-preview { margin-top: 24px; font: 1rem/1.7 "Courier New", ui-monospace, monospace; }
.script-file-actions { margin-bottom: 24px; }
#script-progress { width: 100%; height: 16px; accent-color: var(--accent); }
@media (max-width: 760px) {
  .master-bible-forms { grid-template-columns: 1fr; }
  .script-row { flex-direction: column; gap: 10px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
  .project-step-nav { display: flex; overflow-x: auto; padding-bottom: 6px; }
  .project-step-link { flex: 0 0 auto; min-height: 50px; }
  .rich-text-content { padding: 16px; }
  .step-document .response-header { align-items: flex-start; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .site-header { align-items: flex-start; flex-wrap: wrap; }
  .site-header nav { gap: 10px; }
  .console-project { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 2rem; }
}
.approval-choice { display: flex; align-items: flex-start; gap: .65rem; margin: .75rem 0; }
.approval-choice input[type="checkbox"] { width: auto; flex: 0 0 auto; margin-top: .25rem; }
.script-approval { margin: 1.5rem 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.shooting-filters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; margin-top: 20px; }
.script-import { margin-top: 24px; }
.script-import summary { color: var(--accent-dark); font-weight: 700; cursor: pointer; }
.script-import form { margin-top: 18px; }
.shooting-data { margin-top: 24px; }
.shooting-table-wrap { overflow-x: auto; }
.shooting-table { width: 100%; min-width: 1650px; border-collapse: collapse; font-size: .9rem; line-height: 1.6; }
.shooting-table th, .shooting-table td { text-align: left; vertical-align: top; border: 1px solid var(--line); padding: 12px; overflow-wrap: anywhere; }
.shooting-table th { background: #edf5f2; color: var(--accent-dark); }
.shooting-table td { white-space: pre-line; min-width: 115px; }
.shooting-table td:nth-child(2), .shooting-table td:nth-child(8) { min-width: 220px; }
.shooting-table td small { color: var(--muted); }
.scene-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.scene-detail-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
@media (max-width: 860px) {
  .shooting-filters, .scene-editor-grid { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .site-header, .shooting-controls, .shooting-sheet .page-heading > a { display: none !important; }
  .shooting-sheet { width: 100%; margin: 0; }
  .shooting-data { padding: 0; box-shadow: none; border: 0; }
  .shooting-table-wrap { overflow: visible; }
  .shooting-table { min-width: 0; font-size: 8pt; }
  .shooting-table th, .shooting-table td { min-width: 0 !important; padding: 5px; }
  .shooting-table thead { display: table-header-group; }
  .shooting-table tr { break-inside: avoid; }
}
