:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f4f0ea;
  --border: #e6dfd5;
  --text: #1f1b16;
  --muted: #74695d;
  --accent: #a96d26;
  --accent-hover: #8f5b1d;
  --accent-ink: #ffffff;
  --accent-soft: #f7ecdc;
  --danger: #c0392b;
  --danger-soft: #fbe9e7;
  --ok: #2e7d4f;
  --ok-soft: #e5f4ea;
  --info: #2f6db3;
  --info-soft: #e6f0fb;
  --warn: #a8670c;
  --warn-soft: #fdf1dc;
  --shadow: 0 1px 2px rgba(31, 27, 22, 0.06), 0 4px 16px rgba(31, 27, 22, 0.06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210;
    --surface: #1c1916;
    --surface-2: #26221e;
    --border: #36302a;
    --text: #f2ede6;
    --muted: #a99e91;
    --accent: #d69a4f;
    --accent-hover: #e3ab62;
    --accent-ink: #1b140b;
    --accent-soft: #3a2c1a;
    --danger: #ef6f61;
    --danger-soft: #3b1f1c;
    --ok: #5cc48a;
    --ok-soft: #1b3326;
    --info: #74a8e8;
    --info-soft: #1c2a3b;
    --warn: #e2a64b;
    --warn-soft: #3a2c15;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
img { display: block; max-width: 100%; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; }
.brand-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-size: 14px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 1; } /* no overflow: it would clip the dropdowns */
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 600; color: var(--muted); }
main { max-width: 1440px; margin: 0 auto; padding: 24px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; }
.btn .spin { width: 14px; height: 14px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; }
label.field > .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='search'], input[type='url'], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--accent); }
.counter { font-size: 11px; color: var(--muted); font-weight: 400; }
.counter.bad { color: var(--danger); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.error-box { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 9px; }
.info-box { background: var(--info-soft); color: var(--info); padding: 10px 14px; border-radius: 9px; font-size: 13px; }
.warn-box { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 9px; font-size: 13px; }
.ok-box { background: var(--ok-soft); color: var(--ok); padding: 10px 14px; border-radius: 9px; font-size: 13px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.gray { background: var(--surface-2); color: var(--muted); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- card grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.idea-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform 0.12s; }
.idea-card:hover { transform: translateY(-2px); text-decoration: none; }
.idea-card .thumb { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 34px; position: relative; }
.idea-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.idea-card .thumb .badge { position: absolute; top: 10px; left: 10px; }
.idea-card .thumb .pending { position: absolute; bottom: 10px; right: 10px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.idea-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.idea-card .title { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- card detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.name-input { font-size: 20px !important; font-weight: 700; border-color: transparent !important; padding: 4px 8px !important; margin-left: -8px; background: transparent !important; }
.name-input:hover { border-color: var(--border) !important; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: 0.15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.shot-list { display: flex; flex-direction: column; gap: 6px; }
.shot { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.shot.on { border-color: var(--accent); background: var(--accent-soft); }
.shot .row { flex-wrap: nowrap; }
.shot select { width: 64px; padding: 4px 6px; }
.shot textarea { margin-top: 8px; font-size: 12px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.tile.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tile .img { aspect-ratio: 1; background: var(--surface-2); position: relative; cursor: zoom-in; display: grid; place-items: center; }
.tile .img img { width: 100%; height: 100%; object-fit: cover; }
.tile .img .badge { position: absolute; top: 6px; left: 6px; }
.tile .img .order { position: absolute; top: 6px; right: 6px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 22px; height: 22px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.tile .bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-top: 1px solid var(--border); }
.tile .bar label { display: flex; align-items: center; gap: 5px; font-size: 12px; flex: 1; cursor: pointer; }
.tile .bar .btn { height: 24px; padding: 0 6px; font-size: 12px; }
.tile .fail { padding: 10px; font-size: 11px; color: var(--danger); text-align: center; }
.spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 12px; font-weight: 500; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 5px; }
.chip.locked { background: var(--surface-2); color: var(--muted); padding-right: 11px; }
.chip.new { background: #fff; border: 1px dashed #e08a2e; color: #b35c00; }
.chip .col { font-size: 11px; opacity: 0.85; }
.chip .col.add { cursor: pointer; text-decoration: underline; }
.preview-html { border: 1px solid var(--border); border-radius: 9px; padding: 4px 14px; background: var(--surface-2); max-height: 380px; overflow: auto; }
.checklist { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; font-size: 13px; }
.checklist li.ok::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.checklist li.no::before { content: '○ '; color: var(--muted); }
.linkrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: 9px; font-size: 13px; }
.linkrow a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
td .thumb-sm { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
/* Campaign Meta: product thumbnails 8× the list size (384 px), shrink on narrow screens */
td .thumb-xl { width: min(384px, 60vw); min-width: min(384px, 60vw); max-width: none; height: min(384px, 60vw); border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); cursor: zoom-in; display: block; }

/* Side column that stays in view while the main column scrolls (Campaign Meta); scrolls by itself when taller than the screen */
.sticky-col { position: sticky; top: calc(var(--topbar-h, 64px) + 12px); max-height: calc(100vh - var(--topbar-h, 64px) - 24px); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.tpl-card { display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.tpl-card img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.checkgrid { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checkgrid label { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { justify-content: center; margin-bottom: 18px; font-size: 18px; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 12, 8, 0.55); z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal.wide { max-width: 860px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.lightbox img { max-height: calc(100vh - 220px); margin: 0 auto; border-radius: 8px; }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; font-size: 13px; animation: pop 0.18s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
pre.brief { white-space: pre-wrap; background: var(--surface-2); padding: 14px; border-radius: 9px; font-size: 12px; max-height: 50vh; overflow: auto; }

@media (max-width: 1000px) {
  .detail-grid, .split { grid-template-columns: 1fr; }
  .sticky-col { position: static; max-height: none; overflow: visible; } /* stacked layout: no sticky column */
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tpl-card { grid-template-columns: 1fr; }
  .userbox .who { display: none; }
}

/* waiting bar (video jobs) */
.progress { position: relative; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent, #b4782f); transition: width 1s linear; }
.progress.indeterminate > span { width: 30% !important; animation: progress-slide 1.4s ease-in-out infinite; }
@keyframes progress-slide { 0% { left: -30%; } 100% { left: 100%; } }
.progress-box { padding: 12px; border-radius: 10px; background: var(--bg-soft, rgba(180, 120, 47, 0.06)); }

/* AI cost badge on image tiles */
.tile .img .cost { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.62); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }

/* grouped navigation (workflow order) */
.nav-group { position: relative; display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav-group.active, .nav-group:hover, .nav-group.open { color: var(--accent); background: var(--accent-soft, rgba(169, 109, 38, 0.1)); }
.nav-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 190px; padding: 6px; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 50; }
@media (hover: hover) { .nav-group:hover .nav-menu { display: flex; flex-direction: column; } }
.nav-group.open .nav-menu { display: flex; flex-direction: column; }
.nav-group .nav-menu::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; } /* hover bridge */
.nav-menu a { padding: 8px 10px; border-radius: 6px; color: var(--ink, inherit); }
.nav-menu a.active, .nav-menu a:hover { background: var(--accent-soft, rgba(169, 109, 38, 0.12)); color: var(--accent); }
.lang-btn { font-weight: 700; letter-spacing: .5px; }

.new-version { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 200; background: var(--panel, #fff); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.18); display: flex; gap: 10px; align-items: center; }

.quota-line { display: flex; align-items: center; gap: 6px; }
.quota-bar { flex: 1; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 60px; }
.quota-bar > span { display: block; height: 100%; border-radius: 4px; }


/* ChatGPT-style image composer */
.composer { border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px 8px; margin-bottom: 14px; background: var(--panel, #fff); box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: border-color .15s; }
.composer:focus-within, .composer.over { border-color: var(--accent); }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 4px 2px; font: inherit; line-height: 1.45; min-height: 26px; box-shadow: none; }
.composer-files { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.composer-thumb { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.composer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.composer-thumb button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 13px; line-height: 20px; cursor: pointer; padding: 0; }
.composer-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.composer-bar select { width: auto; padding: 4px 8px; font-size: 13px; border-radius: 999px; }
.composer-opt { gap: 4px; color: var(--muted); }
.composer-send { border-radius: 999px; min-width: 64px; font-weight: 700; }

/* drag & drop swap between gallery boxes */
.tile.swappable .img { cursor: grab; }
.tile.dragging { opacity: .45; }
.tile.drop-target, .tile.swap-target:hover { outline: 3px dashed var(--accent); outline-offset: 2px; }
.tile.swap-from { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile.swap-target { cursor: copy; }

/* Team stats → products sold: thumbnail with zoom */
.sale-thumb { position: relative; width: 56px; height: 56px; flex: none; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.sale-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sale-thumb .zoom { position: absolute; right: 2px; bottom: 2px; font-size: 11px; line-height: 1; padding: 3px; border-radius: 6px; background: rgba(255, 255, 255, 0.85); opacity: 0.8; }
.sale-thumb:hover .zoom { opacity: 1; }
.sale-thumb.empty { display: grid; place-items: center; color: var(--muted); cursor: default; }

/* Idea → Jewelry step list */
.jw-step .jw-thumb { width: 40px; height: 40px; flex: none; border-radius: 6px; border: 1px solid var(--line); background: #fff; object-fit: contain; cursor: zoom-in; display: inline-block; }
.jw-step .jw-thumb.empty { background: var(--surface-2); cursor: default; }

/* batch progress bar */
.progress { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line); }
.progress .seg.ok { background: var(--ok); }
.progress .seg.bad { background: var(--danger); }
.progress .seg.run { background: var(--info); opacity: 0.7; }

/* personalization editor */
.pz-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pz-row input[type=text] { flex: 1; min-width: 140px; }
.pz-preview { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.pz-preview-row { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.pz-preview-input { border: 1px solid var(--line); border-radius: 5px; padding: 6px 10px; background: #fff; }

tr.row-picked td { background: var(--accent-soft); }

/* batch: video preview cell */
.batch-video { position: relative; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; }
.batch-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.batch-video .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 16px; background: rgba(0,0,0,0.25); }
.batch-video:hover .play { background: rgba(0,0,0,0.1); }

.review-thumb { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; flex: none; }
.progress .seg.wait { background: #e0a43a; }
.badge.amber { background: #fdf0d8; color: #8a5a07; }

/* Stats → products of one interest */
.interest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; max-height: 70vh; overflow-y: auto; }
.interest-card { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface); }
.interest-card img, .interest-noimg { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 8px; cursor: zoom-in; display: grid; place-items: center; }

/* Campaign Meta → product picker as a grid (thumbnail on top, details below) */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.product-tile { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.product-tile:hover { border-color: var(--accent); }
.product-tile.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.product-tile img, .product-tile-noimg { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 9px; cursor: zoom-in; display: grid; place-items: center; }
.product-tile-check { position: absolute; top: 16px; left: 16px; width: 20px; height: 20px; z-index: 1; cursor: pointer; }

/* Kiểu đúc page: visual explainer (diagram + real example per casting form) */
.form-ex { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 8px; }
.form-ex-col { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.form-ex-title { font-weight: 700; font-size: 15px; }
.form-ex-diagram { color: var(--muted); max-width: 340px; }
.form-ex-diagram svg { width: 100%; height: auto; display: block; }
.form-ex-col ul { margin: 0; padding-left: 18px; }
.form-ex-photos { display: flex; gap: 10px; }
.form-ex-photos figure { margin: 0; flex: 1; max-width: 160px; }
.form-ex-photos img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: zoom-in; }
.form-ex-photos figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 2px; }
@media (max-width: 760px) { .form-ex { grid-template-columns: 1fr; } }

/* Duyệt sản phẩm: grid, exactly 5 products per row on desktop */
.review-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.review-tile { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.review-tile img, .review-noimg { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 9px; cursor: zoom-in; display: grid; place-items: center; }
.review-tile .chips { flex-wrap: wrap; }
@media (max-width: 1000px) { .review-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Creative tile: ad copy of its own */
.tile .bar .copy-custom { color: var(--accent); font-weight: 600; }

/* Tuan Nguyen Admin · skill video */
.lab-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.lab-skill { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: inherit; text-decoration: none; }
.lab-skill:hover { border-color: var(--accent); }
.lab-skill.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.lab-thumbs { display: flex; gap: 4px; height: 72px; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.lab-thumbs img { height: 72px; width: 72px; object-fit: cover; flex: 0 0 auto; }
.lab-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lab-preview img, .lab-guide { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; margin-top: 4px; }

/* Customer photos: photos only */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.photo-only img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #eee; cursor: zoom-in; display: block; }

/* Lab: deliverable scene (e.g. the ad mockup of the silver relief workflow) */
.tile.deliverable { outline: 2px solid var(--ok, #2a7); outline-offset: -2px; }

/* Append ads page */
.append-adset { border-top: 1px solid var(--line); padding: 10px 0; }
.append-creatives { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.append-creative { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 112px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.append-creative.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.append-creative.in-adset { opacity: 0.55; cursor: default; }
.append-creative img, .append-video { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 6px; display: grid; place-items: center; font-size: 12px; color: var(--muted); }

/* variant image (21/10) */
.vimg { width: 40px; height: 40px; padding: 0; border: 1px dashed var(--border); border-radius: 6px; background: var(--surface-2); cursor: pointer; overflow: hidden; display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.vimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vimg:disabled { cursor: default; }
.vimg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 52vh; overflow-y: auto; }
.vimg-opt { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 6px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; min-height: 120px; justify-content: center; }
.vimg-opt img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; }
.vimg-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }

/* Creative → Campaigns (23/10) */
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cc-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.cc-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.cc-card.exported { opacity: 0.85; }
.cc-tick { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(255,255,255,0.85); border-radius: 6px; padding: 2px 4px; }
.cc-tick input { width: 18px; height: 18px; }
.cc-media { aspect-ratio: 1; background: var(--surface-2); border-radius: 8px; overflow: hidden; display: grid; place-items: center; }
.cc-media img, .cc-media video { width: 100%; height: 100%; object-fit: cover; }
.cc-group.on { border-color: var(--accent); }
.cc-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cc-item { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cc-item.missing { opacity: 0.5; }
.cc-item-media { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #fff; }
.cc-item-media img, .cc-item-media video { width: 100%; height: 100%; object-fit: cover; }
/* 26/10: Creative → Campaigns section 1 — small tiles instead of big cards */
.cc-idea-cards .cc-card.cc-tile, .cc-card.cc-tile { flex: 0 0 84px; width: 84px; padding: 3px; gap: 2px; cursor: pointer; }
.cc-idea-cards.wrap { flex-wrap: wrap; overflow: visible; }
.cc-tile .cc-media { border-radius: 6px; }
.cc-tile .cc-tick { top: 5px; left: 5px; padding: 0 2px; }
.cc-tile .cc-tick input { width: 16px; height: 16px; }
.cc-tile.grouped { border-color: #12b76a; }
.cc-tile.on { border-color: var(--accent); }
.cc-tile-flag { position: absolute; top: 4px; right: 5px; z-index: 2; font-size: 12px; background: rgba(255,255,255,0.85); border-radius: 6px; padding: 0 3px; }
.cc-tile-label { font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-tile-vid { width: 100%; height: 100%; background: #222 center / cover; display: grid; place-items: center; color: #fff; font-size: 20px; text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
.cc-tile-del { position: absolute; bottom: 18px; right: 5px; z-index: 2; border: 0; border-radius: 50%; width: 18px; height: 18px; line-height: 16px; background: rgba(255,255,255,0.9); color: var(--danger, #b42318); cursor: pointer; padding: 0; }
/* 26/10: Creative Hub — compact form, filter chips, runs (batches) and one-line idea rows */
.hub-form { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.hub-form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hub-form-row select { width: auto; flex: 1; min-width: 200px; }
.hub-preview { display: flex; flex-wrap: wrap; gap: 4px; }
.hub-preview:empty { display: none; }
.hub-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.hub-help summary { cursor: pointer; }
.hub-help > div { margin-top: 6px; max-width: 900px; line-height: 1.45; }
.hub-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hub-tools .chip { cursor: pointer; border: 1px solid var(--border); background: var(--surface); padding: 4px 11px; color: var(--text, inherit); }
.hub-tools .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hub-tools input[type=search] { width: auto; }
.hub-batch { display: flex; flex-direction: column; gap: 6px; }
.hub-batch-head { display: flex; gap: 8px; align-items: center; padding: 6px 4px; cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); }
.hub-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.hub-row:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.hub-row.attention { border-left: 3px solid var(--danger, #b42318); }
.hub-row.running { border-left: 3px solid #d97706; }
.hub-ths { display: flex; gap: 4px; flex: none; }
.hub-th { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; color: var(--muted); cursor: zoom-in; }
.hub-th.hub-blank { cursor: default; }
.hub-th.vid { background-size: cover; background-position: center; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.7); font-size: 16px; cursor: pointer; }
.hub-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hub-subject { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .hub-row { flex-wrap: wrap; } .hub-ths .hub-th:nth-child(n+4) { display: none; } }
/* 25/10: action bar of section 1 — under the grid, sticks to the bottom while creatives are ticked */
.cc-pickbar { position: sticky; bottom: 12px; z-index: 6; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 24px rgba(0,0,0,0.12); }
.cc-pickbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cc-pickbar-row input[type=text], .cc-pickbar-row input[type=url] { width: auto; }
.cc-pickbar-row select { width: auto; max-width: 220px; }
/* 24/10: creatives grouped per Creative Hub idea, one row each */
.cc-ideas { display: flex; flex-direction: column; gap: 8px; }
.cc-idea { display: flex; gap: 10px; align-items: stretch; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.cc-idea.on { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.cc-idea-head { flex: 0 0 170px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; }
.cc-idea-head input[type=checkbox] { width: 18px; height: 18px; }
.cc-idea-subject { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.cc-idea-cards { flex: 1; display: flex; gap: 8px; overflow-x: auto; min-width: 0; }
.cc-idea-cards .cc-card { flex: 0 0 150px; }
.cc-idea-uploads { flex-direction: column; }
.cc-idea-uploads .cc-idea-head { flex: none; flex-direction: row; align-items: baseline; gap: 8px; cursor: default; }
@media (max-width: 640px) { .cc-idea { flex-direction: column; } .cc-idea-head { flex: none; } .cc-idea-cards .cc-card { flex-basis: 130px; } }
/* 24/10: quick multi-pick of groups — toolbar, compact rows, sticky summary */
.cc-group-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cc-group-tools select, .cc-group-tools input[type=search] { width: auto; }
.cc-tools-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 2px; }
.cc-seg { display: inline-flex; }
.cc-seg .btn { border-radius: 0; }
.cc-seg .btn:first-child { border-radius: 8px 0 0 8px; }
.cc-seg .btn:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.cc-seg .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cc-grow { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; user-select: none; }
.cc-grow:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.cc-grow.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.cc-grow.locked { cursor: default; opacity: 0.75; }
.cc-grow input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.cc-grow-thumbs { display: flex; gap: 3px; flex: none; align-items: center; }
.cc-grow-thumbs img, .cc-grow-vid { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.cc-grow-more { font-size: 11px; color: var(--muted); }
.cc-grow-main { flex: 1; min-width: 0; }
.cc-grow-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-group-sticky { position: sticky; bottom: 12px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 24px rgba(0,0,0,0.12); }
@media (max-width: 640px) { .cc-grow-thumbs img:nth-child(n+3) { display: none; } .cc-grow { flex-wrap: wrap; } }
.cc-item textarea, .cc-item input { font-size: 12px; }
/* 26/10: compact idea rows of Creative → Campaigns (kept last so they override the 24/10 rules above) */
.cc-idea { padding: 6px 8px; gap: 8px; }
.cc-idea-head { flex: 0 0 220px; gap: 2px; }
.cc-idea-subject { -webkit-line-clamp: 2; font-size: 12.5px; }
/* 26/10: archive button on a creative tile (shown on hover / touch) */
.cc-tile-arch { position: absolute; bottom: 18px; left: 5px; z-index: 2; border: 0; border-radius: 6px; height: 18px; min-width: 18px; padding: 0 3px; font-size: 11px; line-height: 18px; background: rgba(255,255,255,0.92); cursor: pointer; opacity: 0; transition: opacity .15s; }
.cc-tile:hover .cc-tile-arch, .cc-tile:focus-within .cc-tile-arch { opacity: 1; }
@media (hover: none) { .cc-tile-arch { opacity: 1; } }
/* 26/10: replace a hub picture with the designer's own image */
.cc-tile-swap { position: absolute; bottom: 18px; right: 5px; z-index: 2; border: 0; border-radius: 6px; height: 18px; min-width: 18px; padding: 0 4px; font-size: 11px; line-height: 18px; background: rgba(255,255,255,0.92); cursor: pointer; opacity: 0; transition: opacity .15s; }
.cc-tile:hover .cc-tile-swap, .cc-tile:focus-within .cc-tile-swap { opacity: 1; }
@media (hover: none) { .cc-tile-swap { opacity: 1; } }
/* 27/10: Creative Hub own-image upload box */
.hub-own-drop { display: grid; place-items: center; border: 2px dashed var(--border); background: var(--surface-2); color: var(--muted); font-size: 13px; cursor: pointer; }
.hub-own-drop:hover { border-color: var(--accent); color: var(--accent); }
