/* ============================================================
   Base & Variables
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w:    220px;
  --header-h:     56px;

  --bg:           #F1F5F9;
  --surface:      #FFFFFF;
  --border:       #E2E8F0;
  --border-mid:   #CBD5E1;

  --sidebar-bg:   #0F172A;
  --sidebar-text: rgba(255,255,255,.65);
  --sidebar-hover: rgba(255,255,255,.07);
  --sidebar-active: #4F46E5;

  --primary:      #4F46E5;
  --primary-dark: #4338CA;
  --primary-bg:   #EEF2FF;

  --text-1:       #1E293B;
  --text-2:       #475569;
  --text-3:       #94A3B8;

  --green:        #059669;
  --green-bg:     #D1FAE5;
  --green-border: #A7F3D0;

  --amber:        #D97706;
  --amber-bg:     #FEF3C7;
  --amber-border: #FDE68A;

  --slate-bg:     #F1F5F9;
  --slate-text:   #64748B;
  --slate-border: #E2E8F0;

  --red:          #DC2626;
  --red-bg:       #FEE2E2;
  --red-dark:     #B91C1C;

  --radius-sm:    6px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.06);
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.04);
  --shadow-lg:    0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);

  --ease: cubic-bezier(.4,0,.2,1);
  --dur:  150ms;
}

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   App shell — sidebar + main
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand-mark {
  width: 30px;
  height: 30px;
  background: var(--primary);
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark svg { width: 16px; height: 16px; }

.brand-name {
  font-size: .825rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: .68rem;
  color: rgba(255,255,255,.35);
  margin-top: 1px;
}

.sidebar-nav {
  padding: 10px 10px 0;
  flex: 1;
}

.nav-group-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
  padding: 12px 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  text-decoration: none;
  user-select: none;
}

.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }
.nav-link:hover { background: var(--sidebar-hover); color: rgba(255,255,255,.9); }
.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
}
.nav-link.active svg { opacity: 1; }

.nav-subnav {
  padding: 1px 0 3px 32px;
}

.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.38);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  text-decoration: none;
  user-select: none;
}

.nav-sub-link::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: .7;
}

.nav-sub-link:hover { background: var(--sidebar-hover); color: rgba(255,255,255,.85); }
.nav-sub-link.active { background: var(--sidebar-active); color: #fff; }
.nav-sub-link.active::before { opacity: 1; }

.sidebar-footer {
  padding: 14px 16px;
  font-size: .7rem;
  color: rgba(255,255,255,.22);
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ============================================================
   Main content
   ============================================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page {
  padding: 32px 36px;
  max-width: 960px;
  width: 100%;
}

/* ============================================================
   Page header
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page-desc {
  font-size: .825rem;
  color: var(--text-3);
  margin-top: 3px;
}

.cr-breadcrumb-sep {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-3);
  margin: 0 6px;
}

.cr-breadcrumb-sub {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: -.02em;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-size: .825rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--dur) var(--ease);
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(79,70,229,.25);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-mid);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-1); border-color: #B0BAC9; }

.btn-danger-outline {
  background: transparent;
  color: var(--red);
  border-color: transparent;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.btn-danger-outline:hover { background: var(--red-bg); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red-dark); border-color: var(--red-dark); }

.btn:disabled {
  opacity: .5;
  pointer-events: none;
}

/* ============================================================
   Card / surface
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ============================================================
   Table
   ============================================================ */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  background: #FAFAFA;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FAFCFF; }

td {
  padding: 13px 16px;
  vertical-align: middle;
  color: var(--text-1);
}

.td-name     { min-width: 160px; }
.td-id       { min-width: 130px; }
.td-currency { width: 80px; }
.td-status   { width: 130px; }
.td-actions  { width: 48px; text-align: right; }

.account-name {
  font-weight: 600;
  color: var(--text-1);
}

.account-id {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: .775rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* ============================================================
   Status pill — clickable toggle
   ============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--dur) var(--ease);
  user-select: none;
  white-space: nowrap;
}

.status-pill svg { width: 10px; height: 10px; flex-shrink: 0; }

/* Active */
.pill-active {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}
.pill-active:hover {
  background: #A7F3D0;
  border-color: #6EE7B7;
}

/* Paused */
.pill-paused {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: var(--amber-border);
}
.pill-paused:hover {
  background: #FDE68A;
  border-color: #FCD34D;
}

/* Disconnected */
.pill-disconnected {
  background: var(--slate-bg);
  color: var(--slate-text);
  border-color: var(--slate-border);
}
.pill-disconnected:hover {
  background: #E2E8F0;
}

.status-pill.loading {
  opacity: .5;
  pointer-events: none;
}

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  padding: 64px 24px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: var(--text-3);
}

.empty-icon svg { width: 22px; height: 22px; }

.empty-title {
  font-size: .925rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: .825rem;
  color: var(--text-3);
  margin-bottom: 18px;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(6px) scale(.99);
  transition: transform var(--dur) var(--ease);
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-sm { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.crd-delete-row {
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.modal-title {
  font-size: .975rem;
  font-weight: 700;
  color: var(--text-1);
}

.modal-close {
  width: 26px;
  height: 26px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: background var(--dur);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--border); color: var(--text-1); }
.modal-close svg { width: 14px; height: 14px; }

.modal-body { padding: 20px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================
   Delete confirmation specifics
   ============================================================ */
.confirm-icon {
  width: 40px;
  height: 40px;
  background: var(--red-bg);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  color: var(--red);
}

.confirm-icon svg { width: 20px; height: 20px; }

.confirm-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}

.confirm-body {
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.55;
}

.confirm-body strong { color: var(--text-1); }

.warning-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--red-bg);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: #991B1B;
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.warning-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}

.form-label .req { color: var(--red); margin-left: 2px; }

.form-input,
.form-select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-family: inherit;
  color: var(--text-1);
  background: var(--surface);
  transition: border-color var(--dur), box-shadow var(--dur);
  appearance: none;
}

.form-input::placeholder { color: var(--text-3); }

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394A3B8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.form-hint {
  font-size: .75rem;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.4;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ============================================================
   Toast notifications
   ============================================================ */
#toast-region {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: .835rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: slide-up 220ms var(--ease) both;
  min-width: 220px;
  max-width: 340px;
}

.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success { background: #065F46; }
.toast-error   { background: var(--red-dark); }
.toast-info    { background: #1E3A5F; }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Skeleton / loading
   ============================================================ */
@keyframes shimmer {
  from { background-position: -600px 0; }
  to   { background-position:  600px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #E2E8F0 25%, #EFF3F8 50%, #E2E8F0 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 4px;
}

.skel-row td { padding: 16px; }
.skel-row td > span {
  display: block;
  height: 13px;
  border-radius: 4px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 680px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .page { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   Creatives — wide page layout
   ============================================================ */
.page-wide { max-width: 1280px; }

/* ============================================================
   Creatives toolbar
   ============================================================ */
/* ── Sync status bar ───────────────────────────────────────────────────────── */
.cr-sync-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .82rem;
  margin-bottom: 14px;
  animation: slide-up .18s var(--ease) both;
}

.cr-sync-bar.is-running {
  background: rgba(99,102,241,.1);
  border: 1px solid rgba(99,102,241,.25);
  color: var(--text-2);
}

.cr-sync-bar.is-done {
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.3);
  color: var(--text-2);
}

.cr-sync-bar.is-error {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--text-2);
}

.cr-sync-bar-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

@keyframes cr-spin {
  to { transform: rotate(360deg); }
}

.cr-sync-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(99,102,241,.25);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: cr-spin .7s linear infinite;
}

.cr-sync-bar-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cr-sync-bar-msg {
  font-weight: 600;
}

.cr-sync-bar-detail {
  color: var(--text-3);
  font-size: .78rem;
}

.cr-sync-bar-dismiss {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: .9rem;
  padding: 2px 4px;
  line-height: 1;
  flex-shrink: 0;
}
.cr-sync-bar-dismiss:hover { color: var(--text-1); }

.cr-type-bar {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.cr-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.cr-toolbar-spacer { flex: 1; min-width: 8px; }

/* View toggle */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--border-mid); }
.view-toggle-btn:hover { background: var(--bg); color: var(--text-2); }
.view-toggle-btn.active { background: var(--primary-bg); color: var(--primary); }
.view-toggle-btn svg { width: 15px; height: 15px; }

