:root {
  --bg: #ECEEF3;
  --surface: #FFFFFF;
  --sunk: #F5F6F9;
  --ink: #171A26;
  --muted: #5B6074;
  --faint: #8A8FA3;
  --line: #D8DBE4;
  --line-soft: #E7E9EF;
  --ok: #157A3F;
  --ok-bg: #E3F4EA;
  --bad: #B42318;
  --bad-bg: #FDECEA;
  --warn: #8F5200;
  --warn-bg: #FFF2DB;
  --run: #1F3FC4;
  --run-bg: #E6ECFF;

  --accent: #2F3447;       /* changes with the chosen theme */
  --accent-tint: #E9EAF0;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(23, 26, 38, .06), 0 8px 24px rgba(23, 26, 38, .06);
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; background: var(--sunk); padding: 1px 5px; border-radius: 5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, white); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 28px;
  background: rgba(236, 238, 243, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; }
.brand svg rect:first-child { transition: fill .3s; }
.services { display: flex; gap: 14px; margin-left: auto; font-size: 13px; color: var(--muted); }
.svc { display: inline-flex; align-items: center; gap: 6px; }
.svc i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.svc.on i { background: #22A35A; }

.setup {
  margin: 16px 28px 0; padding: 14px 18px; border-radius: var(--r-md);
  background: var(--warn-bg); color: #5C3700; border: 1px solid #F1D29B;
}
.setup strong { display: block; margin-bottom: 4px; }
.setup ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 430px) 1fr;
  gap: 24px;
  padding: 24px 28px 48px;
  align-items: start;
}

/* ---------------------------------------------------------------- composer */
.composer {
  position: sticky; top: 76px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: calc(100vh - 100px);
  display: flex; flex-direction: column;
}
.composer > .step { padding: 14px 22px 2px; }
.composer-head {
  padding: 16px 22px 14px;
  background: var(--accent);
  color: #fff;
  transition: background .3s;
}
.composer-head h1 { margin: 0 0 2px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.composer-head p { margin: 0; opacity: .86; font-size: 14px; max-width: 46ch; }
.composer { overflow-y: auto; }

.step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent); font-size: 13px; font-weight: 800;
  transition: background .3s, color .3s;
}
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* theme tiles: the real logo on the theme's own colour */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme {
  position: relative;
  display: flex; flex-direction: column; align-items: stretch;
  padding: 0; border: 2px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: left; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.theme:hover { border-color: var(--line); }
.theme .sw {
  height: 50px; display: grid; place-items: center; padding: 8px;
  background: var(--t-tint);
}
.theme .sw img { max-width: 100%; max-height: 38px; object-fit: contain; }
.theme .sw .nologo { font-size: 12px; font-weight: 600; color: var(--muted); border: 1.5px dashed #B9BDCB; border-radius: 6px; padding: 4px 8px; }
.theme .tx { padding: 7px 9px 8px; }
.theme b { display: block; font-size: 14px; font-weight: 700; }
.theme small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.theme[aria-checked="true"] { border-color: var(--t-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--t-accent) 18%, transparent); }
.theme[aria-checked="true"]::after {
  content: "✓"; position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--t-accent); color: #fff; font-size: 12px; font-weight: 800;
}

/* platform cards with the real frame shapes */
.platforms { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.platform {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border: 2px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: left;
}
.platform:hover { border-color: var(--line); }
.platform[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent-tint) 55%, white); }
.platform b { font-size: 16px; font-weight: 800; }
.platform small { color: var(--muted); font-size: 12px; display: block; }
.platform > span:last-child { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.frames { display: flex; align-items: flex-end; gap: 4px; height: 36px; flex: none; }
.frame {
  display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: 4px; background: var(--surface);
  font-size: 10px; font-weight: 700; color: var(--ink);
}
.platform[aria-checked="true"] .frame { border-color: var(--accent); color: var(--accent); }
.f-1x1 { width: 30px; height: 30px; }
.f-9x16 { width: 20px; height: 36px; }
.f-16x9 { width: 44px; height: 25px; }
.frame { font-size: 8.5px; }

/* tabs + inputs */
.tabs { display: flex; gap: 4px; margin-bottom: 10px; background: var(--sunk); padding: 4px; border-radius: 10px; }
.tab { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  padding: 10px 12px; font-size: 14px;
}
textarea { resize: vertical; min-height: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; }
textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.count { min-height: 20px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.count .ok { color: var(--ok); font-weight: 600; }
.count .bad { color: var(--bad); }

.drop {
  display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center;
  padding: 26px 16px; border: 2px dashed var(--line); border-radius: var(--r-md); background: var(--sunk);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-tint); }
.drop.has-file { border-style: solid; border-color: var(--ok); background: var(--ok-bg); }
.drop span { font-size: 13px; color: var(--muted); }
.link { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--accent); font-weight: 600; }

