@font-face { font-family: 'Heebo'; src: url('/fonts/Heebo-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Heebo'; src: url('/fonts/Heebo-500.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Heebo'; src: url('/fonts/Heebo-700.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Heebo'; src: url('/fonts/Heebo-800.ttf') format('truetype'); font-weight: 800; font-display: swap; }

:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel-2: #171b25;
  --line: #232937;
  --line-soft: #1b202b;
  --text: #e8ebf2;
  --muted: #8892a6;
  --dim: #5d6779;
  --accent: #6d5efc;
  --accent-soft: #6d5efc22;
  --good: #22c58a;
  --warn: #f5a524;
  --bad: #f0475f;
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Heebo', -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ---------- layout ---------- */

.sidebar {
  width: 232px; flex-shrink: 0; background: var(--panel);
  border-inline-start: 1px solid var(--line); display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
}

.logo {
  padding: 22px 20px 18px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
}
.logo-text { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.logo-text span { color: var(--muted); font-weight: 500; display: block; font-size: 11px; letter-spacing: .04em; }

nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
nav button {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--muted); font-weight: 500; font-size: 14px; text-align: start; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
nav button:hover { background: var(--panel-2); color: var(--text); }
nav button.on { background: var(--accent-soft); color: #fff; font-weight: 700; }
nav button svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }
nav .count { margin-inline-start: auto; font-size: 11px; color: var(--dim); font-weight: 600; }

.side-foot { padding: 14px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--dim); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-inline-end: 7px; }
.dot.on { background: var(--good); } .dot.off { background: var(--dim); }

main { flex: 1; min-width: 0; height: 100vh; overflow-y: auto; }
.page { padding: 26px 30px 60px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 13px; max-width: 620px; line-height: 1.5; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-weight: 600; cursor: pointer;
  transition: border-color .12s, background .12s, opacity .12s; white-space: nowrap;
}
.btn:hover { border-color: #333b4d; background: #1c2130; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #7c6dff; border-color: #7c6dff; }
.btn.ghost { background: none; }
.btn.danger { color: var(--bad); border-color: #3a2530; }
.btn.danger:hover { background: #2a1a20; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn svg { width: 15px; height: 15px; }

input[type=text], input[type=number], input[type=url], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); outline: none; transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 15px; }
.hint { font-size: 11.5px; color: var(--dim); margin-top: 5px; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---------- surfaces ---------- */

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; line-height: 1.5; }

.empty {
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 46px 24px;
  text-align: center; color: var(--muted);
}
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 7px; font-weight: 700; }
.empty p { font-size: 13px; line-height: 1.6; max-width: 420px; margin: 0 auto 16px; }

.banner {
  display: flex; align-items: center; gap: 11px; padding: 12px 15px; border-radius: var(--radius-sm);
  background: #1a1626; border: 1px solid #2e2748; color: #cfc6ff; font-size: 13px; margin-bottom: 18px; line-height: 1.5;
}
.banner.warn { background: #241d10; border-color: #443415; color: #f0cf95; }
.banner .btn { margin-inline-start: auto; }

/* ---------- stats ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.stat .v { font-size: 24px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 11.5px; color: var(--dim); margin-top: 3px; }

/* ---------- tables ---------- */

.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: start; padding: 11px 14px; font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--panel-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
th.num, td.num { text-align: end; font-variant-numeric: tabular-nums; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #151924; }
td.name { white-space: normal; min-width: 240px; max-width: 380px; font-weight: 500; }
.linkish { cursor: pointer; }
.linkish:hover { color: var(--accent); }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.pill.on { background: #102b21; color: var(--good); border-color: #1c4536; }
.pill.off { background: #241a1e; color: #d1728a; border-color: #3d2630; }
.pill.wait { background: #241d10; color: var(--warn); border-color: #443415; }

/* ---------- brand cards ---------- */

.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.brand-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; transition: border-color .12s; }
.brand-card:hover { border-color: #313a4e; }
.brand-top { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.brand-avatar {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; color: #fff; object-fit: cover;
}
.brand-card h3 { font-size: 15px; font-weight: 700; }
.brand-card .niche { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.brand-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 13px; }
/* Five actions do not fit one 280px card in a row - the last two hung off the
   side of the card. They wrap now, and each one is allowed to shrink. */
.brand-actions { display: flex; flex-wrap: wrap; gap: 7px;
  border-top: 1px solid var(--line-soft); padding-top: 12px; }
.brand-actions .btn { flex: 1 1 auto; min-width: 0; white-space: nowrap; }

/* ---------- studio ---------- */

.studio { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .studio { grid-template-columns: 1fr; } }
/* The formats card is a band across the top, not a column. Dropping it into
   the grid as an ordinary child pushed the 380px creation form into the wide
   column and the preview into the narrow one. */
#s-formats { grid-column: 1 / -1; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all .12s;
}
.chip:hover { border-color: #333b4d; color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.content-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.content-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.content-media { width: 100%; aspect-ratio: 4/5; object-fit: cover; background: var(--panel-2); display: block; }
.content-media.reel { aspect-ratio: 9/16; }
/* A design is not a photograph: cropping it to fit the grid removes the part
   that was being judged. Posters arrive at 1:1, 3:4 and 9:16, so cover in a
   fixed 4:5 box cut between 7% and 23% off the top and bottom of every one.
   The box keeps its shape so the grid stays even; the picture fits inside it. */
img.content-media { object-fit: contain; background: var(--panel-2); }
.content-body { padding: 13px; }
/* Clamp to whole lines with an ellipsis - a raw max-height cuts glyphs in half
   and reads as a rendering fault rather than a truncation. */
.content-body .cap {
  font-size: 12.5px; line-height: 1.55; color: var(--muted); margin-bottom: 10px;
  white-space: pre-wrap; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
/* A fifth button turned up here and the row had no way to break. Same trap as
   the brand cards and the landing rows - wrap before it has to. */
.content-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.content-foot .btn { white-space: nowrap; }

/* Creative picker: small tiles, caption over the image. The launcher column is
   half the width of the studio's, so the full-size content cards do not fit. */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.pick {
  position: relative; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
  border: 2px solid var(--line); background: var(--panel-2); transition: border-color .12s;
}
.pick:hover { border-color: var(--muted); }
.pick.on { border-color: var(--accent); }
.pick .content-media { aspect-ratio: 1; }
.pick-tag {
  position: absolute; inset-block-start: 6px; inset-inline-start: 6px; font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff;
}
.pick-check {
  position: absolute; inset-block-start: 6px; inset-inline-end: 6px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.pick-cap {
  position: absolute; inset-block-end: 0; inset-inline: 0; padding: 16px 8px 6px; font-size: 11px;
  color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .82));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.job-line {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px;
}
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modal ---------- */

.modal-bg {
  position: fixed; inset: 0; background: rgba(5, 6, 10, .74);
  display: grid; place-items: center; z-index: 50; padding: 24px; backdrop-filter: blur(3px);
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  width: 100%; max-width: 620px; max-height: 88vh;
  /* Column flex so the head and foot stay pinned and only the body scrolls -
     otherwise a long form pushes the save button off the bottom of the screen. */
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; flex-shrink: 0; }
.modal-head h2 { font-size: 17px; font-weight: 800; }
.modal-head .btn { margin-inline-start: auto; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ---------- toast ---------- */

#toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 13px; max-width: 400px; line-height: 1.5;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5); animation: rise .2s ease-out;
}
.toast.ok { border-inline-start: 3px solid var(--good); }
.toast.err { border-inline-start: 3px solid var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- misc ---------- */

.spark { display: flex; align-items: flex-end; gap: 2px; height: 46px; }
.spark i { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .75; }
.spark i:hover { opacity: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-variant-numeric: tabular-nums; }
.sep { height: 1px; background: var(--line-soft); margin: 16px 0; }

/* ---------- plan picker: quality and cost as one choice ---------- */
.plan {
  display: flex; align-items: center; gap: 14px; padding: 13px 15px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.plan:hover { border-color: #333b4d; }
.plan.on { border-color: var(--accent); background: var(--accent-soft); }
.plan.locked { opacity: .45; cursor: not-allowed; }
.plan-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-main b { font-size: 14px; font-weight: 700; }
.plan-detail { font-size: 12px; color: var(--muted); line-height: 1.45; }
.plan-price {
  margin-inline-start: auto; flex-shrink: 0; font-size: 12.5px; font-weight: 800;
  padding: 5px 11px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); white-space: nowrap;
}
.plan-price.free { color: var(--good); border-color: #1c4536; background: #102b21; }

/* A disclosure the user can actually find: a real header, not a faint line. */
.disclose {
  cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 700;
  color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 7px;
  padding-top: 4px; border-top: 1px solid var(--line-soft);
}
.disclose::-webkit-details-marker { display: none; }
.disclose::before {
  content: '▸'; color: var(--accent); font-size: 11px; transition: transform .15s;
}
details[open] > .disclose::before { transform: rotate(90deg); }
.disclose:hover { color: var(--text); }

/* The landing image count. A row of numbers rather than three plan cards:
   the count is the actual choice, and the price under it is that count times
   the model picked below. */
.countrow { display: flex; gap: 8px; flex-wrap: wrap; }
.countbtn {
  min-width: 46px; height: 46px; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-weight: 800; font-size: 17px;
  background: var(--panel-2); color: var(--text);
  border: 1.5px solid var(--line); transition: all .15s;
}
.countbtn:hover { border-color: var(--accent); color: #fff; }
.countbtn.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.countbtn.locked { opacity: .4; cursor: not-allowed; }


/* The 3D library. Each card spins its own mesh, so the grid shows objects
   rather than filenames. */
.m3d-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.m3d-card { display: flex; flex-direction: column; gap: 12px; }
.m3d-view {
  height: 180px; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(120% 100% at 30% 0%, #1b2233, #0d1017);
  border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--dim); font-size: 12px;
}
.m3d-view canvas { width: 100%; height: 100%; display: block; }
.m3d-meta { display: flex; flex-direction: column; gap: 3px; }
.m3d-meta b { font-size: 14.5px; }
.m3d-meta .mono { font-size: 11.5px; }

/* Templates + media library */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tpl-card { display: flex; flex-direction: column; gap: 8px; }
.tpl-head { display: flex; align-items: center; gap: 8px; }
.tpl-head b { font-size: 14.5px; }
.tpl-meta { font-size: 11.5px; }
.pill {
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
  background: var(--accent-soft); color: var(--accent);
  padding: 2px 7px; border-radius: 99px;
}
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lib-item {
  margin: 0; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--panel); display: flex; flex-direction: column;
}
/* A fixed box keeps the grid even while portrait and landscape images mix. */
.lib-item img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--panel-2); }
.lib-item figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.lib-prompt { color: var(--muted); line-height: 1.45; }

.bt-slot { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; }
.bt-slot .row { margin-bottom: 6px; }
.bt-slot input, .bt-slot select { width: 100%; }

/* A template is chosen by how it looks, so the card leads with a picture. */
.tpl-thumb {
  height: 150px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 11.5px;
}
/* Top-aligned: the hero is what identifies a landing page, not its footer. */
.tpl-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }

.bt-pick { margin-top: 8px; }
.bt-search { width: 100%; margin-bottom: 6px; }
.bt-thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px; max-height: 210px; overflow-y: auto; padding: 4px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
}
.bt-thumb {
  padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  background: var(--panel-2); cursor: pointer; display: flex; flex-direction: column;
}
.bt-thumb img { width: 100%; height: 56px; object-fit: cover; display: block; }
.bt-thumb span { font-size: 9.5px; color: var(--dim); padding: 2px; }
.bt-thumb.on { border-color: var(--accent); }

/* The "save an existing page" picker shows the page, scaled down inside a
   frame - a live view rather than another thumbnail to keep in step. */
.tpl-pick-thumb {
  width: 200px; height: 150px; flex: 0 0 200px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--panel-2);
  display: grid; place-items: center; font-size: 11.5px;
}
.tpl-pick-thumb iframe {
  width: 1280px; height: 960px; border: 0;
  transform: scale(0.156); transform-origin: top right; pointer-events: none;
}

/* Pages are chosen by sight. Each card renders the page itself. */
.page-pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; max-height: 330px; overflow-y: auto; padding: 4px;
}
.page-card {
  padding: 0; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; text-align: right;
}
.page-card img {
  width: 100%; height: 96px; object-fit: cover; object-position: top center;
  display: block; background: var(--bg);
}
.page-card span { padding: 4px 7px; font-size: 11.5px; color: var(--text); }
.page-card span.mono { padding-top: 0; font-size: 10px; }
.page-card.on { border-color: var(--accent); }

/* ---- reels in the media library ----
   A reel is taller than a still and worth more room, and it needs a poster
   plus a length badge: a <video> with preload="none" and no poster paints a
   black rectangle, so a grid of them is unreadable. */
.lib-item.is-reel { position: relative; }
.lib-item video {
  width: 100%; height: 300px; object-fit: cover; display: block;
  background: #000; cursor: pointer;
}
.lib-badge {
  position: absolute; top: 8px; inset-inline-start: 8px; z-index: 2;
  background: rgba(8, 10, 16, .82); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; letter-spacing: .02em;
  pointer-events: none;
}
/* a slot switched off by the image-count control */
.bt-slot.bt-off { pointer-events: none; }
.bt-slot .bt-reuse { margin-top: 6px; }

/* ---- the page copy editor ---- */
.pe-row { display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: start;
  padding: 7px 8px; border-radius: var(--radius-sm); }
.pe-row + .pe-row { border-top: 1px solid var(--line); }
.pe-row label { padding-top: 9px; font-size: 11px; }
.pe-row textarea { width: 100%; resize: vertical; line-height: 1.5; }
/* A changed field has to be findable again after scrolling past it. */
.pe-row.changed { background: rgba(124, 92, 255, .10); }
.pe-row.changed textarea { border-color: var(--accent, #7c5cff); }

/* ---- the brand asset drawer ---- */
.ba-group + .ba-group { margin-top: 22px; }
.ba-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.ba-head b { font-size: 15px; }
.ba-head span { font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--panel-2); border-radius: 99px; padding: 2px 9px; }
.ba-head i { margin-inline-start: auto; font-style: normal; font-size: 12px; color: var(--muted); }
.ba-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.ba-item { margin: 0; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.ba-item img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--panel-2); }
/* A reel is portrait; a 130px letterbox of it shows nothing worth clicking. */
.ba-item video { width: 100%; height: 260px; object-fit: cover; display: block; background: #000; }
.ba-item figcaption { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.ba-item figcaption b { font-size: 12.5px; line-height: 1.45; }
.ba-act { display: flex; gap: 6px; margin-top: 4px; }
.ba-act .btn { flex: 1; padding: 8px 6px; font-size: 12px; }

/* ---- picking from the brand in the studio ---- */
.lib-item.picked { outline: 2px solid var(--accent, #7c5cff); outline-offset: -2px; }
.lib-item.picked figcaption { background: rgba(124, 92, 255, .12); }
.lib-item video { width: 100%; height: 150px; object-fit: cover; display: block; background: #000; }

/* ---- editing a finished item ---- */
.ce-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.ce-preview { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
.ce-preview img, .ce-preview video { display: block; width: 100%; height: auto; }
.ce-fields .field:last-of-type { margin-bottom: 12px; }
@media (max-width: 760px) { .ce-wrap { grid-template-columns: 1fr; } }

/* ---- placing words on a picture ---- */
.it-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.it-stage { position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; user-select: none; touch-action: none;
  /* Percent font-size resolves against the parent, so the stage carries a
     font-size equal to its own width and every layer size is a plain
     percentage - the same rule the renderer uses. */
  container-type: inline-size; }
.it-stage img { display: block; width: 100%; height: auto; pointer-events: none; }
.it-ly { position: absolute; cursor: move; line-height: 1.12; letter-spacing: -.02em;
  white-space: pre-wrap; word-break: break-word; padding: 2px 4px; border-radius: 4px;
  font-size: 7cqw; }
.it-ly.on { outline: 2px dashed rgba(124, 92, 255, .9); outline-offset: 3px; }
.it-side .field { margin-bottom: 12px; }
@media (max-width: 780px) { .it-wrap { grid-template-columns: 1fr; } }

/* ---- page version history ---- */
.pv-now { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: center;
  padding: 13px 14px; border: 1px solid var(--accent, #7c5cff); border-radius: var(--radius);
  background: rgba(124, 92, 255, .08); margin-bottom: 10px; }
.pv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent, #7c5cff); }
.pv-now b { display: block; font-size: 14px; }
.pv-now .mono { font-size: 11.5px; }
.pv-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--line); }
.pv-row:hover { background: var(--panel-2); }
.pv-row.gone { opacity: .5; }
.pv-when b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pv-when .mono { font-size: 11px; }
.pv-label { font-size: 13px; color: var(--muted); line-height: 1.45; }
.pv-tag { display: inline-block; margin-inline-start: 6px; font-size: 10.5px; font-weight: 700;
  background: var(--panel-2); border-radius: 99px; padding: 2px 8px; color: var(--text); }
.pv-act { display: flex; gap: 6px; }
@media (max-width: 640px) { .pv-row { grid-template-columns: 1fr; gap: 6px; } }

/* Seven actions in one table cell fit at 1400px and not at 1100. The brand
   cards learned this the hard way; this row wraps before it has to. */
.page-acts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.page-acts .btn { white-space: nowrap; }

/* ---- re-cutting one picture for other formats ---- */
.rf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.rf { font: inherit; text-align: center; cursor: pointer; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .12s, background .12s; }
.rf:hover { border-color: #3a4560; }
.rf.on { border-color: var(--accent, #7c5cff); background: rgba(124, 92, 255, .1); }
/* The shape of the target, drawn to scale - faster to read than the ratio. */
.rf-box { width: 62px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 4px; display: block; }
.rf.on .rf-box { border-color: var(--accent, #7c5cff); background: rgba(124, 92, 255, .18); }
.rf b { font-size: 13.5px; }
.rf .dim { font-size: 11.5px; line-height: 1.4; }
.rf-mode { font-size: 11px; font-weight: 700; border-radius: 99px; padding: 3px 9px; margin-top: 2px; }
.rf-mode.crop { background: rgba(34, 197, 138, .14); color: #22c58a; }
.rf-mode.bed { background: rgba(201, 162, 39, .16); color: #d8b13c; }

/* ---- filling the business in ---- */
.fd-row { display: grid; grid-template-columns: 200px 1fr; gap: 12px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid var(--line); }
.fd-tok b { display: block; font-size: 12.5px; }
.fd-tok .dim { font-size: 11px; }
.fd-row input { width: 100%; }
@media (max-width: 640px) { .fd-row { grid-template-columns: 1fr; gap: 5px; } }

/* ---- what would stop a publish ---- */
.pf-row { display: grid; grid-template-columns: 10px 1fr; gap: 12px; align-items: start;
  padding: 11px 12px; border-radius: var(--radius-sm); margin-bottom: 7px; }
.pf-row b { display: block; font-size: 13.5px; line-height: 1.5; }
.pf-row .dim { display: block; margin-top: 3px; font-size: 12px; }
.pf-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.pf-row.block { background: rgba(240, 71, 95, .1); }
.pf-row.block .pf-dot { background: var(--bad, #f0475f); }
.pf-row.warn { background: rgba(230, 168, 50, .1); }
.pf-row.warn .pf-dot { background: var(--warn, #e6a832); }

/* ---- a new post in the same design ---- */
.vr-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.vr-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.vr-preview img { width: 100%; height: auto; display: block; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel-2); }
.vr-side { max-height: 66vh; overflow: auto; }
.vr-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted);
  margin: 14px 0 7px; }
.vr-label:first-child { margin-top: 0; }
.vr-slots { display: grid; gap: 6px; }
.vr-slots input { width: 100%; font-size: 13px; }
.vr-none { font-size: 11px; color: var(--muted); line-height: 1.3; }
.vr-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.vr-swatch { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.vr-swatch input[type="color"] { width: 42px; height: 32px; padding: 0; border: 1px solid var(--line);
  border-radius: 6px; background: none; cursor: pointer; }
.vr-swatch .mono { font-size: 9.5px; color: var(--muted); }
@media (max-width: 860px) { .vr-wrap { grid-template-columns: 1fr; }
  .vr-preview { position: static; } }

/* ---- picking a colour off the preview ---- */
.vr-stage { position: relative; cursor: crosshair; }
.vr-stage img { display: block; width: 100%; height: auto; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel-2); }
/* Where the last sample was taken, so the choice is anchored to a place. */
.vr-pin { position: absolute; width: 16px; height: 16px; border-radius: 50%;
  transform: translate(-50%, -50%); box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0,0,0,.55);
  pointer-events: none; }
.vr-swatch.on input[type="color"] { border-color: var(--accent, #7c5cff); border-width: 2px; }
.vr-swatch.on .mono { color: var(--text); font-weight: 700; }

/* A landing page shrunk to a stamp. Cropped from the top rather than fitted:
   a whole page scaled down is a grey ribbon, and the hero is the part that
   makes one page recognisable as itself. */
.page-thumb { width: 84px; height: 60px; flex: none; border-radius: 6px;
  border: 1px solid var(--line); object-fit: cover; object-position: top center;
  background: var(--panel-2); display: block; }
.page-thumb.empty { background: repeating-linear-gradient(45deg,
  var(--panel-2), var(--panel-2) 6px, var(--panel) 6px, var(--panel) 12px); }