/* ============================================================
   Creatives filter bar
   ============================================================ */
.cr-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cr-filter-sel {
  height: 32px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-family: inherit;
  color: var(--text-2);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394A3B8'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}

.cr-filter-sel:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.cr-filter-sel.active {
  border-color: var(--primary);
  background-color: var(--primary-bg);
  color: var(--primary);
}

.cr-filter-divider {
  width: 1px;
  height: 20px;
  background: var(--border-mid);
  flex-shrink: 0;
  margin: 0 2px;
}

.cr-date-input {
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-family: inherit;
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}

.cr-date-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.cr-date-input.active { border-color: var(--primary); color: var(--primary); }

.btn-clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  font-size: .78rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.btn-clear-filters:hover { color: var(--text-1); background: var(--bg); }
.btn-clear-filters svg { width: 12px; height: 12px; }

/* ============================================================
   Column picker popover
   ============================================================ */
.col-picker-wrap { position: relative; }

.col-picker-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 40;
  min-width: 170px;
  padding: 6px 0;
}

.col-picker-panel.open { display: block; }

.col-picker-title {
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 14px 6px;
}

.col-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  font-size: .825rem;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  user-select: none;
}

.col-picker-item:hover { background: var(--bg); }
.col-picker-item input[type=checkbox] {
  accent-color: var(--primary);
  width: 13px; height: 13px;
  cursor: pointer; flex-shrink: 0;
}

/* ============================================================
   Creatives table enhancements
   ============================================================ */
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text-2); }
thead th.sort-active { color: var(--primary); }

.sort-icon {
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
  opacity: .3;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.sort-icon.desc { opacity: 1; }
.sort-icon.asc  { opacity: 1; transform: rotate(180deg); }
thead th.sort-active .sort-icon { opacity: 1; }

.th-metric, .td-metric {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.td-creative-name { font-weight: 600; color: var(--text-1); }
.td-creative-sub  { font-size: .75rem; color: var(--text-3); margin-top: 1px; }

/* Group-by header rows */
.cr-group-row td {
  background: var(--bg) !important;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 5px 16px !important;
  border-bottom: 1px solid var(--border) !important;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  vertical-align: middle;
}

.badge-active   { background: var(--green-bg);  color: var(--green);       border-color: var(--green-border); }
.badge-paused   { background: var(--amber-bg);  color: var(--amber);       border-color: var(--amber-border); }
.badge-archived { background: var(--slate-bg);  color: var(--slate-text);  border-color: var(--slate-border); }

.badge-image      { background: var(--primary-bg); color: var(--primary);  border-color: #C7D2FE; }
.badge-video      { background: #FEF3C7; color: #92400E;                   border-color: #FDE68A; }
.badge-carousel   { background: #ECFDF5; color: #065F46;                   border-color: #A7F3D0; }
.badge-collection { background: #FFF7ED; color: #9A3412;                   border-color: #FED7AA; }

.badge-awareness     { background: #EFF6FF; color: #1D4ED8;                border-color: #BFDBFE; }
.badge-consideration { background: var(--primary-bg); color: var(--primary); border-color: #C7D2FE; }
.badge-conversion    { background: var(--green-bg); color: var(--green);   border-color: var(--green-border); }

.badge-pending  { background: var(--slate-bg); color: var(--slate-text);   border-color: var(--slate-border); }
.badge-analyzed { background: var(--green-bg); color: var(--green);        border-color: var(--green-border); }
.badge-error    { background: var(--red-bg);   color: var(--red);          border-color: #FECACA; }

/* Metric colour hints */
.metric-good  { color: var(--green); font-weight: 600; }
.metric-warn  { color: var(--amber); }
.metric-muted { color: var(--text-3); }

/* ============================================================
   Creative card grid
   ============================================================ */
.cr-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  align-items: start;
}

.cr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.cr-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-mid); }

/* ── Portrait thumbnail (3:4) ── */
.cr-card-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg-2);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.cr-card-thumb img,
.cr-card-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cr-card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border-mid);
}
.cr-card-thumb-placeholder svg { width: 36px; height: 36px; }

/* Top bar: format pill + metrics toggle */
.cr-card-thumb-top {
  position: absolute;
  top: 8px; left: 8px; right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
  pointer-events: none;
}
.cr-card-format-pill {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 7px;
  border-radius: 20px;
  pointer-events: none;
}
.cr-card-thumb-left {
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.cr-card-metrics-btn {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  border: none;
  color: var(--text-3);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
  pointer-events: all;
}
.cr-card-metrics-btn:hover { color: var(--text-1); }
.cr-card-metrics-btn.active { color: var(--accent); }

.cr-card-influencer-pill {
  background: rgba(90,30,30,.8);
  backdrop-filter: blur(4px);
  color: #fca5a5;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 7px;
  border-radius: 20px;
  pointer-events: none;
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr-card-live-pill {
  background: rgba(0,70,25,.85);
  backdrop-filter: blur(4px);
  color: #86efac;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 7px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
}

.cr-card-type-pill {
  background: rgba(120,60,0,.8);
  backdrop-filter: blur(4px);
  color: #fbbf24;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 7px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
}

.cr-card-new-badge {
  position: absolute;
  top: 16px;
  right: -48px;
  width: 140px;
  padding: 6px 0;
  background: #16a34a;
  color: #fff;
  font-size: .58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  text-align: center;
  transform: rotate(45deg);
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  pointer-events: none;
  z-index: 3;
}

/* Gradient overlay — filename + date */
.cr-card-thumb-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.82) 0%, transparent 100%);
  padding: 36px 10px 10px;
  z-index: 2;
}
.cr-overlay-name {
  font-size: .75rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-overlay-date {
  font-size: .67rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* ── Footer: tags + togglable metrics ── */
.cr-card-footer {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cr-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 22px;
}

.cr-tag {
  font-size: .68rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.cr-tag-brand      { background: #1e3a5f; color: #7dd3fc; border-color: #1e4976; }
.cr-tag-product    { background: #1a3327; color: #6ee7b7; border-color: #1c4535; }
.cr-tag-influencer { background: #3b1f1f; color: #fca5a5; border-color: #5a2d2d; }
.cr-tag-custom     { background: #2a1f4a; color: #c4b5fd; border-color: #3b2d6a; }
.cr-tag-empty      { color: var(--text-3); font-style: italic; border: none; background: none; }

/* Metrics grid — hidden until toggled */
.cr-card-metrics {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.cr-card-metrics.open { display: grid; }

.cr-metric-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.cr-metric-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 2px;
}

.cr-metric-value {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Creatives pagination
   ============================================================ */
.cr-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.cr-pagination-info { font-size: .8rem; color: var(--text-3); }

.cr-pagination-btns { display: flex; align-items: center; gap: 4px; }

.cr-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 500;
  font-family: inherit;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}

.cr-page-btn:hover:not(:disabled) { background: var(--bg); border-color: #B0BAC9; color: var(--text-1); }
.cr-page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.cr-page-btn:disabled { opacity: .4; cursor: default; }
.cr-page-btn svg { width: 13px; height: 13px; }

/* ============================================================
   Delivery-status segmented control (All Ads / Had Delivery / Active Ads)
   ============================================================ */
.delivery-seg {
  display: inline-flex;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.delivery-seg-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 13px;
  font-size: .8rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.delivery-seg-btn + .delivery-seg-btn { border-left: 1px solid var(--border-mid); }
.delivery-seg-btn:hover { background: var(--bg); color: var(--text-1); }
.delivery-seg-btn.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }

/* Result count chip next to page title */
.result-count {
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-3);
  padding: 2px 9px;
  background: var(--bg);
  border-radius: 99px;
  border: 1px solid var(--border-mid);
  vertical-align: middle;
  margin-left: 6px;
}

/* ============================================================
   badge-analyzing (pulsing variant for in-progress state)
   badge-tag (neutral AI tag pill)
   badge-neutral
   ============================================================ */
.badge-analyzing {
  background: #EFF6FF;
  color: #1D4ED8;
  border-color: #BFDBFE;
  animation: badge-pulse 1.4s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .55; }
}

.badge-tag {
  background: #F8FAFC;
  color: var(--text-2);
  border-color: var(--border-mid);
  text-transform: capitalize;
}

.badge-neutral {
  background: var(--bg);
  color: var(--text-3);
  border-color: var(--border-mid);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   Row clickable (table rows + cards)
   ============================================================ */
.cr-row-clickable { cursor: pointer; }
.cr-row-clickable:hover td { background: var(--bg) !important; }
.cr-card.cr-row-clickable:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* ============================================================
   Spinner (small)
   ============================================================ */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   btn-sm
   ============================================================ */
.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: .78rem;
  gap: 5px;
}

/* ============================================================
   Creative Detail Modal
   ============================================================ */
.modal-creative {
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.crd-body {
  display: flex;
  gap: 0;
  overflow: hidden;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
}

/* Left — media pane */
.crd-preview {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.crd-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crd-media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--border);
}

.crd-img,
.crd-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.crd-meta-pills { display: flex; flex-wrap: wrap; gap: 4px; }

/* Right — details pane */
.crd-details {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.crd-headline-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Modal header with editable name ─────────────────────── */
.crd-modal-header {
  align-items: center;
  gap: 12px;
}

.crd-header-name-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.crd-header-name-input {
  flex: 1;
  min-width: 0;
  font-size: .975rem;
  font-weight: 700;
  color: var(--text-1);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  margin-left: -6px;
  outline: none;
  transition: border-color .15s, background .15s;
  line-height: 1.35;
}
.crd-header-name-input:hover { border-color: var(--border); background: var(--bg-2); }
.crd-header-name-input:focus { border-color: var(--primary); background: var(--surface); }

.crd-ext-pill {
  flex-shrink: 0;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-3);
}

.crd-download-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.crd-account {
  font-size: .8rem;
  color: var(--text-3);
  margin: 0 0 2px;
}

/* Copy block */
.crd-copy { display: flex; flex-direction: column; gap: 6px; }
.crd-copy-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  margin: 0;
  font-size: .82rem;
  line-height: 1.4;
}
.crd-copy-label {
  font-weight: 500;
  color: var(--text-3);
  padding-top: 1px;
}
.crd-copy-val { color: var(--text-1); }

/* Section wrapper */
.crd-section { display: flex; flex-direction: column; gap: 10px; }
.crd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.crd-section-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0;
}

/* Analyze actions row */
.crd-analyze-actions { display: flex; align-items: center; gap: 10px; }
.crd-analyzed-at {
  font-size: .75rem;
  color: var(--text-3);
}

/* Analyzing state */
.crd-analyzing-state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-2);
  padding: 10px 0;
}

/* Metrics grid */
.crd-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.crd-metric-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
}
.crd-metric-label {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 3px;
}
.crd-metric-val {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

/* AI tags grid */
.crd-tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.crd-tag-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.crd-tag-label {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.crd-tag-val {
  font-size: .78rem;
  align-self: flex-start;
}

/* AI summary */
.crd-ai-summary {
  font-size: .82rem;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0;
}

/* Analysis placeholder */
.crd-analysis-placeholder {
  font-size: .82rem;
  color: var(--text-3);
  margin: 0;
  padding: 4px 0;
}

/* Responsive: stack vertically on narrow screens */
@media (max-width: 640px) {
  .modal-creative { max-width: 100%; }
  .crd-body { flex-direction: column; overflow-y: auto; }
  .crd-preview { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Manual tags ──────────────────────────────────────────── */
.crd-manual-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.crd-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  background: var(--primary-bg);
  border: 1px solid #C7D2FE;
  border-radius: 99px;
  font-size: .74rem;
  color: var(--primary);
  font-weight: 500;
}

.crd-tag-chip-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  opacity: .5;
  padding: 0;
  line-height: 1;
  font-size: .9rem;
  display: flex;
  align-items: center;
  transition: opacity .1s;
}
.crd-tag-chip-del:hover { opacity: 1; }

/* ── Product input ─────────────────────────────────────────── */
.crd-product-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.crd-product-input {
  flex: 1;
  padding: 6px 10px;
  font-size: .82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-1);
  outline: none;
  transition: border-color .15s;
}
.crd-product-input:focus { border-color: var(--primary); }
.crd-product-input::placeholder { color: var(--text-3); }

.crd-tag-input-row { margin-top: 6px; }

.crd-tag-input {
  width: 100%;
  padding: 6px 10px;
  font-size: .82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-1);
  outline: none;
  transition: border-color .15s;
}
.crd-tag-input:focus { border-color: var(--primary); }
.crd-tag-input::placeholder { color: var(--text-3); }

/* ── Comments ─────────────────────────────────────────────── */
.crd-comment-count {
  font-size: .75rem;
  color: var(--text-3);
  font-weight: 400;
}

.crd-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.crd-comments-empty {
  font-size: .82rem;
  color: var(--text-3);
  padding: 8px 0;
}

.crd-comment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  position: relative;
}

.crd-comment-body {
  font-size: .82rem;
  color: var(--text-1);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.crd-comment-meta {
  font-size: .72rem;
  color: var(--text-3);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.crd-comment-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 0;
  font-size: .72rem;
  transition: color .1s;
  margin-left: auto;
}
.crd-comment-del:hover { color: var(--danger); }

.crd-comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  align-items: stretch;
}
.crd-comment-form .btn {
  align-self: flex-end;
}

.crd-comment-textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: .82rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-1);
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.crd-comment-textarea:focus { border-color: var(--primary); }
.crd-comment-textarea::placeholder { color: var(--text-3); }

/* ── Upload modal ─────────────────────────────────────────── */
.modal-upload { max-width: 560px; width: 100%; }

.upload-body { padding: 0; display: flex; flex-direction: column; }

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 24px;
  margin: 20px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}

