/* Kristen's desk. Her palette, copied from her public site (projects/kristen/site/src/site.css):
   warm paper, ink, a coral accent. Phone first; every rule lives here (the CSP allows no inline style). */

:root {
  --bg: #fff8f3;
  --card: #ffffff;
  --ink: #2b2220;
  --muted: #6f6360;
  --line: #ecd9cf;
  --accent: #e8563f;
  --accent-ink: #ffffff;
  --soft: #fde6dd;
  /* the coral darkened until text on white and white on it pass AA */
  --accent-strong: #b93a25;

  --st-idea: #8a7f7b;
  --st-scripted: #2f7f86;
  --st-made: #8b5ab0;
  --st-approved: #3f8a3a;
  --st-posted: #2b2220;
  --st-killed: #b9aaa4;

  --bad: #b3261e;
  --bad-bg: #fdecea;
  --warn: #7a5300;
  --warn-bg: #fff4d6;
  --ok: #2f6f2b;

  --radius: 14px;
  --gutter: 16px;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    ui-rounded,
    'Avenir Next',
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}
a {
  color: var(--accent-strong);
}
h1 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 8px;
}
h2 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}
h3 {
  font-size: 1rem;
  margin: 16px 0 6px;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: var(--gutter);
  top: 8px;
  background: var(--card);
  padding: 8px 12px;
  z-index: 10;
}
.app-loading,
.loading {
  padding: 24px var(--gutter);
  color: var(--muted);
}
.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ── shell ─────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 6px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.top nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}
.top nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
}
.top nav a[aria-current='page'] {
  background: var(--soft);
  color: var(--ink);
}
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px var(--gutter) 64px;
}

/* ── controls ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--accent);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}
.btn[aria-pressed='true'] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.segmented {
  display: inline-flex;
  gap: 4px;
}
input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
}
input[type='checkbox'] {
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--accent-strong);
  flex: none;
}
textarea {
  resize: vertical;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 12px;
  min-width: 0;
  flex: 1;
}
.field > span {
  font-weight: 600;
  font-size: 0.9rem;
}
.field.narrow {
  flex: 0 0 110px;
}
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
}
.field-row > .field {
  flex: 1 1 160px;
}
.tick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-right: 12px;
}
.hint {
  color: var(--muted);
  font-size: 0.9rem;
}
.form-error {
  color: var(--bad);
}
.form-error:empty {
  display: none;
}
.form-error ul {
  margin: 8px 0;
  padding-left: 20px;
}

/* ── cards and blocks ──────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 16px;
}
fieldset.card {
  min-width: 0;
}
legend {
  font-weight: 700;
  padding: 0 6px;
}
.signin {
  max-width: 420px;
  margin: 10vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.toolbar h1 {
  margin: 0;
}
.toolbar-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.actions.sticky {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.prewrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.caption {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
  margin: 0;
}
ul.plain {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}
ul.plain li {
  padding: 2px 0;
}
.song {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 6px;
}
.credit-line {
  background: var(--soft);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.credit-line p {
  margin: 0 0 8px;
}
.earliest {
  font-weight: 700;
}
.ext::after {
  content: ' ↗';
}
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 600;
}
.badge-real {
  background: var(--soft);
  border-color: var(--accent);
}
.all-clear {
  color: var(--ok);
  font-weight: 600;
}
.blockers {
  background: var(--bad-bg);
  color: var(--bad);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.blockers p {
  margin: 0;
  font-weight: 700;
}
.warnings {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 10px;
  padding: 8px 12px 8px 30px;
  margin: 8px 0;
}
.problem {
  border-color: var(--bad);
}

/* ── status colours ────────────────────────────────────────────────── */

.st-idea {
  --st: var(--st-idea);
}
.st-scripted {
  --st: var(--st-scripted);
}
.st-made {
  --st: var(--st-made);
}
.st-approved {
  --st: var(--st-approved);
}
.st-posted {
  --st: var(--st-posted);
}
.st-killed {
  --st: var(--st-killed);
}
.pill {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--st, var(--muted));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.st-killed .chip-title,
.post-row.st-killed .row-title {
  text-decoration: line-through;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  list-style: none;
  padding: 0;
  margin: 12px 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--st);
}

/* ── calendar ──────────────────────────────────────────────────────── */

