/* Design tokens (DESIGN.md): a black-and-white interface; colour only in media, illustrations and status labels. */
@font-face { font-family: 'DM Sans'; src: url('/fonts/dm-sans.woff2') format('woff2'); font-weight: 100 1000; font-style: normal; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('/fonts/outfit.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --bg: #ffffff; --panel: #ffffff; --surface: #f5f5f5; --ink: #18181b; --muted: #45515e; --muted-light: #86909c;
  --line: rgba(0, 0, 0, 0.08); --line-strong: rgba(0, 0, 0, 0.16); --border: #181e25;
  --accent: #18181b; --accent-ink: #ffffff; --chip: #f5f5f5;
  --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --st-idea: #a1a1aa; --st-generating: #8b5cf6; --st-pending_approval: #f59e0b; --st-scheduled: #3b82f6;
  --st-publishing: #06b6d4; --st-published: #16a34a; --st-failed: #dc2626; --st-rejected: #71717a;
  --shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
  --shadow-lift: 0 16px 32px -8px rgba(0, 0, 0, 0.12), 0 6px 14px -4px rgba(0, 0, 0, 0.06);
  /* Behind dialogs: every window dims the page; the top-up window dims it more, to keep the eye on the packs. */
  --overlay: rgba(9, 9, 11, 0.6); --overlay-focus: rgba(9, 9, 11, 0.8);
  --radius: 20px; --radius-sm: 12px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --font-display: 'Outfit', var(--font);
  --gutter: clamp(16px, 4vw, 60px);
  color-scheme: light;
}
/* Dark mode (DESIGN.md §2.3): the same black-and-white system, inverted; ink becomes near-white. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11; --panel: #18181b; --surface: #232327; --ink: #f4f4f5; --muted: #b4b4bb; --muted-light: #8b8b94;
    --line: rgba(255, 255, 255, 0.09); --line-strong: rgba(255, 255, 255, 0.2); --border: #e4e4e7;
    --accent: #f4f4f5; --accent-ink: #18181b; --chip: #232327;
    --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
    --shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.5), 0 4px 12px -2px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 16px 32px -8px rgba(0, 0, 0, 0.6), 0 6px 14px -4px rgba(0, 0, 0, 0.35);
    --overlay: rgba(0, 0, 0, 0.7); --overlay-focus: rgba(0, 0, 0, 0.85);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
/* Rules like .modal { display: flex } would otherwise beat the browser's own [hidden] { display: none }. */
[hidden] { display: none !important; }
body { margin: 0; font: 400 15px/1.5 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
/* Keyboard focus: a clear ink outline on everything that can be clicked (DESIGN.md §8). */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); text-underline-offset: 2px; }
h2 { font-size: 19px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
/* Outfit only at display sizes (28px and up). */
.display { font-family: var(--font-display); font-weight: 500; font-size: 28px; line-height: 1.25; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.top { display: flex; align-items: center; gap: 16px; padding: 12px var(--gutter); background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; }
.status { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.pill { padding: 3px 11px; border-radius: 9999px; background: var(--chip); font-size: 12.5px; white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.top-actions { display: flex; gap: 8px; }

.tabs { display: flex; gap: 4px; padding: 0 var(--gutter); background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; flex: none; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.view { padding: 28px var(--gutter); max-width: 1400px; margin: 0 auto; }
.banner { padding: 10px var(--gutter); background: color-mix(in srgb, var(--warn) 16%, var(--panel)); color: var(--ink); border-bottom: 1px solid var(--line); }

.btn { border: 1px solid var(--line-strong); background: var(--panel); padding: 7px 18px; border-radius: 9999px; cursor: pointer; white-space: nowrap; font-weight: 400; transition: transform .12s, border-color .12s, background .12s; }
.btn:hover { border-color: var(--border); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.error-box { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); padding: 8px 10px; border-radius: 12px; font-size: 13px; margin: 8px 0; overflow-wrap: anywhere; }

/* Status dots and badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 1px 8px; border-radius: 9999px; background: var(--chip); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--muted)); }
[data-status="idea"] { --dot: var(--st-idea); } [data-status="generating"] { --dot: var(--st-generating); }
[data-status="pending_approval"] { --dot: var(--st-pending_approval); } [data-status="scheduled"] { --dot: var(--st-scheduled); }
[data-status="publishing"] { --dot: var(--st-publishing); } [data-status="published"] { --dot: var(--st-published); }
[data-status="failed"] { --dot: var(--st-failed); } [data-status="rejected"] { --dot: var(--st-rejected); }

/* Schedule timeline */
.timeline { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tl-inner { position: relative; }
.tl-head, .tl-lane { display: flex; }
.tl-label { position: sticky; left: 0; z-index: 2; width: 190px; flex: none; padding: 10px 12px; background: var(--panel); border-right: 1px solid var(--line); }
.tl-track { position: relative; flex: none; border-bottom: 1px solid var(--line); }
.tl-head .tl-track { height: 30px; }
.tl-lane .tl-track { height: 106px; }
/* A paused account's lane: greyed and striped, labelled, so its overdue reels read as waiting, not stuck. */
.tl-lane.paused .tl-track { background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--muted) 10%, transparent) 10px 20px); }
.tl-lane.paused .frame, .tl-lane.paused .frame-time { opacity: .5; filter: grayscale(.7); }
.tl-lane.paused .tl-label { background: color-mix(in srgb, var(--muted) 8%, var(--panel)); }
.tl-paused-row { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.tl-paused-row .link-btn { margin: 0; font-size: 12px; }
.tl-paused-tag { position: absolute; left: 8px; bottom: 6px; padding: 2px 8px; border-radius: 9999px; font-size: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); z-index: 1; }
/* The posting time under each reel's box, so times read at a glance. */
.frame-time { position: absolute; top: 82px; transform: translateX(-50%); z-index: 1; padding: 0 3px; border-radius: 3px; background: var(--panel); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; pointer-events: none; }
/* Small platform glyphs (account rows, analytics). */
.pf-row { display: flex; gap: 6px; margin-top: 6px; }
.pf-icon { display: inline-flex; width: 16px; height: 16px; vertical-align: -3px; }
.pf-icon svg { width: 100%; height: 100%; }
.tl-day { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); padding: 6px 8px; font-size: 12px; color: var(--muted); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 1; }
.frame { position: absolute; top: 10px; width: 38px; height: 68px; padding: 0; border-radius: 6px; background: var(--dot); border: 3px solid var(--dot); cursor: pointer; transform: translateX(-19px); overflow: hidden; }
.frame:hover { outline: 2px solid var(--ink); z-index: 2; }
/* With a cover: the image fills the box, the status shows as the border plus a dot in the corner. */
.frame.has-cover { background: #000; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame-dot { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 1.5px #fff; }
.frame:not(.has-cover) .frame-dot { display: none; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* Review cards */
.reel { display: grid; grid-template-columns: 170px 1fr; gap: 14px; }
.reel video, .reel .novideo { width: 170px; aspect-ratio: 9 / 16; border-radius: 16px; background: #000; object-fit: cover; }
.reel .novideo { display: flex; align-items: center; justify-content: center; color: #a1a1aa; font-size: 12px; text-align: center; padding: 8px; }
.reel textarea, .reel input, .field input, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--panel); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.reel textarea { min-height: 80px; resize: vertical; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.cover-row { display: flex; gap: 10px; align-items: flex-start; }
.cover-thumb { width: 64px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px; display: block; background: #000; }
.cover-thumb.empty { display: flex; align-items: center; justify-content: center; color: #a1a1aa; font-size: 10px; text-align: center; padding: 4px; }
.script { font-size: 13px; padding-left: 18px; margin: 6px 0; }
.script li { margin-bottom: 4px; }
@media (max-width: 560px) { .reel { grid-template-columns: 1fr; } .reel video, .reel .novideo { width: 100%; max-width: 260px; } }

/* Forms and suggestions */
.form { display: grid; gap: 14px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { border: 1px solid transparent; background: var(--chip); padding: 4px 12px; border-radius: 9999px; cursor: pointer; font-size: 12.5px; }
.chip:hover { border-color: var(--line-strong); }
.choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.choice { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px; cursor: pointer; background: var(--panel); text-align: left; }
.choice.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice b { display: block; margin-bottom: 2px; }
.choice .desc { font-size: 12px; color: var(--muted); }
.choice .play { margin-top: 6px; font-size: 12px; padding: 2px 8px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400 !important; }
.check input { width: auto; }

/* Subtitle previews: frames rendered by the server in each style (empty until it can draw them) */
.sub-preview { aspect-ratio: 540 / 200; margin-bottom: 8px; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #3b5d50, #8a6b4a); }
.sub-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Admin → Models */
.cap-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 4px 0 12px; background: var(--surface); }
.cap-card p { margin: 8px 0; }
.meter { height: 8px; border-radius: 9999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter.full span { background: var(--bad); }
.cap-form { align-items: center; gap: 10px; }
.money-input { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); padding-left: 10px; }
.money-input input { border: 0; width: 90px; padding: 7px 8px; background: transparent; }
.money-input input:focus { outline: none; }

.model-jobs { display: grid; gap: 14px; }
.model-job h3 { margin: 0; }
.model-job .btn.ghost { padding: 2px 8px; }
.nowrap { white-space: nowrap; }

/* Tables and charts */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 180px; }
.chart rect { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 10px; }
.learnings { white-space: pre-wrap; font-size: 13px; }
.log-row td:first-child { white-space: nowrap; color: var(--muted); }
.lvl-error { color: var(--bad); } .lvl-warn { color: var(--warn); }

/* Modal and toasts */
.modal { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(2px); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal-card { position: relative; background: var(--panel); border-radius: 24px; padding: 26px; width: min(760px, 100%); box-shadow: var(--shadow-lift); }
.modal-card.wide { width: min(1120px, 100%); }

/* Account form: a section menu on the left, one section at a time on the right, actions pinned below. */
.acct-form { display: grid; grid-template-columns: 180px 1fr; grid-template-rows: 1fr auto; gap: 0 22px; }
.acct-nav { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 12px; }
.acct-nav button { text-align: left; border: 0; background: none; padding: 9px 14px; border-radius: 9999px; cursor: pointer; color: var(--muted); }
.acct-nav button.active { background: var(--chip); color: var(--ink); font-weight: 600; }
.acct-body { min-height: 60vh; max-height: 70vh; overflow-y: auto; padding-right: 6px; }
.acct-body h3 { font-size: 16px; margin-bottom: 4px; }
.acct-actions { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.platform { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.platform-head { display: flex; align-items: baseline; gap: 10px; }
.platform-head b { font-size: 15px; }
.link-btn { margin-left: auto; border: 0; background: none; color: var(--ink); cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline; }
@media (max-width: 760px) {
  .acct-form { grid-template-columns: 1fr; }
  .acct-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; margin-bottom: 12px; }
  .acct-body { max-height: none; }
}

/* Setup guide: a side panel above everything, so a half-filled form underneath stays as it is. */
.guide { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-lift); z-index: 55; display: flex; flex-direction: column; }
.guide-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.guide-head .modal-close { position: static; margin-left: auto; }
.guide-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.guide-tabs button { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 9999px; padding: 4px 12px; cursor: pointer; }
.guide-tabs button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.guide-body { padding: 18px 22px 28px; overflow-y: auto; line-height: 1.55; }
.guide-body h4 { margin: 18px 0 6px; }
.guide-body ol { padding-left: 20px; }
.guide-body li { margin-bottom: 6px; }
.guide-body code { background: var(--chip); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.modal-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 9999px; box-shadow: var(--shadow-lift); overflow-wrap: anywhere; }
.toast.bad { background: var(--bad); color: #fff; }
.confirm-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 10%, transparent); margin-top: 8px; font-size: 13px; }

/* Accounts and login */
.auth { max-width: 380px; margin: 40px auto; }
.auth .btn.primary { justify-self: start; }
.auth-links { margin-top: 12px; }
.auth-footer { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.social-row { display: grid; gap: 8px; margin: 6px 0 4px; }
.btn.social { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.or { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.pill-btn { cursor: pointer; border: 0; font-size: 12px; font-family: inherit; color: inherit; }
.credits { display: grid; gap: 14px; }
.credits-title h2 { margin: 0; }
.credit-tiles { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 0; }
.credit-balance { font-size: 1.8rem; }
.credit-buy { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.credits h3 { margin-top: 0; }
.nowrap { white-space: nowrap; }
.credit-form { flex-basis: 100%; margin-top: 6px; }
.user-menu { position: relative; }
.user-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: grid; gap: 2px; padding: 6px; min-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift); }
.user-pop .btn { text-align: left; }
.notice { background: color-mix(in srgb, var(--warn) 14%, transparent); padding: 8px 10px; border-radius: 12px; font-size: 13px; margin-top: 8px; }
.choice:disabled { opacity: 0.55; cursor: not-allowed; }

/* Plan */
.plan-grid { align-items: start; }
.plan-list { padding-left: 18px; margin: 8px 0 14px; }
.checkout { margin-top: 14px; display: grid; gap: 6px; justify-items: start; }
tr.total td { border-top: 2px solid var(--line); }
.platform select { min-width: 220px; }

/* Avatar menu */
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; font-size: 15px; }
.avatar:hover, .avatar[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--line-strong); }
.user-pop-email { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }

/* Assistant */
.chat { max-width: 760px; margin: 0 auto; display: grid; gap: 12px; }
.chat-log { display: grid; gap: 10px; max-height: calc(100vh - 300px); overflow-y: auto; padding: 4px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 80%; padding: 10px 15px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); line-height: 1.45; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chat-input { display: grid; gap: 8px; }
.chat-input textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 20px; padding: 10px; background: var(--panel); resize: vertical; }
.draft { border-color: var(--accent); }

/* Assistant: chats on the left, the open chat on the right */
.chat-app { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.chat-side { position: sticky; top: 12px; display: grid; gap: 8px; }
.chat-list { display: grid; gap: 2px; max-height: calc(100vh - 220px); overflow-y: auto; }
.chat-item { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9999px; cursor: pointer; color: var(--muted); }
.chat-item:hover { background: var(--chip); color: var(--ink); }
.chat-item.active { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.chat-actions { display: none; gap: 6px; }
.chat-item:hover .chat-actions, .chat-item.active .chat-actions { display: inline-flex; }
.chat-actions .link-btn { margin: 0; text-decoration: none; }
.chat-rename { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: var(--panel); }
.chat-app .chat { max-width: none; margin: 0; }
.card-lines { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.lvl-ok { color: var(--ok); }
.remake { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
@media (max-width: 760px) { .chat-app { grid-template-columns: 1fr; } .chat-side { position: static; } }

/* Things that need the user: counters, filters, the Review tab and timeline reels */
.tile-link { text-align: left; font: inherit; color: inherit; cursor: pointer; }
.tile-link { transition: transform .12s, box-shadow .12s; }
.tile-link:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.tile.action { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.action-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 9999px; background: var(--warn); color: #fff; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }
.btn .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 9999px; background: var(--chip); color: var(--ink); font-size: 11px; text-align: center; }
.btn.primary .count { background: color-mix(in srgb, #fff 25%, transparent); color: inherit; }
.btn.action:not(.primary) { border-color: var(--warn); color: var(--warn); }
.btn.action .count { background: var(--warn); color: #fff; }
.tab-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9999px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.frame.needs-action { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--warn); }
.frame-alert { position: absolute; left: 3px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--warn); color: #fff; font-size: 10px; font-weight: 800; line-height: 13px; text-align: center; }
.badge.needs-legend { --dot: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.tl-day.today { color: var(--ink); font-weight: 600; }
/* Without a cover: a dark shade of the status colour, a film mark, and the same corner dot as covered reels. */
.frame:not(.has-cover) { background: linear-gradient(160deg, color-mix(in srgb, var(--dot) 45%, #0b0b0f), color-mix(in srgb, var(--dot) 18%, #0b0b0f)); }
.frame:not(.has-cover) .frame-dot { display: block; }
.frame-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: color-mix(in srgb, var(--dot) 70%, #fff); opacity: 0.75; }
.frame-icon svg { width: 18px; height: 18px; }

/* Review: cards never overlap; on narrow screens the video sits above the text */
.reel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(520px, 100%), 1fr)); }
.reel > div { min-width: 0; }
.reel .row { flex-wrap: wrap; }
@media (max-width: 900px) { .reel { grid-template-columns: 1fr; } .reel video, .reel .novideo { width: 100%; max-width: 280px; justify-self: center; } }
.banner.bad { background: color-mix(in srgb, var(--bad) 16%, var(--panel)); }
.banner.bad div + div { margin-top: 4px; }

/* Reel: what goes out on top, actions at the bottom */
.reel { display: grid; grid-template-columns: 1fr; gap: 12px; }
.reel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.reel-main { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.reel-main video, .reel-main .novideo { width: 220px; aspect-ratio: 9 / 16; border-radius: 16px; background: #000; object-fit: cover; }
.reel-details { display: grid; gap: 10px; min-width: 0; }
.reel-field .label, .quick .label { display: block; font-weight: 600; font-size: 12px; margin-bottom: 3px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.reel-field p { margin: 0; }
.quick { display: grid; gap: 8px; }
.quick input { width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; padding: 7px 12px; background: var(--panel); }
.reel-script { border-top: 1px solid var(--line); padding-top: 8px; }
.reel-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); }
.reel-actions .spacer { flex: 1; }
.modal-card.reel-modal { width: min(1040px, 96vw); max-width: min(1040px, 96vw); }
.modal-card.reel-modal .reel { border: 0; padding: 0; background: none; }
.modal-card.reel-modal .reel-main { grid-template-columns: 280px 1fr; }
.modal-card.reel-modal .reel-main video, .modal-card.reel-modal .reel-main .novideo { width: 280px; }
@media (max-width: 900px) {
  .reel-main, .modal-card.reel-modal .reel-main { grid-template-columns: 1fr; }
  .reel-main video, .reel-main .novideo, .modal-card.reel-modal .reel-main video, .modal-card.reel-modal .reel-main .novideo { width: 100%; max-width: 280px; justify-self: center; }
}

/* Assistant: the message box stays at the bottom; only the messages scroll. --chat-h is the space left below the
   header and any banners (set by fitChat in app.js), so Send never needs a scroll to reach. */
.chat-app .chat { display: flex; flex-direction: column; height: var(--chat-h, calc(100vh - 210px)); min-height: 320px; gap: 10px; }
.chat-app .chat-log { flex: 1; max-height: none; min-height: 0; }
.chat-app .chat-input { flex: none; }
.chat-hello { text-align: center; padding: 18px 0 4px; }
.chat-hello h2 { font-family: var(--font-display); font-weight: 500; font-size: 32px; margin: 0 0 4px; letter-spacing: -0.01em; }
[data-rotate] { display: inline-block; transition: opacity 0.15s; }
[data-rotate].fade { opacity: 0; }
/* Rename and delete appear on hover only, as small icons */
.chat-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.chat-item:hover .chat-actions, .chat-item:focus-within .chat-actions { opacity: 1; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--chip); color: var(--ink); }
.icon-btn.danger:hover { color: var(--bad); }
/* The reel a chat is about */
.chat-reel { display: flex; gap: 12px; align-items: flex-start; max-width: 560px; }
.chat-reel video, .chat-reel .novideo { width: 150px; aspect-ratio: 9 / 16; border-radius: 16px; background: #000; object-fit: cover; flex: none; }
.chat-reel .novideo { display: flex; align-items: center; justify-content: center; color: #a1a1aa; font-size: 12px; }
.chat-reel .cover-thumb { width: 70px; flex: none; }
.info { cursor: help; border-bottom: 1px dotted var(--muted); }
/* Messages stack at their natural height; only the log scrolls. */
.chat-app .chat-log { display: flex; flex-direction: column; gap: 10px; }
.chat-app .chat-log > * { flex: none; }
.modal-card.reel-modal .reel-head { padding-right: 34px; }

/* Every dropdown looks the same: bordered, padded, a custom arrow, a clear focus ring */
select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line-strong); border-radius: 9999px; padding: 6px 32px 6px 14px; min-height: 34px;
  background-color: var(--panel); color: var(--ink); font: inherit; cursor: pointer; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 11px 8px;
}
select:hover { border-color: var(--muted); }
select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
select:disabled { opacity: 0.55; cursor: not-allowed; }
select option { background: var(--panel); color: var(--ink); }

.icon-btn.big { width: 32px; height: 32px; border: 1px solid var(--line); }
.icon-btn.big svg { width: 17px; height: 17px; }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.plan-note { margin-bottom: 12px; }
/* A new account's reels in the chat */
.live-reels { display: grid; gap: 6px; margin: 8px 0; }
.live-reel { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px; background: var(--panel); color: inherit; font: inherit; cursor: pointer; }
.live-reel:hover { border-color: var(--muted); }
.live-reel img, .live-reel .live-ph { width: 34px; height: 60px; border-radius: 5px; object-fit: cover; display: flex; align-items: center; justify-content: center; }
.live-reel .live-ph { background: linear-gradient(160deg, color-mix(in srgb, var(--dot) 45%, #0b0b0f), color-mix(in srgb, var(--dot) 18%, #0b0b0f)); color: color-mix(in srgb, var(--dot) 70%, #fff); }
.live-reel .live-ph svg { width: 16px; height: 16px; }
.live-reel span b { display: block; }

.field select { width: 100%; }
.prices-doc ul { padding-left: 18px; margin: 6px 0 0; display: grid; gap: 6px; }
.price-field { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .price-field { grid-template-columns: 1fr; } }

/* Review: compact cards, 1 to 4 columns, never wider than the page. */
.review-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(max(200px, calc((100% - 3 * 14px) / 4)), 1fr)); }
.review-card { display: grid; grid-template-rows: auto 1fr; gap: 10px; padding: 10px; min-width: 0; }
.review-thumb { padding: 0; border: 0; background: var(--chip); border-radius: 14px; overflow: hidden; aspect-ratio: 9 / 16; width: 100%; cursor: pointer; position: relative; }
.review-thumb img, .review-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.review-thumb .novideo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.review-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.review-title { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.review-error { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stats-tiles { margin-bottom: 10px; }
.views-chart { width: 100%; height: auto; max-width: 560px; display: block; }

/* Characters */
.character-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.character-card { display: grid; gap: 6px; align-content: start; min-width: 0; }
.character-photos { display: flex; gap: 6px; flex-wrap: wrap; }
.character-photo { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--chip); }
.character-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove { position: absolute; top: 2px; right: 2px; border: 0; border-radius: 9999px; width: 22px; height: 22px; background: rgb(0 0 0 / .6); color: #fff; cursor: pointer; line-height: 1; }
.add-photo { display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--muted); cursor: pointer; border: 1px dashed var(--line); }
.character-choice img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 4px; }
.price-tag { display: table; max-width: 100%; margin: 3px 0 4px; font-size: 11px; padding: 1px 7px; border-radius: 9999px; background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); white-space: normal; }
.price-tag.paid { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* The cost on the left, the form's buttons on the right (above them when there is no room). */
.acct-actions { align-items: center; }
.cost-summary { flex: 1 1 260px; min-width: 0; padding: 8px 12px; border-radius: 12px; background: var(--chip); }
.acct-buttons { margin-left: auto; flex-wrap: nowrap; }
.cost-summary:empty { display: none; }

/* Formatting in the Assistant's replies. */
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 20px; }
.bubble code { font-family: ui-monospace, Menlo, monospace; font-size: .92em; padding: 0 4px; border-radius: 4px; background: rgb(127 127 127 / .15); }

/* Profile */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.profile-grid .panel, .profile-grid + .panel { margin: 0; }
.profile-grid + .panel { margin-bottom: 14px; }
.kv { display: flex; gap: 10px; align-items: baseline; margin: 4px 0; }
.kv > span:first-child { min-width: 52px; }
.pause-list { margin: 8px 0 0; padding-left: 20px; }

/* Account cards: a clear header with the ⋯ menu, the settings as a small grid, and the counts as stats. */
.acct-card { display: flex; flex-direction: column; gap: 10px; }
.acct-card.paused { border-style: dashed; }
.acct-head { display: flex; align-items: center; gap: 8px; }
.acct-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acct-title b { font-size: 16px; }
.acct-title .pf-row { margin: 0; }
.acct-topic { margin: 0; color: var(--ink); }
.acct-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px 14px; }
.acct-fact { display: flex; flex-direction: column; font-size: 13px; min-width: 0; }
.acct-fact span { color: var(--muted); font-size: 12px; }
.acct-fact b { font-weight: 500; overflow-wrap: anywhere; }
.acct-stats { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.acct-stat { display: flex; align-items: baseline; gap: 4px; font-size: 13px; color: var(--muted); padding: 2px 8px; border-radius: 9999px; background: var(--surface); }
.acct-stat b { color: var(--ink); }
.acct-stat.warn b { color: var(--warn); }
.acct-menu { position: relative; }
.menu-btn { font-size: 20px; line-height: 1; padding: 2px 10px; }
.acct-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px; display: grid; gap: 2px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lift); }
.acct-pop .btn { justify-content: flex-start; text-align: left; width: 100%; }
.acct-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.danger-text { color: var(--bad); }
.confirm-body p { margin: 0 0 8px; }

/* Something needs an admin's attention: a count on the Admin tab and the System button (red: stopped, amber: covered) */
.tab-alert { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9999px; font-size: 11px; font-weight: 700; color: #fff; background: var(--bad); vertical-align: 1px; }
.tab-alert.amber { background: var(--warn); color: #1d1d1f; }

/* Admin → System: what needs attention, then one line per service */
.system-page { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 14px; align-items: start; }
.system-page > section:first-child { grid-column: 1 / -1; }
.system-page h3 { margin: 0 0 8px; }
.alert-card { border-left: 4px solid var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--panel)); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.alert-card.amber { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.alert-card p { margin: 6px 0; }
.all-good { color: var(--ok); font-weight: 600; }
.svc-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.svc-row:first-of-type { border-top: 0; }
.svc-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); transform: translateY(-1px); }
.svc-dot.amber { background: var(--warn); }
.svc-dot.red { background: var(--bad); }
.svc-dot.off { background: var(--line); }
.svc-name { flex: none; width: 170px; font-weight: 600; }
.svc-status { flex: 1; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.svc-row .link-btn { margin: 0; }
.inline-details { display: inline; }
.inline-details summary { cursor: pointer; display: inline; }
.inline-details[open] > *:not(summary) { display: block; margin-top: 4px; }

/* The video window */
.modal-close { top: 14px; right: 14px; width: 34px; height: 34px; padding: 0; border-radius: 9999px; display: grid; place-items: center; line-height: 1; }
.modal-close:hover, .modal-close:focus-visible { background: var(--chip); color: var(--ink); }
.modal-card.reel-modal .reel { gap: 18px; }
.modal-card.reel-modal .reel-head { padding-right: 44px; align-items: center; }
.reel .reel-details { gap: 14px; }
.reel .hint { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.reel textarea, .reel input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--panel);
  font-size: 14px; line-height: 1.45; transition: border-color .15s, box-shadow .15s;
}
.reel textarea:hover, .reel input:not(:disabled):hover { border-color: var(--muted); }
.reel textarea:focus, .reel input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.reel input:disabled { opacity: .6; cursor: not-allowed; }
.reel textarea[data-field="caption"] { min-height: 96px; }
.cover-row { gap: 12px; }
.cover-row .cover-thumb { width: 72px; flex: none; }
.cover-field { flex: 1; min-width: 0; }
.cover-field .btn { justify-self: start; margin-top: 6px; }
.when-input { cursor: pointer; min-height: 38px; font-variant-numeric: tabular-nums; }
.when-input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; padding: 4px; border-radius: 6px; }
.when-input::-webkit-calendar-picker-indicator:hover { opacity: 1; background-color: var(--chip); }
.script li { margin-bottom: 12px; }
/* A block text box, so the scene number lines up with its first line rather than its bottom */
.script textarea { display: block; min-height: 60px; margin-bottom: 4px; }
.badge { white-space: nowrap; }

/* Video cards: the whole card opens the video; the status sits on the cover */
.review-card { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.review-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.review-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.review-thumb { position: relative; }
.review-thumb .badge { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.94); color: #18181b; box-shadow: 0 2px 8px rgba(0,0,0,.12); }

/* What can be remade, as a quiet list rather than buttons */
.quick .label { margin-bottom: 0; }
.quick-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.quick-list li { border-bottom: 1px solid var(--line); }
.quick-opt { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 4px; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 6px; }
.quick-opt:hover, .quick-opt:focus-visible { background: var(--chip); }
.quick-opt:disabled { opacity: .6; cursor: wait; }
.q-text { flex: 1; min-width: 0; display: grid; }
.q-name { font-size: 14px; color: var(--ink); font-weight: 500; }
.q-desc { font-size: 12px; color: var(--muted); }
.q-cost { font-size: 12px; font-weight: 600; white-space: nowrap; }
.q-cost.free { font-weight: 400; color: var(--muted); }
.saved-tick { margin-left: 6px; color: var(--ok); text-transform: none; letter-spacing: 0; font-weight: 600; }
.saved-tick::before { content: "✓ "; }

/* A question over the open window */
.confirm-layer { position: fixed; inset: 0; z-index: 60; background: var(--overlay); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 16px; }
.confirm-card { background: var(--panel); border-radius: 24px; padding: 22px 24px; width: min(440px, 100%); box-shadow: var(--shadow-lift); }
.confirm-card h3 { margin: 0 0 8px; }
.confirm-card p { margin: 0 0 10px; }
.confirm-cost { padding: 8px 10px; border-radius: 12px; background: var(--chip); }
.confirm-card .row { margin-top: 14px; }
/* A published video's caption folds open: show the arrow so it reads as clickable */
.reel-field > summary.label { display: list-item; cursor: pointer; }
/* Where Connect would be, without enough credit */
.connect-credit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: var(--chip); }

/* Content styles: a scrollable grid of previews with tag filters (account form, Assistant, its full list). */
.chip.on { background: var(--accent); border-color: var(--accent); border-style: solid; color: var(--accent-ink); }
.style-bar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; max-height: 56vh; overflow-y: auto; padding: 2px; }
.style-grid.compact { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); max-height: none; }
.style-card { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); cursor: pointer; text-align: left; }
.style-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.style-card.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.style-card b { font-size: 12px; line-height: 1.25; }
.style-card-tags { font-size: 11px; color: var(--muted); line-height: 1.25; }
.style-media { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: var(--chip); }
.style-media img, .style-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-blank { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 8px; text-align: center; font-size: 12px; color: var(--muted);
  background: var(--surface); }
.style-new { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 11px; vertical-align: middle; }
.style-media .style-new { position: absolute; top: 6px; left: 6px; }
.style-sort { gap: 6px; align-items: center; }
.style-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.style-media .style-text { position: absolute; inset: 0; }
.style-busy { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 10px; background: rgb(0 0 0 / 0.6); color: #fff; font-size: 11px; }
.style-subs { gap: 4px; margin-top: 6px; align-items: center; }
.chat-styles { margin: 6px 0 10px; max-width: 640px; }

/* Admin → Prompts */
.prompt-step { margin: 18px 0 8px; }
.prompt-card textarea { width: 100%; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.prompt-after { margin-top: 6px; }
.prompt-default { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 320px; overflow: auto; }
.admin-styles { display: flex; flex-direction: column; gap: 10px; }
.admin-style { display: flex; flex-direction: column; gap: 8px; }
.admin-style.off { opacity: 0.7; }
.admin-style-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.admin-style-previews figure { margin: 0; min-width: 0; }
.admin-style-previews img, .admin-style-previews video, .admin-style-previews .style-blank { width: 100%; max-width: 150px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 7px; display: block; height: auto; }
.admin-style-previews figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.admin-style-previews figcaption b { color: var(--ink); }
.admin-preview-actions { gap: 4px; }
.admin-preview-actions .btn { padding: 3px 8px; font-size: 12px; }
.admin-style-previews ol { margin: 4px 0 0; padding-left: 18px; }
.admin-style-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.style-form { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.style-form textarea { width: 100%; }
@media (max-width: 640px) {
  .admin-style-previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .style-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Gutters by breakpoint (DESIGN.md §4.2): 60px desktop, 24px tablet, 16px phone. */
@media (max-width: 1023px) { :root { --gutter: 24px; } }
@media (max-width: 767px) { :root { --gutter: 16px; } .panel { padding: 16px; } .modal-card { padding: 20px; border-radius: 20px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .btn.primary:hover, .tile-link:hover, .review-card:hover { transform: none; } }

/* The top-up window: three packs with what each buys, the prices, then where credits come from (DESIGN.md §9). */
.topup-layer { align-items: start; overflow-y: auto; padding: 48px 16px; background: var(--overlay-focus); backdrop-filter: blur(6px); }
.confirm-card.topup-card { position: relative; width: min(820px, 100%); padding: 36px 40px 32px; display: grid; gap: 22px; }
.topup-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-right: 44px; }
.topup-head h3 { font-family: var(--font-display); font-weight: 500; font-size: 32px; line-height: 1.1; margin: 0; }
.topup-balance { display: grid; justify-items: end; gap: 2px; font-size: 13px; }
.topup-balance b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.topup-intro { margin: -6px 0 0; font-size: 14px; max-width: 620px; }
.topup-why { margin: 0; }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.pack { display: flex; flex-direction: column; align-items: stretch; gap: 10px; text-align: left; padding: 22px 22px 18px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.pack { position: relative; }
.pack.popular { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pack-badge { position: absolute; top: -11px; left: 22px; padding: 3px 10px; border-radius: 9999px; background: var(--ink); color: var(--accent-ink); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.pack:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--border); }
.pack.chosen { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pack-amount { font-family: var(--font-display); font-weight: 500; font-size: 34px; line-height: 1; }
.pack-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; border-top: 1px solid var(--line); }
.pack-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; line-height: 1.35; flex: 1; }
.pack-lines li { position: relative; padding-left: 16px; }
.pack-lines li::before { content: ""; position: absolute; left: 0; top: .5em; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); opacity: .7; }
.pack-pick { margin-top: 6px; text-align: center; padding: 7px 12px; border-radius: 9999px; background: var(--surface); font-weight: 500; font-size: 14px; }
.pack:hover .pack-pick, .pack.chosen .pack-pick { background: var(--ink); color: var(--accent-ink); }
.topup-next-slot:empty { display: none; }
.topup-next { display: grid; gap: 12px; padding: 18px 20px; border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; }
.topup-next .btn { text-decoration: none; }
.topup-prices h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.topup-prices dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.topup-prices dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.topup-prices dt { color: var(--muted); }
.topup-prices dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.topup-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding-top: 4px; }
.topup-foot .small { max-width: 440px; }
@media (max-width: 720px) {
  .confirm-card.topup-card { padding: 28px 20px 22px; gap: 18px; }
  .packs { grid-template-columns: 1fr; }
  .topup-prices dl { grid-template-columns: 1fr; }
}

.tl-label b { font-size: 14px; font-weight: 600; }
@media (max-width: 767px) { .top { gap: 10px; } .top-actions #pause { padding: 6px 14px; font-size: 14px; } .tabs button { padding: 12px 10px; } }

/* Assistant (DESIGN.md §6, "Assistant chat"): a real sidebar of chats on the left; messages with avatars, the
   Assistant's on the left and the user's on the right; suggested replies as outlined pills, not messages. */
.chat-app { grid-template-columns: 272px minmax(0, 1fr); gap: 24px; }
.chat-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; height: var(--chat-h, calc(100vh - 210px)); min-height: 320px;
  padding: 16px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chat-side-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 6px; }
.chat-side-title { font-weight: 600; font-size: 15px; }
.chat-new { width: 100%; }
.chat-side-label { padding: 6px 8px 0; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chat-side .chat-list { flex: 1; min-height: 0; max-height: none; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 2px; }
.chat-side .chat-list > * { flex: none; }
.chat-item { gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; color: var(--muted); }
.chat-item:hover { background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--ink); }
.chat-item.active { background: var(--panel); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.chat-item-icon { flex: none; display: inline-flex; width: 16px; height: 16px; color: var(--muted); }
.chat-item-icon svg { width: 100%; height: 100%; }
.chat-item.active .chat-item-icon { color: var(--ink); }
.chat-title { font-size: 13.5px; }

.chat-app .chat-log { gap: 18px; padding: 8px 4px 8px 0; }
.chat-app .chat-log > .msg, .chat-hello, .chat-input { width: 100%; max-width: 860px; margin-left: auto; margin-right: auto; }
.msg { display: flex; align-items: flex-start; gap: 12px; }
.msg.user { justify-content: flex-end; }
.msg-avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 600; font-size: 14px; }
.msg-avatar.ai { background: var(--ink); color: var(--accent-ink); }
.msg-avatar.ai svg { width: 18px; height: 18px; }
.msg-avatar.me { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.msg-body { min-width: 0; max-width: min(680px, 85%); display: flex; flex-direction: column; gap: 8px; }
.msg.assistant .msg-body { flex: 1; max-width: 720px; }
.msg-name { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: -2px; }
.msg .bubble { max-width: 100%; padding: 11px 16px; border-radius: 18px; line-height: 1.55; }
.msg.assistant .bubble { align-self: flex-start; background: var(--surface); border-color: transparent; border-top-left-radius: 6px; }
.msg.user .bubble { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); border-top-right-radius: 6px; }

.suggestions { display: grid; gap: 8px; margin-top: 2px; }
.suggestions-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.suggestions-list { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 7px 14px 7px 11px; border: 1px dashed var(--line-strong); border-radius: 9999px;
  background: transparent; color: var(--ink); font-size: 13.5px; cursor: pointer; text-align: left; transition: border-color .12s, background .12s, transform .12s; }
.suggestion svg { flex: none; width: 14px; height: 14px; color: var(--muted); }
.suggestion span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion:hover { border-style: solid; border-color: var(--ink); background: var(--panel); transform: translateY(-1px); }
.suggestion:hover svg { color: var(--ink); }
.earn-pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--ink); color: var(--ink); background: var(--panel); font-weight: 600; }
.earn-pill svg { width: 13px; height: 13px; }
.earn-pill:hover { background: var(--ink); color: var(--bg); }
.invite-row { display: flex; gap: 8px; margin: 10px 0 8px; flex-wrap: wrap; }
.invite-row .btn.copied { background: var(--panel); color: var(--ink); border-color: var(--ink); }
.invite-row input { flex: 1 1 220px; min-width: 0; border: 1px solid var(--line-strong); border-radius: 9999px; padding: 8px 14px; background: var(--panel); color: var(--ink); font: inherit; }
.remix-vars { display: grid; gap: 10px; margin: 10px 0; }
.remix-var { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--panel); }
.remix-var .btn { justify-self: start; }
.remix-hook { font-style: italic; }
.remix-scenes { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.remix-analysis { margin-top: 14px; }
.sched-actions { align-items: center; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.card-upsell { display: grid; gap: 10px; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--ink); border-radius: 14px; background: var(--panel); }
.launchpads { display: grid; gap: 8px; margin-top: 2px; }
.launchpad-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.launchpad { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--panel);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.launchpad:hover { border-color: var(--ink); transform: translateY(-1px); }
.launchpad:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.launchpad-emoji { flex: none; font-size: 22px; line-height: 1.2; }
.launchpad-text { display: grid; gap: 2px; min-width: 0; }
.launchpad-text .small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 760px) {
  .chat-app { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .chat-app > * { min-width: 0; }
  .chat-side { position: static; height: auto; min-height: 0; max-height: 200px; padding: 12px 10px; }
  .chat-side-label { display: none; }
  .msg-avatar { width: 28px; height: 28px; font-size: 12px; }
  .msg-body { max-width: 88%; }
}

/* Chat titles use the row's full width; rename and delete float over its end on hover, on a fade. */
.chat-item { position: relative; }
.chat-item .chat-actions { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding-left: 22px;
  background: linear-gradient(to right, transparent, var(--chat-row, var(--surface)) 18px); border-radius: 0 12px 12px 0; }
.chat-item:hover { --chat-row: var(--panel); background: var(--panel); }
.chat-item.active { --chat-row: var(--panel); }

/* The message box: one rounded field with the send button inside it, bottom right (an arrow; a square to stop). */
.chat-compose { position: relative; display: block; }
.chat-compose textarea { display: block; width: 100%; min-height: 56px; max-height: 220px; padding: 14px 60px 14px 18px; border-radius: 24px; border: 1px solid var(--line-strong); background: var(--panel); resize: none; box-shadow: var(--shadow); line-height: 1.5; }
.chat-compose textarea:focus { outline: none; border-color: var(--ink); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.send-btn { position: absolute; right: 10px; bottom: 10px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--accent-ink); cursor: pointer; transition: background .12s, opacity .12s, transform .12s; }
.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover:not(:disabled) { transform: scale(1.05); }
.send-btn:disabled { background: var(--surface); color: var(--muted-light); cursor: default; }
.send-btn.stop { background: var(--ink); color: var(--accent-ink); }
.chat-disclaimer { display: block; text-align: center; margin-top: 2px; }
/* "Stopped" under a message whose reply the user stopped. */
.msg-stopped { align-self: center; font-size: 12.5px; color: var(--muted); padding: 2px 12px; border-radius: 9999px; background: var(--surface); }
/* Thinking: dots that bounce in a wave, and what it is looking up in a soft moving shimmer. */
.typing { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 2px; vertical-align: middle; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); opacity: .35; animation: typing-bounce 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .16s; } .typing i:nth-child(3) { animation-delay: .32s; }
@keyframes typing-bounce { 0%, 70%, 100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-6px); opacity: 1; } }
.typing-text:not(:empty) { margin-left: 10px; vertical-align: middle; background: linear-gradient(90deg, var(--muted) 0%, var(--ink) 50%, var(--muted) 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .typing i, .typing-text { animation: none !important; } .typing-text { color: var(--muted); } }

/* Several videos at (nearly) the same time on the Schedule: one box with a count, two more peeking out behind it. */
.frame.stack { overflow: visible; box-shadow: 4px -4px 0 -1px var(--panel), 4px -4px 0 0 var(--line-strong), 8px -8px 0 -1px var(--panel), 8px -8px 0 0 var(--line-strong); }
.frame.stack img { border-radius: 3px; }
.frame.stack.needs-action { box-shadow: 4px -4px 0 -1px var(--panel), 4px -4px 0 0 var(--line-strong), 8px -8px 0 -1px var(--panel), 8px -8px 0 0 var(--line-strong), 0 0 0 2px var(--panel), 0 0 0 4px var(--warn); }
.stack-count { position: absolute; right: -12px; top: -14px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 9999px; background: var(--ink); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--panel); z-index: 1; }
.stack-pop { position: fixed; z-index: 45; width: min(340px, calc(100vw - 16px)); max-height: min(420px, 70vh); overflow-y: auto; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lift); display: grid; gap: 2px; }
.stack-pop-head { padding: 6px 10px 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stack-item { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; padding: 8px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.stack-item:hover, .stack-item:focus-visible { background: var(--surface); }
.stack-item img, .stack-ph { width: 40px; height: 71px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: color-mix(in srgb, var(--dot, var(--muted)) 35%, #0b0b0f); color: #fff; }
.stack-ph svg { width: 16px; height: 16px; opacity: .8; }
.stack-text { display: grid; gap: 3px; min-width: 0; justify-items: start; }
.stack-text b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* A pack's name, what it gives (with its bonus), above the list of what that buys. */
.pack-name { font-size: 13px; font-weight: 600; color: var(--muted); }
.pack-gets { font-size: 13.5px; line-height: 1.4; }
.pack-bonus { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 9999px; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pack:disabled { cursor: progress; opacity: .75; }
/* A free video's watermark, said plainly, with the button to take it off. */
.watermark-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); font-size: 13.5px; }
.watermark-notice span { flex: 1 1 260px; }