.upload-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-dz-text {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-1);
}

.upload-dz-sub {
  font-size: .8rem;
  color: var(--text-3);
}

.upload-browse-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
}

.upload-file-list {
  padding: 0 24px;
  flex: 1;
}

.upload-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}

.upload-add-more {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  padding: 0;
}

.upload-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.upload-table th {
  padding: 6px 8px;
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.upload-table td {
  padding: 8px 8px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.upload-table tr:last-child td { border-bottom: none; }

.upload-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color .1s;
}
.upload-remove-btn:hover { color: var(--danger); }

.upload-footer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  flex-wrap: wrap;
}

.upload-acct-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-2);
  font-weight: 500;
}

.upload-acct-select {
  padding: 5px 8px;
  font-size: .82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-1);
  outline: none;
}

.upload-progress-bar {
  height: 3px;
  background: var(--primary-bg);
  border-radius: 99px;
  overflow: hidden;
  margin: 0 24px 12px;
}

.upload-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width .3s ease;
  border-radius: 99px;
}

/* ============================================================
   Analytics — Win Rate Analysis
   ============================================================ */

/* ── Funnel color tokens ──────────────────────────────────── */
:root {
  --tof-color:  #1D4ED8;   --tof-bg:  #EFF6FF;  --tof-border:  #BFDBFE;
  --mof-color:  #7C3AED;   --mof-bg:  #F5F3FF;  --mof-border:  #DDD6FE;
  --bof-color:  #059669;   --bof-bg:  #D1FAE5;  --bof-border:  #A7F3D0;
}

/* Funnel badges */
.badge-tof     { background: var(--tof-bg); color: var(--tof-color); border-color: var(--tof-border); }
.badge-mof     { background: var(--mof-bg); color: var(--mof-color); border-color: var(--mof-border); }
.badge-bof     { background: var(--bof-bg); color: var(--bof-color); border-color: var(--bof-border); }
.badge-blended { background: var(--slate-bg); color: var(--slate-text); border-color: var(--slate-border); font-size: .68rem; }
.badge-winner     { background: #ECFDF5; color: #065F46;              border-color: #6EE7B7; font-weight: 600; }
.badge-non-winner { background: transparent; color: var(--text-3);   border-color: transparent; }

/* ── Toolbar ──────────────────────────────────────────────── */
.an-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.an-toolbar-spacer { flex: 1 1 0; }

.an-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Funnel tab strip ─────────────────────────────────────── */
.an-funnel-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 34px;
}

.an-funnel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  font-size: .82rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.an-funnel-btn + .an-funnel-btn { border-left: 1px solid var(--border); }
.an-funnel-btn:hover { background: var(--bg); color: var(--text-1); }

