/* CustomApp Video Maker: the making flow. Brand: charcoal wordmark, teal for action, Plus Jakarta Sans headings, Inter body. */
:root {
  --ground: #f7f8f7; --surface: #ffffff; --line: #e4e7e6; --line-strong: #d3d8d6;
  --ink: #2d2d2d; --ink-2: #4a4a4a; --muted: #6b7270;
  --teal: #5cbdb4; --teal-dark: #3fa89f; --teal-ink: #23756e; --teal-wash: #eaf6f5;
  --warn: #9a5b00; --warn-wash: #fdf3e1; --bad: #a3322b; --bad-wash: #fbeceb; --ok-wash: #e8f5ee; --ok: #1f7a4a;
  --add-wash: #e8f5ee; --del-wash: #fbeceb;
  --head: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #151717; --surface: #1d2020; --line: #2c3030; --line-strong: #3a3f3f;
    --ink: #f1f3f2; --ink-2: #d6dad9; --muted: #9aa3a1;
    --teal: #5cbdb4; --teal-dark: #6fcac1; --teal-ink: #8ad6ce; --teal-wash: #1c2e2c;
    --warn: #e9b866; --warn-wash: #33291a; --bad: #f0a39d; --bad-wash: #3a2220; --ok: #7fd1a3; --ok-wash: #1b2e24;
    --add-wash: #1b2e24; --del-wash: #3a2220;
    color-scheme: dark;
  }
  .logo { filter: brightness(0) invert(1); opacity: .92; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.6 var(--body); }
a { color: var(--teal-ink); }
h1 { font: 700 clamp(26px, 3.4vw, 34px)/1.15 var(--head); margin: 0 0 8px; letter-spacing: -.01em; text-wrap: balance; }
h2 { font: 700 20px/1.25 var(--head); margin: 0 0 6px; }
h3 { font: 600 15.5px/1.3 var(--head); margin: 0 0 4px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.main { padding-block: 28px 56px; }

/* top bar */
.bar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar-in { display: flex; align-items: center; gap: 22px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.logo { height: 24px; width: auto; display: block; }
.brand .divider { width: 1px; height: 22px; background: var(--line-strong); }
.brand .product { font: 600 15px/1 var(--head); color: var(--ink-2); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--teal-wash); }
.nav a[aria-current="page"] { color: var(--teal-ink); background: var(--teal-wash); }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.signout { color: var(--ink-2); text-decoration: none; border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 10px; }
.signout:hover { border-color: var(--teal); color: var(--teal-ink); }

/* buttons, fields */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 14px/1 var(--body); padding: 11px 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--teal); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--teal-ink); border-color: var(--teal-ink); }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.link { border: 0; background: none; padding: 4px 6px; color: var(--teal-ink); }
.btn:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=url], input[type=tel], input[type=password], input[type=number], input[type=search], textarea, select {
  width: 100%; font: 15px/1.4 var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px;
}
textarea { min-height: 84px; resize: vertical; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card > h2:first-child { margin-bottom: 4px; }
.card .sub { color: var(--muted); margin-bottom: 14px; max-width: 70ch; }
.eyebrow { font: 600 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--teal-ink); margin: 0 0 10px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }

/* status chips */
.chip { display: inline-block; font: 600 12px/1 var(--body); padding: 5px 9px; border-radius: 99px; background: var(--line); color: var(--ink-2); white-space: nowrap; }
.chip-done { background: var(--ok-wash); color: var(--ok); }
.chip-rendering, .chip-approved { background: var(--teal-wash); color: var(--teal-ink); }
.chip-failed { background: var(--bad-wash); color: var(--bad); }
.chip-script, .chip-storyboard, .chip-draft { background: var(--warn-wash); color: var(--warn); }
.chip-cancelled { background: var(--line); color: var(--muted); }