.week {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  display: grid;
  gap: 8px;
}
.week-day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
}
.week-day.is-today {
  border-color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent);
}
.day-head {
  font-size: 0.95rem;
  margin: 0 0 6px;
}
.empty {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}
.post-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0 0 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border-left: 5px solid var(--st);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}
.post-chip:hover {
  background: var(--soft);
}
.chip-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chip-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.chip-meta {
  width: 100%;
  color: var(--muted);
  font-size: 0.8rem;
}
.chips .post-chip {
  display: inline-flex;
  margin-right: 6px;
}
.month {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.month-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.month-names div {
  padding: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.month-cell {
  min-height: 72px;
  padding: 2px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  min-width: 0;
}
.month-cell:first-child {
  border-left: 0;
}
.month-cell.is-other {
  background: var(--bg);
  color: var(--muted);
}
.month-cell.is-today .month-day {
  background: var(--accent-strong);
  color: #fff;
}
.month-day {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: inherit;
  min-width: 32px;
  min-height: 32px;
  border-radius: 999px;
  cursor: pointer;
}
.month-cell .post-chip {
  min-height: 0;
  padding: 3px 4px;
  margin: 0 0 3px;
  border-left-width: 4px;
  font-size: 0.75rem;
  gap: 0 4px;
}
.month-cell .chip-title {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
@media (min-width: 760px) {
  .week {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .month-cell {
    min-height: 96px;
  }
}

/* ── posts list ────────────────────────────────────────────────────── */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.filter {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1 1 130px;
}
.filter.grow {
  flex: 3 1 200px;
}
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-row {
  display: grid;
  gap: 2px;
  padding: 12px;
  margin: 0 0 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--st);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.row-when {
  color: var(--muted);
  font-size: 0.9rem;
}
.row-title {
  font-weight: 700;
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.85rem;
  align-items: center;
}
.row-meta .bad {
  color: var(--bad);
  font-weight: 700;
}
.row-meta .warn {
  color: var(--warn);
}

/* ── one post ──────────────────────────────────────────────────────── */

.post-head {
  margin-bottom: 12px;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  margin: 0;
  color: var(--muted);
}
.script {
  padding-left: 0;
  list-style: none;
  margin: 0 0 8px;
}
.script li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 2px 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.script .at {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.script .said {
  font-weight: 600;
}
.script .screen {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.9rem;
}
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 0;
}
.checklist .ck-todo span {
  color: var(--bad);
}
.checklist .ck-ok span {
  color: var(--ok);
}
.ck-auto {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.files {
  list-style: none;
  padding: 0;
  margin: 0;
}
.files li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.player video,
.player img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin-top: 8px;
  border-radius: 10px;
}
.player audio {
  width: 100%;
  margin-top: 8px;
}
.upload {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.upload select {
  width: auto;
}
.upload input[type='file'] {
  flex: 1 1 200px;
}
.line-editor {
  padding-left: 18px;
}
.line-editor li {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.history {
  font-size: 0.9rem;
  color: var(--muted);
}
details summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 32px;
}
.pill.st-killed {
  color: var(--ink);
}

/* ── the automated flow: library, make the video, settings ─────────── */

:root {
  --perm-ai: #2f7f86;
  --perm-ok: #3f8a3a;
  --perm-no: #b3261e;
}
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--perm, var(--muted));
}
.perm-ai-persona {
  --perm: var(--perm-ai);
}
.perm-permission {
  --perm: var(--perm-ok);
}
.perm-real-no-permission {
  --perm: var(--perm-no);
}
.ratio {
  font-weight: 700;
  color: var(--accent-strong);
}
.mono,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.library {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.ref-card {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  margin: 0;
  min-width: 0;
}
.ref-thumb {
  width: 90px;
  height: 160px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ref-noimg {
  color: var(--muted);
  font-size: 0.85rem;
}
.ref-body {
  min-width: 0;
}
.ref-body p {
  margin: 0 0 6px;
}
.ref-who,
.ref-numbers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.ref-caption {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.ref-badges .badge {
  font-size: 0.75rem;
}
.ref-diff {
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.ref-diff ul {
  margin: 4px 0;
  padding-left: 18px;
}
.b-talk,
.b-song {
  background: var(--soft);
}
.b-used,
.b-unset {
  color: var(--muted);
}
.b-video-failed,
.b-video-expired,
.b-warn,
.b-key-empty,
.b-run-failure {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: var(--bad);
}
.b-video-saved,
.b-set,
.b-key-active,
.b-run-success {
  background: #e7f3e5;
  color: var(--ok);
  border-color: var(--ok);
}
.filter-tick {
  align-self: end;
  min-height: 44px;
}
.money-meter {
  width: 100%;
  height: 14px;
}
.key-list,
.creator-list,
.secrets {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.key-list li,
.creator-list li,
.secrets li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.secrets li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.key-empty {
  opacity: 0.75;
}
.auto-next {
  margin-top: 12px;
}
.runs li {
  padding: 4px 0;
}
.steps {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.steps li {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  align-items: center;
  gap: 4px 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}
.step-done .step-dot,
.step-skipped .step-dot {
  background: var(--ok);
}
.step-running .step-dot {
  background: var(--accent);
}
.step-failed .step-dot {
  background: var(--bad);
}
.step-awaiting_preview_approval .step-dot {
  background: var(--warn);
}
.step-todo .step-name {
  color: var(--muted);
}
.step-state,
.step-cost {
  font-size: 0.85rem;
  color: var(--muted);
}
.step-msg {
  grid-column: 2 / -1;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.preview img {
  max-width: 100%;
  border-radius: 10px;
}
.check-rows,
.fixes {
  list-style: none;
  padding: 0;
}
.check-rows li,
.fixes li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.ck-failed .badge {
  background: var(--bad-bg);
  color: var(--bad);
}
.ck-warning .badge {
  background: var(--warn-bg);
  color: var(--warn);
}
.ck-passed .badge {
  background: #e7f3e5;
  color: var(--ok);
}
.change-form[hidden] {
  display: none;
}

/* ── thumbnails (posters and reference covers, fetched with the key) ───── */
.thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--soft);
  border-radius: 8px;
  flex: none;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-empty {
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
  padding: 4px;
}
.post-row {
  grid-template-columns: 54px 1fr;
  column-gap: 12px;
}
.post-row > :not(.row-thumb) {
  grid-column: 2;
}
.row-thumb {
  grid-row: 1 / span 3;
  width: 54px;
  height: 96px;
}
.chip-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 140px;
  margin-bottom: 4px;
}

/* ── ours vs the reference ───────────────────────────────────────────────── */
.cmp {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.cmp-side {
  min-width: 0;
}
.cmp-side h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.cmp-media {
  width: 100%;
  max-width: 270px;
  margin: 0 0 8px;
}
.cmp-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
}
.cmp-media video {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #000;
  display: block;
}
.cmp-hook {
  margin: 8px 0 4px;
}
.cmp-caption {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
  max-height: 320px;
  overflow: auto;
  overflow-wrap: anywhere;
}
.cmp-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 8px 0 0;
  font-size: 0.85rem;
}
.cmp-stats dt {
  color: var(--muted);
}
.cmp-stats dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