.an-funnel-btn.active              { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.an-funnel-btn[data-funnel="awareness"].active     { background: var(--tof-bg); color: var(--tof-color); }
.an-funnel-btn[data-funnel="consideration"].active { background: var(--mof-bg); color: var(--mof-color); }
.an-funnel-btn[data-funnel="conversion"].active    { background: var(--bof-bg); color: var(--bof-color); }

/* Funnel dot indicators */
.an-funnel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.an-dot-tof { background: var(--tof-color); }
.an-dot-mof { background: var(--mof-color); }
.an-dot-bof { background: var(--bof-color); }

/* ── KPI summary row ──────────────────────────────────────── */
.an-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .an-kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .an-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.an-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.an-kpi-card--winners {
  border-color: #6EE7B7;
  background: linear-gradient(145deg, #ECFDF5 0%, var(--surface) 55%);
}

.an-kpi-card--good {
  border-color: var(--green-border);
}
.an-kpi-card--warn {
  border-color: var(--amber-border);
}

.an-kpi-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: 6px;
}

.an-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.an-kpi-sub {
  font-size: .72rem;
  color: var(--text-3);
}

/* ── Funnel breakdown strip ───────────────────────────────── */
.an-breakdown-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.an-strip-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: .8rem;
  box-shadow: var(--shadow-sm);
}

.an-strip-tof { border-left: 3px solid var(--tof-color); }
.an-strip-mof { border-left: 3px solid var(--mof-color); }
.an-strip-bof { border-left: 3px solid var(--bof-color); }

.an-strip-label { font-weight: 700; color: var(--text-1); min-width: 30px; }
.an-strip-stat  { color: var(--text-1); font-weight: 500; }
.an-strip-rate  { color: var(--text-3); }
.an-strip-roas  { color: var(--green); font-weight: 600; }

/* ── Loading state ────────────────────────────────────────── */
.an-loading-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 60px 24px;
  justify-content: center;
  font-size: .9rem;
  color: var(--text-2);
}

/* ── Table card ───────────────────────────────────────────── */
.an-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}

.an-table-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}

.an-sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.an-sort-sel {
  height: 28px !important;
  font-size: .78rem !important;
  padding: 0 24px 0 8px !important;
}

.an-order-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.an-order-btn:hover { background: var(--bg); color: var(--text-1); }

/* Winner row highlight */
.an-row-winner td { background: #FAFFF8 !important; }
.an-row-winner:hover td { background: #F0FDF4 !important; }

/* ── Score bar ────────────────────────────────────────────── */
.an-score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.an-score-bar {
  width: 52px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}

.an-score-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--border-mid);
  transition: width .3s var(--ease);
}
.an-score-fill--mid    { background: var(--amber); }
.an-score-fill--winner { background: var(--green); }

.an-score-num {
  font-size: .8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  min-width: 22px;
  text-align: right;
}

/* ── Breakdown section ────────────────────────────────────── */
.an-breakdown-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .an-breakdown-section { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .an-breakdown-section { grid-template-columns: 1fr; }
}

.an-breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.an-breakdown-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin: 0 0 14px;
}

.an-bd-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.an-bd-row:last-child { margin-bottom: 0; }

