/* Ad Engine — app layer on top of tokens.css + components.css (the design system).
   Helpers the app's screens use, form defaults, and the app-specific pieces the design kit doesn't cover. */

/* ---------- helpers ---------- */
.small { font-size: var(--fs-sm); }
.err { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.grow { flex: 1; min-width: 0; }
.min0 { min-width: 0; }
.stack.tight { gap: var(--s-2); }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.ellipsis.wide { max-width: 70%; }
.clamp, .clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mt { margin-top: var(--s-4); } .mb { margin-bottom: var(--s-3); }
.pad { padding: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); align-items: start; }
.wide { width: 100%; }
h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: var(--fw-semibold); }
h4 { margin: 0; font-size: 13.5px; font-weight: var(--fw-semibold); }
code { background: var(--subtle); padding: 1px 5px; border-radius: var(--radius-sm); font-size: 12px; }
details summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
details[open] > summary { margin-bottom: var(--s-2); }
progress { width: 100%; accent-color: var(--accent); }
audio { width: 100%; height: 32px; }

/* ---------- forms: plain inputs look like .input / .select / .textarea ---------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font-size: 13.5px; outline: 0; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select { height: 36px; padding: 0 12px; }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2385858C' stroke-width='1.6'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 11px center; }
textarea { padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select.mini { width: auto; height: 28px; font-size: 12px; padding: 0 26px 0 8px; background-position: right 8px center; }
input.tiny { width: 56px !important; height: 28px; padding: 0 6px; font-size: 12px; }
label.field { font-size: 12.5px; font-weight: var(--fw-medium); color: var(--muted); }
label.field .hint { font-weight: var(--fw-regular); }
label.check { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; color: var(--text); }
label.check input { width: 16px; height: 16px; flex: none; margin: 0; accent-color: var(--accent); }
.btn.big { height: 46px; padding: 0 18px; font-size: 15px; border-radius: var(--radius-lg); }
.btn.on, .seg button.on { background: var(--surface); color: var(--text); }
.btn.danger.ghost { background: none; color: var(--danger); }
.cost { font: var(--fw-semibold) 12px var(--font-num); padding: 3px 7px; border-radius: var(--radius-sm); background: var(--subtle); color: var(--muted); }
.icon-btn { font-size: 13px; }
.spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; vertical-align: -1px; }

/* ---------- layout pieces ---------- */
.main > .content:first-child { padding-bottom: 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-3); flex-wrap: wrap; }
input.page-title-input { font: var(--fw-bold) var(--fs-2xl)/1.2 var(--font); letter-spacing: var(--tracking-tight); border: 1px solid transparent !important; background: none !important; padding: 0 6px !important; margin-left: -7px; height: 40px !important; width: min(560px, 100%) !important; }
input.page-title-input:hover { border-color: var(--line) !important; }
input.page-title-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.ws-meta { gap: 14px; font-size: 12px; color: var(--muted); }
.ws-meta b { color: var(--text); }
.menu-wrap { position: relative; }
.menu-wrap .nav-menu { right: 0; left: auto; min-width: 220px; }
.menu-wrap.open .nav-menu { display: flex; flex-direction: column; gap: 2px; animation: in var(--t) var(--ease); }
.menu-wrap .nav-menu button { display: flex; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--radius); background: none; font-size: 13px; cursor: pointer; color: var(--text); }
.menu-wrap .nav-menu button:hover { background: var(--subtle); }
.menu-wrap .nav-menu button.danger { color: var(--danger); }
.card.pad, .card.stack, .card.row, .card.empty { padding: 16px 18px; }
.card.empty { border-style: dashed; border-width: 1.5px; }
.card > .card-head:first-child { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
.banner.bad { background: var(--danger-soft); } .banner.bad::before { background: var(--danger); }
.banner.ok { background: var(--ok-soft); } .banner.ok::before { background: var(--ok); }
.banner:has(.spin)::before, .banner:has(.spinner)::before { display: none; }
.banner > .grow { flex: 1; min-width: 200px; }
.status.stale, .status.done, .status.error, .status.running { white-space: nowrap; }
.toast.bad { background: var(--surface); color: var(--text); box-shadow: var(--shadow-float); }
.toast.bad .toast-icon { background: var(--danger); color: var(--danger-ink); }
.toast { cursor: pointer; } .toast p { margin: 0; font-size: 13px; font-weight: var(--fw-medium); }

/* ---------- dialog = the design's modal ---------- */
dialog { padding: 0; border: 0; background: var(--surface); color: var(--text); border-radius: var(--radius-xl); box-shadow: var(--shadow-float); width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 48px); overflow: auto; }
dialog::backdrop { background: var(--overlay); }
dialog > .stack { padding: 20px 22px; }
dialog:has(.voice-picker) { width: min(940px, calc(100vw - 24px)); }
dialog .modal-head { position: sticky; top: 0; background: var(--surface); z-index: 1; }
dialog .modal-foot { position: sticky; bottom: 0; z-index: 1; }