.field { margin-top: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

.submit {
  position: sticky; bottom: 0; margin-top: 18px;
  padding: 14px 22px 18px; background: var(--surface); border-top: 1px solid var(--line-soft);
}
.summary { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.summary b { color: var(--ink); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #B9BDCB; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: rgba(0,0,0,.04); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; transition: background .3s, border-color .3s; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { width: 100%; padding: 13px 16px; font-size: 16px; font-weight: 700; border-radius: 11px; }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { color: var(--bad); }
.icon { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--muted); }
.icon:hover { background: var(--sunk); color: var(--ink); }

/* ---------------------------------------------------------------- board */
.board { min-width: 0; }
.board-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.board-title { display: flex; align-items: center; gap: 18px; }
.board-title .meters { flex: 1; min-width: 0; gap: 4px 14px; }
.board-title .downloads { margin-left: auto; flex: none; }
.board-title h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.meters { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.meters b { color: var(--ink); font-variant-numeric: tabular-nums; }
.slots { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 6px; }
.slots i { width: 9px; height: 14px; border-radius: 3px; background: var(--line); }
.slots i.on { background: var(--run); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.board-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.is-on { background: var(--ink); color: #fff; }
.board-tools select { width: auto; max-width: 300px; padding: 7px 34px 7px 12px; font-size: 13px; }
.downloads { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.jobs { display: flex; flex-direction: column; gap: 10px; }
.batch-label { margin: 10px 2px 0; font-size: 13px; font-weight: 700; color: var(--muted); }

.job {
  display: grid; grid-template-columns: 1fr auto; gap: 14px 18px;
  padding: 14px 16px; background: var(--surface); border-radius: var(--r-md);
  border: 1px solid var(--line-soft); border-left: 4px solid var(--j-accent, var(--line));
}
.job-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.job-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.job-title h3 { margin: 0; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-link { font-size: 12.5px; color: var(--faint); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 100%; }
.job-link:hover { color: var(--accent); text-decoration: underline; }
.hookline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.bucket { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); border: 1px solid var(--line-soft); }
.hooktext { font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--sunk); color: var(--ink); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--j-accent); }
.status { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.st-queued { background: var(--sunk); color: var(--muted); }
.st-running { background: var(--run-bg); color: var(--run); }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-partial { background: var(--warn-bg); color: var(--warn); }
.st-failed, .st-cancelled { background: var(--bad-bg); color: var(--bad); }
.stage { font-size: 13px; color: var(--muted); }
.err { font-size: 12.5px; color: var(--bad); background: var(--bad-bg); padding: 6px 10px; border-radius: 7px; overflow-wrap: anywhere; }

.sizes { display: flex; gap: 10px; align-items: flex-end; }
.size { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 0; cursor: default; }
.size .box {
  position: relative; overflow: hidden; border-radius: 7px; background: var(--sunk);
  border: 1.5px solid var(--line); display: grid; place-items: center;
}
.size.r-1x1 .box { width: 92px; height: 92px; }
.size.r-9x16 .box { width: 58px; height: 102px; }
.size.r-16x9 .box { width: 150px; height: 84px; }
.size .box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.size .box img.scene { filter: saturate(.6) brightness(.9); }
.size .lbl { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.size.is-done { cursor: zoom-in; }
.size.is-done .box { border-color: transparent; box-shadow: 0 0 0 1px var(--line-soft); }
.size.is-done:hover .box { box-shadow: 0 0 0 2px var(--accent); }
.size.is-failed .box { border-color: #F3B8B1; background: var(--bad-bg); color: var(--bad); font-weight: 800; }
.size .tag { position: absolute; inset: auto 4px 4px; font-size: 9.5px; font-weight: 700; text-align: center; background: rgba(255,255,255,.9); border-radius: 4px; padding: 2px 3px; color: var(--ink); line-height: 1.2; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--run); animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.job-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.job-actions .right { margin-left: auto; display: flex; gap: 6px; }

.empty {
  padding: 48px 24px; text-align: center; background: var(--surface); border-radius: var(--r-lg);
  border: 1.5px dashed var(--line); color: var(--muted);
}
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 18px; }
.empty p { margin: 0 auto; max-width: 44ch; }

/* ---------------------------------------------------------------- modals */
.modal { border: 0; padding: 0; border-radius: var(--r-lg); box-shadow: 0 24px 80px rgba(10, 12, 20, .35); max-width: min(1180px, 96vw); width: 100%; background: var(--surface); }
.modal::backdrop { background: rgba(15, 17, 28, .62); backdrop-filter: blur(3px); }
.pv { display: grid; grid-template-columns: 1fr 360px; min-height: min(80vh, 760px); }
.pv-stage { background: #1B1E2B; display: flex; flex-direction: column; min-width: 0; }
.pv-ratios { display: flex; gap: 6px; padding: 12px; }
.pv-ratios button { border: 1.5px solid #3A3F55; background: transparent; color: #C9CCDA; border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer; }
.pv-ratios button.is-on { background: #fff; color: #1B1E2B; border-color: #fff; }
.pv-ratios button:disabled { opacity: .4; cursor: not-allowed; }
.pv-img { flex: 1; display: grid; place-items: center; padding: 8px 20px 24px; min-height: 0; }
.pv-img img { max-width: 100%; max-height: calc(80vh - 90px); object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.pv-img .ph { color: #9EA3B8; text-align: center; }
.pv-side { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: min(80vh, 760px); }
.pv-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pv-top h3 { margin: 4px 0 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.hookcard { padding: 12px 14px; border-radius: var(--r-md); background: var(--sunk); }
.hookcard .bucket { background: var(--surface); }
.hookcard p { margin: 8px 0 0; font-size: 17px; font-weight: 700; }
.hookcard small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.pv-actions { display: flex; flex-direction: column; gap: 8px; }
.pv-nav { display: flex; justify-content: space-between; margin-top: auto; }
details.prompt summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
details.prompt pre { white-space: pre-wrap; font-size: 11.5px; background: var(--sunk); padding: 10px; border-radius: 8px; max-height: 220px; overflow: auto; }

.lib { padding: 18px 22px 22px; max-height: 86vh; overflow-y: auto; }
.lib h4 { margin: 22px 0 10px; font-size: 16px; }
.logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.logo-card { border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; }
.logo-card .sw { height: 84px; display: grid; place-items: center; padding: 10px; background: var(--sunk); }
.logo-card img { max-width: 100%; max-height: 64px; object-fit: contain; }
.logo-card div:last-child { padding: 8px 10px; font-size: 13px; font-weight: 700; }
.hook-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.hook-group { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 12px 14px; }
.hook-group h5 { margin: 0 0 8px; font-size: 14px; }
.hook-group ol { margin: 0; padding-left: 20px; font-size: 13.5px; }
.hook-group li { margin: 3px 0; }
.lib-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.warn-list { margin: 12px 0 0; padding: 10px 14px 10px 30px; background: var(--warn-bg); border-radius: 8px; font-size: 13px; color: #5C3700; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: 380px; animation: up .2s ease-out; }
.toast.bad { background: var(--bad); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .board-title { flex-wrap: wrap; }
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .composer { position: static; max-height: none; }
  .topbar { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .services { order: 3; width: 100%; margin-left: 0; }
  .pv { grid-template-columns: 1fr; }
  .pv-side { max-height: none; }
  .setup { margin: 12px 16px 0; }
}
@media (max-width: 560px) {
  .themes { grid-template-columns: repeat(2, 1fr); }
  .job { grid-template-columns: 1fr; }
  .sizes { flex-wrap: wrap; }
  .downloads { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.logoname { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.2; }
#openLibrary { position: relative; }
#openLibrary.has-dot::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #E08A00; }
.hk-label { font-size: 12px; color: var(--faint); font-weight: 600; }
.hk-top { display: flex; align-items: center; gap: 8px; }
.hookcard p { margin-top: 6px; }
#pvBody { display: flex; flex-direction: column; gap: 14px; }
.facts a { color: var(--ink); }
.hook-group ul { margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.hook-group li { margin: 4px 0; display: flex; gap: 8px; }
.hid { color: var(--faint); font-variant-numeric: tabular-nums; min-width: 20px; text-align: right; font-size: 12px; padding-top: 1px; }
@media (max-width: 980px) { .topbar { position: static; } }

/* ---------------------------------------------------------------- accounts */
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who { color: var(--muted); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quota { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.quota b { color: var(--ink); font-variant-numeric: tabular-nums; }
.qbar { width: 46px; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.quota.low .qbar i { background: #E08A00; }
.quota.out { border-color: #F3B8B1; background: var(--bad-bg); }
.quota.out .qbar i { background: var(--bad); }
.quota.admin { background: var(--ink); color: #fff; border-color: var(--ink); }
.summary .over { color: var(--bad); }
.busy { margin-bottom: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--run-bg); color: #1B2F8F; border: 1px solid #C7D3FB; font-size: 14px; }
.chip.owner { background: var(--run-bg); color: var(--run); }
.users-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.users-tools input[type=search] { flex: 1; min-width: 200px; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; }
.utable-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-md); max-height: 56vh; }
.utable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.utable th { position: sticky; top: 0; background: var(--sunk); text-align: left; font-weight: 700; padding: 8px 12px; color: var(--muted); }
.utable td { padding: 6px 12px; border-top: 1px solid var(--line-soft); }
.utable tr.full td:first-child { color: var(--bad); font-weight: 600; }
.utable input { width: 72px; border: 1.5px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.utable input.custom { border-color: var(--run); }
@media (max-width: 980px) { .account { order: 4; width: 100%; } .who { display: none; } }

/* ---------------------------------------------------------------- prompt */
.opt { font-size: 11.5px; font-weight: 600; color: var(--faint); background: var(--sunk); padding: 2px 7px; border-radius: 999px; }
textarea.prompt-box { font-family: var(--font); font-size: 14px; line-height: 1.45; min-height: 78px; }
.prompt-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-top: 6px; }
.ideas { display: flex; flex-wrap: wrap; gap: 5px; }
.idea { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.idea:hover { border-color: var(--accent); color: var(--accent); }
.chars { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; flex: none; padding-top: 4px; }
.switch { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .2s; margin-top: 1px; }
.switch .track i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track i { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--accent) 55%, white); outline-offset: 2px; }
.switch b { display: block; font-size: 14px; }
.switch small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.chip.prompt { background: #FFF2DB; color: var(--warn); cursor: help; }
.promptcard { padding: 10px 14px; border-radius: var(--r-md); border: 1px dashed var(--line); }
.promptcard p { margin: 4px 0 0; font-size: 14px; }

/* ---------------------------------------------------------------- video studio */
.other-studio { margin-left: 4px; }
.apptabs { display: flex; gap: 6px; padding: 14px 28px 0; }
.apptab { border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 14px; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.apptab.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.dirs { display: grid; gap: 8px; }
.dirs label { display: block; font-size: 13px; font-weight: 600; }
.dirs input, .text-in { display: block; width: 100%; margin-top: 4px; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; font-size: 14px; background: #fff; }
.dirs input:focus, .text-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
#dirWarn { margin-top: 10px; }
.theme:disabled { opacity: .45; cursor: not-allowed; }
.tl { display: flex; gap: 3px; height: 64px; border-radius: 10px; overflow: hidden; font-size: 11.5px; font-weight: 700; text-align: center; }
.tl span { display: flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1.2; padding: 0 4px; min-width: 44px; }
.tl-s { background: var(--accent); color: #fff; }
.tl-m { background: var(--accent-tint); color: var(--ink); }
.tl small { font-weight: 600; color: var(--muted); }
.upbar { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin-bottom: 10px; }
.upbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.is-video .size.r-9x16 .box { width: 74px; height: 132px; }
.size.vid .play { position: absolute; inset: 0; margin: auto; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.55); }
.size.vid .play::after { content: ""; position: absolute; left: 12px; top: 9px; border-left: 10px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.hooktext.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: 13.5px; }
.chip.warnchip { background: var(--bad-bg); color: var(--bad); cursor: help; }
.pv-img video { max-width: 100%; max-height: calc(80vh - 60px); border-radius: 8px; background: #000; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.steps-img { display: flex; gap: 8px; }
.steps-img a { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); text-decoration: none; text-align: center; }
.steps-img img { width: 84px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-soft); background: var(--sunk); }
.logo-card video { display: block; width: 100%; height: 150px; object-fit: cover; background: #000; }
@media (max-width: 980px) { .apptabs { padding: 12px 16px 0; } }
.dirs input { font-weight: 400; }

/* ---------------------------------------------------------------- parts switches + user admin */
.parts { margin-top: 12px; }
.parts-title { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.pill input { accent-color: var(--accent); margin: 0; }
.pill:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); color: var(--ink); }
.pill:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 55%, white); outline-offset: 2px; }
#makeTimeline { margin-top: 10px; }
.adduser { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; padding: 12px 14px; border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--sunk); }
.adduser b { font-size: 13.5px; }
.adduser input { flex: 1; min-width: 160px; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; font-size: 13.5px; background: #fff; }
.rowacts { white-space: nowrap; }
.rowacts .btn { padding: 4px 8px; font-size: 12px; }

/* ---------------------------------------------------------------- prompt nudge + style buttons */
.promptnudge { margin-top: 8px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--warn-bg); border: 1px solid #F1D29B; color: #5C3700; font-size: 13px; line-height: 1.4; }
.promptnudge b { color: #4A2D00; }
.styleopts { margin-top: 14px; }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; text-align: center; }
.modelbox { margin: 12px 0; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.modelrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.modelrow b { font-size: 13.5px; }
.modelrow select { width: auto; min-width: 110px; padding: 7px 30px 7px 10px; font-size: 13.5px; }
.modelbox .hint { margin-top: 8px; }

/* ---------------------------------------------------------------- collection banner */
.collinks { display: flex; flex-direction: column; gap: 6px; }
.collink { display: flex; align-items: center; gap: 8px; }
.collink .n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); font-size: 12px; font-weight: 800; }
.collink input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.collink .icon { flex: none; width: 28px; height: 28px; font-size: 13px; }
.fieldlabel { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.req { font-size: 11.5px; font-weight: 600; color: var(--bad); background: var(--bad-bg); padding: 2px 7px; border-radius: 999px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.collinks-chips { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.job-link.one { max-width: 220px; }
#colSubmit + .hint a { color: var(--accent); }

/* ---------------------------------------------------------------- own script + access */
.ownscript { margin-top: 14px; }
.scriptmeta { display: flex; justify-content: space-between; gap: 10px; margin-top: 5px; align-items: flex-start; }
.scriptwarn { color: var(--bad); font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.chars.over { color: var(--bad); font-weight: 700; }
.gbox { display: inline-flex; cursor: pointer; }
.gbox input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.warnline { color: var(--warn); font-weight: 600; }
.utable td:nth-child(2) { text-align: center; }
.step.locked .platforms { grid-template-columns: 1fr; max-width: 230px; }
.step.locked .platform { cursor: default; }

/* =====================================================================
   DARK GALLERY UI (sidebar + tool cards), modelled on a template gallery
   ===================================================================== */
:root {
  --bg: #121214;
  --surface: #1c1c1f;
  --sunk: #26262a;
  --ink: #f2f2f4;
  --muted: #a4a4ae;
  --faint: #6f6f7a;
  --line: #33333a;
  --line-soft: #2a2a30;
  --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .12);
  --bad: #f87171; --bad-bg: rgba(248, 113, 113, .12);
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .12);
  --run: #93a8ff; --run-bg: rgba(147, 168, 255, .14);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.35);
}
body { background: var(--bg); color: var(--ink); }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }

/* inputs and panels that were white */
textarea, select, input.text-in, .dirs input, .text-in, .adduser input, .utable input, .users-tools input[type=search], #langNote, #rtPrompt {
  background: var(--sunk) !important; color: var(--ink) !important; border-color: var(--line) !important;
}
textarea::placeholder, input::placeholder { color: var(--faint); }
.btn { background: var(--sunk); color: var(--ink); border-color: var(--line); }
.btn:hover { border-color: #4a4a54; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(255,255,255,.05); color: var(--ink); }
.tabs { background: var(--sunk); }
.tab.is-on { background: var(--surface); color: var(--ink); box-shadow: none; }
.seg { background: var(--sunk); border-color: var(--line); }
.seg button.is-on { background: var(--ink); color: var(--bg); }
.drop { background: var(--sunk); border-color: var(--line); }
.drop span { color: var(--muted); }
.theme, .platform { background: var(--sunk); border-color: var(--line-soft); }
.theme .tx small, .platform small { color: var(--muted); }
.theme .sw { background: color-mix(in srgb, var(--t-tint) 18%, #1a1a1d); }
.theme .sw .nologo { color: var(--muted); border-color: #4a4a54; }
.frame { background: transparent; border-color: var(--muted); color: var(--muted); }
.platform[aria-checked="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--sunk)); }
.pill { background: var(--sunk); border-color: var(--line); color: var(--muted); }
.pill:has(input:checked) { background: color-mix(in srgb, var(--accent) 18%, var(--sunk)); color: var(--ink); }
.pill.off, label.off { opacity: .45; }
.idea { background: var(--sunk); border-color: var(--line); color: var(--muted); }
.job { background: var(--surface); border-color: var(--line-soft); }
.chip, .bucket { background: var(--sunk); color: var(--ink); border-color: var(--line); }
.size .box { background: var(--sunk); border-color: var(--line); }
.size .tag { background: rgba(0,0,0,.72); color: #fff; }
.empty { background: var(--surface); border-color: var(--line); }
.modal { background: var(--surface); color: var(--ink); }
.hookcard, .promptcard, .modelbox, .adduser { background: var(--sunk); border-color: var(--line); }
.utable th { background: var(--sunk); }
.utable td { border-color: var(--line-soft); }
.quota { background: var(--sunk); border-color: var(--line); }
.quota.admin { background: var(--ink); color: var(--bg); }
.setup { background: var(--warn-bg); color: var(--warn); border-color: rgba(251,191,36,.3); }
.promptnudge { background: var(--warn-bg); border-color: rgba(251,191,36,.35); color: #fcd88a; }
.promptnudge b { color: #fde7b0; }
.busy { background: var(--run-bg); color: #c7d2ff; border-color: rgba(147,168,255,.3); }
.warn-list { background: var(--warn-bg); color: #fcd88a; }
.err { background: var(--bad-bg); color: #fca5a5; }
.summary { color: var(--muted); }
.summary b { color: var(--ink); }
.submit { background: var(--surface); border-color: var(--line-soft); }
.toast { background: #2c2c33; }
.utable tr.full td:first-child { color: var(--bad); }
code { background: var(--sunk); color: var(--ink); }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: #18181b; border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; font-size: 18px; }
.sb-brand svg { width: 28px; height: 28px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-size: 14.5px; font-weight: 600; text-align: left; cursor: pointer; text-decoration: none;
}
.sb-item svg { width: 20px; height: 20px; flex: none; }
.sb-item:hover { background: rgba(255,255,255,.05); color: var(--ink); }
.sb-item.is-on { background: #2a2a2f; color: var(--ink); }
.sb-dot { width: 8px; height: 8px; border-radius: 50%; margin: 0 6px; flex: none; }
.sb-sec { margin: 18px 12px 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.mainwrap { min-width: 0; }
.mainwrap .topbar { background: rgba(18,18,20,.86); border-bottom-color: var(--line-soft); }
.mainwrap .topbar .brand { display: none; }
#openUsers, #openLibrary { display: none; }

/* ---------------------------------------------------------------- gallery */
.gallery { padding: 26px 32px 60px; }
.gal-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.gal-head h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.gal-search { display: flex; align-items: center; gap: 10px; width: min(460px, 50%); padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.gal-search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.gal-search input { flex: 1; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 15px; }
.gal-chips { margin-bottom: 20px; }
.gal-note { font-size: 13.5px; color: var(--muted); }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.gcard {
  display: flex; flex-direction: column; gap: 12px; padding: 0 0 14px;
  background: transparent; border: 0; border-radius: 16px; color: var(--ink); text-align: left; cursor: pointer;
}
.gthumb { position: relative; display: block; aspect-ratio: 1 / 1; border-radius: 16px; overflow: hidden; background: var(--surface); outline: 1px solid var(--line-soft); transition: transform .18s ease, outline-color .18s; }
.gthumb svg { width: 100%; height: 100%; display: block; }
.gcard:hover .gthumb, .gcard:focus-visible .gthumb { transform: translateY(-3px); outline-color: var(--accent); }
.gbadge { position: absolute; top: 12px; left: 12px; padding: 5px 11px; border-radius: 9px; background: rgba(20,20,22,.78); color: #fff; font-size: 12.5px; font-weight: 700; backdrop-filter: blur(6px); }
.gbody { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.gbody b { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.gbody small { font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.gtags { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 4px; }
.gtags span { padding: 5px 10px; border-radius: 8px; background: var(--sunk); color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* ---------------------------------------------------------------- tool view */
#toolView { padding-top: 22px; }
#toolView.queue-only { grid-template-columns: 1fr; }
.composer { background: var(--surface); }
.composer-head { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 85%, #000), color-mix(in srgb, var(--accent) 55%, #000)); }

/* new banner tools */
.langs { display: flex; flex-wrap: wrap; gap: 8px; }
.langbtn { padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--sunk); color: var(--muted); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.langbtn.is-on { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, var(--sunk)); }
.upthumb:empty { display: none; }
.upthumb { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunk); }
.upthumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; background: #000; }
.upthumb span { flex: 1; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.trlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.trlist li { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.trlist span { color: var(--muted); }

/* video: end picker, mirror note, review */
.endpick { margin-top: 12px; }
.endpick .seg button { font-size: 12.5px; padding: 7px 8px; }
#sSiteLink { margin-top: 8px; }
.mirrornote { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, var(--sunk)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); font-size: 13px; line-height: 1.45; color: var(--ink); }
.tl-web { background: #fff !important; color: #D7262B !important; }
.size.review .box { box-shadow: 0 0 0 2px var(--warn); }
.status.st-review { background: var(--warn-bg); color: var(--warn); }
.reviewbox { padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: #fcd88a; font-size: 13.5px; line-height: 1.45; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .sb-nav { flex-direction: row; flex-wrap: wrap; }
  .sb-sec { display: none; }
  .gallery { padding: 18px; }
  .gal-head { flex-direction: column; align-items: stretch; }
  .gal-search { width: 100%; }
}

.size.r-original .box { width: 92px; height: 92px; }
.qfor { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--sunk); border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; vertical-align: middle; letter-spacing: 0; margin-left: 6px; }
.board-title h2 { white-space: nowrap; }
.board-title .meters { font-size: 13px; }

.board-title { flex-wrap: wrap; row-gap: 8px; }
.board-title .meters { order: 3; flex-basis: 100%; }
.langbtn.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.tl-m { background: color-mix(in srgb, var(--accent) 24%, var(--sunk)) !important; color: var(--ink) !important; }
.tl small { color: var(--muted) !important; }

/* ---------------------------------------------------------------- upload boxes that work in every browser */
.drop { position: relative; }
.drop input.filepick { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; font-size: 0; }
.drop:focus-within { border-color: var(--accent); }
.dropalt { font-size: 12px !important; color: var(--faint) !important; margin-top: 2px; }
.imglink { margin-top: 8px; }
.uperr { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--bad-bg); color: #fca5a5; font-size: 13px; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gal-sec { grid-column: 1 / -1; margin: 10px 2px -6px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.gal-sec:first-child { margin-top: 0; }
a.gcard { text-decoration: none; }

.limitsbox { margin: 12px 0; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--sunk); }
.lb-title { display: block; margin-bottom: 10px; font-size: 14px; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.lb-sec { padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-soft); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.lb-sec h4 { grid-column: 1 / -1; margin: 0; font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lb-sec h4 .hint { margin: 0; font-weight: 500; font-size: 12px; }
.lb-sec label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; }
.lb-sec input { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 9px; background: var(--sunk); color: var(--ink); font-size: 14px; }
.lb-sec small { color: var(--faint); font-weight: 500; font-size: 11.5px; }
.lb-sec .btn { grid-column: 1 / -1; justify-self: start; }
.drop.small { padding: 14px 12px; }
.drop.small strong { font-size: 14px; }