.an-bd-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.an-bd-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-1);
  text-transform: capitalize;
}
.an-bd-stat {
  font-size: .73rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.an-bd-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.an-bd-bar {
  flex: 1 1 0;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.an-bd-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s var(--ease);
}
.an-bd-fill--good { background: var(--green); }
.an-bd-fill--mid  { background: var(--amber); }
.an-bd-fill--low  { background: var(--border-mid); }

.an-bd-pct {
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: right;
}

/* ── Kill / Watch / Scale recommendations ─────────────────── */

.an-rec-wrap {
  margin-bottom: 20px;
}

.an-rec-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.an-rec-title {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.an-rec-sub {
  font-size: .77rem;
  color: var(--text-3);
  margin: 0;
}

.an-rec-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 900px) {
  .an-rec-columns { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .an-rec-columns { grid-template-columns: 1fr; }
}

.an-rec-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Column header strip */
.an-rec-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

.an-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.an-rec-dot--scale { background: #16A34A; }
.an-rec-dot--watch { background: #D97706; }
.an-rec-dot--kill  { background: #DC2626; }

.an-rec-col-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  flex: 1;
}
.an-rec-col--scale .an-rec-col-label { color: #16A34A; }
.an-rec-col--watch .an-rec-col-label { color: #D97706; }
.an-rec-col--kill  .an-rec-col-label { color: #DC2626; }

.an-rec-col-count {
  font-size: .7rem;
  font-weight: 700;
  min-width: 22px;
  height: 20px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
}
.an-rec-col--scale .an-rec-col-count { background: #DCFCE7; color: #166534; }
.an-rec-col--watch .an-rec-col-count { background: #FEF3C7; color: #92400E; }
.an-rec-col--kill  .an-rec-col-count { background: #FEE2E2; color: #991B1B; }

/* Card list */
.an-rec-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}

/* Individual card */
.an-rec-card {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  background: var(--bg);
  transition: box-shadow var(--dur) var(--ease);
}
.an-rec-card:hover { box-shadow: 0 1px 6px rgba(0,0,0,.08); }

.an-rec-card--scale { border-left-color: #16A34A; }
.an-rec-card--watch { border-left-color: #D97706; }
.an-rec-card--kill  { border-left-color: #DC2626; }

.an-rec-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.an-rec-card-name {
  font-size: .81rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72%;
  line-height: 1.3;
}

.an-rec-rationale {
  font-size: .76rem;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0 0 8px;
}

.an-rec-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.an-rec-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}

.an-rec-metric-key {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
}

.an-rec-metric-val {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.an-rec-empty {
  font-size: .8rem;
  color: var(--text-3);
  text-align: center;
  padding: 22px 12px;
  margin: 0;
  font-style: italic;
}

/* ── Iteration Priorities ─────────────────────────────────── */

.an-iter-wrap {
  /* inherits .card base */
}

.an-iter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.an-iter-title {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 2px;
}

.an-iter-sub {
  font-size: .77rem;
  color: var(--text-3);
  margin: 0;
}

.an-iter-count {
  font-size: .7rem;
  font-weight: 700;
  background: var(--border);
  color: var(--text-2);
  border-radius: 99px;
  padding: 2px 8px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* 2-column grid on desktop */
.an-iter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 800px) {
  .an-iter-grid { grid-template-columns: 1fr; }
}

/* Individual priority card */
.an-iter-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--dur) var(--ease);
}
.an-iter-card:hover { box-shadow: 0 1px 8px rgba(0,0,0,.07); }

/* Top row: rank + score badge + name */
.an-iter-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.an-iter-rank-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.an-iter-rank {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .05em;
}

/* Priority score badge */
.an-prio-score {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.an-prio--high { background: #FEE2E2; color: #991B1B; }
.an-prio--med  { background: #FEF3C7; color: #92400E; }
.an-prio--low  { background: var(--border); color: var(--text-2); }

.an-iter-name-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.an-iter-card-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.an-iter-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* Weakest metric row */
.an-iter-weak-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.an-weak-label {
  font-size: .7rem;
  color: var(--text-3);
  font-weight: 500;
}

.an-weak-badge {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: 4px;
  padding: 1px 6px;
}

.an-weak-val {
  font-size: .78rem;
  font-weight: 700;
  color: #DC2626;
  font-variant-numeric: tabular-nums;
}

.an-weak-pct {
  font-size: .7rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  background: var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.an-iter-cohort {
  font-size: .7rem;
  color: var(--text-3);
  margin-left: auto;
}

/* Next-test suggestion */
.an-iter-next-test {
  font-size: .77rem;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
  padding: 8px 10px;
  background: #F0F9FF;
  border-left: 3px solid #38BDF8;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.an-iter-next-label {
  font-weight: 700;
  color: #0369A1;
}

/* Footer metrics */
.an-iter-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.an-iter-score-lbl {
  font-size: .73rem;
  color: var(--text-3);
}
.an-iter-score-lbl strong {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}

.an-iter-spend {
  font-size: .73rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.an-iter-empty {
  font-size: .82rem;
  color: var(--text-3);
  text-align: center;
  padding: 24px;
  font-style: italic;
  margin: 0;
}

/* ── Reports page ─────────────────────────────────────────── */

/* Generate card */
.rpt-gen-card {
  margin-bottom: 20px;
}

.rpt-gen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.rpt-gen-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 3px;
}

.rpt-gen-sub {
  font-size: .77rem;
  color: var(--text-3);
  margin: 0;
}

.rpt-gen-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rpt-gen-form .cr-filter-sel {
  min-width: 140px;
  flex: 1 1 140px;
}

/* State messages */
.rpt-state-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: .85rem;
}

/* History section */
.rpt-list-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.rpt-list-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin: 0;
}

.rpt-list-count {
  font-size: .72rem;
  font-weight: 600;
  background: var(--border);
  color: var(--text-2);
  border-radius: 99px;
  padding: 2px 8px;
}

/* History grid */
.rpt-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.rpt-history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.rpt-history-card:hover {
  border-color: var(--border-mid);
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
}
.rpt-history-card--active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.rpt-hc-top {
  margin-bottom: 6px;
}

.rpt-hc-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.rpt-hc-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.rpt-hc-window, .rpt-hc-date {
  font-size: .72rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Detail panel */
.rpt-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 14px;
  border-top: 2px solid var(--border-mid);
  margin-top: 20px;
}

.rpt-detail-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 3px;
}

.rpt-detail-meta {
  font-size: .77rem;
  color: var(--text-3);
  margin: 0;
}

/* KPI row reuse — give it slightly more spacing */
.rpt-kpi-row {
  margin-bottom: 14px;
}

/* Sync window + rec pills row */
.rpt-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.rpt-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}

.rpt-rec-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rpt-rec-pill {
  font-size: .72rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 2px 10px;
}
.rpt-rec-pill--scale { background: #DCFCE7; color: #166534; }
.rpt-rec-pill--watch { background: #FEF3C7; color: #92400E; }
.rpt-rec-pill--kill  { background: #FEE2E2; color: #991B1B; }

.rpt-delete-btn { margin-left: auto; }

/* Danger ghost button */
.btn-danger-ghost {
  color: #DC2626;
  border-color: #FECACA;
  background: transparent;
}
.btn-danger-ghost:hover {
  background: #FEF2F2;
  border-color: #FCA5A5;
}

/* Performers section */
.rpt-performers-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .rpt-performers-wrap { grid-template-columns: 1fr; }
}

.rpt-performers-card {
  /* inherits .card */
}

.rpt-table-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  margin: 0 0 12px;
}

.rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

/* ============================================================
   Report Detail Modal
   ============================================================ */

.modal-rpt {
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rpt-modal-body {
  overflow-y: auto;
  padding: 20px;
  flex: 1 1 auto;
  min-height: 0;
}

/* Header */
.rpt-modal-hd { flex: 1; min-width: 0; }

.rpt-modal-meta {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* KPI delta line (below each value) */
.rpt-kpi-delta {
  font-size: .72rem;
  font-weight: 500;
  min-height: 1em;
  margin-top: 4px;
}

.rpt-delta-good    { color: var(--green); }
.rpt-delta-bad     { color: var(--red); }
.rpt-delta-neutral { color: var(--text-3); }
.rpt-delta-flat    { color: var(--text-3); font-style: italic; }

/* Comparison context strip */
.rpt-compare-wrap { margin-bottom: 14px; }

.rpt-compare-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  line-height: 1.5;
}

.rpt-compare-strip strong { color: var(--text-1); }

.rpt-cs-window { color: var(--text-3); }

.rpt-compare-empty {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .78rem;
  color: var(--slate-text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .modal-rpt { max-width: 100%; }
}

/* ============================================================
   Settings Page
   ============================================================ */

/* Cards stack with a modest gap */
#page-settings .stg-card { margin-bottom: 18px; }

/* Card header: icon + text side by side */
.stg-card-hd {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.stg-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--primary-bg);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stg-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 3px;
}

.stg-card-desc {
  font-size: .82rem;
  color: var(--text-3);
  margin: 0;
  line-height: 1.5;
}

/* Fields */
.stg-field {
  margin-bottom: 18px;
}

.stg-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* Base input */
.stg-input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-size: .875rem;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--dur);
}
.stg-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* Select */
.stg-select { appearance: none; cursor: pointer; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394A3B8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

/* Password input + reveal button wrapper */
.stg-secret-wrap { position: relative; }
.stg-secret-wrap .stg-input { padding-right: 38px; }

.stg-reveal-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-3);
  display: grid;
  place-items: center;
  padding: 2px;
  border-radius: 3px;
}
.stg-reveal-btn:hover { color: var(--text-2); }

/* Input with suffix/prefix addon */
.stg-input-addon { display: flex; align-items: center; }
.stg-input-addon .stg-input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.stg-addon {
  height: 36px;
  padding: 0 10px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-3);
  background: var(--bg);
  border: 1px solid var(--border-mid);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: grid;
  place-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.stg-input-addon--prefix .stg-input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.stg-addon--prefix { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-left: 1px solid var(--border-mid); border-right: none; }

/* Helper text */
.stg-hint {
  margin: 5px 0 0;
  font-size: .78rem;
  color: var(--text-3);
  line-height: 1.55;
}
.stg-hint a { color: var(--primary); text-decoration: none; }
.stg-hint a:hover { text-decoration: underline; }
.stg-hint code {
  font-size: .77rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  color: var(--text-2);
}

/* 2-column grid for data settings */
.stg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
@media (max-width: 640px) {
  .stg-grid { grid-template-columns: 1fr; }
}

/* Footer: button + inline status */
.stg-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Inline status message */
.stg-status { font-size: .8rem; }
.stg-status--loading { color: var(--text-3); }
.stg-status--success { color: var(--green); font-weight: 500; }
.stg-status--error   { color: var(--red); }

/* Meta connection result panel */
.stg-meta-result {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stg-meta-user {
  font-size: .82rem;
  font-weight: 600;
  color: #065F46;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.stg-meta-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.stg-acct-pill {
  font-size: .75rem;
  font-weight: 500;
  background: rgba(5,150,105,.15);
  color: #065F46;
  border: 1px solid var(--green-border);
  border-radius: 20px;
  padding: 2px 9px;
}

/* ============================================================
   Onboarding Setup Banner
   ============================================================ */

.setup-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin: 24px 36px 0;
  max-width: 888px; /* 960px - 2×36px to match .page content width */
  background: var(--primary-bg);
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-lg);
  transition: opacity .35s ease, padding .35s ease, margin .35s ease;
}

.setup-banner--hiding {
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  overflow: hidden;
}

/* Heading + progress sub-line */
.setup-banner-hd {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.setup-banner-title {
  font-size: .74rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .07em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.setup-banner-title--done { color: var(--green); }

.setup-banner-sub {
  font-size: .73rem;
  color: var(--text-3);
}

/* Step list */
.setup-steps {
  display: flex;
  gap: 7px;
  list-style: none;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
}

/* Individual step chip */
.setup-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid #C7D2FE;
  border-radius: 20px;
  font-size: .8rem;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
  user-select: none;
}

.setup-step:hover:not(.setup-step--done) {
  background: #EEF2FF;
  border-color: var(--primary);
  color: var(--primary);
}

/* Completed state */
.setup-step--done {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
  cursor: default;
}

/* Step number bubble */
.setup-step-num {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #C7D2FE;
  color: var(--primary);
  font-size: .65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.setup-step--done .setup-step-num { display: none; }

/* Checkmark icon (hidden until step is done) */
.setup-step-check { display: none; }
.setup-step--done .setup-step-check { display: block; }

/* "sync runs automatically" hint (step 3 only) */
.setup-step-sub {
  font-size: .72rem;
  color: var(--text-3);
  margin-left: 1px;
}
.setup-step--done .setup-step-sub { display: none; }

/* Dismiss × button */
.setup-dismiss {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-3);
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-left: auto;
  flex-shrink: 0;
  transition: background var(--dur), color var(--dur);
}
.setup-dismiss:hover { background: rgba(79,70,229,.1); color: var(--primary); }

/* All-complete celebration tint */
.setup-banner--complete {
  background: var(--green-bg);
  border-color: var(--green-border);
}

@media (max-width: 640px) {
  .setup-banner { gap: 10px; }
  .setup-steps  { gap: 5px; }
  .setup-step   { font-size: .76rem; padding: 4px 10px; }
}

/* ============================================================
   Boot Screen  (#hook-boot)
   ============================================================ */

#hook-boot {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #050008;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity .85s ease;
  /* Contain mix-blend-mode children — prevents blending through to the app */
  isolation: isolate;
}
#hook-boot.hb-out {
  opacity: 0;
  pointer-events: none;
}

/* ── Corner brackets ── */
.hb-corner {
  position: absolute;
  width: 48px;
  height: 48px;
  border-style: solid;
  border-color: #6b21d6;
}
.hb-tl { top: 22px; left: 22px;  border-width: 2px 0 0 2px; }
.hb-tr { top: 22px; right: 22px; border-width: 2px 2px 0 0; }
.hb-bl { bottom: 22px; left: 22px;  border-width: 0 0 2px 2px; }
.hb-br { bottom: 22px; right: 22px; border-width: 0 2px 2px 0; }

/* ── Side dot rails ── */
.hb-rail {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 140px;
  background-image: radial-gradient(circle, #7c3aed 1.5px, transparent 1.5px);
  background-size: 5px 14px;
  background-repeat: repeat-y;
}
.hb-rail-l { left: 32px; }
.hb-rail-r { right: 32px; }

/* ── Header labels ── */
.hb-header-l,
.hb-header-r {
  position: absolute;
  top: 28px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #7c3aed;
  letter-spacing: .07em;
}
.hb-header-l { left: 78px; }
.hb-header-r {
  right: 78px;
  width: 120px;
  height: 10px;
  background-image: radial-gradient(circle, #7c3aed 1px, transparent 1px);
  background-size: 10px 10px;
  background-repeat: repeat-x;
  /* override text rendering */
  font-size: 0;
}

/* ── Centre panel ── */
.hb-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: min(660px, 88vw);
}

/* ── Logo ── */
/* ── Logo container ───────────────────────────────────────── */
.hb-logo {
  margin-bottom: 36px;
  user-select: none;
  position: relative;
  /* do NOT isolate — let screen layers blend against the dark #050008 bg */
}

/* Shared base filter for all logo image layers.
   invert(1)         → black HOOK becomes white, white background becomes black
   hue-rotate(180deg)→ re-corrects purple OS back to purple
   mix-blend-mode:screen → the inverted-black background vanishes on dark bg  */
.hb-logo-img,
.hb-glow-img,
.hb-slice {
  mix-blend-mode: screen;
}

/* ── Master crisp logo ─────────────────────────────────────── */
.hb-logo-img {
  display: block;
  width: min(540px, 82vw);
  height: auto;
  position: relative;
  z-index: 5;
  filter: invert(1) hue-rotate(180deg);
  animation: hb-logo-main 8s ease-in-out infinite;
}

/* ── Glow layers ───────────────────────────────────────────── */
/* Shared positioning */
.hb-glow-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Large diffuse spread — the outer bloom halo */
.hb-glow-lg {
  inset: -30px;
  width: calc(100% + 60px);
  height: calc(100% + 60px);
  filter: invert(1) hue-rotate(180deg) blur(32px) brightness(1.1) saturate(1.0);
  opacity: 0.18;
  z-index: 1;
  animation: hb-breathe-lg 3.8s ease-in-out infinite;
}

/* Medium tight halo — adds crispness to the glow edge */
.hb-glow-md {
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  filter: invert(1) hue-rotate(180deg) blur(8px) brightness(1.05) saturate(1.0);
  opacity: 0.25;
  z-index: 2;
  animation: hb-breathe-md 3.8s ease-in-out infinite 0.4s;
}

/* ── Ambient color bloom ───────────────────────────────────── */
/* Two-node radial gradient: cool white pool on the HOOK side,
   vivid purple bloom on the OS side — both very diffuse.        */
.hb-bloom {
  position: absolute;
  inset: -90px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 68% at 28% 52%,
      rgba(220,200,255,.06) 0%, transparent 65%),
    radial-gradient(ellipse 46% 78% at 80% 50%,
      rgba(139,43,226,.18) 0%, transparent 62%),
    radial-gradient(ellipse 30% 50% at 80% 50%,
      rgba(170,70,255,.08) 0%, transparent 50%);
  filter: blur(28px);
  mix-blend-mode: screen;
  animation: hb-breathe-bloom 3.8s ease-in-out infinite 0.8s;
}

/* ── Glitch slice overlays ─────────────────────────────────── */
.hb-slice {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  z-index: 6;
  filter: invert(1) hue-rotate(180deg);
}

/* Upper slice — shifts left/right on glitch trigger */
.hb-slice-a {
  clip-path: polygon(0 18%, 100% 18%, 100% 31%, 0 31%);
  animation: hb-slice-a 9s steps(1) infinite 1.5s;
}

/* Lower slice — different band and offset direction */
.hb-slice-b {
  clip-path: polygon(0 58%, 100% 58%, 100% 70%, 0 70%);
  animation: hb-slice-b 9s steps(1) infinite 2.2s;
}

/* ── Grain / cinematic noise overlay ──────────────────────── */
/* SVG feTurbulence noise as a background, position-shifted rapidly
   to simulate analogue film grain. mix-blend-mode:overlay adds
   cinematic depth without washing out the logo.                 */
.hb-grain {
  position: absolute;
  inset: -5px;
  z-index: 8;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: hb-grain-shift 0.18s steps(1) infinite;
}

/* ── Keyframes ─────────────────────────────────────────────── */

/* Master logo: subtle transform + filter micro-glitch */
@keyframes hb-logo-main {
  0%, 80%, 100%
    { transform: none; filter: invert(1) hue-rotate(180deg); }
  /* First glitch event */
  81%
    { transform: translate(-2px, 0) skewX(-.6deg);
      filter: invert(1) hue-rotate(174deg) saturate(1.7) brightness(1.08); }
  81.6%
    { transform: translate(2px, -1px);
      filter: invert(1) hue-rotate(186deg) saturate(2.1) brightness(.94); }
  82.2%
    { transform: none; filter: invert(1) hue-rotate(180deg); }
  /* Second glitch event */
  91%
    { transform: translate(-1px, 1px) skewX(.4deg);
      filter: invert(1) hue-rotate(177deg) saturate(1.5); }
  91.6%
    { transform: translate(1px, 0);
      filter: invert(1) hue-rotate(183deg) saturate(1.8); }
  92%
    { transform: none; filter: invert(1) hue-rotate(180deg); }
}

/* Slice A: left-shift + brief right-shift */
@keyframes hb-slice-a {
  0%, 89%, 100%  { opacity: 0; transform: none; }
  89.5%          { opacity: .85; transform: translateX(-14px); }
  90%            { opacity: .85; transform: translateX(9px);
                   clip-path: polygon(0 38%, 100% 38%, 100% 45%, 0 45%); }
  90.5%          { opacity: 0;   transform: none; }
  /* Secondary micro flash */
  95%            { opacity: 0; }
  95.3%          { opacity: .5; transform: translateX(7px);
                   clip-path: polygon(0 22%, 100% 22%, 100% 26%, 0 26%); }
  95.6%          { opacity: 0; }
}

/* Slice B: right-shift, different band */
@keyframes hb-slice-b {
  0%, 90%, 100%  { opacity: 0; transform: none; }
  90.5%          { opacity: .75; transform: translateX(11px); }
  91%            { opacity: .65; transform: translateX(-8px); }
  91.4%          { opacity: 0;   transform: none; }
}

/* Breathing for large glow layer */
@keyframes hb-breathe-lg {
  0%, 100% { opacity: .18; }
  50%      { opacity: .10; }
}

/* Breathing for medium glow layer (offset phase) */
@keyframes hb-breathe-md {
  0%, 100% { opacity: .25; }
  50%      { opacity: .14; }
}

/* Breathing for ambient bloom — slightly different rhythm */
@keyframes hb-breathe-bloom {
  0%, 100% { opacity: .70; }
  50%      { opacity: .35; }
}

/* Grain position shift — rapid steps simulate animated film grain */
@keyframes hb-grain-shift {
   0% { background-position:   0px   0px; }
  10% { background-position: -52px -18px; }
  20% { background-position:  34px  61px; }
  30% { background-position: -71px  27px; }
  40% { background-position:  18px -54px; }
  50% { background-position: -39px  83px; }
  60% { background-position:  77px  -9px; }
  70% { background-position: -14px  45px; }
  80% { background-position:  55px -37px; }
  90% { background-position: -28px  12px; }
 100% { background-position:   0px   0px; }
}

/* ── "BOOTING…" label ── */
.hb-booting {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  letter-spacing: .35em;
  color: #a855f7;
  margin-bottom: 14px;
}

/* ── Progress bar ── */
.hb-progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-bottom: 28px;
}
.hb-bar {
  flex: 1;
  height: 10px;
  background: rgba(147,51,234,.12);
  border: 1px solid rgba(147,51,234,.3);
  border-radius: 99px;
  overflow: hidden;
}
.hb-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #5b21b6, #a855f7 55%, #d8b4fe);
  box-shadow: 0 0 14px rgba(168,85,247,.85);
  transition: width .35s cubic-bezier(.4,0,.2,1);
}
.hb-pct {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: #a855f7;
  min-width: 38px;
  text-align: right;
}

/* ── Boot log ── */
.hb-log {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: #7c3aed;
  line-height: 1.75;
  width: 100%;
}
.hb-log-plus {
  margin-bottom: 2px;
}
.hb-line {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .28s ease, transform .28s ease;
}
.hb-line--in {
  opacity: 1;
  transform: none;
}
.hb-ok {
  color: #c084fc;
}

/* ── Bottom status bar ── */
.hb-status {
  position: absolute;
  bottom: 28px;
  right: 78px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: #7c3aed;
  letter-spacing: .1em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hb-blink {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7, 0 0 16px rgba(168,85,247,.5);
  animation: hb-pulse 1.4s ease-in-out infinite;
}
@keyframes hb-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .25; }
}

/* ============================================================
   Influencer Matching Page
   ============================================================ */

/* ── Layout ──────────────────────────────────────────────── */
.inf-layout {
  display: flex;
  gap: 20px;
  height: calc(100vh - var(--header-h) - 48px);
  min-height: 0;
}

.inf-sidebar {
  width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
}
#inf-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inf-sidebar-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inf-sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.inf-detail-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

/* ── Influencer card (sidebar list item) ─────────────────── */
.inf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.inf-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.08);
}
.inf-card--active {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.inf-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inf-card-handle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.inf-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
  border: 2px solid var(--border);
}
.inf-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--primary-bg);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}
.inf-card-info {
  flex: 1;
  min-width: 0;
}
.inf-card-handle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inf-card-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Scrape status badge ─────────────────────────────────── */
.inf-scrape-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
}
.inf-scrape-badge--pending  { background: var(--amber-bg);  color: var(--amber);  }
.inf-scrape-badge--scraping { background: #EFF6FF; color: #2563EB; }
.inf-scrape-badge--done     { background: var(--green-bg);  color: var(--green);  }
.inf-scrape-badge--error    { background: var(--red-bg);    color: var(--red);    }
.inf-scrape-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: inf-pulse 1.4s ease-in-out infinite;
}
@keyframes inf-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* ── Empty state ─────────────────────────────────────────── */
.inf-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 280px;
  color: var(--text-3);
  text-align: center;
}
.inf-empty-icon {
  opacity: .35;
}
.inf-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
}
.inf-empty-sub {
  font-size: 13px;
  max-width: 280px;
}

