/* Tokens mirror Mixed OS (src/index.css there) so the two tools read as one. */
:root {
  --bg: #fffffc;
  --card: #ffffff;
  --ink: #0f1729;
  --muted: #65758b;
  --line: #e5e7eb;
  --soft: #f3f4f6;
  --head: #f6f7f9;
  --action: #8e354a;
  --action-hover: #752c3d;
  --action-light: #f8ecef;
  --danger: #ef4444;
  --ok: #25a777;
  --warn: #f59e0b;
  --shell: #1f1b1a;
  --shell-fg: #c9cbcf;
  --shell-hover: #303236;
  --shell-active: #6e5a66;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --below: 0px; /* what is fixed to the bottom of the screen: the phone's tab bar */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  accent-color: var(--action);
}
a { color: inherit; }

/* Shell: the Mixed OS sidebar, turned on its side. */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 24px; background: var(--shell); border-bottom: 1px solid var(--shell-hover);
}
header .brand { display: flex; align-items: center; }
header .brand img { height: 34px; width: auto; display: block; }
header nav { display: flex; gap: 4px; }
header nav a { color: var(--shell-fg); text-decoration: none; font-weight: 500; padding: 6px 12px; border-radius: var(--radius-sm); }
header nav a:hover { background: var(--shell-hover); color: #fff; }
header nav a.active { background: var(--shell-active); color: #fff; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 24px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 12px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 14px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); }
.banner { padding: 10px 24px; font-size: 14px; }
.banner.warn { background: color-mix(in srgb, var(--warn) 14%, white); color: color-mix(in srgb, var(--warn) 65%, black); border-bottom: 1px solid color-mix(in srgb, var(--warn) 35%, white); }

/* In-app notices and questions, in place of the browser's alert() and confirm() */
#notices { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(560px, calc(100vw - 32px)); }
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--shell); color: #fff; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); font-size: 14px; line-height: 1.4; }
.notice.err { background: var(--danger); }
.notice a { color: #fff; }
.notice code { color: #fff; background: rgb(255 255 255 / 0.18); }
.notice .close { margin-left: auto; background: none; border: 0; color: inherit; min-height: 0; padding: 0 2px; font-size: 18px; line-height: 1; opacity: 0.8; }
.notice .close:hover { background: none; opacity: 1; }
dialog.ask { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 16px 48px rgb(0 0 0 / 0.2); color: var(--ink); }
dialog.ask::backdrop { background: rgb(31 27 26 / 0.45); }
dialog.ask p { margin: 0 0 16px; line-height: 1.45; }
dialog.try { width: min(760px, calc(100vw - 32px)); }
dialog.try h2 { margin: 0 0 4px; }
dialog.try h3 { margin: 0 0 6px; }
dialog.try form > label, dialog.try .row { margin-bottom: 14px; }
dialog.try form > label small { font-weight: 400; margin-top: -4px; }
.snippets { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; margin: 0 0 14px; max-height: 240px; overflow: auto; }
.snippets legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.snippets > small { display: block; padding: 0 8px 4px; }
.snippets label { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 14px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.snippets label:hover { background: var(--soft); }
.snippets input:is([type="checkbox"], [type="radio"]) { margin: 3px 0 0; width: 15px; height: 15px; flex: none; }
dialog.form h2 { margin: 0 0 12px; }
dialog.form form > label { margin-bottom: 16px; }
dialog.form form > label.inline { align-items: flex-start; }
dialog.form form > label.inline input { margin-top: 3px; flex: none; }
/* The style cards again, small enough for four across in the Regenerate dialog */
.styles.compact { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.styles.compact .style-card { padding: 8px; gap: 5px; font-size: 12px; }
.styles.compact .style-card > .small { display: none; }
.styles.compact .pv { min-height: 64px; padding: 10px 8px; gap: 5px; }
.styles.compact .pv-text { font-size: calc(var(--pv-size) * 0.62); }
.styles.compact .pv-overlay { font-size: calc(var(--pv-size) * 0.72); padding: 2px 8px; }
.styles.compact .pv.pv-off { font-size: 11px; }
.row.end { justify-content: flex-end; }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

table.list { width: 100%; border-collapse: collapse; }
table.list thead tr { background: var(--head); }
table.list th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 1px solid var(--line); }
table.list td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tbody tr:hover { background: var(--head); }
table.list td a { font-weight: 500; }
table.list th.pick, table.list td.pick { width: 1%; padding-right: 0; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 3px 0 0; border: 0; background: none; cursor: pointer; vertical-align: top; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.span2 { grid-column: span 2; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
label small { font-weight: 400; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; }
input, textarea, select {
  font: inherit; color: var(--ink); padding: 8px 12px; min-height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, .dropzone:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
textarea { width: 100%; resize: vertical; }
button, .btn {
  font: inherit; font-size: 14px; font-weight: 500; padding: 8px 14px; min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background-color 0.15s, border-color 0.15s;
}
button:hover, .btn:hover { background: var(--soft); }
button:disabled { opacity: 0.5; cursor: default; pointer-events: none; }
button.primary, .btn.primary { background: var(--action); color: #fff; border-color: var(--action); }
button.primary:hover, .btn.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
button.danger { color: var(--danger); }
button.danger.active { background: var(--danger); color: #fff; border-color: var(--danger); }
button.ok.active { background: var(--ok); color: #fff; border-color: var(--ok); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: flex-start; }
progress { width: 100%; height: 8px; margin-top: 12px; }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.badge.s-review, .badge.s-rendered { background: color-mix(in srgb, var(--ok) 14%, white); color: color-mix(in srgb, var(--ok) 65%, black); }
.badge.s-error, .badge.s-failed { background: color-mix(in srgb, var(--danger) 12%, white); color: color-mix(in srgb, var(--danger) 70%, black); }
.badge.s-staging, .badge.s-rendering, .badge.s-planning, .badge.s-transcribing { background: color-mix(in srgb, var(--warn) 16%, white); color: color-mix(in srgb, var(--warn) 50%, black); }
.status { margin-top: 10px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--action); border-radius: 50%; animation: spin 0.9s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
button .spin { border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }

/* While the pipeline works: Zuck as Pac-Man eats a row of ads. The row is clipped from the left in step with his mouth. */
.chomp { position: relative; height: 80px; margin-top: 12px; overflow: hidden; }
.chomp .ads { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-around; padding: 0 3%; clip-path: inset(0 0 0 0); animation: eaten 7s linear infinite; }
.chomp .ad { position: relative; width: 40px; height: 48px; border: 1px solid var(--line); border-radius: 4px; background: var(--card); box-shadow: var(--shadow); }
.chomp .ad::before { content: "AD"; position: absolute; left: 4px; top: 4px; width: 30px; height: 18px; border-radius: 2px; background: var(--action); color: #fff; font: 700 8px/18px Inter, sans-serif; text-align: center; letter-spacing: 0.05em; }
.chomp .ad::after { content: ""; position: absolute; left: 4px; top: 27px; width: 30px; height: 13px; background: linear-gradient(var(--line), var(--line)) 0 0 / 30px 4px no-repeat, linear-gradient(var(--line), var(--line)) 0 9px / 18px 4px no-repeat; }
.chomp .zuck { position: absolute; top: 6px; left: -64px; width: 64px; height: 64px; animation: walk 7s linear infinite; }
.chomp .zuck img { position: absolute; inset: 0; width: 64px; height: 64px; transform-origin: 9% 74%; }
.chomp .zuck .top { clip-path: inset(0 0 26% 0); animation: bite-top 0.32s ease-in-out infinite; }
.chomp .zuck .jaw { clip-path: inset(74% 0 0 0); animation: bite-jaw 0.32s ease-in-out infinite; }
@keyframes walk { to { left: calc(100% - 64px); } }
@keyframes eaten { to { clip-path: inset(0 0 0 100%); } }
@keyframes bite-top { 50% { transform: rotate(-7deg); } }
@keyframes bite-jaw { 50% { transform: rotate(13deg); } }
@media (prefers-reduced-motion: reduce) { .chomp * { animation-play-state: paused; } }

/* Variations on the review page: the players on the left, the cut's description beside them */
.card.hook { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "media info"; gap: 16px 24px; align-items: start; }
.hook .formats { grid-area: media; }
.hook .hook-head { grid-area: info; margin: 0; }
.hook-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.hook-top button { padding: 4px 10px; min-height: 30px; font-size: 13px; flex: none; }
.hook-label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.hook-label .secs { text-transform: none; }
.hook-text { width: 420px; max-width: 100%; font-weight: 600; }
.formats { display: flex; gap: 14px; flex-wrap: wrap; }
/* Every format renders 360px tall, so the players and their buttons line up across formats. */
.variant { width: 202px; }
.variant.f-4x5 { width: 288px; }
.variant.f-1x1 { width: 360px; }
.variant .small, .variant .err { overflow-wrap: anywhere; }
.variant .row { gap: 6px; }
.variant .row button, .variant .row .btn { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.player video, .player img { width: 100%; background: #111; border-radius: var(--radius); display: block; object-fit: cover; }
.player .placeholder { width: 100%; background: #111; border-radius: var(--radius); }
.variant.f-9x16 .player video, .variant.f-9x16 .player img, .variant.f-9x16 .placeholder { aspect-ratio: 9 / 16; }
.variant.f-4x5 .player video, .variant.f-4x5 .player img, .variant.f-4x5 .placeholder { aspect-ratio: 4 / 5; }
.variant.f-1x1 .player video, .variant.f-1x1 .player img, .variant.f-1x1 .placeholder { aspect-ratio: 1 / 1; }
.placeholder { color: #999; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.vmeta { margin: 8px 0 6px; font-size: 13px; }
.transcript { white-space: pre-wrap; font-size: 14px; }
details summary { cursor: pointer; font-weight: 600; }
.beats { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.beat { font-size: 13px; background: var(--soft); border-radius: var(--radius-sm); padding: 3px 8px; max-width: 100%; }
.beat b { font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; color: var(--muted); margin-right: 4px; }
.beat .warn { color: color-mix(in srgb, var(--warn) 60%, black); font-size: 12px; }

/* New video wizard */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: step; }
.steps li { flex: 1; font-size: 13px; color: var(--muted); padding: 8px 0; border-top: 3px solid var(--line); }
.steps li::before { counter-increment: step; content: counter(step) ". "; }
.steps li.current { color: var(--ink); border-top-color: var(--action); font-weight: 600; }
.steps li.done { border-top-color: color-mix(in srgb, var(--action) 45%, white); }
.step h3 { margin-top: 0; }
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer;
  background: var(--head); margin-bottom: 12px; outline: none; transition: background-color 0.15s, border-color 0.15s;
}
.dropzone:hover, .dropzone:focus, .dropzone.over { border-color: var(--action); background: var(--action-light); }
.dropzone .dz-idle { display: flex; flex-direction: column; gap: 4px; }
.types { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
#broll-zone { margin-bottom: 16px; }
/* A clip that has been picked, shown where it was picked */
.picked { display: flex; align-items: center; gap: 16px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--head); }
.picked img { width: 84px; max-height: 120px; object-fit: cover; background: #111; border-radius: var(--radius-sm); flex: none; }
.picked > div { min-width: 0; overflow-wrap: anywhere; }
.raw-pick-head { align-items: center; margin-bottom: 10px; }
.raw-pick-head input { flex: 0 1 280px; }
.drive { margin-top: 10px; }
.drive-picker { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-top: 10px; max-height: 380px; overflow: auto; }
.crumbs { margin-bottom: 8px; font-size: 13px; }
.crumb { background: none; border: 0; padding: 2px 4px; color: var(--action); font-weight: 600; }
.crumb:hover { background: var(--action-light); }
.drive-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.drive-item { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding: 8px; text-align: left; }
.drive-item.folder { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
.drive-item.selected { border-color: var(--action); background: var(--action-light); box-shadow: 0 0 0 1px var(--action) inset; }
.drive-thumb { position: relative; display: block; width: 100%; height: 150px; background: #111; border-radius: 6px; overflow: hidden; }
.drive-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* What the speech check heard, over the thumbnail that cannot show it. */
.drive-thumb .badge { position: absolute; left: 6px; bottom: 6px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.drive-thumb .badge.speech-no { background: var(--shell); color: var(--shell-fg); }
.drive-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.type-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; color: var(--ink); font-weight: 400; }
.type-card:hover { background: var(--head); }
.type-card:has(input:checked) { border-color: var(--action); background: var(--action-light); box-shadow: 0 0 0 1px var(--action) inset; }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card .type-name { font-weight: 600; font-size: 15px; }
fieldset.formats-pick { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
fieldset.formats-pick legend { padding: 0 4px; }
fieldset.formats-pick label.inline { font-size: 14px; }
.wizard-nav { margin-top: 16px; }
.wizard-nav > .row { margin-left: auto; }

/* Caption style previews: the sample caption drawn the way Creatomate will render it */
.pv { background: linear-gradient(160deg, #3b3b3b, #121212); border-radius: var(--radius); padding: 18px 14px; min-height: 110px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; }
.pv-text, .pv-overlay { color: var(--pv-color); line-height: 1.25; }
.pv-text { font-family: var(--pv-font), sans-serif; font-weight: var(--pv-weight); font-size: var(--pv-size); letter-spacing: 0.01em; }
.pv-overlay { font-family: var(--pv-overlay-font), serif; font-weight: 600; font-size: calc(var(--pv-size) * 1.15); padding: 3px 12px; border-radius: 6px; }
.pv.box-dark .pv-overlay { background: rgba(0, 0, 0, 0.78); }
.pv.box-light .pv-overlay { background: rgba(255, 255, 255, 0.9); color: #111111; }
.pv.box-none .pv-overlay { text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
.pv.pv-off { background: linear-gradient(160deg, #2c2c2c, #121212); border: 1px dashed #5a5a5a; color: #a9a9a9; font-size: 14px; }
.pv.outline .pv-text { text-shadow: -1.5px -1.5px 0 var(--pv-outline), 1.5px -1.5px 0 var(--pv-outline), -1.5px 1.5px 0 var(--pv-outline), 1.5px 1.5px 0 var(--pv-outline), 0 0 4px var(--pv-outline); }
.pv-word { color: var(--pv-accent); }
.pv.fx-none .pv-word { color: var(--pv-color); }
.pv.fx-highlight .pv-word { color: var(--pv-color); background: var(--pv-accent); padding: 0.05em 0.3em; border-radius: 0.3em; }
.pv.fx-enlarge .pv-word { font-size: 1.2em; }
.styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.style-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; color: var(--ink); font-weight: 400; }
.style-card:hover { background: var(--head); }
.style-card:has(input:checked) { border-color: var(--action); background: var(--action-light); box-shadow: 0 0 0 1px var(--action) inset; }
.style-card input { position: absolute; opacity: 0; pointer-events: none; }
.style-card .style-name { font-weight: 600; }
.styles-edit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 8px 0 18px; }
.style-editor { margin: 0; }
.style-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 12px; }
.style-fields label.inline { align-self: start; margin-top: 25px; min-height: 38px; }
input[type="color"] { padding: 3px; height: 38px; width: 100%; cursor: pointer; }
input[type="number"] { width: 100%; }
#general fieldset.formats-pick { align-self: start; }

/* Upload Raw Media: one row per file with its own tags. On a phone (see the end of this file) a
   row is a compact card and the Upload button rides in a bar along the bottom. */
.upload { max-width: 760px; }
.row .grow { flex: 1 1 240px; min-width: 0; }
.raw-head { align-items: center; margin-bottom: 12px; }
.raw-head h1 { margin: 0; }
.raw-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex: 1 1 auto; min-width: 0; }
.raw-bar #raw-status { text-align: right; }
#raw-drop { padding: 36px 20px; }
.raw-rows { list-style: none; padding: 0; margin: 0 0 14px; }
.raw-row {
  display: grid; grid-template-columns: 72px minmax(160px, 1fr) 1.4fr auto; gap: 4px 12px; align-items: center;
  grid-template-areas: "thumb file product remove" ". bar bar bar" ". state state state";
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.raw-thumb {
  grid-area: thumb; width: 72px; aspect-ratio: 3 / 4; min-height: 0; padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; cursor: zoom-in;
  display: grid; place-items: center; background: var(--soft); font-size: 12px; font-weight: 600; color: var(--muted);
}
.raw-thumb :is(img, video) { width: 100%; height: 100%; object-fit: cover; display: block; }
.raw-row .raw-file { grid-area: file; display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.raw-row .file-name { overflow-wrap: anywhere; }
.raw-row .product { grid-area: product; min-width: 0; }
/* The creator field shows only when there is a creator list to pick from */
.raw-row .creator { grid-area: creator; min-width: 0; display: none; }
.raw-rows.with-creator .creator { display: flex; }
.raw-rows.with-creator .raw-row {
  grid-template-columns: 72px minmax(140px, 1fr) 1fr 1.4fr auto;
  grid-template-areas: "thumb file creator product remove" ". bar bar bar bar" ". state state state state";
}
.raw-row .field.missing .picker-trigger { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset; }
.raw-row .remove { grid-area: remove; min-height: 0; padding: 0 8px; font-size: 18px; line-height: 1.4; border: 0; background: none; color: var(--muted); align-self: center; }
.raw-row .remove:hover { background: none; }
@media (hover: hover) { .raw-row .remove:hover { color: var(--danger); } }
.raw-row progress { grid-area: bar; margin: 6px 0 0; height: 6px; }
.raw-row .file-state { grid-area: state; color: var(--muted); }
.raw-row .file-state:empty { display: none; }
.raw-row.done .file-state { color: var(--ok); }
.raw-row.failed .file-state { color: var(--danger); }
.raw-row.done .picker-trigger { opacity: 0.6; }
.raw-row.done .remove { visibility: hidden; }
.done-list { list-style: none; padding: 0; margin: 8px 0 16px; }
.done-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.done-list .done-name { font-weight: 500; overflow-wrap: anywhere; }
#raw-form.over :is(.raw-rows, #raw-drop) { outline: 2px dashed var(--action); outline-offset: 6px; border-radius: var(--radius); }
#raw-form.busy .remove, #raw-form.busy #raw-add { pointer-events: none; opacity: 0.5; }
dialog.preview {
  padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--shell); color: var(--shell-fg);
  max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); box-shadow: 0 16px 48px rgb(0 0 0 / 0.3);
}
dialog.preview:focus { outline: none; }
dialog.preview::backdrop { background: rgb(31 27 26 / 0.7); }
dialog.preview .row { padding: 4px 4px 4px 14px; flex-wrap: nowrap; }
dialog.preview .row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.preview .close { min-height: 0; padding: 2px 10px; border: 0; background: none; color: var(--shell-fg); font-size: 20px; }
dialog.preview .close:hover { background: var(--shell-hover); color: #fff; }
dialog.preview :is(img, video) { display: block; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px - 40px); margin: 0 auto; }
dialog.preview .row a { color: var(--shell-fg); flex: none; margin-left: auto; }
dialog.preview .row a + .close { margin-left: 0; }
dialog.preview .preview-note { margin: 0; padding: 28px 24px; max-width: 340px; }

/* The Raw Queue: a clip, what is known of it, the coordinator's three calls */
.queue { list-style: none; padding: 0; margin: 14px 0 0; border-top: 1px solid var(--line); }
.queue-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "thumb what actions"; gap: 8px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.queue-what { grid-area: what; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.queue-what .badge { vertical-align: 1px; }
.queue-actions { grid-area: actions; flex-wrap: nowrap; }
.queue-actions button { white-space: nowrap; }
.queue-what .badge.speech-yes { background: var(--action-light); color: var(--action); }
.queue-what .badge.speech-no { background: var(--shell); color: var(--shell-fg); }
.queue-note { font-size: 13px; background: var(--soft); border-radius: var(--radius-sm); padding: 4px 8px; margin-top: 2px; }
.queue-note b { font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; color: var(--muted); margin-right: 4px; }
.queue-links { display: flex; gap: 14px; margin-top: 2px; }
.queue-links a { color: var(--action); font-weight: 500; }
.queue-note.rejected { background: color-mix(in srgb, var(--danger) 8%, white); }
.queue-note.rejected b { color: color-mix(in srgb, var(--danger) 70%, black); }
.edits { list-style: none; padding: 0; margin: 12px 0 0; border-top: 1px solid var(--line); }
.edits li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.edit-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.edits .badge { flex: none; }
#edits h2 { margin-bottom: 4px; }
#drive h3 { margin-top: 20px; }
.badge.ad-approved, .badge.src-human { background: color-mix(in srgb, var(--ok) 14%, white); color: color-mix(in srgb, var(--ok) 65%, black); }
.badge.ad-rejected { background: color-mix(in srgb, var(--danger) 12%, white); color: color-mix(in srgb, var(--danger) 70%, black); }
.badge.ad-pending { background: color-mix(in srgb, var(--warn) 16%, white); color: color-mix(in srgb, var(--warn) 50%, black); }
#mine h2 { margin-bottom: 4px; }
dialog.submit-edit { width: min(520px, calc(100vw - 32px)); }
dialog.submit-edit input[type="file"] { width: 100%; }
dialog.submit-edit progress { margin: 0 0 12px; }
.badge.priority { background: color-mix(in srgb, var(--warn) 16%, white); color: color-mix(in srgb, var(--warn) 50%, black); }

/* A field whose control is not an input (a picker): laid out like a label, without a label's click-through */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink); }
.field small { font-weight: 400; }

/* Picker: a type-to-find select over a fixed list, after Mixed OS's PickerCombobox */
.picker { position: relative; }
.picker-trigger { width: 100%; justify-content: space-between; font-weight: 400; padding: 8px 12px; text-align: left; }
.picker-trigger svg { flex: none; opacity: 0.5; }
.picker-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-value.placeholder { color: var(--muted); }
.picker-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; width: 100%; min-width: min(320px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); font-size: 14px; font-weight: 400;
}
.picker-pop.up { top: auto; bottom: calc(100% + 4px); }
.picker-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.picker-search svg { flex: none; opacity: 0.5; }
.picker-search input { flex: 1; min-width: 0; height: 44px; min-height: 0; padding: 0; border: 0; background: transparent; font-size: 14px; }
.picker-search input:focus-visible { outline: none; }
.picker-list { list-style: none; margin: 0; padding: 4px; max-height: 200px; overflow-y: auto; overscroll-behavior: contain; }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: default; user-select: none; }
.picker-item.active { background: var(--soft); }
.picker-item svg { flex: none; opacity: 0; }
.picker-item.selected svg { opacity: 1; }
.picker-empty { padding: 24px 0; text-align: center; }

/* Before sign-in: the wordmark over one card on the dark shell, as Mixed OS has it */
body[data-page="login"] { background: var(--shell); }
body[data-page="login"] main { max-width: none; padding: 0; }
.auth { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px 16px; }
.auth-logo { height: 46px; width: auto; }
.auth-card { width: 100%; max-width: 384px; background: var(--card); border-radius: 16px; padding: 30px; box-shadow: 0 24px 60px rgb(0 0 0 / 0.4); }
.auth-card h1 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.auth-card h1 + form, .auth-card h1 + p + form { margin-top: 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card label { font-size: 12px; color: var(--muted); }
.auth-card input { font-size: 16px; min-height: 44px; }
.auth-card button, .auth-card .btn { min-height: 44px; margin-top: 4px; }
.auth-card .btn { display: flex; margin-top: 20px; }
.auth-card .err { margin: 0; font-size: 14px; }
.auth-note { margin: 18px 0 0; text-align: center; }

/* Who is signed in: a disc in the corner that opens their name and Sign Out */
.account { position: relative; margin-left: 12px; }
.account summary { list-style: none; cursor: pointer; border-radius: 50%; }
.account summary::-webkit-details-marker { display: none; }
.account summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--shell-active); color: #fff; font-size: 13px; font-weight: 600; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px; display: flex; flex-direction: column; gap: 2px;
  padding: 12px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
.account-menu .small { overflow-wrap: anywhere; }
.account-menu button { margin-top: 10px; }
header.top nav { margin-left: auto; }

/* Settings and Users & Access, the admin's two pages */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--action); }

/* Users & Access: a person, what they may open, what can be done with the account */
.users-head { align-items: center; }
.users-head h1 { margin: 0; }
.users { list-style: none; padding: 0; margin: 14px 0 0; border-top: 1px solid var(--line); }
.user { display: grid; grid-template-columns: minmax(0, 1.3fr) auto auto; gap: 10px 24px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.user-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.user-who .small { overflow-wrap: anywhere; }
.user.disabled .user-who, .user.disabled .perms { opacity: 0.55; }
.user-actions { flex-wrap: nowrap; }
.user-actions button { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.perms { display: flex; gap: 6px; flex-wrap: wrap; border: 0; padding: 0; margin: 0; }
.perms legend { font-size: 13px; font-weight: 500; padding: 0; margin-bottom: 6px; }
label.check {
  flex-direction: row; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer; user-select: none;
}
label.check input { margin: 0; }
label.check:has(input:checked) { border-color: var(--action); background: var(--action-light); }
.perms.stacked { flex-direction: column; gap: 8px; }
.perms.stacked label.check { border-radius: var(--radius); padding: 10px 12px; align-items: flex-start; }
.perms.stacked label.check input { margin-top: 2px; }
.perms.stacked label.check span { display: flex; flex-direction: column; }
dialog.add-user form { display: flex; flex-direction: column; gap: 14px; }
dialog.add-user h2, dialog.link h2 { margin: 0; }
dialog.link { width: min(520px, calc(100vw - 32px)); }
dialog.link .row { margin: 12px 0; }

/* The picker as a sheet: on a phone the list takes the whole screen, sized to what the keyboard leaves */
html.sheet-open, html.sheet-open body { overflow: hidden; }
.picker-head { display: none; }
.picker-pop.sheet {
  position: fixed; inset: 0 0 auto 0; z-index: 100; width: auto; min-width: 0; height: 100dvh; display: flex; flex-direction: column;
  border: 0; border-radius: 0; box-shadow: none; font-size: 16px;
}
.picker-pop.sheet .picker-head { display: flex; align-items: center; justify-content: space-between; padding: max(6px, env(safe-area-inset-top)) 6px 6px 16px; border-bottom: 1px solid var(--line); font-size: 16px; }
.picker-pop.sheet .picker-close { border: 0; background: none; color: var(--action); font-weight: 600; font-size: 16px; }
.picker-pop.sheet .picker-search { padding: 0 16px; }
.picker-pop.sheet .picker-search input { height: 52px; font-size: 16px; }
.picker-pop.sheet .picker-list { flex: 1; max-height: none; padding: 4px 8px calc(16px + env(safe-area-inset-bottom)); }
.picker-pop.sheet .picker-item { min-height: 48px; padding: 10px 8px; border-radius: var(--radius-sm); }
@media (pointer: coarse) { .picker-pop.sheet .picker-item.active:not(.selected) { background: none; } }
.picker-pop.sheet .picker-item.selected { background: var(--action-light); }

.on-narrow { display: none; }
header nav a svg { display: none; }

@media (max-width: 960px) {
  .styles-edit { grid-template-columns: 1fr; }
}

/* Phones. Touch-sized controls, 16px in every field (smaller and iOS zooms the page on focus),
   the nav as a tab bar along the bottom, and tables as stacked blocks. */
@media (max-width: 720px) {
  .on-wide { display: none; }
  .on-narrow { display: inline; }
  body.has-nav { --below: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: var(--below); }
  main { padding: 12px max(12px, env(safe-area-inset-right)) 28px max(12px, env(safe-area-inset-left)); }
  .card { padding: 16px; margin-bottom: 12px; }
  h1 { font-size: 20px; }
  .banner { padding: 8px 14px; font-size: 13px; }
  input, textarea, select { font-size: 16px; min-height: 44px; max-width: 100%; }
  button, .btn, .picker-trigger { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; margin-top: 0; }
  code { overflow-wrap: anywhere; }
  .grid2 { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
  #notices { bottom: calc(var(--below) + 12px); }
  dialog.ask { padding: 16px; }
  dialog.try { width: calc(100vw - 16px); max-width: none; max-height: calc(100dvh - 16px); }

  header.top { height: 52px; padding: 0 14px; justify-content: center; }
  header .brand img { height: 28px; }
  header nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: var(--below); gap: 2px;
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left));
    background: var(--shell); border-top: 1px solid var(--shell-hover);
  }
  header nav a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 2px; font-size: 11px; line-height: 1.3; }
  header nav a svg { display: block; }

  /* Pending Ads: each video a block, the title over one line of details */
  table.list, table.list tbody { display: block; }
  table.list thead { display: none; }
  table.list tr { display: block; position: relative; padding: 12px 0 12px 36px; border-bottom: 1px solid var(--line); }
  table.list tbody tr:hover { background: none; }
  table.list td { display: inline; padding: 0; border: 0; }
  table.list td[colspan] { display: block; margin-left: -36px; }
  table.list td.pick { position: absolute; left: 0; top: 13px; width: auto; }
  table.list td.c-title { display: block; padding-right: 104px; font-size: 15px; }
  table.list td.c-status { position: absolute; right: 0; top: 12px; }
  table.list td.c-meta { color: var(--muted); }
  table.list td.c-meta:not(:empty) ~ td.c-meta:not(:empty)::before { content: " · "; }
  table.list td.c-count:not(:empty)::before { content: "approved / rendered / total "; color: var(--muted); }
  table.list td.c-count, table.list td.c-date { display: block; font-size: 13px; }
  table.list td:empty { display: none; }

  /* Review: the cut's description, then its player as large as the screen allows */
  .card.hook { grid-template-columns: minmax(0, 1fr); grid-template-areas: "info" "media"; }
  #body-head > .row.between { flex-direction: column; align-items: stretch; gap: 12px; }
  #body-actions button { flex: 1 1 auto; }
  .hook-top button { min-height: 40px; }
  .hook-text { width: auto; flex: 1 1 180px; min-width: 0; }
  .formats { justify-content: center; }
  .variant, .variant.f-4x5, .variant.f-1x1 { width: 100%; }
  .variant.f-9x16 { width: min(100%, 300px); }
  .variant .row { flex-wrap: nowrap; }
  .variant .row button { flex: 1 1 0; min-height: 44px; font-size: 14px; }
  .variant .row .btn { flex: 0 0 52px; min-height: 44px; }
  .styles.compact { grid-template-columns: repeat(2, 1fr); }

  /* Create: the caption styles two across, small; Back and Next ride along the bottom */
  .styles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .styles .style-card { padding: 8px; gap: 5px; font-size: 12px; }
  .styles .style-card > .small { display: none; }
  .styles .pv { min-height: 64px; padding: 10px 8px; gap: 5px; }
  .styles .pv-text { font-size: calc(var(--pv-size) * 0.62); }
  .styles .pv-overlay { font-size: calc(var(--pv-size) * 0.72); padding: 2px 8px; }
  .styles .pv.pv-off { font-size: 11px; }
  .dropzone { padding: 24px 16px; }
  .drive-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard-nav { position: sticky; bottom: var(--below); z-index: 10; margin: 16px -16px -16px; padding: 10px 16px; background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); align-items: center; }
  .wizard-nav button { min-width: 96px; }

  /* Settings */
  .styles-edit > *, .style-fields > * { min-width: 0; }
  #upload-link .row .grow { flex-basis: 100%; }

  /* Upload Raw Media: a row is a card with the frame beside its pickers, and Upload stays in reach */
  body[data-page="upload"] main { padding-bottom: 104px; }
  .raw-bar {
    position: fixed; left: 0; right: 0; bottom: var(--below); z-index: 20; justify-content: space-between;
    padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgb(0 0 0 / 0.07);
  }
  body:not(.has-nav) .raw-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .raw-bar #raw-status { text-align: left; flex: 1; min-width: 0; }
  .raw-bar #raw-submit { flex: none; min-height: 48px; padding: 0 20px; font-size: 16px; font-weight: 600; }
  .upload.empty .raw-bar { display: none; }
  #raw-drop { padding: 44px 16px; }
  #raw-drop strong { display: inline-block; padding: 12px 20px; border-radius: var(--radius-sm); background: var(--action); color: #fff; font-size: 16px; margin-bottom: 6px; }
  #raw-more-row { flex-direction: column; align-items: stretch; }
  #raw-add { min-height: 48px; }
  .raw-row, .raw-rows.with-creator .raw-row {
    grid-template-columns: 84px minmax(0, 1fr) 36px; gap: 8px 10px; align-items: start; padding: 14px 0;
    grid-template-areas: "thumb product remove" "thumb file file" "bar bar bar" "state state state";
  }
  .raw-rows.with-creator .raw-row { grid-template-areas: "thumb creator remove" "thumb product product" "thumb file file" "bar bar bar" "state state state"; }
  .raw-row .raw-thumb { width: 84px; align-self: start; }
  .raw-row .field-label { display: none; }
  .raw-row .remove { min-height: 44px; padding: 0; font-size: 22px; align-self: start; }
  .raw-row .raw-file { flex-direction: row; flex-wrap: wrap; gap: 0 8px; }
  .done-list li { flex-direction: column; }
  #raw-done .row > * { flex: 1 1 auto; }

  /* The Raw Queue: the clip beside what is known of it, its three calls in a row underneath */
  .queue-row { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "thumb what" "actions actions"; align-items: start; padding: 14px 0; }
  .queue-row .raw-thumb { width: 84px; }
  .queue-actions { flex-wrap: wrap; }
  .queue-actions button { flex: 1 1 auto; }
  .raw-pick-head input { flex: 1 1 100%; }
  .picked img { width: 64px; }

  /* Accounts */
  header.top .account { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 9px; margin: 0; }
  header.top { position: relative; }
  .auth { justify-content: flex-start; padding-top: max(48px, 12dvh); }
  .auth-card { padding: 24px; }
  .tabs a { flex: 1; text-align: center; padding: 12px 8px; }
  .user { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .user-actions button { flex: 1 1 auto; min-height: 44px; white-space: nowrap; }
  label.check { padding: 10px 14px 10px 12px; }
  .users-head .primary { min-height: 44px; }
}