/* tabs and segmented controls */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 14px 10px; font: 600 14px/1 var(--body); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--teal-ink); border-bottom-color: var(--teal-dark); }
.tabs .tick { color: var(--ok); margin-left: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; width: fit-content; }
.seg button { font: 500 13px/1 var(--body); padding: 8px 12px; background: transparent; color: var(--ink-2); border: 0; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

/* lists and tables */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.job-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; text-decoration: none; color: inherit; }
.job-row:hover h3 { color: var(--teal-ink); }
.job-row .meta { color: var(--muted); font-size: 13px; }
.product-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.product-pick button { text-align: left; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; font: inherit; color: inherit; }
.product-pick button:hover { border-color: var(--teal); }
.product-pick button[aria-pressed="true"] { border-color: var(--teal-dark); box-shadow: 0 0 0 2px var(--teal-wash); background: var(--teal-wash); }
.topics { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.topic { font-size: 11.5px; padding: 3px 8px; border-radius: 99px; background: var(--line); color: var(--ink-2); }

/* wizard */
.steps { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.steps li { list-style: none; font: 600 13px/1 var(--body); padding: 8px 12px; border-radius: 99px; background: var(--line); color: var(--muted); }
.steps li.on { background: var(--teal-wash); color: var(--teal-ink); }
.steps li.past { color: var(--ink-2); }
.wizard { max-width: 760px; }

/* notices */
.notice { padding: 12px 14px; border-radius: var(--radius); background: var(--teal-wash); color: var(--ink-2); font-size: 14px; margin-bottom: 14px; }
.notice.warn { background: var(--warn-wash); color: var(--ink); }
.notice.bad { background: var(--bad-wash); color: var(--ink); }
.notice.ok { background: var(--ok-wash); color: var(--ink); }
.notice ul { margin: 6px 0 0 18px; padding: 0; }
.working { display: flex; align-items: center; gap: 12px; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line-strong); border-top-color: var(--teal-dark); border-radius: 50%; animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } * { transition: none !important; } }