/* ── Detail panel header ─────────────────────────────────── */
.inf-detail-hd {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.inf-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--border);
}
.inf-detail-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--primary-bg);
  border: 3px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}
.inf-detail-info {
  flex: 1;
  min-width: 0;
}
.inf-detail-handle {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}
.inf-detail-display {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.inf-detail-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.inf-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.inf-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.inf-stat-lbl {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.inf-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Section titles in detail panel ─────────────────────── */
.inf-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: 12px;
  margin-top: 24px;
}
.inf-section-title:first-child { margin-top: 0; }

/* ── Reference image grid ────────────────────────────────── */
.inf-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.inf-ref-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  aspect-ratio: 1;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.inf-ref-card--usable {
  border-color: var(--green-border);
}
.inf-ref-card--unusable {
  opacity: .45;
}
.inf-ref-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.inf-ref-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 5px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.inf-ref-badge--usable  { background: rgba(5,150,105,.8); }
.inf-ref-badge--skip    { background: rgba(100,116,139,.7); }

/* ── Aliases section ─────────────────────────────────────── */
.inf-aliases-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.inf-alias-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid rgba(79,70,229,.2);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
}
.inf-alias-rm {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  opacity: .6;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  display: flex;
  align-items: center;
}
.inf-alias-rm:hover { opacity: 1; }
.inf-alias-add-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.inf-alias-input {
  flex: 1;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 13px;
  color: var(--text-1);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.inf-alias-input:focus { border-color: var(--primary); }

/* ── Matches section (in detail panel) ──────────────────── */
.inf-matches-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inf-match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.inf-match-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}
.inf-match-info {
  flex: 1;
  min-width: 0;
}
.inf-match-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inf-match-reasons {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Confidence meter ────────────────────────────────────── */
.inf-conf {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
  min-width: 52px;
}
.inf-conf-val {
  font-size: 13px;
  font-weight: 700;
}
.inf-conf-bar-bg {
  width: 52px;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.inf-conf-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--green);
  transition: width .3s ease;
}
.inf-conf-bar-fill--med { background: var(--amber); }
.inf-conf-bar-fill--low { background: var(--text-3); }