/* ---------- sidebar ---------- */
.ad-item .proj-del { opacity: 0; margin-left: auto; }
.ad-item:hover .proj-del { opacity: 1; }
@media (hover: none) { .ad-item .proj-del { opacity: 1; } }
.ad-thumb { background: var(--tone, var(--subtle-2)) center/cover; }
.ad-status { white-space: nowrap; overflow: hidden; }
.ad-status span { overflow: hidden; text-overflow: ellipsis; }
.sidebar.select-mode .ad-item .check { display: flex; }
.queue .q-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.queue .icon-btn { width: 22px; height: 22px; }
.drafts-toggle { margin-top: 4px; }
.sel-actions { display: flex; flex-direction: column; gap: 6px; }

/* ---------- workspace: brief ---------- */
.ws-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.ws-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.ws-side { flex: 1 1 280px; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.format-card .media { aspect-ratio: 4/5; }
.format-card .media img { position: absolute; inset: 0; }
.creator-card .media { background-size: cover; background-position: center; }
.creator-add { width: 160px; aspect-ratio: 4/5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--bg); color: var(--muted); font-size: 12.5px; font-weight: var(--fw-medium); cursor: pointer; }
.creator-add:hover { border-color: var(--accent); color: var(--text); }
.photo-pick button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: var(--subtle); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.photo-pick button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick button.on { box-shadow: 0 0 0 2px var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-full); padding: 4px 12px 4px 4px; background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: var(--fw-medium); }
.chip-toggle img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.chip-toggle.on { border-color: var(--accent); background: var(--accent-soft); }
.choice { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--line-strong); }
.choice.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.choice h4 { margin-bottom: 4px; }
.cost-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cost-row b { font: var(--fw-bold) 22px var(--font-num); letter-spacing: -.02em; }

