:root {
  --bg: #0b0d12;
  --bg-2: #12151d;
  --panel: #161a24;
  --panel-2: #1c2130;
  --border: #262c3a;
  --text: #e8ebf2;
  --muted: #8b93a7;
  --primary: #6d5efc;
  --primary-2: #8b7dff;
  --accent: #22d3a6;
  --danger: #f26d6d;
  --warn: #f7b955;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 800px at 80% -10%, #1a1e2e 0%, var(--bg) 55%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Login */
.login-screen {
  position: fixed; inset: 0;
  display: grid; place-items: center;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 360px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.brand-mark { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.login-sub { margin: -6px 0 10px; color: var(--muted); font-size: 14px; }
.login-card input {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px 14px; font: inherit;
}
.login-error { color: #ff8080; font-size: 13px; min-height: 16px; }

/* App shell */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.logo-dot { width: 12px; height: 12px; border-radius: 4px; background: linear-gradient(135deg, var(--primary), var(--accent)); }

/* ---- top-left brand switcher ---- */
.brand-switcher { position: relative; margin-top: -14px; }
.brand-switch-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 11px; cursor: pointer; color: var(--text); font: inherit; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.brand-switch-btn:hover { border-color: var(--primary); background: var(--panel-2); }
.brand-switch-btn[aria-expanded="true"] { border-color: var(--primary); background: var(--panel-2); }
.brand-switch-logo {
  width: 30px; height: 30px; flex: none; border-radius: 8px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--border);
}
.brand-switch-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-switch-glyph { font-size: 13px; font-weight: 700; color: var(--muted); }
.brand-switch-labels { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.brand-switch-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.brand-switch-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-switch-caret { color: var(--muted); font-size: 11px; flex: none; }
.brand-switch-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px; max-height: 320px; overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}
.brand-switch-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; border-radius: 9px; cursor: pointer;
  padding: 7px 9px; color: var(--text); font: inherit; text-align: left;
}
.brand-switch-option:hover { background: var(--panel-2); }
.brand-switch-option.active { background: var(--panel-2); }
.brand-switch-option-logo {
  width: 26px; height: 26px; flex: none; border-radius: 7px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--border);
}
.brand-switch-option-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-switch-option-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 1px; }
.brand-switch-option-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-switch-option-meta { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-switch-check { color: var(--accent); font-size: 12px; flex: none; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: none; color: var(--muted);
  font: inherit; font-weight: 600; text-align: left;
  padding: 11px 14px; border-radius: 10px; cursor: pointer;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); }
.nav-ico { font-size: 14px; opacity: 0.9; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.version { font-size: 11px; color: var(--muted); }

/* Content */
.content { padding: 34px 40px 60px; overflow-y: auto; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; gap: 20px; }
.view-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.5px; }
.view-head p { margin: 0; font-size: 14px; }

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