/* ── Match status actions ────────────────────────────────── */
.inf-match-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.inf-status-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  color: var(--text-2);
}
.inf-status-btn:hover { border-color: var(--primary); color: var(--primary); }
.inf-status-btn--confirm { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.inf-status-btn--reject  { background: var(--red-bg);   color: var(--red);   border-color: var(--red-bg); }

/* ── Status badge (auto/pending/confirmed/rejected) ──────── */
.inf-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
}
.inf-status-badge--auto      { background: var(--green-bg);  color: var(--green); }
.inf-status-badge--confirmed { background: var(--green-bg);  color: var(--green); }
.inf-status-badge--pending   { background: var(--amber-bg);  color: var(--amber); }
.inf-status-badge--rejected  { background: var(--red-bg);    color: var(--red); }

/* ── Loading/error states ────────────────────────────────── */
.inf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  color: var(--text-3);
  font-size: 13px;
}
.inf-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: inf-spin .7s linear infinite;
}
@keyframes inf-spin {
  to { transform: rotate(360deg); }
}
.inf-error-msg {
  color: var(--red);
  font-size: 13px;
  padding: 16px;
  background: var(--red-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(220,38,38,.15);
}

/* ── Bio text ────────────────────────────────────────────── */
.inf-bio {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  white-space: pre-wrap;
  margin-bottom: 4px;
}

/* ── Responsive: collapse sidebar on narrow screens ──────── */
@media (max-width: 900px) {
  .inf-layout {
    flex-direction: column;
    height: auto;
  }
  .inf-sidebar {
    width: 100%;
    max-height: 320px;
  }
}

/* ── Influencer card inner layout (used by influencers.js) ── */
.inf-card-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.inf-card-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
}
.inf-card-initials {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-bg);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}
.inf-card-name {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inf-card-status { flex-shrink: 0; }

/* ── Detail panel layout (JS class names) ────────────────── */
.inf-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.inf-detail-avatar {
  position: relative;
  flex-shrink: 0;
}
.inf-detail-avatar img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  display: block;
}
.inf-detail-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inf-detail-name {
  font-size: 14px;
  color: var(--text-2);
}
.inf-detail-bio {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-top: 4px;
}
.inf-detail-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.inf-detail-stats strong {
  color: var(--text-1);
  font-weight: 700;
}
.inf-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Sections inside detail panel ───────────────────────── */
.inf-detail-section {
  margin-bottom: 28px;
}
.inf-detail-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: 12px;
}
.inf-detail-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}
.inf-tagged-table th,
.inf-tagged-table td {
  white-space: nowrap;
  vertical-align: middle;
}
.inf-tagged-creator {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}
.inf-tagged-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.inf-tagged-avatar img,
.inf-tagged-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.inf-tagged-avatar img {
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
}
.inf-tagged-avatar-fallback {
  background: var(--bg-soft);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
}
.inf-tagged-creator-meta {
  min-width: 0;
}
.inf-tagged-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.inf-tagged-handle {
  font-size: 12px;
  color: var(--text-3);
}
.inf-tagged-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.inf-tagged-link:hover {
  text-decoration: underline;
}
.inf-unusable-toggle {
  margin-top: 10px;
}
.inf-unusable-toggle summary {
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
  margin-bottom: 8px;
}
.inf-ref-grid--dim { opacity: .55; }