/* ---------- creator picker (avatars) ---------- */
.avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.avatar { aspect-ratio: 9/16; border-radius: var(--radius-lg); background: var(--subtle) center/cover; border: 1px solid var(--line); cursor: pointer; position: relative; display: grid; place-items: center; overflow: hidden; }
.avatar.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.avatar .badge { position: absolute; top: 8px; left: 8px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-full); }
.avatar .fb { position: absolute; top: 8px; right: 8px; background: var(--surface); font-size: 10px; padding: 1px 7px; border-radius: var(--radius-full); }
.save-lib { position: absolute; bottom: 8px; right: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-full); font-size: 11px; padding: 3px 10px; cursor: pointer; }
.lib-avatars { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-avatar { width: 64px; aspect-ratio: 9/16; border-radius: var(--radius); border: 1px solid var(--line); background: var(--subtle) center/cover; cursor: pointer; padding: 0; }
.lib-avatar:hover { box-shadow: 0 0 0 2px var(--accent); }
.lib-avatar.static { cursor: default; flex: none; } .lib-avatar.static:hover { box-shadow: none; }
.lib-avatar.mini { width: 40px; }

/* ---------- script editor (Edit lines) ---------- */
.scene-row { display: grid; grid-template-columns: 30px 1fr; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.scene-row:first-of-type { border-top: 0; }
.scene-num { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 11.5px; font-weight: 600; }
.scene-num.hook-num { background: var(--text); color: var(--bg); border-color: var(--text); }
.dialogue { font-size: 14px; }
.script-row .tag { justify-self: end; }
.ov-row { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- shots ---------- */
.shot .media img, .shot .media video { position: absolute; inset: 0; }
.shot .media .media-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: var(--fw-medium); }
.shot.attn .shot-steps .step.err { font-weight: var(--fw-semibold); }
.fix-panel .fix-preview .media img, .fix-panel .fix-preview .media video { position: absolute; inset: 0; }
.fix-btn[disabled] { opacity: .5; cursor: not-allowed; }
.fix-btn small { font-size: 11px; color: var(--faint); font-weight: var(--fw-regular); }
.fix-status .step b { margin-left: auto; font-weight: var(--fw-medium); }
.fix-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fix-row .step { min-width: 52px; }
.fix-row .btn { margin-left: auto; }
.fix-preview .media { width: 96px !important; }
.fix-status.full { gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.ov-thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.ov-thumbs img { height: 40px; border-radius: var(--radius-sm); }

/* ---------- export ---------- */
.version .media video { position: absolute; inset: 0; }
.final-video { width: 100%; aspect-ratio: 9/16; border-radius: var(--radius-lg); background: #000; object-fit: cover; display: block; }

/* ---------- library, lab, competitors, import, costs, lists ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.lib-media { position: relative; aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; background: var(--subtle); border: 1px solid var(--line); }
.lib-media img, .lib-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-media .default-btns { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; }
.upload-drop { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--bg); cursor: pointer; }
.upload-drop:hover { border-color: var(--accent); }
.lab-grid { grid-template-columns: 1fr 1.4fr; }
.lab-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lab-shot { display: flex; flex-direction: column; gap: 8px; }
.lab-shot .media img, .lab-shot .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.comp-card { padding: 16px 18px; }
.comp-grid { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: start; }
.comp-video { width: 100%; aspect-ratio: 9/16; border-radius: var(--radius-lg); background: #000; object-fit: cover; }
.comp-card ul { margin: 4px 0 0; padding-left: 18px; }
.beat { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.import-grid { grid-template-columns: 2fr 1fr; }
.import-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.import-item.off { opacity: .45; }
.hook-pill { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 10px; font-weight: 700; margin-right: 4px; }
.hook-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.hook-row:first-of-type { border-top: 0; }
.type-tag { font-size: 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-full); padding: 1px 8px; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-num { font: var(--fw-bold) 30px/1 var(--font-num); letter-spacing: -.03em; }
.costs-bars { display: flex; flex-direction: column; gap: 12px; }
.est-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.est-row span:last-child { font-family: var(--font-num); font-weight: var(--fw-semibold); }
.video-card { gap: 14px; }
.thumb-sm { width: 34px; height: 48px; border-radius: var(--radius-sm); background: var(--subtle) center/cover; flex: none; border: 1px solid var(--line); }
.version-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 190px)); gap: 12px; }
.version-mini { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.version-mini video { width: 100%; aspect-ratio: 9/16; border-radius: var(--radius-lg); background: #000; object-fit: cover; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.shot-tile { border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 8px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); min-width: 0; }
.shot-tile video { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: var(--radius-lg); background: var(--subtle); }

/* ---------- generators (Image gen / Video gen / Generations) ---------- */
.result .media img, .result .media video { position: absolute; inset: 0; }
.ref-thumbs i { background-size: cover; background-position: center; }
.ref-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.ref-pick button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; opacity: .85; box-shadow: inset 0 0 0 1px var(--line); }
.ref-pick button:hover { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }
.ref-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- voice picker ---------- */
.voice-row .btn { flex: none; }
.vp-cols { display: flex; flex-wrap: wrap; }

/* ---------- login / setup ---------- */
.entry { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: min(8vh, 72px) 12px 24px; background: var(--bg); }
.entry .modal { max-width: 560px; }
.entry .modal.sm { max-width: 400px; }
.entry .brand { margin-bottom: 18px; justify-content: center; }
.step-title { font-size: 11.5px; font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }

/* ---------- phone ---------- */
@media (max-width: 1100px) { .ws-side { max-width: none; } }
@media (max-width: 760px) {
  .appbar { gap: 8px; padding: 0 10px; }
  .brand-sub, #update-pill { display: none; }
  .brand-name, .credits { white-space: nowrap; }
  .appbar-right { gap: 2px; }
  .grid2, .lab-grid, .import-grid, .comp-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  input.page-title-input { font-size: 20px; }
  .scene-row { grid-template-columns: 1fr; } .scene-num { display: none; }
  .ws-meta { display: none; }
  input[type=text], input[type=email], input[type=password], input[type=search], select, textarea { font-size: 16px; }
}

.lib-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 760px) { .lib-cols { grid-template-columns: 1fr; } }

.back-btn { align-self: flex-start; margin: -8px 0 -10px -10px; color: var(--muted); }

.btn.lg.split { align-items: center; }

/* Shots: every card the same height (2 lines of text), and a play button with sound. */
.shot-line { min-height: calc(1.45em * 2); }
.shot-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(14,14,16,.55); color: #fff; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding-left: 2px; opacity: .85; transition: opacity .15s, transform .15s; backdrop-filter: blur(4px); }
.shot-play:hover { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
.shot.playing .shot-play { opacity: 0; padding-left: 0; }
.shot.playing:hover .shot-play { opacity: .9; }

/* Edit tab */
.edit-tl-card { margin-bottom: 16px; }
.edit-tl { display: flex; gap: 3px; padding: 12px 14px 14px; overflow-x: auto; }
.tl-shot { position: relative; min-width: 46px; height: 92px; border: 2px solid transparent; border-radius: var(--radius-sm); background: var(--subtle) center/cover no-repeat; cursor: pointer; overflow: hidden; padding: 0; }
.tl-shot::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14,14,16,.5), rgba(14,14,16,.05) 45%, rgba(14,14,16,.55)); }
.tl-shot.broll { border-bottom-color: #4C7DF0; }
.tl-shot.on { border-color: var(--accent, #E8693F); }
.tl-code, .tl-dur, .tl-ai { position: absolute; color: #fff; font-size: 11px; font-weight: var(--fw-semibold); }
.tl-code { left: 6px; top: 5px; } .tl-dur { left: 6px; bottom: 5px; font-variant-numeric: tabular-nums; } .tl-ai { right: 5px; top: 5px; font-size: 9.5px; background: rgba(255,255,255,.22); padding: 1px 4px; border-radius: 3px; }
.tl-zoom, .tl-cut { position: absolute; height: 6px; border-radius: 3px; }
.tl-zoom { bottom: 22px; background: #FFD84D; }
.tl-cut { bottom: 31px; background: #E8693F; }
.key { display: inline-block; width: 12px; height: 6px; border-radius: 3px; margin: 0 3px 0 8px; vertical-align: middle; }
.key.zoom { background: #FFD84D; } .key.cut { background: #E8693F; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.edit-shot { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.edit-prev { aspect-ratio: 9 / 16; border-radius: var(--radius); overflow: hidden; background: #111; }
.edit-prev video, .edit-out video { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-out { aspect-ratio: 9 / 16; max-height: 420px; margin: 0 auto 12px; border-radius: var(--radius); overflow: hidden; background: #111; }
.word-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.word { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-full, 99px); background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; }
.word:hover:not(:disabled) { border-color: var(--text); }
.word.on { background: #FFD84D; border-color: #E5BE2C; color: #1a1a1a; font-weight: var(--fw-semibold); }
.word:disabled { opacity: .6; cursor: default; }
.grid3 { display: grid; grid-template-columns: 1.6fr 1fr .7fr; gap: 8px; }
.sub-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.sub-styles.off { opacity: .5; }
.sub-style { position: relative; aspect-ratio: 9 / 13; border: 2px solid var(--line); border-radius: var(--radius-sm); background: #333 center/cover no-repeat; cursor: pointer; overflow: hidden; padding: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.sub-style::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.18); }
.sub-style.on { border-color: var(--accent, #E8693F); }
.sub-style b { position: relative; background: var(--surface); color: var(--text); font-size: 11px; padding: 4px; text-align: center; }
/* sits where it renders: just above the bottom 35% (Reels/Stories safe zone) */
.sub-prev { position: relative; margin: 0 6px 34%; text-align: center; color: #fff; font: 800 11px/1.2 var(--font-sans, sans-serif); text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 3px #000; }
.sub-prev em { font-style: normal; color: #FFE45C; }
.s-caps { text-transform: uppercase; font-size: 12.5px; font-weight: 900; }
.s-clean { font-weight: 600; text-shadow: 0 0 6px rgba(0,0,0,.7); } .s-clean em { color: #fff; }
.s-subtle { font-size: 9px; font-weight: 600; text-shadow: none; background: rgba(0,0,0,.5); padding: 2px 5px; border-radius: 3px; align-self: center; }
.s-marker { font-weight: 600; text-shadow: 0 0 2px #000; } .s-marker em { color: #fff; background: #E8693F; border-radius: 4px; padding: 0 3px; text-shadow: none; }
.s-reveal em { color: #fff; } .s-reveal i { font-style: normal; opacity: .45; }
.s-yellow { color: #FFE45C; } .s-yellow em { color: #FFE45C; }
.s-one { font-size: 15px; } .s-one em { color: #fff; }
.s-box { text-shadow: none; } .s-box { background: rgba(0,0,0,.78); padding: 3px 5px; border-radius: 4px; align-self: center; } .s-box em { color: #fff; }
.s-minimal { font-size: 9px; font-weight: 600; } .s-minimal em { color: #fff; }
.s-pop em { color: #7CF566; font-size: 15px; }
.qc > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 2px 0; }
.qc span { color: var(--muted); } .qc b.warn { color: #C2410C; }
@media (max-width: 980px) { .edit-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .edit-shot { grid-template-columns: 1fr; } .edit-prev { max-width: 220px; } .grid3 { grid-template-columns: 1fr; } }
input[type=range] { accent-color: var(--accent, #E8693F); width: 100%; }

/* Sidebar groups: In progress / Done / Drafts, each with a count and a chevron */
.sec-toggle { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; cursor: pointer; margin-top: 10px; }
.sec-toggle svg { transition: transform .15s; flex: none; }
.sec-toggle.open svg { transform: rotate(90deg); }
.sec-toggle:hover { color: var(--text); }
.sec-count { margin-left: auto; font-variant-numeric: tabular-nums; background: var(--subtle); color: var(--muted); border-radius: 99px; padding: 0 7px; font-size: 10.5px; line-height: 18px; }
.sec-empty { padding: 4px 8px 6px; }

/* Menu cards: two real photos per item */
.nav-art i { background: var(--subtle) center/cover no-repeat; }
.version-actions { align-items: center; } .version-actions > span { flex: none; width: 92px; }

/* Batch: one row per image */
.batch-out a { width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.batch { display: flex; flex-direction: column; gap: 8px; }
.batch-row { display: grid; grid-template-columns: 28px auto minmax(220px, 2fr) auto 90px minmax(220px, 2fr) 70px; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 6px); padding: 10px 12px; }
.batch-row.head { background: none; border: 0; padding: 0 12px; font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.batch-row textarea { width: 100%; resize: vertical; min-height: 64px; }
.batch-ref { position: relative; width: 84px; height: 84px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--subtle) center/cover no-repeat; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; color: var(--muted); }
.batch-ref button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 1; }
.batch-outs { display: flex; flex-wrap: wrap; gap: 6px; }
.batch-out { position: relative; width: 64px; height: 84px; border-radius: var(--radius); overflow: hidden; background: var(--subtle); display: flex; align-items: center; justify-content: center; }
.batch-out img { width: 100%; height: 100%; object-fit: cover; }
.batch-out { cursor: pointer; border: 2px solid transparent; }
.batch-out.on { border-color: var(--accent); }
.batch-out em { position: absolute; left: 3px; top: 3px; font-style: normal; font-size: 9px; font-weight: 700; background: rgba(0,0,0,.6); color: #fff; padding: 1px 4px; border-radius: 3px; }
.batch-out.split { width: 96px; }
.batch-out a, .batch-out span { position: absolute; right: 3px; bottom: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.batch-out.err { color: var(--danger); font-weight: 700; }
@media (max-width: 900px) { .batch-row { grid-template-columns: 24px 70px 1fr; } .batch-row.head { display: none; } .batch-row > :nth-child(n+4) { grid-column: 2 / -1; } }

/* Product shots */
.ps-product { position: relative; width: 64px; height: 64px; border-radius: var(--radius); background: var(--subtle) center/contain no-repeat; border: 1px solid var(--line); }
.ps-product button, .ps-inspo i { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-style: normal; font-size: 12px; line-height: 18px; text-align: center; }
.ps-inspo { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; max-height: 300px; overflow: auto; }
.ps-inspo button { position: relative; aspect-ratio: 1; border: 2px solid transparent; border-radius: var(--radius); background: var(--subtle) center/cover no-repeat; cursor: pointer; padding: 0; }
.ps-inspo button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); }
.ps-inspo i { display: none; } .ps-inspo button:hover i { display: block; }

.ps-inspo button.active { border-color: var(--text); }
.ps-inspo b { position: absolute; left: 3px; bottom: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.ps-spec { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg, 6px); background: var(--subtle); }

/* B-roll boards: 30 rows, stills → pick → Seedance */
.board { display: flex; flex-direction: column; gap: 8px; }
.board-row { display: grid; grid-template-columns: 34px 76px minmax(180px, 1.4fr) 220px minmax(180px, 1.4fr) 130px; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 6px); padding: 10px 12px; }
.board-row.head { background: none; border: 0; padding: 0 12px; font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.board-row textarea { width: 100%; resize: vertical; min-height: 60px; }
.board-row .batch-ref { width: 76px; height: 100px; }
.board-stills { display: flex; gap: 6px; } .board-stills .batch-out { width: 66px; height: 117px; padding: 0; }
.board-vid video { width: 100%; aspect-ratio: 9 / 16; border-radius: var(--radius); background: #111; object-fit: cover; }
.batch-out.tall { width: 100%; height: 200px; }
@media (max-width: 1100px) { .board-row { grid-template-columns: 26px 76px 1fr; } .board-row.head { display: none; } .board-row > :nth-child(n+4) { grid-column: 2 / -1; } .board-vid video { max-width: 200px; } }
.board-row select { width: 72px; flex: none; } .board-row .row.nowrap .btn { flex: 1; white-space: nowrap; }

/* Drag & drop zones */
[data-drop].drop-over { outline: 2px dashed var(--accent); outline-offset: 2px; background-color: var(--accent-soft, #FBEDE6); }

/* B-roll board sections (Hooks / Body), each folds open and closed */
.board-sec { margin-bottom: 14px; }
.board-tab { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg, 6px); background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; margin-bottom: 8px; }
.board-tab svg { transition: transform .15s; } .board-sec.open .board-tab svg { transform: rotate(90deg); }
.board-tab .sec-count { margin-left: auto; }

/* Hook pairs get one colour each (A1+A2, B1+B2, …) */
.board-row.hook-A { --hk: #E8693F; } .board-row.hook-B { --hk: #2F7DE1; } .board-row.hook-C { --hk: #1F9D63; } .board-row.hook-D { --hk: #8B5CF6; } .board-row.hook-E { --hk: #D9A11A; }
.board-row[class*="hook-"] { border-left: 5px solid var(--hk); background: color-mix(in srgb, var(--hk) 5%, var(--surface)); }
.board-row .hook-tag { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 22px; border-radius: 5px; background: var(--hk); color: #fff; font-size: 12px; }
.board-row.hook-A + .board-row.hook-B, .board-row.hook-B + .board-row.hook-C, .board-row.hook-C + .board-row.hook-D, .board-row.hook-D + .board-row.hook-E { margin-top: 10px; }

/* Parked for now (New ad, Product images): hidden, not removed. Delete this rule to bring them back. */
[data-park] { display: none !important; }
#select-toggle { flex: 1; width: 100%; }

/* Sidebar parked for now: the main area takes the full width. Remove with the [data-park] rule. */
.app:has(#sidebar[data-park]) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "mnav" "main"; }

/* Sidebar Recent generations */
.gen-item .ad-thumb { position: relative; overflow: hidden; background-size: cover; background-position: center; }
.gen-item .ad-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gen-item .ad-status { font-size: 11.5px; }

/* Remake gen */
.rm-list { display: flex; flex-direction: column; gap: 10px; }
.rm-row { display: grid; grid-template-columns: 120px minmax(200px, 1.2fr) minmax(180px, 1fr) minmax(330px, 1.6fr); gap: 14px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 6px); padding: 12px; }
.rm-row textarea { width: 100%; resize: vertical; }
.rm-ref { width: 120px; height: 150px; }
.rm-outs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rm-out { display: flex; flex-direction: column; gap: 6px; }
.rm-img { display: flex; align-items: center; justify-content: center; border-radius: var(--radius); overflow: hidden; background: var(--subtle); color: var(--faint); font-weight: 700; }
.rm-img img { width: 100%; height: 100%; object-fit: cover; }
.rm-img.r45 { width: 100%; aspect-ratio: 4 / 5; } .rm-img.r916 { width: 42%; aspect-ratio: 9 / 16; flex: none; }
.rm-img.err { color: var(--danger); }
@media (max-width: 1100px) { .rm-row { grid-template-columns: 120px 1fr; } .rm-row > :nth-child(n+3) { grid-column: 1 / -1; } }

.rm-research { margin-bottom: 14px; }
.rm-big { gap: 10px; margin-top: 6px; }
.rm-driver { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: var(--accent-soft, #FBEDE6); color: var(--accent-text, #A4441F); font-size: 11px; font-weight: 600; }
.rm-outs { grid-template-columns: repeat(5, 1fr) !important; }
.rm-row { grid-template-columns: 120px minmax(240px, 1.5fr) minmax(200px, 1fr) !important; }
.rm-row .rm-outs { grid-column: 1 / -1; }
.rm-row .rm-img.r45 { max-height: 260px; }

.rm-img { position: relative; } .rm-img.bad { outline: 3px solid var(--danger); } .rm-img.ok { outline: 2px solid var(--ok); }
.rm-check { position: absolute; left: 4px; bottom: 4px; font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; color: #fff; background: rgba(0,0,0,.65); }
.rm-img.bad .rm-check { background: var(--danger); } .rm-img.ok .rm-check { background: var(--ok); }

.rm-img.r11 { width: 100%; aspect-ratio: 1; } .rm-img.r916 { width: 100% !important; }
.rm-img.r11m { width: 100%; aspect-ratio: 1; }

/* Batch: up to 4 reference images per row */
.batch-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.batch-refs .batch-ref { width: 64px; height: 84px; }
.batch-refs .batch-ref em { position: absolute; left: 3px; top: 3px; font-style: normal; font-size: 10px; font-weight: 700; background: rgba(0,0,0,.6); color: #fff; padding: 0 4px; border-radius: 3px; }
.batch-refs .batch-ref.add { font-size: 12px; text-align: center; }
.batch-refs .batch-ref.add small { display: block; font-size: 10px; color: var(--faint); }

.batch-fb { width: 220px; resize: vertical; font-size: 12.5px; }

/* Hover preview of result images */
.hover-preview { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity .12s; background: var(--surface); padding: 4px; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.hover-preview.on { opacity: 1; }
.hover-preview img { display: block; max-width: min(46vw, 560px); max-height: 78vh; border-radius: 5px; }
@media (hover: none) { .hover-preview { display: none; } }

/* Social posts */
.soc-refs { display: flex; flex-wrap: wrap; gap: 10px; }
.soc-ref { display: flex; gap: 6px; align-items: flex-start; } .soc-ref .batch-ref { width: 64px; height: 80px; } .soc-ref textarea { width: 180px; font-size: 12px; }
.soc-go { margin: 14px 0; gap: 12px; }
.soc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 14px; }
.soc-card > .stack { min-width: 0; }
.soc-card { display: grid; grid-template-columns: 150px 1fr; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 6px); padding: 12px; }
.soc-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.soc-card textarea { width: 100%; resize: vertical; font-size: 12.5px; }
.soc-img { position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; background: var(--subtle); display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px; }
.soc-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.soc-pick { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; align-items: center; background: rgba(255,255,255,.92); border-radius: 5px; padding: 2px 6px; font-size: 11.5px; font-weight: 600; }
.soc-type { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 10.5px; }
@media (max-width: 640px) { .soc-card { grid-template-columns: 1fr; } }
.soc-person { width: 64px; height: 80px; border-radius: var(--radius); border: 2px solid var(--accent); background: center / cover var(--subtle); cursor: pointer; padding: 0; }
.soc-person.off { border-color: var(--line); opacity: .35; filter: grayscale(1); }
.soc-face { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: center / cover #ccc; }
.soc-count { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 10.5px; }
.soc-slides { display: flex; gap: 4px; flex-wrap: wrap; }
.soc-slide { position: relative; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 4px; background: var(--subtle); padding: 0; overflow: hidden; font-size: 11px; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.soc-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.soc-soaps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 10px; align-items: start; }
.soc-soap { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--surface); }
.soc-soap .batch-ref { width: 64px; height: 80px; flex: none; background-size: cover; background-position: center; }
.soc-soap input[type=text], .soc-soap textarea { width: 100%; font-size: 12.5px; }
.soc-del { position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.soc-del:hover { background: var(--danger, #c0392b); }
.soc-card:has(.soc-count) .soc-del { bottom: 30px; }
.soc-sec-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--subtle); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.soc-sec-head:hover { border-color: var(--accent); }
.soc-sec-head b { white-space: nowrap; font-size: 13.5px; }
.soc-chev { width: 12px; color: var(--muted); }
.soc-sum { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; }
.soc-sec-body { padding: 4px 2px 10px; display: flex; flex-direction: column; gap: 12px; }
.soc-mini { display: inline-flex; gap: 3px; align-items: center; } .soc-mini i { width: 22px; height: 26px; border-radius: 3px; background: center / cover var(--line); display: inline-block; } .soc-mini.round i { width: 24px; height: 24px; border-radius: 50%; } .soc-mini em { font-style: normal; font-size: 11px; margin-left: 2px; }
.soc-own { margin-top: 14px; } .soc-own textarea { flex: 1; min-width: 0; resize: vertical; }
.soc-group { color: var(--accent); font-weight: 600; }
.soc-bar { margin: 18px 0 10px; gap: 10px; align-items: center; } .soc-bar .soc-sec-head { width: auto; }
.soc-grid.stories { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.soc-card.story { grid-template-columns: 120px 1fr; } .soc-card.story .soc-img { aspect-ratio: 9 / 16; }

/* Start page */
.hub { display: flex; flex-direction: column; gap: 22px; max-width: 1180px; }
.hub-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.hub-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg, 8px); overflow: hidden; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.hub-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.hub-art { display: grid; grid-template-columns: 1fr 1fr; height: 120px; } .hub-art i { background: center / cover var(--subtle); }
.hub-text { display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 18px; min-height: 120px; } .hub-text b { font-size: 15px; } .hub-text small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.hub-badge { align-self: flex-start; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-bottom: 2px; background: var(--subtle); color: var(--muted); }
.hub-badge.cs { background: var(--accent); color: #fff; }

/* Social posts calendar */
.soc-cal { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 18px 0 4px; }
.soc-day { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.soc-day small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; } .soc-day b { font-size: 15px; } .soc-day span { font-size: 11.5px; color: var(--muted); } .soc-day em { font-style: normal; font-size: 11px; color: var(--ok, #2e7d32); }
.soc-day.today small { color: var(--accent); font-weight: 600; }
.soc-day:hover { border-color: var(--accent); } .soc-day.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--subtle); }
.soc-card.posted { opacity: .55; } .soc-card.posted:hover { opacity: 1; }
.soc-num { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); } .soc-num select { width: auto; min-width: 58px; padding: 4px 22px 4px 10px; }
.soc-img video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.soc-anim { position: absolute; left: 6px; right: 6px; top: 50%; transform: translateY(-50%); text-align: center; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; border-radius: 4px; padding: 3px; }
.soc-fb { gap: 6px; } .soc-fb input { flex: 1; min-width: 0; font-size: 12.5px; }
