:root {
  color-scheme: light;
  --ink: #1e2328;
  --muted: #647078;
  --line: #d8dedb;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --mint: #d9efe6;
  --mint-strong: #2f7d64;
  --coral: #e76f51;
  --gold: #c6922e;
  --indigo: #385170;
  --danger: #b94b4b;
  --shadow: 0 18px 42px rgba(39, 48, 54, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  display: grid;
  grid-template-columns: 280px 1fr;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 24px;
  background: #24313a;
  color: #f7faf8;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--mint);
  color: #1d3d35;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #b9c8c3;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #dce7e3;
  padding: 12px 14px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(217, 239, 230, 0.12);
  border-color: rgba(217, 239, 230, 0.22);
  color: #ffffff;
}

.sidebar-section {
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  padding-top: 18px;
}

.sidebar-section p {
  margin: 8px 0 0;
  color: #d6dfdc;
  line-height: 1.5;
}

.section-label,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .section-label {
  color: #9fb4ad;
}

.status-pill,
.small-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--mint);
  color: #214d3e;
  font-size: 12px;
  font-weight: 800;
}

.status-pill {
  margin-top: 10px;
  background: #f1c98b;
  color: #432c0c;
}

.app-shell {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.04;
  max-width: 760px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.primary-button {
  background: var(--coral);
  border-color: var(--coral);
  color: #ffffff;
}

.primary-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 3px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  color: var(--ink);
  background: #fcfdfb;
  line-height: 1.55;
}

.brief-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.field-chip {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfaf7;
}

.field-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field-chip strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.35;
}

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.task-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.task-number {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #edf2ef;
  color: var(--indigo);
  font-weight: 900;
}

.task-title {
  font-weight: 850;
}

.task-agent {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.state {
  min-width: 118px;
  text-align: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  color: #2e363b;
  background: #e9eceb;
}

.state.running {
  background: #dbe8f4;
  color: #264664;
}

.state.completed,
.state.approved {
  background: var(--mint);
  color: #214d3e;
}

.state.needs_review,
.state.revision_requested {
  background: #f7dfb8;
  color: #624214;
}

.state.failed {
  background: #f2d7d7;
  color: var(--danger);
}

.artifact-list,
.review-list,
.audit-log,
.proof-grid {
  display: grid;
  gap: 12px;
}

.artifact {
  border-left: 4px solid var(--mint-strong);
  padding: 12px 12px 12px 14px;
  background: #fbfaf7;
  border-radius: 0 6px 6px 0;
}

.artifact strong,
.review-card strong,
.proof-item strong {
  display: block;
  margin-bottom: 5px;
}

.artifact p,
.review-card p,
.proof-item span {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.clarifications:not(:empty) {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 4px solid var(--warn, #d08b1f);
  background: #fdf8ee;
}

.clarifications p {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.clarification-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.clarification-row label {
  font-size: 12px;
}

.clarification-row input {
  padding: 6px 8px;
  border: 1px solid #ddd6c6;
  border-radius: 4px;
  font: inherit;
  font-size: 12px;
}

.proof-subheading {
  margin-top: 20px;
}

.proof-grid-muted .proof-item {
  opacity: 0.62;
}

/* The generated content itself, so a rerun is visibly different. */
.artifact-content {
  margin: 8px 0 0;
  padding: 8px 10px;
  max-height: 160px;
  overflow: auto;
  border-radius: 4px;
  background: #f2efe8;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.audit-log {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.audit-event {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.audit-event time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fffdf8;
}

.review-card.warning {
  border-color: #e3bd72;
}

.review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.packet-output {
  /* Capped so the render and delivery panels below stay within reach — an
     uncapped packet pushed them a full screen down, which is awkward on
     camera and easy to overscroll past. */
  min-height: 280px;
  max-height: 44vh;
  white-space: pre-wrap;
  overflow: auto;
  margin: 0;
  padding: 16px;
  background: #20282d;
  color: #eff8f4;
  border-radius: 8px;
  line-height: 1.55;
}

.proof-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.proof-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfaf7;
}

@media (max-width: 1040px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .workspace-grid,
  .proof-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell,
  .sidebar {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1 1 140px;
  }

  .brief-fields,
  .task-item {
    grid-template-columns: 1fr;
  }

  .state {
    min-width: 0;
    width: fit-content;
  }
}

/* Hero-shot render panel and audit results (packet view).
   NOTE: this app's palette is --ink / --muted / --line on a light --paper.
   An earlier version of this block used --text and --border, which do not
   exist here, so the fallbacks (dark-theme colours) applied and the verdict
   text rendered near-white on white. Use the real variables. */
.render-status {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

/* The :not([hidden]) matters: a bare display:block would override the hidden
   attribute, and the empty player showed before any render had happened. */
.render-video:not([hidden]) {
  display: block;
}

.render-video {
  width: 100%;
  max-width: 420px;
  margin-top: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #000;
}

.render-audit {
  margin-top: 14px;
  max-width: 620px;
}

.render-audit-title {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.render-verdict {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--panel);
}

.render-verdict-mark {
  font-weight: 700;
  width: 1.1em;
  text-align: center;
}

.render-verdict-pass .render-verdict-mark,
.render-verdict-present .render-verdict-mark { color: var(--mint-strong); }
.render-verdict-fail .render-verdict-mark,
.render-verdict-missing .render-verdict-mark { color: var(--danger); }
.render-verdict-cannot_tell .render-verdict-mark,
.render-verdict-uncertain .render-verdict-mark,
.render-verdict-unplanned .render-verdict-mark { color: var(--gold); }

.render-verdict-check {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.render-verdict-evidence {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}

.render-verdict-out,
.render-verdict-unplanned {
  border-style: dashed;
}

.render-verdict-out .render-verdict-mark { color: var(--muted); }

.render-verdict-out .render-verdict-check {
  font-weight: 500;
  color: var(--muted);
}

.render-audit-skipped,
.render-audit-scope {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 12px 0 8px;
}

.upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.upload-row input[type="file"] {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 320px;
}