/* ── Ref image card (JS version) ─────────────────────────── */
.inf-ref-check {
  position: absolute;
  top: 3px;
  right: 3px;
  background: var(--green);
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
}
.inf-ref-card--dim { opacity: .45; }
.inf-ref-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Alias row in detail ─────────────────────────────────── */
.inf-alias-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inf-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── Verified check ──────────────────────────────────────── */
.inf-verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #1D9BF0;
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Detail loading / error ──────────────────────────────── */
.inf-detail-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 24px;
  color: var(--text-3);
  font-size: 13px;
}
.inf-detail-error {
  padding: 20px;
  color: var(--red);
  font-size: 13px;
  background: var(--red-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(220,38,38,.15);
}
.inf-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 300px;
  color: var(--text-3);
  text-align: center;
  font-size: 13px;
}
.inf-detail-empty svg { opacity: .3; }

/* ── Badge variants for influencer scrape status ─────────── */
.badge-warning { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); animation: badge-pulse 1.4s ease-in-out infinite; }
.badge-success { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.badge-danger  { background: var(--red-bg);   color: var(--red);   border-color: #FECACA; }

/* ── Influencer match rows inside creative modal ─────────── */
.crd-match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.crd-match-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.crd-match-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
}
.crd-match-info {
  flex: 1;
  min-width: 0;
}
.crd-match-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}
.crd-match-display {
  font-weight: 400;
  color: var(--text-2);
  margin-left: 4px;
}
.crd-match-reasons {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crd-match-reason {
  line-height: 1.5;
}
.crd-match-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}
.crd-match-actions {
  display: flex;
  gap: 5px;
}
.crd-matches-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Influencer reference image upload zone ──────────────── */
.inf-upload-zone {
  margin-top: 14px;
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--bg);
}
.inf-upload-zone:hover,
.inf-upload-zone--over {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.inf-upload-label {
  font-size: 13px;
  color: var(--text-2);
}
.inf-upload-browse {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.inf-upload-hint {
  font-size: 11px;
  color: var(--text-3);
}
.inf-upload-status {
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}
.inf-upload-status--loading { color: var(--primary); }
.inf-upload-status--success { color: var(--green); }
.inf-upload-status--error   { color: var(--red); }

/* ── Delete button on manual ref images ──────────────────── */
.inf-ref-delete {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(220,38,38,.85);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  backdrop-filter: blur(2px);
}
.inf-ref-card:hover .inf-ref-delete { opacity: 1; }

/* ── Inline delete confirm overlay ──────────────────────── */
.inf-ref-confirm {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 10;
  backdrop-filter: blur(2px);
}
.inf-ref-confirm-label {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.inf-ref-confirm-yes,
.inf-ref-confirm-no {
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  width: 70px;
}
.inf-ref-confirm-yes { background: #dc2626; color: #fff; }
.inf-ref-confirm-no  { background: rgba(255,255,255,.18); color: #fff; }
.inf-ref-confirm-no:hover { background: rgba(255,255,255,.3); }

/* ── Accepted / Filtered badge on ref images ─────────────── */
.inf-ref-status-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 5px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.inf-ref-badge--accepted {
  background: rgba(5,150,105,.82);
  color: #d1fae5;
}
.inf-ref-badge--filtered {
  background: rgba(100,116,139,.75);
  color: #e2e8f0;
}
.inf-ref-badge--analyzing {
  background: rgba(79,70,229,.85);
  color: #e0e7ff;
  animation: inf-badge-pulse 1.4s ease-in-out infinite;
}
@keyframes inf-badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .55; }
}

/* ── KPI boxes ───────────────────────────────────────────── */
.inf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 4px;
}
.inf-kpi-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inf-kpi-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
}
.inf-kpi-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}

/* ── Refresh row with last-sync date ─────────────────────── */
.inf-refresh-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.inf-last-sync {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ── Delete zone at bottom ───────────────────────────────── */
.inf-delete-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding: 10px 14px;
  border: 1px solid rgba(220,38,38,.25);
  border-radius: var(--radius);
  background: rgba(220,38,38,.04);
}
.inf-delete-zone-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.inf-delete-zone-info strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.inf-delete-zone-info span {
  font-size: 11px;
  color: var(--text-3);
}

/* ── Image hover popup ───────────────────────────────────── */
.inf-img-popup {
  position: fixed;
  width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  overflow: hidden;
  pointer-events: none;
  z-index: 9999;
}
.inf-img-popup-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.inf-img-popup-body {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.45;
}

/* ── Creative modal: Performance collapsible section ─────── */
.crd-perf-section {
  border-top: 1px solid var(--border);
  padding: 0;
}
.crd-perf-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 10px 0;
  cursor: pointer;
  color: var(--text-2);
  gap: 6px;
}
.crd-perf-toggle:hover { color: var(--text-1); }
.crd-perf-toggle .crd-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: inherit;
}
.crd-perf-chevron {
  flex-shrink: 0;
  transition: transform .2s ease;
  color: var(--text-3);
}
.crd-perf-toggle[aria-expanded="true"] .crd-perf-chevron {
  transform: rotate(180deg);
}
.crd-perf-body {
  padding-bottom: 8px;
}

/* ── Creative modal: AI Analysis card ───────────────────── */
.crd-ai-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  /* No overflow:hidden — it can clip dynamically-added children */
  margin: 4px 0;
}
.crd-ai-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f8faff 100%);
  border-bottom: 1px solid var(--border);
  /* Clip gradient at card's top corners without blocking card children */
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  gap: 8px;
}
.crd-ai-card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.crd-ai-card-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--primary);
}
.crd-analyzed-at {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}
.crd-ai-card > .crd-tags-grid,
.crd-ai-card > .crd-ai-summary,
.crd-ai-card > .crd-analysis-placeholder {
  margin: 10px 14px;
}

/* ── Skeleton loading state ─────────────────────────────── */
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel {
  background: linear-gradient(90deg,
    var(--border) 25%,
    #f8faff       50%,
    var(--border) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.crd-skel-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 4px;
}
.crd-skel-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.crd-skel-label { width: 88px; height: 10px; }
.crd-skel-badge { width: 72px; height: 20px; border-radius: 999px; }
.crd-analyzing-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px 12px;
  font-size: .78rem;
  color: var(--text-3);
}

/* ── Auto-tags reveal ───────────────────────────────────── */
@keyframes crd-tags-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
.crd-ai-auto-tags {
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  animation: crd-tags-in .3s ease;
}
.crd-ai-auto-tags-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  margin-right: 3px;
}

/* ── Creative modal: AI card inner sections ─────────────── */
.crd-ai-divider {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
}
.crd-ai-sub-hd {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 10px;
}

/* ── Creative modal: editable CTA row ───────────────────── */
#crd-cta-row .crd-product-row {
  gap: 6px;
}
#crd-cta-row .crd-product-input {
  flex: 1;
}

/* ── Creative modal: account pill in header ─────────────── */
.crd-account-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(79,70,229,.18);
  flex-shrink: 0;
}

/* ── Creative modal: Creative Details card ──────────────── */
.crd-cd-card {
  /* Inherits .crd-ai-card border/radius/shadow/background */
}
.crd-cd-hd {
  background: var(--slate-bg);   /* neutral slate, not blue gradient */
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.crd-cd-label {
  color: var(--text-2);          /* slate text, not primary purple */
}
.crd-cd-item {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
/* Header already has border-bottom — suppress duplicate on the first item */
.crd-ai-card-hd + .crd-cd-item {
  border-top: none;
}

/* ── Creative modal: comments in left panel ─────────────── */
.crd-comments-panel {
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}
.crd-comments-panel .crd-section-title {
  margin-bottom: 4px;
}
.crd-comments-panel .crd-comments-list {
  flex: 1;
  min-height: 0;
  max-height: 200px;
}
.crd-comments-panel .crd-comment-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