/* brand kit */
.brand-grid { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 22px; }
@media (max-width: 760px) { .brand-grid { grid-template-columns: 1fr; } }
.logo-stage { background: repeating-conic-gradient(#e9ecec 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; padding: 14px; }
.logo-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-stage.empty { color: var(--muted); font-size: 13px; text-align: center; background: var(--ground); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs button { width: 64px; height: 52px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; cursor: pointer; }
.thumbs button[aria-pressed="true"] { border-color: var(--teal-dark); box-shadow: 0 0 0 2px var(--teal-wash); }
.thumbs img { width: 100%; height: 100%; object-fit: contain; display: block; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.colour-pick { display: flex; gap: 8px; align-items: center; }
.colour-pick input[type=text] { width: 110px; font-family: var(--mono); }
.brand-sample { border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 12px; color: #fff; margin-top: 10px; }
.brand-sample img { height: 30px; background: rgba(255,255,255,.9); border-radius: 6px; padding: 3px; }
.brand-sample .accent { margin-left: auto; padding: 5px 12px; border-radius: 99px; font-weight: 600; font-size: 13px; }

/* script editor */
.line-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.line-row:last-child { border-bottom: 0; }
.line-no { width: 30px; height: 30px; border-radius: 50%; background: var(--teal-wash); color: var(--teal-ink); font: 700 13px/30px var(--head); text-align: center; }
.line-tools { display: flex; flex-direction: column; gap: 4px; }
.line-tools button { padding: 4px 8px; }
.line-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.suggestion { font-size: 13px; color: var(--muted); font-style: italic; margin-top: 4px; }

/* voices */
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.voice { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); display: grid; gap: 8px; }
.voice.on { border-color: var(--teal-dark); box-shadow: 0 0 0 2px var(--teal-wash); background: var(--teal-wash); }
.voice .labels { color: var(--muted); font-size: 12.5px; }

/* media editor */
.media-line { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: var(--surface); }
.media-line header { display: flex; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.media-line .vo { color: var(--ink-2); font-size: 14px; margin-bottom: 10px; }
.mini-row { display: grid; grid-template-columns: 110px 1fr 1fr 90px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 760px) { .mini-row { grid-template-columns: 1fr 1fr; } }
.chat-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.preview { max-width: 220px; max-height: 140px; border-radius: 8px; border: 1px solid var(--line); display: block; margin-top: 8px; }
.progress { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; background: var(--teal-dark); width: 0; transition: width .4s; }

/* storyboard */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.shot { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.shot-frame { aspect-ratio: 16 / 9; background: #14191a; color: #e8eceb; display: flex; align-items: center; justify-content: center; padding: 12px; text-align: center; font: 600 15px/1.3 var(--head); position: relative; overflow: hidden; }
.shot-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot-frame .tag { position: absolute; left: 8px; top: 8px; font: 600 11px/1 var(--body); background: rgba(255,255,255,.14); color: #fff; padding: 4px 8px; border-radius: 99px; }
.shot-body { padding: 12px 14px; font-size: 14px; display: grid; gap: 6px; }
.shot-body .vo { color: var(--ink-2); }

/* render + versions */
.big-progress { display: grid; gap: 8px; }
.version { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; background: var(--surface); }
.version header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.player { background: #0e1010; border-radius: 8px; overflow: hidden; display: flex; justify-content: center; }
.player video { width: 100%; max-height: 520px; display: block; }
.player.tall video { max-width: 300px; }

/* changes room + diff */
.comment { border-left: 3px solid var(--teal); padding: 6px 12px; margin: 10px 0; background: var(--teal-wash); border-radius: 0 8px 8px 0; }
.comment .by { font-size: 12.5px; color: var(--muted); }
.diff { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.diff-row { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; font-size: 14px; }
.diff-row:last-child { border-bottom: 0; }
.diff-row.added { background: var(--add-wash); }
.diff-row.removed { background: var(--del-wash); }
.diff-row.changed { background: var(--surface); }
.diff-row .op { font: 700 11px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.diff-row .before { text-decoration: line-through; color: var(--bad); }
.diff-row .after { color: var(--ok); }
.diff-row .scene { font-size: 12.5px; color: var(--muted); }
.diff-row.same { opacity: .6; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 10px; font-size: 14px; max-width: min(92vw, 560px); z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.error { background: var(--bad); color: #fff; }
.toast[hidden] { display: none; }

/* audit page */
.table-wrap { padding: 0; overflow-x: auto; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.audit-table th { text-align: left; font: 600 12px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.audit-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.audit-table tr:last-child td { border-bottom: 0; }
.audit-table code { font: 12.5px var(--mono); }
.audit-detail { margin: 6px 0 0; padding: 8px 10px; background: var(--ground); border-radius: 8px; font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; max-width: 56ch; }
.nowrap { white-space: nowrap; }

/* progress */
.chip-progress { background: var(--teal-wash); color: var(--teal-ink); }
.live-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--ink-2); }
.live-line b { color: var(--ink); }

/* live brand offer */
.offer { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.offer-logo { width: 110px; height: 80px; border: 1px solid var(--line); border-radius: 8px; background: repeating-conic-gradient(#e9ecec 0 25%, #fff 0 50%) 0 0 / 14px 14px; display: flex; align-items: center; justify-content: center; padding: 6px; }
.offer-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.history { max-height: 360px; overflow: auto; }

/* storyboard: real screenshots (contract 8) */
.shot-frame { position: relative; }
.shot-frame.tall { aspect-ratio: 9 / 16; }
.shot-frame.dim img { opacity: .45; }
.board.tall { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.shot-note { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 8px; font: 500 12.5px/1.3 var(--body); background: rgba(12, 16, 16, .82); color: #e8eceb; padding: 7px 10px; border-radius: 8px; text-align: left; }
.shot-note.bad { background: rgba(120, 30, 24, .92); }
.shot-note.warn { background: rgba(110, 70, 0, .92); }
.shot-note .spinner { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.3); border-top-color: #fff; }
.chip-shot-ok { background: var(--ok-wash); color: var(--ok); }
.chip-shot-failed { background: var(--bad-wash); color: var(--bad); }
.chip-shot-stale { background: var(--warn-wash); color: var(--warn); }
.chip-shot-shooting { background: var(--teal-wash); color: var(--teal-ink); }
.chip-shot-none { background: var(--line); color: var(--muted); }
.shot-frame:not(:has(img)) { background: var(--stage, #14191a); }

/* demo instance */
.demo-banner { position: sticky; top: 0; z-index: 60; background: #f2b134; color: #2a1d00; text-align: center; font: 600 13px/1 var(--body); padding: 8px 12px; letter-spacing: .02em; }
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(420px, 100%); display: grid; gap: 4px; }
.login-card h1 { margin-top: 10px; }