.kit-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: border 0.15s, transform 0.1s;
}
.kit-card:hover { border-color: #39415a; transform: translateY(-2px); }
.kit-logo-wrap {
  height: 120px; display: grid; place-items: center; padding: 18px;
  background: repeating-conic-gradient(#1d212b 0% 25%, #1b1f28 0% 50%) 50% / 22px 22px;
}
.kit-logo-wrap img { max-height: 84px; max-width: 80%; object-fit: contain; }
.kit-logo-wrap .no-logo { color: var(--muted); font-size: 13px; }
.kit-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.kit-name { font-weight: 700; font-size: 16px; }
.kit-meta { font-size: 12px; color: var(--muted); }
.swatches { display: flex; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.12); }
.kit-refs { display: flex; gap: 6px; }
.kit-refs img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); }
.kit-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Generate layout */
.generate-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.4; }
.field-label { display: block; margin: 8px 0 8px; }
.field input, .field select, .field textarea {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 11px 13px; font: inherit;
}
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-2); font-size: 13px; cursor: pointer; user-select: none;
}
.chip.on { background: rgba(109,94,252,0.18); border-color: var(--primary); color: #cfc7ff; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }

/* Progress */
.progress-panel h3 { margin: 0 0 14px; }
.gen-status { font-size: 13px; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; display: inline-block; }
.gen-status.idle { background: var(--panel-2); color: var(--muted); }
.gen-status.running { background: rgba(247,185,85,0.16); color: var(--warn); }
.gen-status.done { background: rgba(34,211,166,0.16); color: var(--accent); }
.gen-status.error { background: rgba(242,109,109,0.16); color: #ff8080; }
.progress-bar { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.3s ease; }
.gen-log {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; height: 260px; overflow-y: auto; font-size: 12px;
  color: #b9c0d0; white-space: pre-wrap; margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.gen-done { margin-top: 14px; padding: 14px; border-radius: 10px; background: var(--panel-2); }
.gen-done .stat { display: inline-block; margin-right: 16px; font-weight: 700; }
.gen-done .stat small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }

.thumb-creator { margin-top: 20px; }
.thumb-form { margin-bottom: 18px; }
.thumb-formats { font-size: 12px; line-height: 1.5; margin: 0 0 14px; }
.thumb-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.thumb-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.thumb-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #111;
}
.thumb-card figcaption {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.thumb-card strong { display: block; color: var(--text); font-size: 12px; margin-bottom: 2px; }

/* Library */
.campaign-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform 0.1s, border 0.15s; }
.campaign-card:hover { transform: translateY(-2px); border-color: #39415a; }
.campaign-cover { height: 150px; background: var(--bg-2); background-size: cover; background-position: center; }
.campaign-body { padding: 14px; }
.campaign-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; word-break: break-all; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pill { font-size: 11px; padding: 4px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.pill.warn { background: rgba(247,185,85,0.16); color: var(--warn); }

/* Campaign detail */
.campaign-detail { margin-top: 10px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; }
.detail-head h2 { margin: 0; word-break: break-all; }
.detail-head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }

.push-card { width: min(720px, 96vw); }
.push-summary {
  font-size: 13px; color: var(--muted); margin-bottom: 14px;
  padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
}
.push-summary b { color: var(--text); }
.push-summary code { font-size: 12px; color: var(--primary-2); }
.push-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--text); margin: 10px 0;
}
.push-check input { margin-top: 2px; }
.push-plan {
  margin-top: 14px; padding: 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
}
.push-plan h4 { margin: 0 0 8px; font-size: 13px; }
.push-counts, .push-issues { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.push-issues .push-err, .push-issues li.push-err { color: var(--danger); }
.push-issues.warn, .push-issues .push-warn { color: var(--warn); }
.push-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.group-title { margin: 26px 0 12px; font-size: 15px; text-transform: capitalize; color: var(--text); display: flex; align-items: center; gap: 10px; }
.group-title small { color: var(--muted); font-weight: 500; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.asset { position: relative; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.asset img, .asset video { width: 100%; display: block; background: #000; }
.asset .badges {
  position: absolute; top: 8px; left: 8px; display: flex; gap: 5px;
  flex-wrap: wrap; max-width: calc(100% - 76px); z-index: 2;
}
.badge { font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 6px; backdrop-filter: blur(4px); }
.badge.perf { background: rgba(34,211,166,0.85); color: #05221a; }
.badge.awar { background: rgba(109,94,252,0.85); color: #fff; }
.badge.aes { background: rgba(250,204,21,0.9); color: #2a2000; }
.badge.place { background: rgba(56,189,248,0.9); color: #042033; }
/* Video concepts are scored as copy before render — distinct hue from the
   image scores so the two are never misread as the same measurement. */
.badge.concept { background: rgba(167,139,250,0.9); color: #1b1040; }
.badge.verdict { background: rgba(15,23,42,0.75); color: #e6e8ef; border: 1px solid rgba(255,255,255,0.18); }
.badge.verdict.ok { color: #7ff0d2; border-color: rgba(34,211,166,0.5); }
.badge.verdict.warn { color: #f0c878; border-color: rgba(247,185,85,0.5); }
.badge.verdict.bad { color: #ff9d9d; border-color: rgba(242,109,109,0.5); }
.asset .flag-badge { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 6px; background: rgba(244,63,94,0.9); color: #fff; backdrop-filter: blur(4px); }
.asset .flag-badge.place-issues { background: rgba(247,185,85,0.95); color: #2a2000; }
.asset.flagged { border-color: rgba(244,63,94,0.6); }

/* Card selection */
.asset.selectable .badges { left: 42px; max-width: calc(100% - 118px); }
.card-select {
  position: absolute; top: 8px; left: 8px; z-index: 4;
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85); background: rgba(15,18,28,0.55);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.9); transition: opacity 0.12s, transform 0.12s, background 0.12s;
  backdrop-filter: blur(3px);
}
.card-select .cs-check { font-size: 14px; line-height: 1; opacity: 0; }
.asset:hover .card-select,
.asset.selected .card-select,
.selecting .card-select { opacity: 1; transform: scale(1); }
.card-select:hover { border-color: var(--primary); }
.asset.selected .card-select { background: var(--primary); border-color: var(--primary); }
.asset.selected .card-select .cs-check { opacity: 1; }
.asset.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(109,94,252,0.55); }
.asset .caption { padding: 8px 10px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }

.copy-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 26px; }
.copy-group { margin-bottom: 16px; }
.copy-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.copy-list { display: flex; flex-wrap: wrap; gap: 8px; }
.copy-item { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px; font-size: 13px; }
.copy-item small { color: var(--muted); margin-left: 6px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(5,7,12,0.7); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; width: min(880px, 96vw); max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 20px; }
.icon-btn { background: transparent; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 24px; }
.modal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 22px; }
.form-error { color: #ff8080; font-size: 13px; margin-right: auto; }

/* Dropzones */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 18px;
  text-align: center; cursor: pointer; margin-bottom: 8px; transition: border 0.15s, background 0.15s;
}
.dropzone.drag { border-color: var(--primary); background: rgba(109,94,252,0.08); }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.dz-ico { font-size: 20px; }
.dz-preview { margin-top: 12px; }
.dz-preview.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dz-preview img { border-radius: 8px; object-fit: cover; width: 100%; }
.dz-preview.grid img { height: 60px; }
#logo-preview img { max-height: 80px; }

/* Logo background toggle */
.logo-bg-toggle { margin: 10px 0 4px; font-size: 13px; color: var(--muted); }

/* Existing references (edit mode) */
.existing-refs { margin-bottom: 10px; }
.existing-ref { position: relative; }
.existing-ref img { height: 60px; width: 100%; object-fit: cover; border-radius: 8px; display: block; }
.existing-ref.marked img { opacity: 0.32; filter: grayscale(1); }
.existing-ref .ref-x {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; line-height: 18px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.65); color: #fff;
  font-size: 12px; cursor: pointer; padding: 0; text-align: center;
}
.existing-ref .ref-x:hover { background: rgba(0,0,0,0.85); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; font-size: 14px;
}
.toast.err { border-color: #6e2b2b; }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Library: filters ---------- */
.filter-bar {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 10px;
}
.score-guide {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 11px;
}
.score-guide > span:not(.filter-label) {
  font-size: 11px; color: var(--muted); cursor: help;
}
.score-guide b { color: var(--text); margin-right: 3px; }
.filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-right: 2px; }
.filter-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }
.fchip {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
}
.fchip small { color: var(--muted); font-weight: 500; margin-left: 3px; }
.fchip:hover { border-color: #39415a; }
.fchip.on { background: rgba(109,94,252,0.18); border-color: var(--primary); color: #cfc7ff; }
.fchip.on small { color: #a99dff; }

/* ---------- Upload shortlist (best picks) ---------- */
.bp-note {
  border-top: 1px solid var(--border); padding-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.bp-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.bp-cell {
  font-size: 11px; color: var(--muted); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
}
.bp-cell b { color: var(--text); font-weight: 700; margin-right: 4px; }
.bp-hint { font-size: 11px; }
.bp-warn { font-size: 11px; font-weight: 700; color: var(--warn); }
.bp-issues {
  margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px;
  font-size: 11px; color: var(--warn);
}
.bp-issues li { line-height: 1.45; }

/* ---------- Library: format sections ---------- */
.format-section { margin-top: 30px; }
.format-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.format-head .group-title { margin: 0; }
.ratio-tag { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel-2); border-radius: 6px; padding: 3px 7px; }
.format-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.req-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 8px; border-radius: 6px; }
.req-badge.req { background: rgba(34,211,166,0.16); color: var(--accent); }
.req-badge.rec { background: rgba(247,185,85,0.16); color: var(--warn); }
.req-badge.opt { background: var(--panel-2); color: var(--muted); }
.camp-chip { font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: rgba(109,94,252,0.14); color: #b5aaff; }
.platform-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.platform-chip { font-size: 11px; padding: 4px 9px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); }
.placement-details { margin: 6px 0 12px; font-size: 13px; color: var(--muted); }
.placement-details summary { cursor: pointer; color: var(--primary-2); font-weight: 600; font-size: 12px; user-select: none; }
.placement-details[open] summary { margin-bottom: 8px; }
.placement-details ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.placement-details b { color: var(--text); }
.placement-role { margin: 4px 0; }

/* ---------- Library: asset cards ---------- */
.asset.clickable { cursor: zoom-in; transition: transform 0.1s, border 0.15s; }
.asset.clickable:hover { transform: translateY(-2px); border-color: #39415a; }
.angle-chip { color: #b5aaff; font-weight: 600; }
.variant-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.5px; color: var(--warn);
  background: rgba(247,185,85,0.14); border-radius: 4px; padding: 2px 5px; margin-right: 6px;
}
.play-hint {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%);
  width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,0.6);
  color: #fff; display: grid; place-items: center; font-size: 16px; pointer-events: none;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 80; background: rgba(4,6,10,0.88);
  backdrop-filter: blur(6px); display: grid; place-items: center; padding: 28px;
}
.lb-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px;
  width: min(1240px, 100%); height: min(86vh, 900px);
}
.lb-main { display: flex; flex-direction: column; min-width: 0; }
.lb-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.lb-tab {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; cursor: pointer;
}
.lb-tab.on { background: rgba(109,94,252,0.18); border-color: var(--primary); color: #cfc7ff; }
.lb-stage {
  flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden;
  background: repeating-conic-gradient(#14171f 0% 25%, #12151d 0% 50%) 50% / 26px 26px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.18s ease; cursor: zoom-in; }
.lb-stage img.zoomed { cursor: zoom-out; }
.lb-stage video { max-width: 100%; max-height: 100%; }
.lb-placements { flex: 1; min-height: 0; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 18px; }
.lb-place-intro { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.lb-meta {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.lb-meta-title { font-size: 17px; font-weight: 800; }
.lb-meta-sub { font-size: 12px; color: var(--muted); margin-top: -8px; }
.lb-meta-row { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-meta-block h5 { margin: 0 0 7px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.lb-kv { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.lb-kv span { color: var(--muted); }
.lb-file { font-size: 11px; word-break: break-all; text-align: right; max-width: 170px; }
.lb-flags { font-size: 12px; color: #ff9d9d; background: rgba(244,63,94,0.12); border-radius: 8px; padding: 8px 10px; }
.asset-revise-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.asset-revise-actions .quick-logo-btn { grid-column: 1 / -1; }
.fix-recommendation {
  display: flex; flex-direction: column; gap: 4px; padding: 10px;
  border-radius: 9px; background: rgba(109,94,252,0.12);
  border: 1px solid rgba(109,94,252,0.3);
}
.fix-recommendation b { font-size: 11px; color: #cfc7ff; text-transform: uppercase; letter-spacing: 0.4px; }
.fix-recommendation span { font-size: 12px; color: var(--text); }
.fix-recommendation small { font-size: 10px; color: var(--muted); line-height: 1.35; }
.lb-count { text-align: center; font-size: 12px; color: var(--muted); margin-top: auto; }
.lb-close {
  position: absolute; top: 18px; right: 22px; z-index: 82;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 50%; font-size: 15px; cursor: pointer;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 82;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer; line-height: 1;
}
.lb-nav:hover, .lb-close:hover { background: var(--panel-2); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }

/* ---------- Creative revision modal ---------- */
#revise-modal { z-index: 120; }
.revise-card { width: min(680px, 96vw); }
.revise-subtitle { margin: 5px 0 0; font-size: 13px; }
.revise-preview-row {
  display: grid; grid-template-columns: 180px 1fr; gap: 18px;
  align-items: center; margin-bottom: 20px;
}
#revise-preview {
  width: 180px; max-height: 150px; object-fit: contain; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
}
.revise-help { display: flex; flex-direction: column; gap: 6px; }
.revise-help b { font-size: 12px; color: var(--text); }
.revise-help span { font-size: 11px; color: var(--muted); }
.revise-progress { margin-top: 14px; }
#revise-status { font-size: 12px; margin-top: 6px; }

/* ---------- Quick logo editor ---------- */
#logo-edit-modal { z-index: 125; }
.logo-edit-card { width: min(720px, 96vw); }
.logo-edit-layout {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; align-items: center;
}
.logo-position-preview {
  position: relative; min-height: 230px; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; background: var(--bg-2);
}
.logo-position-preview > img { width: 100%; height: 230px; display: block; object-fit: cover; }
.logo-position-marker {
  position: absolute; padding: 6px 10px; border-radius: 6px;
  background: rgba(109,94,252,0.9); color: #fff; font-size: 11px; font-weight: 800;
  border: 1px solid rgba(255,255,255,0.3); transform: translate(0, 0);
  transition: inset 0.15s, transform 0.15s, font-size 0.15s, padding 0.15s;
}
.logo-position-marker.top_right { top: 10px; right: 10px; }
.logo-position-marker.top_left { top: 10px; left: 10px; }
.logo-position-marker.bottom_right { bottom: 10px; right: 10px; }
.logo-position-marker.bottom_left { bottom: 10px; left: 10px; }
.logo-position-marker.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.logo-controls { display: grid; gap: 18px; }
.logo-control-group {
  padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg-2);
}
.logo-control-label {
  display: block; margin-bottom: 9px; color: var(--text); font-size: 12px; font-weight: 750;
}
.logo-position-pad {
  position: relative; width: 150px; height: 92px; margin: 0 auto;
  border: 2px solid var(--border); border-radius: 10px;
  background: linear-gradient(135deg, rgba(109,94,252,0.08), transparent);
}
.logo-point {
  position: absolute; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 2px solid var(--muted); background: var(--bg); cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.logo-point::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%; background: currentColor;
}
.logo-point:hover { transform: scale(1.12); border-color: var(--primary); color: var(--primary); }
.logo-point.on {
  color: #fff; border-color: var(--primary); background: var(--primary);
  box-shadow: 0 0 0 4px rgba(109,94,252,0.18);
}
.logo-point.top_left { top: 8px; left: 8px; }
.logo-point.top_right { top: 8px; right: 8px; }
.logo-point.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.logo-point.center:hover { transform: translate(-50%, -50%) scale(1.12); }
.logo-point.bottom_left { bottom: 8px; left: 8px; }
.logo-point.bottom_right { bottom: 8px; right: 8px; }
.logo-control-value { margin-top: 7px; color: var(--muted); font-size: 11px; text-align: center; }
.logo-size-heading { display: flex; justify-content: space-between; align-items: center; }
.logo-size-heading .logo-control-label { margin: 0; }
.logo-size-heading b { color: var(--primary); font-size: 13px; }
.logo-volume-control { display: flex; gap: 9px; align-items: center; margin-top: 12px; }
.logo-volume-icon { color: var(--muted); line-height: 1; }
.logo-volume-icon.small { font-size: 15px; }
.logo-volume-icon.large { font-size: 23px; }
#logo-edit-scale {
  width: 100%; height: 8px; padding: 0; border: 0; border-radius: 999px;
  accent-color: var(--primary); cursor: ew-resize;
}
.logo-size-ticks {
  display: flex; justify-content: space-between; padding: 4px 27px 0;
  color: var(--muted); font-size: 9px;
}
.logo-scope-note {
  font-size: 12px; line-height: 1.5; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px;
}
#logo-edit-status { font-size: 12px; margin-top: 6px; }

/* ---------- Mass editor tray ---------- */
.mass-tray {
  position: fixed; left: 50%; bottom: 18px; top: auto; right: auto;
  transform: translateX(-50%);
  z-index: 90; width: min(880px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.45); padding: 0 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
  user-select: none;
}
.mass-tray.dragged { transform: none; }
.mass-tray.dragging { box-shadow: 0 22px 55px rgba(0,0,0,0.55); cursor: grabbing; }
.mass-tray.hidden { display: none; }
.mt-drag {
  display: flex; align-items: center; gap: 8px; margin: 0 -14px; padding: 8px 14px 2px;
  cursor: grab; color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
  border-radius: 14px 14px 0 0;
}
.mt-drag:active { cursor: grabbing; }
.mt-drag-dots {
  width: 18px; height: 12px;
  background:
    radial-gradient(circle, currentColor 1.2px, transparent 1.3px) 0 0 / 6px 6px,
    radial-gradient(circle, currentColor 1.2px, transparent 1.3px) 0 6px / 6px 6px;
  opacity: 0.7;
}
.mt-drag-label { opacity: 0.85; }
.mass-tray-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.mt-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mt-count {
  font-weight: 800; font-size: 13px; color: var(--text);
  background: rgba(109,94,252,0.16); border: 1px solid rgba(109,94,252,0.4);
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}
.mt-count.empty {
  background: var(--bg-2); border-color: var(--border); color: var(--muted); font-weight: 700;
}
.mt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mt-actions .btn { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); }
.mt-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.mt-actions .btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.mt-panel {
  border-top: 1px solid var(--border); padding-top: 11px;
  display: flex; flex-direction: column; gap: 11px;
  user-select: text;
}
.mt-panel.hidden { display: none; }
.mt-sub.hidden { display: none; }
#mt-prompt {
  width: 100%; font: inherit; font-size: 13px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
}
.mt-logo-controls { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
#mt-logo-pad { margin: 0; }
.mt-size { flex: 1; min-width: 200px; }
#mt-scale {
  width: 100%; height: 8px; padding: 0; border: 0; border-radius: 999px;
  accent-color: var(--primary); cursor: ew-resize;
}
.mt-size-label { margin-top: 8px; font-size: 12px; color: var(--muted); }
.mt-size-label b { color: var(--primary); }
.mt-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt-panel-hint, #mt-panel-hint { font-size: 12px; }
.mt-panel-btns { display: flex; gap: 8px; }
.mt-progress .progress-bar {
  height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden;
}
.mt-progress .progress-fill { height: 100%; background: var(--primary); width: 0; transition: width 0.3s; }
#mt-status { font-size: 12px; margin-top: 6px; }
.mass-tray.busy { opacity: 0.96; }

@media (max-width: 620px) {
  .mass-tray:not(.dragged) { left: 8px; right: 8px; transform: none; width: auto; }
  .mass-tray-main { flex-direction: column; align-items: stretch; }
  .mt-logo-controls { justify-content: center; }
}

/* ---------- Placement mockups ---------- */
.mock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; align-items: start; }
.mock { display: flex; flex-direction: column; gap: 7px; }
.mock-surface { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary-2); }
.mock-caption { font-size: 11px; color: var(--muted); line-height: 1.45; }
.mock-verdict {
  margin-top: 6px; border-radius: 8px; padding: 8px 10px; font-size: 11px; line-height: 1.4;
  border: 1px solid var(--border);
}
.mock-verdict.ok { background: rgba(34,211,166,0.12); border-color: rgba(34,211,166,0.35); color: var(--accent); font-weight: 700; }
.mock-verdict.warn { background: rgba(247,185,85,0.12); border-color: rgba(247,185,85,0.4); color: #f0c878; }
.mock-verdict.bad { background: rgba(242,109,109,0.12); border-color: rgba(242,109,109,0.4); color: #ff9d9d; }
.mock-verdict.note { background: rgba(109,94,252,0.1); border-color: rgba(109,94,252,0.3); color: #cfc7ff; }
.mock-verdict .mv-label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; font-size: 10px; display: block; margin-bottom: 3px; }
.mock-verdict .mv-note + .mv-note { margin-top: 4px; }
.place-score.ok { color: var(--accent); }
.place-score.warn { color: var(--warn); }
.place-score.bad { color: #ff8080; }
.place-issue-list { margin: 8px 0 0; padding-left: 16px; font-size: 12px; color: #f0c878; display: flex; flex-direction: column; gap: 4px; }
.place-ok-msg { margin-top: 6px; font-size: 12px; color: var(--accent); }

/* Concept check — video pre-render review */
.lb-meta-block h5 small { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: 0.7; }
.dim-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.dim-chip {
  display: inline-flex; align-items: baseline; gap: 4px; font-size: 11px;
  padding: 3px 7px; border-radius: 6px; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); color: var(--muted);
}
.dim-chip b { font-weight: 600; color: var(--muted); }
.dim-chip.ok { color: var(--accent); border-color: rgba(34,211,166,0.35); }
.dim-chip.warn { color: #f0c878; border-color: rgba(247,185,85,0.35); }
.dim-chip.bad { color: #ff9d9d; border-color: rgba(242,109,109,0.35); }
.concept-beats { margin-top: 11px; }
.concept-beats-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted);
}
.concept-beats ol {
  margin: 6px 0 0; padding-left: 17px; display: flex; flex-direction: column; gap: 3px;
  font-size: 12px;
}
.concept-beats li { display: flex; justify-content: space-between; gap: 8px; }
.concept-beats li small { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.concept-beats li.end-card span { color: var(--muted); font-style: italic; }
.concept-sub { margin-top: 6px; font-size: 11px; color: var(--muted); }
.concept-gates { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.gate-fail {
  font-size: 12px; color: #ff9d9d; background: rgba(244,63,94,0.12);
  border-radius: 7px; padding: 6px 8px;
}
.mock-frame { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.mock-frame.m-light { background: #fff; color: #1f1f1f; }
.mock-frame.m-dark { background: #0f0f0f; color: #f1f1f1; }
.mock-frame.m-phone { max-width: 230px; }
.m-media { background: #d8dbe2; }
.m-media img, .m-media video { width: 100%; display: block; }
.m-media.square img, .m-media.square video { aspect-ratio: 1/1; object-fit: cover; }
.m-media.tall img, .m-media.tall video { aspect-ratio: 4/5; object-fit: cover; }
.m-media.wide img, .m-media.wide video { aspect-ratio: 16/9; object-fit: cover; }
.m-media.full img, .m-media.full video { aspect-ratio: 9/16; object-fit: cover; }
.m-media.ph { height: 90px; background: repeating-linear-gradient(45deg, #e8eaf0 0 10px, #dfe2ea 10px 20px); }
.m-logo { width: 22px; height: 22px; border-radius: 50%; object-fit: contain; background: #fff; border: 1px solid #e0e0e0; flex: none; }
.m-logo-fallback { display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #555; }
.m-logo-slot img { width: 22px; height: 22px; border-radius: 50%; object-fit: contain; background: #fff; border: 1px solid #e0e0e0; display: block; }
.m-ad-badge { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: #e8f0fe; color: #1a73e8; vertical-align: 1px; }
.m-ad-badge.grn { background: #e6f4ea; color: #188038; }
.m-ad-badge.yel { background: #fd0; color: #111; border-radius: 2px; }
.m-ad-corner { position: absolute; top: 6px; right: 6px; font-size: 9px; font-weight: 700; background: rgba(255,255,255,0.9); color: #5f6368; padding: 2px 6px; border-radius: 3px; z-index: 2; }

/* Discover */
.m-discover { padding-bottom: 10px; }
.m-d-head { font-size: 14px; font-weight: 600; line-height: 1.3; padding: 10px 12px 6px; }
.m-d-head.sm { font-size: 13px; padding: 0 0 6px; }
.m-d-brand { display: flex; align-items: center; gap: 7px; padding: 0 12px; font-size: 11px; color: #5f6368; }
.m-d-brand em { font-style: normal; color: #80868b; }
.m-d-brand i { margin-left: auto; font-style: normal; color: #80868b; }
.m-disc-row { display: flex; gap: 12px; padding: 12px; }
.m-dr-text { flex: 1; min-width: 0; }
.m-dr-thumb { width: 84px; flex: none; }
.m-dr-thumb img, .m-dr-thumb video { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }

/* GDN */
.m-gdn { position: relative; }
.m-gdn-body { padding: 10px 12px 12px; }
.m-gdn-head { font-size: 13px; font-weight: 700; margin: 6px 0 4px; line-height: 1.3; }
.m-gdn-desc { font-size: 11px; color: #5f6368; line-height: 1.4; margin-bottom: 8px; }
.m-gdn-cta { display: inline-block; font-size: 11px; font-weight: 700; color: #1a73e8; border: 1px solid #dadce0; border-radius: 999px; padding: 5px 12px; }
.m-gdn-cta.wide { display: block; text-align: center; margin: 10px 12px 12px; }
.m-leader { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.m-leader-logo { width: 40%; flex: none; }
.m-leader-logo img { width: 100%; display: block; }
.m-leader-head { font-size: 12px; font-weight: 600; flex: 1; color: #1f1f1f; }

/* Gmail */
.m-gmail { padding: 6px 0; }
.m-gm-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; }
.m-gm-row.ad { background: #f8faff; }
.m-gm-row.dim { opacity: 0.45; }
.m-gm-text { flex: 1; min-width: 0; }
.m-gm-from { font-size: 12px; font-weight: 700; }
.m-gm-subj { font-size: 12px; font-weight: 600; margin-top: 1px; }
.m-gm-snip { font-size: 11px; color: #5f6368; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-gm-thumb { width: 46px; flex: none; }
.m-gm-thumb img, .m-gm-thumb video { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; }
.m-gmail-exp .m-gm-row { padding: 10px 12px 6px; }

/* Gmail avatar crop demo */
.m-avatar-demo { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px 12px; }
.m-av-orig, .m-av-circ { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10px; color: #5f6368; }
.m-av-orig img, .m-av-orig video { width: 64px; height: 64px; object-fit: contain; border: 1px dashed #b0b4bc; background: #fff; }
.m-av-clip { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; border: 1px solid #dadce0; background: #fff; }
.m-av-clip img, .m-av-clip video { width: 100%; height: 100%; object-fit: contain; }
.m-av-arrow { color: #80868b; font-size: 16px; }

/* YouTube */
.m-yt-body { padding: 10px 12px 12px; }
.m-yt-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.m-yt-sub { font-size: 11px; color: #aaa; margin: 4px 0 8px; }
.m-yt-cta { display: inline-block; font-size: 11px; font-weight: 700; background: #3ea6ff; color: #0f0f0f; border-radius: 999px; padding: 5px 12px; }
.m-instream { position: relative; }
.m-is-overlay { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 8px; gap: 8px; }
.m-is-info { font-size: 10px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-is-skip { font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,0.75); border: 1px solid rgba(255,255,255,0.4); padding: 5px 10px; flex: none; }
.m-is-bar { height: 3px; background: #fd0; width: 34%; }

/* Shorts */
.m-shorts { position: relative; }
.m-sh-rail { position: absolute; right: 8px; bottom: 84px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; text-align: center; }
.m-sh-rail i { font-style: normal; filter: grayscale(0.2); text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
.m-sh-info { position: absolute; left: 10px; right: 52px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.m-sh-brand { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.m-sh-head { font-size: 11px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); line-height: 1.35; }
.m-sh-cta { align-self: flex-start; font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.92); color: #0f0f0f; border-radius: 999px; padding: 5px 12px; }

/* ---------- Brandbook ---------- */
.kit-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.brandbook-view { margin-top: 8px; }
.bb-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.bb-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bb-hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center;
  padding: 36px; border-radius: 18px; margin-bottom: 28px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(109,94,252,0.28), transparent 55%),
    linear-gradient(145deg, #12151d 0%, #1a2030 55%, #10131a 100%);
  border: 1px solid var(--border); overflow: hidden;
}
.bb-kicker {
  text-transform: uppercase; letter-spacing: 1.2px; font-size: 11px; font-weight: 700;
  color: #b7aeff; margin: 0 0 10px;
}
.bb-hero h1 {
  margin: 0 0 10px; font-size: clamp(32px, 4vw, 52px); line-height: 1.05;
  color: #fff; font-weight: 800;
}
.bb-hero-copy p { color: #c7cbe0; margin: 0 0 14px; max-width: 38ch; line-height: 1.5; }
.bb-hero-meta { color: #8f95ad; font-size: 13px; }
.bb-hero-logo {
  background: rgba(255,255,255,0.96); border-radius: 16px; min-height: 220px;
  display: grid; place-items: center; padding: 28px;
}
.bb-hero-logo img { max-width: 80%; max-height: 180px; object-fit: contain; }
.bb-section { margin-bottom: 34px; }
.bb-section h2 { margin: 0 0 6px; font-size: 22px; }
.bb-section > .muted { margin: 0 0 16px; }
.bb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px;
}
.bb-tile {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.bb-tile img {
  width: 100%; aspect-ratio: 8/5; object-fit: contain; background: #fff; display: block;
}
/* Product mockups are square (Printful 1:1). Never force a landscape frame —
   that used to stretch shirts/hats horizontally in the brandbook view. */
.bb-tile.bb-mock img,
.bb-mock img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  display: block;
}
.bb-tile span { padding: 0 12px 12px; font-size: 13px; font-weight: 600; }
.bb-colors {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.bb-swatch {
  display: flex; gap: 12px; align-items: center; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; cursor: pointer; color: var(--text); font: inherit;
}
.bb-swatch:hover { border-color: var(--primary); }
.bb-swatch-chip {
  width: 54px; height: 54px; border-radius: 10px; flex: none;
  background: var(--sw); border: 1px solid rgba(255,255,255,0.12);
}
.bb-swatch-meta { display: flex; flex-direction: column; gap: 2px; }
.bb-swatch-meta b { font-size: 13px; }
.bb-swatch-meta small { color: var(--muted); font-size: 11px; }
.bb-rules {
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px;
}
.bb-rules h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.bb-rules ul { margin: 0 0 14px; padding-left: 18px; color: var(--text); }
.bb-rules li { margin-bottom: 6px; font-size: 14px; }
.bb-misuse-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bb-misuse {
  border: 1px solid rgba(244,63,94,0.4); border-radius: 10px; overflow: hidden; background: var(--bg-2);
}
.bb-misuse img { width: 100%; aspect-ratio: 32/22; object-fit: cover; display: block; }
.bb-misuse span {
  display: block; padding: 7px 9px; font-size: 11px; font-weight: 700; color: #ff9d9d;
}
.bb-mockups {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.bb-mock {
  position: relative;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--panel); color: var(--text); font: inherit; padding: 0; cursor: pointer; text-align: left;
}
.bb-mock span { display: block; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.bb-mock-badge {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase;
  background: rgba(12, 14, 20, 0.72); color: #d8dcff; backdrop-filter: blur(4px);
}

/* Per-mockup brand-QA verdict badge (top-left). */
.bb-mock-qa {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 800;
  letter-spacing: .02em; backdrop-filter: blur(4px);
}
.bb-mock-qa.green { background: rgba(22, 101, 52, 0.82); color: #d1fae5; }
.bb-mock-qa.yellow { background: rgba(120, 90, 12, 0.85); color: #fde68a; }
.bb-mock-qa.red { background: rgba(120, 30, 30, 0.85); color: #fecaca; }
.bb-mock-variant {
  margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; background: #262b3d; color: #aab3d6;
}

/* ---------- Brand card: clickable + brandbook status chip ---------- */
.kit-card[data-open] { cursor: pointer; transition: transform 0.1s ease, border-color 0.15s ease; }
.kit-card[data-open]:hover { transform: translateY(-2px); border-color: #39415a; }
.kit-card[data-open]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kit-bb-chip {
  display: inline-block; margin: 8px 0 2px; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.kit-bb-chip.ready { background: rgba(34,211,166,0.16); color: var(--accent); }
.kit-bb-chip.stale { background: rgba(247,185,85,0.16); color: var(--warn); }
.kit-bb-chip.none { background: var(--panel-2); color: var(--muted); }

/* ---------- Brand detail workspace ---------- */
.brand-detail { margin-top: 8px; }
.bd-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.bd-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bd-identity {
  display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; margin-bottom: 24px;
}
.bd-logo {
  background: #fff; border-radius: 14px; min-height: 150px; display: grid; place-items: center; padding: 18px;
}
.bd-logo img { max-width: 100%; max-height: 130px; object-fit: contain; }
.bd-logo .no-logo { color: #98a; font-size: 13px; }
.bd-identity-body h1 { margin: 0 0 8px; font-size: clamp(24px, 3vw, 34px); }
.bd-value { color: var(--muted); margin: 0 0 14px; max-width: 60ch; line-height: 1.5; }
.bd-meta { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-bottom: 12px; }
.bd-meta div { display: flex; flex-direction: column; gap: 2px; }
.bd-meta span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.bd-meta b { font-size: 14px; color: var(--text); }
.bd-swatches { margin-top: 4px; }

/* ---------- Brandbook document section ---------- */
.bd-doc { margin-top: 4px; }
.doc-empty, .doc-intro, .doc-error {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px;
}
.doc-intro { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.doc-intro-copy h2 { margin: 0 0 8px; font-size: 22px; }
.doc-deliverables { margin: 14px 0 0; padding-left: 20px; color: var(--text); }
.doc-deliverables li { margin-bottom: 6px; font-size: 14px; }
.doc-intro-cta { display: grid; place-items: center; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.doc-empty h2 { margin: 0 0 8px; }

/* Document card (completed) */
.doc-card {
  display: grid; grid-template-columns: 280px 1fr; gap: 24px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.doc-card.is-stale { border-color: rgba(247,185,85,0.5); }
.doc-preview { background: var(--bg-2); display: grid; place-items: center; padding: 20px; }
.doc-preview img { width: 100%; border-radius: 10px; box-shadow: var(--shadow); background: #fff; }
.doc-preview-fallback {
  width: 120px; height: 150px; border-radius: 10px; background: #fff; color: #444;
  display: grid; place-items: center; font-weight: 800; letter-spacing: 1px;
}
.doc-body { padding: 24px 24px 24px 0; }
.doc-title-row { display: flex; align-items: center; gap: 12px; }
.doc-title-row h2 { margin: 0; font-size: 22px; }
.doc-badge { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.doc-badge.ready { background: rgba(34,211,166,0.16); color: var(--accent); }
.doc-badge.stale { background: rgba(247,185,85,0.16); color: var(--warn); }
.doc-stats { display: flex; gap: 28px; margin: 16px 0 10px; }
.doc-stats div { display: flex; flex-direction: column; }
.doc-stats b { font-size: 24px; font-weight: 800; line-height: 1; }
.doc-stats span { font-size: 12px; color: var(--muted); margin-top: 3px; }
.doc-generated { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.doc-stale-note { font-size: 13px; color: var(--warn); margin: 0 0 12px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.doc-hint { font-size: 12px; max-width: 60ch; }

/* Error state */
.doc-error h2 { margin: 0 0 8px; color: #ff9d9d; }
.doc-error-msg {
  background: var(--bg-2); border: 1px solid #6e2b2b; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: #ffb4b4; margin: 0 0 12px; word-break: break-word;
}

/* Progress widget */
.doc-progress {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 26px;
}
.pg-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.pg-head h2 { margin: 0; font-size: 22px; }
.pg-pct { font-size: 20px; font-weight: 800; color: var(--primary-2, var(--primary)); }
.pg-bar { height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.pg-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.4s ease; }
.pg-current { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 18px; }
.pg-steps { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pg-step { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
.pg-dot {
  grid-row: 1 / span 2; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--bg-2); position: relative; transition: all 0.2s ease;
}
.pg-step-label { font-size: 14px; font-weight: 600; color: var(--muted); transition: color 0.2s ease; }
.pg-step-sub { font-size: 12px; color: var(--muted); grid-column: 2; }
.pg-step.active .pg-dot { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(109,94,252,0.18); }
.pg-step.active .pg-dot::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary);
  animation: pg-pulse 1.1s ease-in-out infinite;
}
.pg-step.active .pg-step-label { color: var(--text); }
.pg-step.done .pg-dot { border-color: var(--accent); background: var(--accent); }
.pg-step.done .pg-dot::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11px; font-weight: 900; color: #06231b;
}
.pg-step.done .pg-step-label { color: var(--text); }
.pg-note { font-size: 12px; margin: 0; }
@keyframes pg-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------------------------------------------------- logo quality */
.bd-logo-qa { margin-top: 22px; }
.lq-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
}
.lq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.lq-head h2 { margin: 0 0 4px; font-size: 18px; }
.lq-head p { margin: 0; font-size: 13px; }
.lq-chip, .lq-pct { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.lq-chip.ready { background: rgba(34,211,166,.14); color: var(--accent); }
.lq-chip.review { background: rgba(240,180,60,.16); color: #f0b43c; }
.lq-chip.fail { background: rgba(240,90,90,.16); color: #f05a5a; }
.lq-chip.none { background: var(--panel-2); color: var(--muted); }
.lq-options { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.lq-opt { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 8px; cursor: pointer; }
.lq-diag { margin: 14px 0 6px; }
.lq-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lq-tag { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.lq-warnings { margin: 10px 0 0; padding-left: 18px; font-size: 12px; color: #f0b43c; }
.lq-candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 16px; }
.lq-cand { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-2); }
.lq-cand.is-recommended { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.lq-cand.red { opacity: .92; }
.lq-checker {
  background-image:
    linear-gradient(45deg, #23283340 25%, transparent 25%),
    linear-gradient(-45deg, #23283340 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #23283340 75%),
    linear-gradient(-45deg, transparent 75%, #23283340 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.lq-cand-proof { display: grid; place-items: center; padding: 10px; min-height: 180px; }
.lq-cand-proof img { max-width: 100%; max-height: 220px; }
.lq-cand-body { padding: 12px 14px 16px; }
.lq-cand-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lq-cand-head b { font-size: 13px; }
.lq-conf { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.lq-conf.green { background: rgba(34,211,166,.14); color: var(--accent); }
.lq-conf.yellow { background: rgba(240,180,60,.16); color: #f0b43c; }
.lq-conf.red { background: rgba(240,90,90,.16); color: #f05a5a; }
.lq-bgs { display: flex; gap: 6px; margin: 10px 0; }
.lq-bg { font-size: 11px; text-transform: capitalize; padding: 3px 10px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.lq-bg.active { color: var(--text); border-color: var(--accent); }
.lq-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.lq-metrics div { background: var(--panel-2); border-radius: 8px; padding: 6px 8px; text-align: center; }
.lq-metrics span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.lq-metrics b { font-size: 13px; }
.lq-flags { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.lq-fail { font-size: 10px; padding: 2px 6px; border-radius: 5px; background: rgba(240,90,90,.16); color: #f05a5a; }
.lq-warn { font-size: 10px; padding: 2px 6px; border-radius: 5px; background: rgba(240,180,60,.16); color: #f0b43c; }
.lq-notes { font-size: 11px; margin: 6px 0 10px; }
.lq-actions { margin-top: 16px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; padding: 14px 16px; gap: 12px;
    display: grid; grid-template-columns: minmax(120px, auto) minmax(160px, 1fr);
    align-items: center;
  }
  .brand-switcher { margin-top: 0; min-width: 0; }
  .nav {
    grid-column: 1 / -1; width: 100%;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  }
  .nav-item { justify-content: center; min-width: 0; padding: 10px 7px; font-size: 13px; }
  .sidebar-footer {
    grid-column: 1 / -1; width: 100%; margin: 0;
    flex-direction: row; align-items: center; justify-content: space-between;
  }
  .generate-layout, .modal-cols { grid-template-columns: 1fr; }
  .lb-body { grid-template-columns: 1fr; height: 92vh; }
  .lb-meta { display: none; }
  .logo-edit-layout { grid-template-columns: 1fr; }
  .bb-hero { grid-template-columns: 1fr; }
  .bb-rules { grid-template-columns: 1fr; }
  .bd-identity { grid-template-columns: 1fr; }
  .doc-intro { grid-template-columns: 1fr; }
  .doc-card { grid-template-columns: 1fr; }
  .doc-body { padding: 0 24px 24px; }
  .pf-fields { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .sidebar { grid-template-columns: 1fr; }
  .logo, .brand-switcher, .nav, .sidebar-footer { grid-column: 1; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-item { justify-content: flex-start; padding: 10px 14px; }
  .content { padding: 24px 16px 48px; }
  .view-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 18px; }
  .head-actions { width: 100%; flex-wrap: wrap; }
  .head-actions > .btn { flex: 1; }
  .ads-view-toggle { flex: 1; }
  .ads-view-toggle .btn { flex: 1; }
  .ads-brand-context { align-items: flex-start; flex-wrap: wrap; }
  .ads-brand-context > .btn { width: 100%; }
}

/* ------------------------------------------------------ Brand profile */
.bd-profile { margin-top: 20px; }
.pf-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.pf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.pf-head h2 { margin: 0 0 4px; }
.pf-head p { margin: 0; max-width: 620px; }
.pf-status { flex-shrink: 0; }
.pf-research { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.pf-research.ok { color: var(--accent); border-color: rgba(34, 211, 166, 0.4); background: rgba(34, 211, 166, 0.08); }
.pf-research.warn { color: var(--warn); border-color: rgba(247, 185, 85, 0.4); background: rgba(247, 185, 85, 0.08); }
.pf-research.info { color: var(--primary-2); border-color: rgba(139, 125, 255, 0.4); background: rgba(139, 125, 255, 0.08); }
.pf-research.muted { color: var(--muted); }
.pf-progress { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; }
.pf-progress-bar { flex: 1; height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.pf-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; transition: width 0.4s ease; }
.pf-progress-pct { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pf-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pf-step {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; cursor: pointer; text-align: left; color: var(--text); font: inherit;
}
.pf-step:hover { border-color: var(--primary); }
.pf-step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.pf-step.done .pf-step-dot { background: var(--accent); }
.pf-step.partial .pf-step-dot { background: var(--warn); }
.pf-step-label { font-weight: 600; font-size: 13px; }
.pf-step-count { font-size: 12px; color: var(--muted); }
.pf-next { margin: 14px 0 0; font-size: 13px; color: var(--warn); }
.pf-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* Onboarding / research modal */
.profile-card { width: min(760px, 94vw); max-height: 92vh; display: flex; flex-direction: column; }
.profile-stepper { display: flex; gap: 6px; padding: 0 24px 4px; flex-wrap: wrap; }
.pf-tab {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  background: transparent; border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
}
.pf-tab.on { color: white; background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; }
.pf-tab.past { color: var(--accent); border-color: rgba(34, 211, 166, 0.4); }
.profile-body { overflow-y: auto; }
.pf-intro { color: var(--muted); margin: 0 0 16px; }
.pf-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pf-field { min-width: 0; }
.pf-help { color: var(--muted); font-size: 11px; margin-top: 4px; }
.pf-advanced-toggle { margin-top: 16px; background: none; border: none; color: var(--primary-2); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.profile-foot { display: flex; justify-content: space-between; align-items: center; }
.profile-foot-btns { display: flex; gap: 10px; margin-left: auto; }

/* Research review */
.rv-block { margin-bottom: 22px; }
.rv-block h3 { margin: 0 0 10px; font-size: 15px; }
.rv-sources { display: flex; flex-direction: column; gap: 8px; }
.rv-source { display: flex; gap: 10px; align-items: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; }
.rv-source-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rv-source-url { font-size: 12px; color: var(--primary-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-source-ex { font-size: 12px; color: var(--muted); }
.rv-field span { display: flex; align-items: center; gap: 8px; }
.rv-prov { font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 6px; }
.rv-prov.ok { color: var(--accent); background: rgba(34, 211, 166, 0.12); }
.rv-prov.warn { color: var(--warn); background: rgba(247, 185, 85, 0.12); }
.rv-prov.info { color: var(--primary-2); background: rgba(139, 125, 255, 0.12); }
.rv-prov.muted { color: var(--muted); background: var(--panel-2); }

/* ------------------------------------------------ Brandbook rich preview */
.bb-tagline { font-style: italic; color: var(--primary-2); margin: 2px 0 8px; }
.bb-approval { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.bb-approval.ok { color: var(--accent); background: rgba(34, 211, 166, 0.12); }
.bb-approval.warn { color: var(--warn); background: rgba(247, 185, 85, 0.12); }
.bb-layout { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; }
.bb-nav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.bb-nav-item { text-align: left; font: inherit; font-size: 13px; color: var(--muted); background: none; border: none; border-left: 2px solid transparent; padding: 7px 12px; cursor: pointer; border-radius: 0 8px 8px 0; }
.bb-nav-item:hover, .bb-nav-item.active { color: var(--text); background: var(--panel); border-left-color: var(--primary); }
.bb-body { min-width: 0; display: flex; flex-direction: column; gap: 30px; }
.bb-sec-head h2 { margin: 0 0 4px; }
.bb-sec-head p { margin: 0 0 14px; }
.bb-para { line-height: 1.6; margin: 0 0 12px; }
.bb-callout { border-left: 3px solid var(--primary); padding: 8px 14px; background: var(--panel); border-radius: 0 8px 8px 0; }
.bb-list { margin: 0 0 14px; padding-left: 20px; line-height: 1.6; }
.bb-list-label { margin: 6px 0; font-size: 13px; }
.bb-list-label.do, .bb-list.do li::marker { color: var(--accent); }
.bb-list-label.dont, .bb-list.dont li::marker { color: var(--danger); }
.bb-kv { display: grid; gap: 0; margin: 0 0 14px; }
.bb-kv > div { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.bb-kv dt { color: var(--muted); font-size: 13px; margin: 0; }
.bb-kv dd { margin: 0; }
.bb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bb-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.bb-tile { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-decoration: none; color: var(--text); cursor: pointer; position: relative; }
.bb-tile:not(.bb-mock) img { width: 100%; height: 150px; object-fit: contain; border-radius: 6px; background: #fff; }
.bb-tile.bb-mock img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; border-radius: 6px; background: #fff; }
.bb-tile span { font-size: 12px; text-align: center; }
.bb-tile.warn img { background: #fff; }
.bb-type-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.bb-type-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bb-type-sample.display { font-size: 40px; font-weight: 800; letter-spacing: 0.02em; }
.bb-type-sample.body { font-size: 20px; }
.bb-type-notes { margin-top: 6px; }
.bb-personas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.bb-persona { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.bb-persona h4 { margin: 0 0 6px; }
.bb-persona-kv { font-size: 13px; margin-top: 6px; }
.bb-persona-kv span { color: var(--muted); font-weight: 600; }
.bb-sources { list-style: none; padding: 0; margin: 0; }
.bb-sources li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.bb-source-meta { display: block; font-size: 12px; color: var(--muted); }
.bb-pdf-frame { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; height: 80vh; background: var(--panel); }
.bb-pdf-frame iframe { width: 100%; height: 100%; border: 0; }

/* Concise workspace card handoff panel */
.doc-handoff { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.doc-handoff summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--primary-2); }
.doc-handoff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.doc-handoff-grid > div { display: flex; flex-direction: column; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.doc-handoff-grid span { font-size: 11px; color: var(--muted); }
.doc-handoff-grid b { font-size: 13px; }
.doc-warns { margin-top: 12px; }
.doc-warns p { color: var(--warn); font-size: 13px; margin: 4px 0; }

@media (max-width: 900px) {
  .bb-layout { grid-template-columns: 1fr; }
  .bb-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .bb-grid, .bb-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------- SEO proposal */
.bd-proposal { margin-top: 18px; }
.pr-card .pr-head h2 { margin: 0 0 4px; }
.pr-warn { color: var(--warn); font-size: 13px; background: rgba(220, 140, 20, 0.08);
  border: 1px solid rgba(220, 140, 20, 0.35); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.pr-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.pr-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.pr-field span { font-weight: 600; }
.pr-field em { font-weight: 400; color: var(--muted); font-style: normal; }
.pr-field input, .pr-field textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; color: inherit; font: inherit; resize: vertical; }
.pr-field:has(#pr-keywords) { grid-column: 1 / -1; }
.pr-actions { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 8px; }
.pr-estimate-out { margin: 8px 0; }
.pr-est { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.pr-est-total { font-size: 15px; margin-bottom: 6px; }
.pr-est-total b { font-size: 22px; color: var(--primary-2); }
.pr-est-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px 16px; list-style: none; padding: 0; margin: 6px 0; font-size: 12px; color: var(--muted); }
.pr-cache.ok { color: var(--accent); font-size: 13px; margin: 6px 0 0; }
.pr-history { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.pr-history h3 { margin: 0 0 8px; font-size: 15px; }
.pr-hist-row { display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.pr-hist-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-hist-sum { font-size: 12px; }
.pr-hist-side { display: flex; align-items: center; gap: 12px; }
.pr-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.pr-badge.cache { background: rgba(120, 120, 200, 0.15); color: var(--primary-2); }
.pr-badge.fresh { background: rgba(40, 170, 120, 0.15); color: var(--accent); }

@media (max-width: 720px) {
  .pr-form { grid-template-columns: 1fr; }
}

/* ------------------------------------------- customer onboarding invites */
.head-actions { display: flex; gap: 10px; align-items: center; }
.invite-create { display: flex; gap: 10px; margin-bottom: 6px; }
.invite-create input { flex: 1; font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; }
.invite-create input:focus { outline: none; border-color: var(--primary); }
.invite-list { margin-top: 10px; max-height: 420px; overflow-y: auto; }
.invite-empty { padding: 14px 2px; }
.invite-row { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 2px; border-bottom: 1px solid var(--border); }
.invite-row:last-child { border-bottom: none; }
.invite-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.invite-meta { font-size: 12px; margin-top: 3px; }
.invite-chip { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.invite-chip.pending { background: rgba(139, 147, 167, 0.16); color: var(--muted); }
.invite-chip.processing { background: rgba(109, 94, 252, 0.16); color: var(--primary-2); }
.invite-chip.done { background: rgba(34, 211, 166, 0.14); color: var(--accent); }
.invite-chip.error { background: rgba(242, 109, 109, 0.14); color: var(--danger); }
.invite-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.invite-delete { color: var(--muted); }
.invite-delete:hover { color: var(--danger); }

/* -------------------------------------------------- AI website builder */
.bd-website { margin-top: 18px; }
.ws-card .ws-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ws-card .ws-head h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.ws-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ws-locked { opacity: 0.92; }
.ws-badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.ws-badge.ok { background: rgba(34, 211, 166, 0.14); color: var(--accent); }
.ws-badge.warn { background: rgba(220, 140, 20, 0.14); color: var(--warn); }
.ws-deliverables { margin: 12px 0; padding-left: 20px; display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.ws-cta { margin-top: 10px; }
.ws-guide { margin: 12px 0; padding: 12px 14px; border-radius: 12px;
  background: rgba(109, 94, 252, 0.08); border: 1px solid rgba(109, 94, 252, 0.28); }
.ws-guide-label { display: block; color: var(--primary-2); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.ws-guide p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.5; }
.ws-readiness { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.ws-readiness span { display: flex; flex-direction: column; gap: 2px; padding: 10px;
  border-radius: 10px; background: var(--panel-2); color: var(--muted); font-size: 11px; }
.ws-readiness b { color: var(--text); font-size: 14px; }

.ws-preview-wrap { margin: 16px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel-2); }
.ws-preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ws-page-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ws-page-tab { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--border); }
.ws-page-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ws-viewport-toggle { display: flex; gap: 4px; }
.ws-vp { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--border); }
.ws-vp.active { background: var(--panel); color: var(--text); border-color: var(--primary); }
.ws-frame-stage { display: flex; justify-content: center; background: #ffffff; padding: 0; }
.ws-frame-stage.desktop .ws-frame { width: 100%; height: 560px; }
.ws-frame-stage.mobile { padding: 16px 0; background: var(--panel-2); }
.ws-frame-stage.mobile .ws-frame { width: 390px; height: 640px; border: 1px solid var(--border);
  border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.ws-frame { border: 0; background: #fff; }

.ws-chat { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.ws-chat h3, .ws-deploy h3, .ws-domain h3 { margin: 0 0 6px; font-size: 15px; }
.ws-chat-log { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.ws-chat-row { font-size: 13px; }
.ws-chat-you { margin-bottom: 3px; }
.ws-chat-ai { color: var(--muted); }
.ws-chat-input { display: flex; gap: 10px; }
.ws-chat-input input { flex: 1; font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; }
.ws-chat-input input:focus { outline: none; border-color: var(--primary); }
.ws-rev-count { font-size: 12px; margin: 8px 0 0; }

.ws-deploy, .ws-domain { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.ws-live { font-size: 14px; }
.ws-deploy-actions, .ws-domain-input { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ws-domain-input input { flex: 1; min-width: 200px; font: inherit; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; }
.ws-checklist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.ws-check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.ws-check-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.ws-check.active { color: var(--text); }
.ws-check.active .ws-check-dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(220,140,20,0.18); }
.ws-check.done { color: var(--text); }
.ws-check.done .ws-check-dot { background: var(--accent); }
.ws-ns { margin-top: 8px; font-size: 13px; }
.ws-ns-list { display: grid; gap: 6px; margin-top: 8px; }
.ws-ns-list code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; }

@media (max-width: 720px) {
  .ws-frame-stage.desktop .ws-frame { height: 420px; }
  .ws-readiness { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
}

/* ------------------------------------------------ Google Ads archive */
.ads-disabled { color: var(--warn); line-height: 1.6; }
.ads-disabled code { color: var(--text); }
.ads-brand-context {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 13px 15px;
  border-color: rgba(109, 94, 252, .45);
}
.ads-context-brand {
  width: 38px; height: 38px; flex: none; overflow: hidden; border-radius: 10px;
  display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--primary-2); font-weight: 800;
}
.ads-context-brand img { width: 100%; height: 100%; object-fit: contain; }
.ads-context-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.ads-context-copy strong { font-size: 14px; }
.ads-context-copy span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.ads-view-toggle { display: flex; gap: 6px; }
.ads-view-toggle .active { background: var(--panel-2); border-color: var(--primary); }
.ads-toolbar { padding: 16px; margin-bottom: 14px; }
.ads-toolbar-grid {
  display: grid; grid-template-columns: 1.15fr 1.35fr .8fr .8fr 1.4fr; gap: 10px;
}
.ads-toolbar label, .ads-date-row label, .ads-status-filter {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
}
.ads-toolbar label > span, .ads-status-filter > span {
  color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: .55px; font-weight: 700;
}
.ads-toolbar select, .ads-toolbar input {
  width: 100%; min-height: 38px; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 12px;
}
.ads-toolbar select:focus, .ads-toolbar input:focus { outline: none; border-color: var(--primary); }
.ads-date-row {
  display: grid; grid-template-columns: 160px 145px 145px minmax(300px, 1fr);
  gap: 10px; align-items: end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.ads-status-filter .filter-row { min-height: 38px; }
.ads-sync-panel { margin: 8px 0 14px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.ads-sync-panel .progress-bar { margin-bottom: 7px; }
#ads-sync-status { font-size: 12px; }
.ads-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0;
}
.ads-summary > div {
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.ads-summary b { font-size: 17px; }
.ads-summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .45px; }
.ads-notice { font-size: 11px; margin: 8px 2px 14px; }
.ads-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 14px;
}
.ads-gallery .empty { grid-column: 1 / -1; }
.ads-card {
  position: relative; min-width: 0; overflow: hidden; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; cursor: zoom-in;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.ads-card:hover { transform: translateY(-2px); border-color: #3b4356; }
.ads-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(109,94,252,.35); }
.ads-select {
  position: absolute; top: 9px; left: 9px; z-index: 4; width: 27px; height: 27px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,.9); color: transparent;
  background: rgba(8,10,15,.7); cursor: pointer; opacity: 0; transition: opacity .12s;
}
.ads-card:hover .ads-select, .ads-card.selected .ads-select { opacity: 1; }
.ads-card.selected .ads-select { color: #fff; background: var(--primary); border-color: var(--primary); }
.ads-card-media {
  height: 190px; display: grid; place-items: center; overflow: hidden; background:
  repeating-conic-gradient(#171a22 0% 25%, #13161d 0% 50%) 50% / 22px 22px;
}
.ads-card-media > img, .ads-compare-media > img, #ads-lb-media > img {
  width: 100%; height: 100%; display: block; object-fit: contain;
}
.ads-card-body { padding: 12px; }
.ads-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ads-status, .ads-field {
  display: inline-flex; align-items: center; width: fit-content; font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .45px; border-radius: 999px; padding: 4px 7px;
}
.ads-status.live { color: var(--accent); background: rgba(34,211,166,.13); }
.ads-status.paused { color: var(--warn); background: rgba(247,185,85,.13); }
.ads-status.removed { color: #b5bbca; background: rgba(139,147,167,.15); }
.ads-status.not_eligible { color: var(--danger); background: rgba(242,109,109,.13); }
.ads-field { color: #b5aaff; background: rgba(109,94,252,.13); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ads-card h3 { margin: 9px 0 4px; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ads-card-body > p { margin: 0; color: var(--muted); font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ads-primary-metric {
  display: flex; align-items: baseline; gap: 7px; margin: 13px 0 9px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.ads-primary-metric b { font-size: 20px; color: var(--text); }
.ads-primary-metric span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .5px; }
.ads-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; }
.ads-metrics span { color: var(--muted); font-size: 10px; display: flex; justify-content: space-between; gap: 4px; }
.ads-metrics b { color: var(--text); }
.ads-text-creative, .ads-ad-creative {
  width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: 24px; background: radial-gradient(circle at 20% 10%, rgba(109,94,252,.25), transparent 50%), var(--bg-2);
}
.ads-text-creative span, .ads-google-mark { color: #b5aaff; font-size: 9px; text-transform: uppercase; letter-spacing: .8px; font-weight: 800; margin-bottom: 10px; }
.ads-text-creative strong { font-size: 19px; line-height: 1.25; }
.ads-ad-creative strong { font-size: 17px; }
.ads-ad-creative p { color: var(--muted); font-size: 11px; line-height: 1.4; margin: 7px 0; }
.ads-ad-creative small { color: var(--warn); font-size: 9px; }
.ads-gallery.table { display: flex; flex-direction: column; }
.ads-gallery.table .ads-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); }
.ads-gallery.table .ads-card-media { height: 130px; }
.ads-gallery.table .ads-card-body { display: grid; grid-template-columns: minmax(220px, 1fr) 150px 260px; align-items: center; gap: 16px; }
.ads-gallery.table .ads-card-top { position: absolute; top: 10px; right: 10px; }
.ads-gallery.table .ads-primary-metric { border: 0; padding: 0; margin: 0; }
.ads-gallery.table .ads-metrics { grid-template-columns: 1fr 1fr; }
.ads-pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; font-size: 12px; color: var(--muted); }
.ads-compare-tray {
  position: fixed; z-index: 60; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--primary); box-shadow: var(--shadow); font-size: 12px;
}
.ads-lb-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px;
  width: min(1220px, 100%); height: min(86vh, 880px);
}
.ads-lb-visual { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) 150px; gap: 12px; }
#ads-lb-media { min-height: 0; }
.ads-chart { color: var(--primary-2); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; overflow: hidden; }
.ads-chart svg { width: 100%; height: 95px; }
.ads-chart-head { display: flex; justify-content: space-between; color: var(--text); font-size: 11px; }
.ads-chart-head span, .ads-chart-empty { color: var(--muted); font-size: 10px; }
.ads-attribution-note { color: var(--muted); background: var(--bg-2); border-radius: 8px; padding: 9px 10px; font-size: 10px; line-height: 1.45; }
.ads-compare-card { width: min(1180px, 96vw); }
.ads-compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.ads-compare-item { min-width: 0; background: var(--bg-2); border: 1px solid var(--border); border-radius: 11px; padding: 10px; }
.ads-compare-media { height: 145px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; margin-bottom: 10px; background: var(--panel); }
.ads-compare-item h3 { font-size: 13px; margin: 8px 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ads-compare-item > p { color: var(--muted); font-size: 10px; margin: 0 0 10px; }
.ads-compare-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ads-compare-kpis > div { display: flex; flex-direction: column; padding: 7px 8px; border-radius: 7px; background: var(--panel); }
.ads-compare-kpis span { color: var(--muted); font-size: 9px; }
.ads-compare-kpis b { font-size: 12px; }
.ads-compare-warning { color: var(--warn); font-size: 11px; padding: 9px 11px; margin-bottom: 12px; border: 1px solid rgba(247,185,85,.35); border-radius: 8px; background: rgba(247,185,85,.08); }
#ads-compare-body > .ads-attribution-note { margin-top: 12px; }

@media (max-width: 1050px) {
  .ads-toolbar-grid { grid-template-columns: repeat(2, 1fr); }
  .ads-search { grid-column: 1 / -1; }
  .ads-date-row { grid-template-columns: repeat(3, 1fr); }
  .ads-status-filter { grid-column: 1 / -1; }
  .ads-gallery.table .ads-card-body { grid-template-columns: 1fr 130px; }
  .ads-gallery.table .ads-metrics { display: none; }
}

@media (max-width: 720px) {
  .ads-toolbar-grid, .ads-date-row, .ads-summary { grid-template-columns: 1fr 1fr; }
  .ads-search, .ads-status-filter { grid-column: 1 / -1; }
  .ads-summary > div:last-child { display: none; }
  .ads-gallery { grid-template-columns: 1fr; }
  .ads-gallery.table .ads-card { grid-template-columns: 110px minmax(0, 1fr); }
  .ads-gallery.table .ads-card-body { display: block; }
  .ads-gallery.table .ads-card-media { height: 120px; }
  .ads-lb-body { grid-template-columns: 1fr; height: 90vh; }
  .ads-lb-visual { min-height: 55vh; }
  .ads-lb-body .lb-meta { max-height: 30vh; }
}

/* ============================ Portfolio Overview ======================== */
.ov-range-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.ov-range-field select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; font: inherit;
}
.ov-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.ov-stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.ov-stat-val { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.ov-stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ov-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 12px; cursor: pointer;
  transition: border 0.15s ease, transform 0.08s ease;
}
.ov-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.ov-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ov-card-head { display: flex; align-items: center; gap: 12px; }
.ov-card-logo {
  width: 46px; height: 46px; border-radius: 12px; overflow: hidden; flex-shrink: 0;
  background: var(--panel-2); display: grid; place-items: center;
}
.ov-card-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-glyph { font-size: 20px; font-weight: 800; color: var(--muted); }
.ov-card-title { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ov-card-title strong { font-size: 16px; }
.ov-card-account { font-size: 13px; }
.ov-card-meta { font-size: 12px; }

.conn-badge {
  align-self: flex-start; font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.conn-badge.ok { background: rgba(34, 211, 166, 0.14); color: var(--accent); border-color: rgba(34,211,166,0.35); }
.conn-badge.warn { background: rgba(247, 185, 85, 0.14); color: var(--warn); border-color: rgba(247,185,85,0.35); }
.conn-badge.none, .conn-badge.off { background: var(--panel-2); color: var(--muted); border-color: var(--border); }

.ov-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ov-kpi { display: flex; flex-direction: column; gap: 2px; background: var(--panel-2); border-radius: 10px; padding: 8px 6px; text-align: center; }
.ov-kpi-val { font-size: 14px; font-weight: 700; }
.ov-kpi-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.ov-kpis-empty { font-size: 12px; padding: 10px 0; }
.ov-card-actions { display: flex; gap: 8px; margin-top: auto; }
.ov-card-actions .btn { flex: 1; }

/* Single-brand Overview dashboard */
.ov-dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ov-section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 12px; }
.ov-section-head h3 { margin: 0; font-size: 15px; }
.ov-pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.ov-pack-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.ov-pack-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.ov-pack-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ov-pack-cover { height: 120px; background: var(--panel-2) center/cover no-repeat; }
.ov-pack-body { padding: 10px 12px; }
.ov-pack-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ====================== Brand-scope gate (per view) ==================== */
/* A ".brand-gate" is a direct child of a ".view" section that shows a
   select-a-brand prompt. When the view is in "All brands" mode, renderView()
   adds ".gated" to the section: the gate shows and every sibling hides, so the
   whole tab collapses to the prompt without per-view show/hide bookkeeping. */
.view > .brand-gate { display: none; }
.view.gated > .brand-gate { display: flex !important; }
.view.gated > *:not(.brand-gate) { display: none !important; }

/* Active-brand chip shown in scoped view headers. */
.view-brand-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--panel-2); font-size: 13px; font-weight: 600;
}
.view-brand-chip img,
.view-brand-chip .brand-glyph {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); font-size: 11px;
}

/* ============================ Unified Library =========================== */
.profile-required {
  display: flex; flex-direction: column; gap: 6px; text-align: center;
  padding: 48px 24px; color: var(--muted);
}
.profile-required strong { font-size: 17px; color: var(--text); }

.lib-mode-toggle { display: inline-flex; gap: 4px; background: var(--panel-2); border-radius: 10px; padding: 4px; }
.lib-mode-toggle .btn { border: none; }
.lib-mode-toggle .btn.active { background: var(--primary); color: #fff; }

.lib-toolbar { padding: 14px 18px; margin-bottom: 14px; }
.lib-toolbar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.lib-toolbar-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.lib-toolbar-grid select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 10px; font: inherit;
}
.lib-summary { font-size: 13px; margin-bottom: 14px; }

.lib-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.lib-gallery .empty { grid-column: 1 / -1; }
.lib-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border 0.15s ease, transform 0.08s ease;
}
.lib-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.lib-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lib-card-media { position: relative; height: 170px; background: var(--panel-2); display: grid; place-items: center; }
.lib-card-media img { width: 100%; height: 100%; object-fit: cover; }
.lib-noimg { font-size: 28px; font-weight: 800; color: var(--muted); }
.lib-noimg.lg { font-size: 15px; }
.lib-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.lib-card-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-card-kpis { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }

.lib-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.lib-badge {
  font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 6px;
  background: rgba(0,0,0,0.55); color: #fff; backdrop-filter: blur(4px);
}
.lib-badge.matched { background: rgba(109, 94, 252, 0.85); }
.lib-badge.gen { background: rgba(139, 125, 255, 0.55); }
.lib-badge.ads { background: rgba(34, 211, 166, 0.7); }
.lib-badge.live { background: var(--accent); color: #06231b; }
.lib-badge.score { background: rgba(247, 185, 85, 0.85); color: #2a1c00; }

/* Library detail drawer (reuses the ads lightbox shell) */
#lib-drawer .lb-meta { display: flex !important; flex-direction: column; gap: 12px; overflow-y: auto; }
#lib-drawer .lb-meta h2 { margin: 0; font-size: 20px; }
#lib-drawer .lb-meta h4 { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.lb-meta-badges { display: flex; gap: 6px; flex-wrap: wrap; position: static; }
.lb-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; border-bottom: 1px solid var(--border); padding: 5px 0; }
.lb-kv span { color: var(--muted); }
.lb-perf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.lb-perf-cell { background: var(--panel-2); border-radius: 8px; padding: 8px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.lb-perf-cell span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.lb-perf-cell b { font-size: 14px; }
.lib-link-form { display: flex; gap: 8px; }
.lib-link-form select { flex: 1; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font: inherit; }

@media (max-width: 620px) {
  .ov-kpis { grid-template-columns: repeat(3, 1fr); }
  .lib-perf-grid, .lb-perf-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------- cloud imports */
.cloud-source-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 82%, var(--bg));
  margin: 4px 0 16px;
  overflow: hidden;
}
.cloud-source-loading {
  align-items: center; color: var(--muted); display: flex;
  font-size: 12px; gap: 8px; padding: 14px;
}
.cloud-source-head {
  align-items: center; display: flex; gap: 12px;
  justify-content: space-between; padding: 12px 14px;
}
.cloud-source-head > div { display: grid; gap: 2px; }
.cloud-source-head b { font-size: 13px; }
.cloud-source-head small,
.cloud-source-meta,
.cloud-scan-summary small,
.cloud-folder-option small {
  color: var(--muted); display: block; font-size: 11px; font-weight: 400;
}
.cloud-source-list { border-top: 1px solid var(--border); }
.cloud-source-row {
  align-items: center; display: grid; gap: 8px;
  grid-template-columns: auto minmax(80px, 1fr) auto auto auto;
  padding: 9px 12px;
}
.cloud-source-row + .cloud-source-row { border-top: 1px solid var(--border); }
.cloud-source-name {
  font-size: 12px; font-weight: 600; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.cloud-provider {
  background: #e8eefc; border-radius: 999px; color: #3158a4;
  display: inline-flex; font-size: 10px; font-weight: 700;
  padding: 3px 7px; white-space: nowrap;
}
.cloud-provider.sharepoint { background: #e5f7f6; color: #087a75; }
.cloud-asset-grid {
  border-top: 1px solid var(--border); display: grid; gap: 5px;
  grid-template-columns: repeat(6, minmax(0, 1fr)); max-height: 320px;
  overflow: auto; padding: 8px;
}
.cloud-asset {
  aspect-ratio: 1; background: var(--panel-2); border: 2px solid #2c8b68;
  border-radius: 8px; cursor: pointer; overflow: hidden; padding: 0; position: relative;
}
.cloud-asset img {
  height: 100%; object-fit: cover; transition: opacity 0.15s ease; width: 100%;
}
.cloud-asset span {
  background: #1e7659; border-radius: 999px; bottom: 4px; color: #fff;
  font-size: 8px; font-weight: 700; padding: 2px 5px; position: absolute; right: 4px;
}
.cloud-asset.is-off { border-color: var(--border); }
.cloud-asset.is-off img { filter: grayscale(1); opacity: 0.42; }
.cloud-asset.is-off span { background: #667085; }
.cloud-show-all {
  background: transparent; border: 0; border-top: 1px solid var(--border);
  color: var(--primary); cursor: pointer; font-size: 11px;
  padding: 9px 12px; text-align: left; width: 100%;
}
.cloud-empty-action {
  align-items: center; background: transparent; border: 0;
  border-top: 1px dashed var(--border); color: inherit; cursor: pointer;
  display: flex; gap: 10px; padding: 14px; text-align: left; width: 100%;
}
.cloud-empty-action:hover { background: rgba(109, 94, 252, 0.05); }
.cloud-empty-action > span:last-child { display: grid; gap: 2px; }
.cloud-empty-action small { color: var(--muted); }
.cloud-empty-icon {
  align-items: center; background: rgba(109, 94, 252, 0.12);
  border-radius: 9px; color: var(--primary); display: inline-flex;
  font-size: 18px; height: 34px; justify-content: center; width: 34px;
}
.cloud-import-modal {
  max-height: min(820px, 92vh); max-width: 720px; overflow: auto;
  width: min(720px, calc(100vw - 28px));
}
.cloud-import-actions { align-items: center; display: flex; gap: 12px; }
.cloud-scan-result {
  border: 1px solid var(--border); border-radius: 12px;
  margin-top: 16px; overflow: hidden;
}
.cloud-scan-summary {
  align-items: center; background: var(--panel-2); display: flex;
  justify-content: space-between; padding: 13px 14px;
}
.cloud-scan-summary > div {
  align-items: center; display: grid; gap: 4px; grid-template-columns: auto 1fr;
}
.cloud-scan-summary small { grid-column: 1 / -1; }
.cloud-folder-list {
  border: 0; display: grid; gap: 4px; margin: 0; max-height: 290px;
  overflow: auto; padding: 12px 14px;
}
.cloud-folder-list legend {
  color: var(--muted); font-size: 11px; font-weight: 700;
  padding: 12px 0 2px; text-transform: uppercase;
}
.cloud-folder-option {
  align-items: center; border-radius: 8px; cursor: pointer;
  display: flex; gap: 10px; padding: 8px;
}
.cloud-folder-option:hover { background: rgba(109, 94, 252, 0.05); }
.cloud-folder-option input { accent-color: var(--primary); flex: 0 0 auto; }
.cloud-folder-option span { display: grid; gap: 2px; }
.cloud-folder-option b { font-size: 12px; }
.cloud-import-foot {
  align-items: end; border-top: 1px solid var(--border); display: flex;
  gap: 14px; justify-content: flex-end; padding: 12px 14px;
}
.cloud-max-files { margin: 0 auto 0 0; max-width: 130px; }
.cloud-safety-note {
  color: var(--muted); font-size: 10px; margin: 0; padding: 0 14px 13px;
}
.cloud-import-progress { margin-top: 18px; }
.cloud-import-progress .gen-log { margin-top: 10px; max-height: 220px; }

@media (max-width: 720px) {
  .cloud-source-row { grid-template-columns: auto 1fr auto auto; }
  .cloud-source-meta { display: none; }
  .cloud-asset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cloud-import-foot { align-items: stretch; flex-direction: column; }
  .cloud-max-files { max-width: none; }
}

/* ---------- Meta Ads view ---------- */
.meta-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 980px) { .meta-layout { grid-template-columns: 1fr; } }
.meta-spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.meta-spec-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.meta-spec-card.video { border-color: rgba(109,94,252,0.35); }
.meta-spec-kicker { font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.meta-spec-title { font-size: 14px; font-weight: 700; margin-top: 4px; text-transform: capitalize; }
.meta-spec-size { font-size: 18px; font-weight: 800; margin-top: 8px; color: var(--text); }
.meta-spec-ratio { font-size: 12px; color: var(--muted); margin-top: 2px; }
.meta-placements { display: flex; flex-direction: column; gap: 8px; }
.meta-place-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.meta-place-row span { color: var(--muted); text-align: right; }
.meta-safe { margin-top: 12px; font-size: 12px; line-height: 1.45; }
.meta-plan-placements { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.meta-plan-placements .pill { font-size: 11px; text-transform: capitalize; }
