/* Light Google-Ads-inspired theme.
   ── --bg / --bg-2 : page canvas + slightly elevated surfaces (sidebar, modal cards)
   ── --panel / --panel-2 : white cards / subtle inset tiles inside cards
   ── --border : Google's #dadce0 hairline
   ── --text / --muted : Google grey 900 / 600
   ── accent / good / warn / bad : Material primary palette
*/
:root {
  --bg: #f8f9fa;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f3f4;
  --border: #dadce0;
  --text: #202124;
  --muted: #5f6368;
  --accent: #1a73e8;     /* Google blue 600 */
  --accent-2: #4285f4;   /* Google blue 500 */
  --good: #188038;       /* Google green 700 — readable on white */
  --warn: #b06000;       /* Amber dark — readable on white */
  --bad:  #d93025;       /* Google red 600 */
  --shadow: 0 1px 2px rgba(60,64,67,0.08), 0 1px 3px rgba(60,64,67,0.10);
  --radius: 12px;
}

.google-ads-report-banner {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 0 0 16px 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}
.google-ads-report-banner.is-ok {
  background: rgba(52, 168, 83, 0.08);
  border-color: rgba(52, 168, 83, 0.35);
}
.google-ads-report-banner.is-warn {
  background: rgba(251, 188, 4, 0.12);
  border-color: rgba(251, 188, 4, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 14px; letter-spacing: 0.5px;
}
.brand-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mode-client .brand-mark {
  background: linear-gradient(135deg, #28d39f, #4f8cff);
}
.sidebar-action { padding: 4px 0; }
.sidebar-action .btn-secondary.block {
  display: block; text-align: center; width: 100%;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  text-decoration: none; color: var(--muted);
  padding: 9px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { color: var(--text); background: var(--panel-2); }
.nav-item.active {
  color: var(--accent);
  background: rgba(26, 115, 232, 0.10);
  font-weight: 600;
}

/* "← All Clients" back link sits visually above the nested per-client nav */
.nav-back {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.7px;
  font-weight: 700; color: var(--muted); padding: 8px 12px;
  margin-bottom: 8px;
}
.nav-back:hover { color: var(--text); background: var(--panel-2); }

/* Nested per-client section in the sidebar */
.nav-section {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 6px; display: flex; flex-direction: column; gap: 2px;
}
.nav-section .nav-section-h {
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--muted);
  padding: 6px 10px 4px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-section .nav-item { padding: 7px 10px; }
.nav-section .nav-item.active {
  background: rgba(26, 115, 232, 0.10);
  color: var(--accent);
}

/* Agency clients table — full row is clickable */
#clients-table tr.row-link { cursor: pointer; }
#clients-table tr.row-link:hover { background: rgba(0, 0, 0, 0.03); }
.sidebar-footer { margin-top: auto; color: var(--muted); font-size: 12px; }

/* ---------- Main ---------- */
.main {
  flex: 1;
  padding: 28px 34px 60px;
  min-width: 0;
}

.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.eyebrow {
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); font-weight: 600;
}
.topbar h1 { margin: 4px 0 2px; font-size: 26px; font-weight: 700; }
.subline { color: var(--muted); font-size: 13px; }

.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.control { display: flex; flex-direction: column; gap: 6px; }
.control label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
}
.control input, .control select {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; font-size: 13px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
  min-width: 160px;
}
.control input:focus, .control select:focus { border-color: var(--accent); }

.presets { display: flex; gap: 4px; }
.preset {
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.preset:hover { color: var(--text); }
.preset.active {
  background: var(--accent);
  color: white; border-color: transparent;
}

.btn-primary, .btn-secondary, .btn-ghost {
  font-family: inherit; font-weight: 600; font-size: 13px;
  border-radius: 9px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: filter 0.15s, background 0.15s, color 0.15s;
}
/* Global override — class-based `display:` rules (above) defeat the
   browser's default `[hidden] { display: none }` because class selectors
   have higher specificity than attribute selectors. This restores the
   semantic that `hidden` ALWAYS hides, regardless of what classes are
   on the element. Without this, JS calls like `.prop("hidden", true)`
   silently no-op on .btn-primary / .btn-secondary / etc. */
[hidden] { display: none !important; }
.btn-primary {
  background: var(--accent);
  color: white; border: 0; padding: 9px 18px;
  box-shadow: 0 1px 2px rgba(60,64,67,0.18);
}
.btn-primary:hover { background: #1765cc; }
.btn-secondary {
  background: var(--panel); color: var(--accent);
  border: 1px solid var(--border); padding: 8px 14px;
}
.btn-secondary:hover { background: rgba(26,115,232,0.06); border-color: rgba(26,115,232,0.40); }
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 0; padding: 4px 8px; font-size: 14px;
}
.btn-ghost:hover { color: var(--bad); }

/* Disabled state — applies to any button while an AI job is in flight. */
.btn-primary:disabled, .btn-secondary:disabled, .btn-ghost:disabled {
  cursor: not-allowed; opacity: 0.6; filter: grayscale(0.3);
  pointer-events: none;
}

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
}
.kpi-label {
  color: var(--muted); font-size: 12px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px;
}
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- Cards / charts ---------- */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.row.single { grid-template-columns: 1fr; }
.row .large { grid-column: span 1; }
@media (min-width: 1200px) {
  .row:not(.single) { grid-template-columns: 2fr 1fr; }
}
.mode-client textarea.lead-notes {
  min-height: 3rem;
  max-height: 14rem;
  resize: vertical;
  overflow-y: auto;
  box-sizing: border-box;
  width: 100%;
  vertical-align: top;
}

.mode-client .row:not(.single) {
  grid-template-columns: 2fr 1fr;
}
.row-actions { display: flex; gap: 12px; align-items: center; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head:has(.editor-section-intro) {
  align-items: flex-start;
  gap: 14px;
}
.card-head:has(.editor-section-intro) > .editor-section-intro {
  flex: 1;
  min-width: 0;
}
.editor-section-intro > h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}
.editor-section-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #444746;
  max-width: 52rem;
}
.editor-section-meta {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
}
.editor-section-aside {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-top: 2px;
}
.muted { color: var(--muted); font-size: 12px; }

.chart-card canvas { width: 100% !important; height: 280px !important; }

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  color: var(--muted); font-weight: 600;
  text-transform: uppercase; font-size: 11px; letter-spacing: 0.6px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .num.good { color: var(--good); }
.data-table .num.bad  { color: var(--bad); }
.data-table tbody tr:hover { background: rgba(0, 0, 0, 0.025); }

.data-table th.center,
.data-table td.center { text-align: center; vertical-align: middle; }
.data-table .notes-cell { max-width: 280px; vertical-align: top; }

/* Client dashboard — Recent Leads preview (polished grid) */
.data-table--dashboard-client-leads {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08);
}
.data-table--dashboard-client-leads thead th {
  background: var(--panel-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.data-table--dashboard-client-leads tbody td {
  padding-top: 13px;
  padding-bottom: 13px;
  vertical-align: top;
}
.data-table--dashboard-client-leads tbody tr:hover {
  background: rgba(26, 115, 232, 0.06);
}
.data-table--dashboard-client-leads .dashboard-client-lead-when {
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}
.data-table--dashboard-client-leads .dashboard-client-lead-name {
  font-weight: 600;
  color: var(--text);
}
.data-table--dashboard-client-leads .dashboard-client-lead-contact {
  font-size: 13px;
}
.data-table--dashboard-client-leads .dashboard-client-lead-message {
  max-width: 340px;
  font-size: 13px;
  line-height: 1.45;
}

.table-wrap { overflow-x: auto; }

.btn-icon {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  font-family: inherit;
}
.btn-icon:hover { border-color: var(--accent); }
.btn-icon.active {
  background: rgba(26, 115, 232, 0.12);
  border-color: var(--accent);
}
.lead-actions { white-space: nowrap; }
.inline-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer;
  user-select: none;
}
input.input, textarea.input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
input.input:focus, textarea.input:focus {
  outline: none; border-color: var(--accent);
}
input.lead-value.narrow { max-width: 100px; margin-left: auto; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-new      { background: rgba(26, 115, 232, 0.15); color: #1a73e8; }
.badge-contacted{ background: rgba(251, 188, 4, 0.15); color: var(--warn); }
.badge-booked   { background: rgba(52, 168, 83, 0.15); color: var(--good); }
.badge-won      { background: rgba(103, 58, 183, 0.18); color: #673ab7; }

/* ---------- Forms (settings page) ---------- */
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .control.grow,
.form-row .grow { flex: 1; min-width: 180px; }
.form-actions { margin-top: 16px; }

textarea {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font-size: 13px; font-family: inherit;
  outline: none; resize: vertical; width: 100%;
  min-width: 240px;
  transition: border-color 0.15s;
}
textarea:focus { border-color: var(--accent); }

.status { font-size: 12px; min-height: 16px; margin-top: 4px; }
.status.ok  { color: var(--good); }
.status.err { color: var(--bad); }

/* ---------- Input with affix (prefix/suffix like $ ___ /mo) ---------- */
.input-affix {
  display: inline-flex; align-items: stretch;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 9px; overflow: hidden;
  transition: border-color 0.15s;
}
.input-affix:focus-within { border-color: var(--accent); }
.input-affix input {
  background: transparent; border: 0; outline: none;
  color: var(--text); font-family: inherit; font-size: 13px;
  padding: 8px 10px; min-width: 80px; flex: 1;
  -moz-appearance: textfield;
}
.input-affix input::-webkit-outer-spin-button,
.input-affix input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.input-affix .prefix, .input-affix .suffix {
  display: flex; align-items: center; padding: 0 10px;
  color: var(--muted); font-size: 12px; font-weight: 600;
  background: var(--panel-2);
}
.input-affix.grow { flex: 1; }

/* ---------- Pill toggle (% / $) ---------- */
.markup-row {
  display: flex; gap: 8px; align-items: stretch;
}
.pill-toggle {
  display: inline-flex; background: var(--panel); border: 1px solid var(--border);
  border-radius: 9px; padding: 3px; gap: 2px;
}
.pill-toggle button {
  background: transparent; color: var(--muted); border: 0;
  padding: 5px 14px; font-family: inherit; font-weight: 600;
  font-size: 13px; cursor: pointer; border-radius: 7px;
  min-width: 36px; transition: all 0.15s;
}
.pill-toggle button:hover { color: var(--text); }
.pill-toggle button.active {
  background: var(--accent);
  color: white;
}

/* ---------- Computed grid (Budget & Markup readouts) ---------- */
.computed-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-top: 16px;
}
@media (max-width: 720px) { .computed-grid { grid-template-columns: 1fr; } }
.computed-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.computed-item.highlight {
  border-color: rgba(52, 168, 83, 0.35);
  background: linear-gradient(180deg, rgba(52,168,83,0.06), var(--panel-2));
}
.ci-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}
.ci-value {
  font-size: 20px; font-weight: 700; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.ci-value.good { color: var(--good); }
.ci-value.bad  { color: var(--bad); }
.ci-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Small utilities ---------- */
.muted.small  { font-size: 12px; }
.no-margin    { margin: 0; }

/* Bigger primary CTA used for the Save & Push action */
.btn-primary.big { padding: 11px 22px; font-size: 14px; }

/* ---------- Goal hero (Lead Goal Calculator main input) ---------- */
.goal-hero {
  text-align: center;
  margin: 18px 0 14px;
  padding: 22px 18px;
  background: linear-gradient(180deg, rgba(26, 115, 232, 0.06), rgba(103, 58, 183, 0.04));
  border: 1px solid var(--border);
  border-radius: 12px;
}
.goal-hero label {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 14px;
}
.input-affix.big-input {
  display: inline-flex;
  margin: 0 auto;
  min-width: 320px;
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(26, 115, 232, 0.18);
}
.input-affix.big-input input {
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  padding: 12px 14px;
  min-width: 160px;
}
.input-affix.big-input .suffix {
  font-size: 13px;
  padding: 0 18px;
}
.goal-hint { margin-top: 10px; }

/* ---------- Inline forecast strip (under the budget computed grid) ---------- */
.forecast-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(26, 115, 232, 0.06);
  border: 1px solid rgba(26, 115, 232, 0.20);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 14px 0 4px;
  font-size: 13px;
}
.forecast-strip .forecast-icon { font-size: 16px; }

/* ===========================================================================
   Dashboard "At a glance today" mini-row — sits ABOVE the KPI grid so
   the operator sees campaign live status + today's spend vs target
   before scanning anything else. Always visible in internal mode.
   =========================================================================== */
.glance-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
}
@media (max-width: 900px) {
  .glance-card { grid-template-columns: 1fr; }
}
.glance-tile { display: flex; flex-direction: column; gap: 4px; }
.glance-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}
.glance-value {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  font-variant-numeric: tabular-nums;
}
.glance-value .small { font-size: 12px; font-weight: 500; }
.glance-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; background: var(--muted);
  flex-shrink: 0;
}
.glance-dot.live    { background: var(--good); box-shadow: 0 0 0 3px rgba(52,168,83,0.18); }
.glance-dot.paused  { background: var(--warn); box-shadow: 0 0 0 3px rgba(251,188,4,0.18); }
.glance-dot.offline { background: var(--bad);  box-shadow: 0 0 0 3px rgba(234,67,53,0.18); }
.glance-campaign-row { align-items: flex-start; }
.glance-campaign-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.glance-campaign-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.glance-campaign-badges .chip {
  font-size: 11px;
  font-weight: 600;
}
.glance-value .good { color: var(--good); }
.glance-value .bad  { color: var(--bad); }

/* Internal admin alerts (dashboard) */
.admin-alerts-card { border-color: rgba(251, 188, 4, 0.45); }
.admin-alerts-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 14px;
}
.admin-alerts-list > li {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2);
}
.admin-alerts-list .admin-alert-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.admin-alerts-list .admin-alert-body { font-size: 13px; line-height: 1.45; margin-bottom: 6px; }
.admin-alerts-list .admin-alert-gaps { font-size: 12px; margin-bottom: 8px; }
.admin-alerts-list .admin-alert-link { font-size: 13px; font-weight: 600; }
.admin-alerts-list .admin-alert-warn { border-left: 4px solid var(--warn); }
.admin-alerts-list .admin-alert-info { border-left: 4px solid var(--accent, #1a73e8); }

/* Client visibility cycle strip — below the performance KPI grid. Hidden when no active cycle.
   =========================================================================== */
.cycle-strip-card { display: flex; flex-direction: column; gap: 14px; }
.cycle-strip-card[hidden] { display: none !important; }
.cycle-strip-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.cs-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 700;
}
.cs-cycle-range { margin-top: 2px; }
.cycle-strip-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
}
@media (max-width: 1400px) {
  .cycle-strip-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .cycle-strip-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .cycle-strip-grid { grid-template-columns: repeat(2, 1fr); }
}
.cs-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.cs-tile .cs-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}
.cs-tile .cs-value {
  font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ===========================================================================
   Agency dashboard — Billing column + pills
   =========================================================================== */
.billing-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase;
}
.bp-ok        { background: rgba(52, 168, 83, 0.18); color: #137333; }
.bp-info      { background: rgba(26, 115, 232, 0.18); color: #1a73e8; }
.bp-warn      { background: rgba(251, 188, 4, 0.18);  color: #b06000; }
.bp-fail      { background: rgba(234, 67, 53, 0.18); color: #c5221f; }
.bp-cancelled { background: rgba(255, 140, 60, 0.18); color: #c26401; }
.bp-muted     { background: rgba(138, 147, 166, 0.18); color: var(--muted); }

/* Highlight the Failed Payments KPI tile when the count is non-zero. */
.kpi.warn {
  border-color: rgba(251, 188, 4, 0.40);
  background: rgba(251, 188, 4, 0.06);
}
.kpi.warn .kpi-value { color: #b06000; }

/* ===========================================================================
   Global billing banner (top of any internal per-client page)
   =========================================================================== */
.billing-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px;
  border-radius: 10px; font-size: 13px; line-height: 1.5;
  border: 1px solid transparent;
}
.billing-banner[hidden] { display: none !important; }
.billing-banner .bb-msg { flex: 1; min-width: 240px; }
.billing-banner strong { font-weight: 700; }
.billing-banner .bb-link {
  font-weight: 600; text-decoration: none;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid currentColor;
  color: inherit;
  white-space: nowrap;
}
.billing-banner .bb-link:hover { background: rgba(0, 0, 0, 0.05); }
.billing-banner.grace {
  background: rgba(251, 188, 4, 0.10); color: #b06000;
  border-color: rgba(251, 188, 4, 0.40);
}
.billing-banner.paused {
  background: rgba(234, 67, 53, 0.12); color: #c5221f;
  border-color: rgba(234, 67, 53, 0.40);
}
.billing-banner.cancelled {
  background: rgba(255, 140, 60, 0.12); color: #c26401;
  border-color: rgba(255, 140, 60, 0.40);
}
.billing-banner.operator-paused {
  background: rgba(26, 115, 232, 0.10); color: #1a73e8;
  border-color: rgba(26, 115, 232, 0.40);
}

/* ===========================================================================
   Setup tab — Current Plan read-only strip
   =========================================================================== */
.current-plan-strip {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
}
.cps-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 700;
}
.cps-value {
  font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cps-sub { flex: 1; min-width: 160px; }

/* ===========================================================================
   Cycle tab — Start Plan inline card (visible when status === unbilled)
   =========================================================================== */
.start-plan-card {
  background: linear-gradient(135deg,
    rgba(103, 58, 183, 0.10), rgba(26, 115, 232, 0.10));
  border: 1px solid rgba(103, 58, 183, 0.40);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.spc-head {
  display: flex; flex-direction: column; gap: 4px;
}
.spc-head strong { font-size: 14px; }

/* Budget page — primary metrics + daily spend */
.budget-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .budget-metrics-grid { grid-template-columns: 1fr; }
}
.budget-metric-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.budget-metric-tile .bm-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  line-height: 1.35;
}
.budget-metric-tile .bm-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.budget-metric-tile .bm-sub { margin-top: 6px; }
.budget-daily-row { margin-top: 8px; margin-bottom: 8px; max-width: 420px; }

.budget-billing-details {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--panel);
}
.budget-billing-details > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 0;
  list-style-position: outside;
}
.budget-billing-details[open] > summary { margin-bottom: 12px; }
.budget-billing-details .row.single { margin-bottom: 0; }

/* ===========================================================================
   Billing & Cycle (Cycle tab)
   =========================================================================== */

.billing-card { display: flex; flex-direction: column; gap: 16px; }

.billing-status-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--border);
}
.billing-status-block { display: flex; align-items: center; gap: 12px; }
.billing-actions { display: flex; align-items: center; gap: 10px; }

/* Delinquency banner — yellow / red / orange severity. */
.delinquency-banner {
  border-radius: 10px; padding: 12px 14px;
  font-size: 13px; line-height: 1.5;
}
.delinquency-banner.grace {
  background: rgba(251, 188, 4, 0.10); color: #b06000;
  border: 1px solid rgba(251, 188, 4, 0.35);
}
.delinquency-banner.paused {
  background: rgba(234, 67, 53, 0.12); color: #c5221f;
  border: 1px solid rgba(234, 67, 53, 0.35);
}
.delinquency-banner.cancelled {
  background: rgba(255, 140, 60, 0.12); color: #c26401;
  border: 1px solid rgba(255, 140, 60, 0.35);
}
.delinquency-banner strong { font-weight: 700; }

/* Deferred-rate banner — informational, blue. */
.deferred-rate-banner {
  background: rgba(26, 115, 232, 0.08); color: #1a73e8;
  border: 1px solid rgba(26, 115, 232, 0.30);
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
}

/* 6-tile cycle financials grid. */
.cycle-financials-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 1100px) {
  .cycle-financials-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .cycle-financials-grid { grid-template-columns: 1fr; }
}
.cycle-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.cycle-tile .ct-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}
.cycle-tile .ct-value {
  font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
}
.cycle-tile .ct-value.good  { color: var(--good); }
.cycle-tile .ct-sub { line-height: 1.3; }

/* Pace badge inside the End-of-Cycle Forecast tile. */
.pace-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase;
}
.pace-on    { background: rgba(52, 168, 83, 0.18); color: #137333; }
.pace-warn  { background: rgba(251, 188, 4, 0.18);  color: #b06000; }
.pace-over  { background: rgba(234, 67, 53, 0.18); color: #c5221f; }
.pace-under { background: rgba(138, 147, 166, 0.18); color: var(--muted); }
.pace-none  { background: rgba(138, 147, 166, 0.18); color: var(--muted); }

/* Pacing bar — fill = spent so far, marker = where you should be today. */
.pacing-bar-wrap { display: flex; flex-direction: column; gap: 8px; }
.pacing-bar-label { display: flex; gap: 10px; align-items: center; }
.pacing-bar {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 14px; overflow: hidden;
}
.pacing-bar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), #34a853);
  border-radius: 999px;
  transition: width 0.2s;
}
.pacing-bar-marker {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px;
  background: var(--text);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  transition: left 0.2s;
}

/* Last/Next charge tiles row. */
.charge-tiles {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.charge-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.charge-tile .ct-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}
.charge-tile .ct-value {
  font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Payment Attempts panel (this cycle's charge timeline). */
.payment-attempts {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.pa-row {
  display: grid;
  grid-template-columns: 140px 80px 90px 100px 1fr;
  gap: 10px; align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.pa-row:first-child { border-top: 0; }
.pa-result.ok  { color: var(--good); font-weight: 700; }
.pa-result.err { color: #c5221f;     font-weight: 700; }
@media (max-width: 720px) {
  .pa-row { grid-template-columns: 1fr 1fr; }
  .pa-error { grid-column: 1 / -1; }
}

/* Billing history (collapsible). */
.billing-history { background: transparent; padding: 0; }
.billing-history > summary {
  cursor: pointer; padding: 8px 0;
  list-style: none;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}
.billing-history > summary::-webkit-details-marker { display: none; }
.billing-history-list { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.bh-row {
  display: grid;
  grid-template-columns: 200px 100px 160px 1fr;
  gap: 10px; align-items: baseline;
  padding: 4px 0;
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.bh-row:first-child { border-top: 0; }
.bh-kind { font-weight: 600; }

/* Apply-When modal — radio-style option cards. */
.apply-when-options { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.apply-when-option {
  text-align: left;
  background: var(--panel-2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px; cursor: pointer;
  font: inherit; color: var(--text);
}
.apply-when-option:hover { border-color: rgba(26, 115, 232, 0.45); }
.apply-when-option.active {
  border-color: var(--accent);
  background: rgba(26, 115, 232, 0.08);
}
.awo-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.awo-detail { line-height: 1.4; }

/* Simulate modal — section labels + ample spacing. */
.sim-section {
  border-top: 1px solid var(--border);
  padding-top: 14px; margin-top: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.sim-section:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.sim-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}

/* ---------- Goal-based budget specifics ---------- */
.lookback-row {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 12px;
}

.baseline-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 16px;
}
@media (max-width: 720px) { .baseline-grid { grid-template-columns: 1fr; } }

.baseline-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}
.bi-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 600;
}
.bi-value {
  font-size: 22px; font-weight: 700; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.bi-value.good { color: var(--good); }
.bi-value.bad  { color: var(--bad); }
.bi-sub { font-size: 11px; margin-top: 2px; }

/* ---------- Recommendation card ---------- */
.rec-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 8px 0 8px;
  font-size: 13px;
}
.rec-card.empty { color: var(--muted); text-align: center; }
.rec-card.good  { border-color: rgba(52, 168, 83, 0.45);
                  background: linear-gradient(180deg, rgba(52,168,83,0.06), var(--panel)); }
.rec-card.warn  { border-color: rgba(251, 188, 4, 0.45);
                  background: linear-gradient(180deg, rgba(251,188,4,0.06), var(--panel)); }
.rec-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.rec-tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
}
.rec-tag.good { background: rgba(52, 168, 83, 0.18); color: var(--good); }
.rec-tag.warn { background: rgba(251, 188, 4, 0.18); color: var(--warn); }
.rec-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 12px;
}
@media (max-width: 720px) { .rec-grid { grid-template-columns: 1fr; } }
.rec-grid > div {
  background: var(--panel-2); padding: 10px 12px;
  border-radius: 8px; border: 1px solid var(--border);
}
.rec-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forecast grid ---------- */
.forecast-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.forecast-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

/* ---------- Landing pages ---------- */
.data-table .actions {
  text-align: right; white-space: nowrap;
}
.data-table .actions .btn-primary,
.data-table .actions .btn-secondary {
  padding: 5px 12px; font-size: 12px;
  margin-left: 4px;
}
.data-table tr.editing input,
.data-table tr.editing select {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 8px; font-size: 12px; font-family: inherit;
  width: 100%; outline: none;
  transition: border-color 0.15s;
}
.data-table tr.editing input:focus,
.data-table tr.editing select:focus { border-color: var(--accent); }

/* Generic colour roles (used across the app). */
.badge-good  { background: rgba(52, 168, 83, 0.15); color: var(--good); }
.badge-warn  { background: rgba(251, 188, 4, 0.15); color: var(--warn); }
.badge-muted { background: rgba(138, 147, 166, 0.15); color: var(--muted); }
.badge-info  { background: rgba(26, 115, 232, 0.18); color: #1a73e8; }

/* Landing-page status badges — one distinct colour per status so the
   variants table is scannable at a glance. ``Active`` is the strongest
   (currently in flight), ``Won`` is gold, ``Ready`` is calm blue, and
   ``Lost`` / ``Archived`` recede into muted grays. */
.badge-active   { background: rgba(52, 168, 83, 0.22); color: #137333;
                  font-weight: 700; }
.badge-won      { background: rgba(251, 188, 4, 0.18); color: #b06000;
                  font-weight: 700; }
.badge-ready    { background: rgba(26, 115, 232, 0.18); color: #1a73e8; }
.badge-lost     { background: rgba(234, 67, 53, 0.14); color: #c5221f; }
.badge-archived { background: rgba(138, 147, 166, 0.12); color: var(--muted); }
/* "Control" identifier on the split-test card — neutral pill, not a status. */
.badge-control  { background: rgba(103, 58, 183, 0.18); color: #673ab7;
                  letter-spacing: 1px; font-weight: 700; }

/* Client portal — relative performance rank (no numeric stats shown). */
.lp-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.lp-rank-pill--gold {
  background: rgba(251, 188, 4, 0.22);
  color: #8a5a00;
}
.lp-rank-pill--silver {
  background: rgba(138, 147, 166, 0.18);
  color: #5f6368;
}
.lp-rank-pill--bronze {
  background: rgba(191, 87, 48, 0.16);
  color: #a14c28;
}
.lp-rank-pill--muted {
  background: rgba(138, 147, 166, 0.12);
  color: var(--muted);
  font-weight: 500;
}
.lp-rank-pill--solo {
  background: rgba(26, 115, 232, 0.14);
  color: #1a73e8;
  font-weight: 600;
}

/* ─────────────── Split Test card ─────────────── */
.split-test-card {
  background: linear-gradient(180deg, rgba(103, 58, 183, 0.06), var(--panel));
  border-color: rgba(103, 58, 183, 0.30);
}
.st-help { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }

/* ─── Stats strip above the control-vs-variant grid (Split Test tab) ───
   Three tiles: Current Winner, Confidence (z-test, one-sided), Time
   Elapsed (live-ticks every 30s). Confidence colors mirror standard A/B
   significance thresholds (≥95% = strong, ≥80% = leaning). */
.st-stats-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 720px) {
  .st-stats-strip { grid-template-columns: 1fr; }
}
.st-stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.st-stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--muted);
}
.st-stat-value {
  font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.st-stat-sub { line-height: 1.3; }

/* Winner tile colour cues. */
.winner-control { color: #673ab7; }      /* purple = control / baseline */
.winner-variant { color: #1a73e8; }      /* blue   = variant / challenger */
.winner-tie     { color: var(--muted); }
.winner-none    { color: var(--muted); }

/* Confidence tile colour by significance band. */
.conf-high      { color: #137333; }       /* ≥95% — significant */
.conf-mid       { color: #b06000; }       /* ≥80% — leaning */
.conf-low,
.conf-none      { color: var(--muted); }  /* under 80% or not enough data */

.st-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px; align-items: stretch;
  margin-bottom: 14px;
}
@media (max-width: 720px) {
  .st-grid { grid-template-columns: 1fr; }
  .st-grid .st-vs { display: none; }
}
.st-side {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.st-side-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--muted);
}
.st-side-name { font-size: 16px; font-weight: 700; }
.st-side-stats {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px solid var(--border); margin-top: 4px;
}
.st-side-stats > div { font-size: 13px; }
.st-side-stats strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.st-vs {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--muted); font-size: 14px;
  letter-spacing: 1px;
}
.st-manual {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.btn-secondary.small-link {
  font-size: 12px; padding: 5px 10px; align-self: flex-start;
}

/* ─────────────── Test history ─────────────── */
.history-row {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
}
.history-row:last-child { margin-bottom: 0; }
.history-row.history-failed {
  border-color: rgba(255, 107, 107, 0.40);
  background: linear-gradient(180deg, rgba(255,107,107,0.06), var(--panel-2));
}
.history-row .ht-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 10px;
}
.history-row .ht-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px; align-items: center;
}
@media (max-width: 720px) {
  .history-row .ht-grid { grid-template-columns: 1fr; }
  .history-row .ht-vs   { display: none; }
}
.ht-side {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.ht-side.ht-winner {
  border-color: rgba(52, 168, 83, 0.45);
  background: linear-gradient(180deg, rgba(52,168,83,0.08), var(--panel));
}
.ht-side-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--muted);
}
.ht-side.ht-winner .ht-side-label { color: var(--good); }
.ht-side-name { font-size: 14px; font-weight: 700; }
.ht-vs {
  color: var(--muted); font-weight: 700; font-size: 12px;
  letter-spacing: 1px;
}

/* ─────────────── Test summary block (inside history rows) ─────────────── */
.ht-summary {
  margin-top: 12px; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(103, 58, 183, 0.06), var(--panel));
  border: 1px solid rgba(103, 58, 183, 0.25);
  border-radius: 10px;
}
.ht-summary[open] { padding-bottom: 14px; }
.ht-summary > .ht-summary-head,
.ht-summary > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--accent-2);
}
.ht-summary > summary::-webkit-details-marker { display: none; }
.ht-summary-icon { font-size: 14px; }
.ht-summary-label { flex: 1; }
.ht-summary-body {
  margin: 10px 0 0; font-size: 13px; line-height: 1.6; color: var(--text);
  white-space: pre-wrap;
}
.ht-summary-refresh {
  font-size: 14px; padding: 2px 8px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 6px;
}
.ht-summary-refresh:hover { color: var(--accent); border-color: var(--accent); }
.ht-summary-loading {
  background: linear-gradient(180deg, rgba(251,188,4,0.06), var(--panel));
  border-color: rgba(251, 188, 4, 0.30);
}
.ht-summary-loading .ht-summary-label { color: var(--warn); }
.ht-summary-error {
  background: linear-gradient(180deg, rgba(255,107,107,0.06), var(--panel));
  border-color: rgba(255, 107, 107, 0.35);
}
.ht-summary-error .ht-summary-label { color: var(--bad); }
.ai-spinner-inline {
  width: 14px; height: 14px; border-width: 2px; display: inline-block;
}

/* ─────────────── Hide/show utility ─────────────── */
.hidden { display: none !important; }

/* ─────────────── Landing-pages tabs ───────────────
   Top-of-page nav for Overview / Split Test / Variants / History. Built
   so a tab label can carry a small inline meta (e.g. "Variants · 4",
   "Split Test · running"). Hidden panes use the [hidden] attribute. */
.lp-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.lp-tab {
  background: transparent; border: 0; cursor: pointer;
  padding: 10px 16px; margin-bottom: -1px;
  font: inherit; color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
  display: inline-flex; align-items: baseline; gap: 6px;
}
.lp-tab:hover { color: var(--text); }
.lp-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.lp-tab .lp-tab-label { font-weight: 600; font-size: 14px; }
.lp-tab .lp-tab-meta { font-weight: 500; }
.lp-tab-meta-on      { color: #137333; font-weight: 700; }
.lp-tab-meta-pending { color: #b06000; font-weight: 700; }
.lp-tab-meta-fail    { color: var(--bad); font-weight: 700; }

.lp-tab-pane[hidden] { display: none !important; }

/* ─────────────── Overview tab — condensed test summary card ─────────────── */
.overview-test-summary {
  display: flex; flex-direction: column; gap: 14px;
}
.overview-test-summary .ots-head {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.overview-test-summary .ots-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px;
  align-items: center;
}
.overview-test-summary .ots-side {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.overview-test-summary .ots-side-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted); font-weight: 600; margin-bottom: 4px;
}
.overview-test-summary .ots-side-name {
  font-size: 15px; font-weight: 700; margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.overview-test-summary .ots-vs {
  font-size: 12px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
}
.overview-test-summary .ots-foot {
  display: flex; justify-content: flex-end;
}
@media (max-width: 700px) {
  .overview-test-summary .ots-grid {
    grid-template-columns: 1fr;
  }
  .overview-test-summary .ots-vs { display: none; }
}

/* ─────────────── Live URL strip (landing pages list) ─────────────── */
.card.live-url-card {
  display: flex; align-items: center; gap: 22px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(52, 168, 83, 0.06), var(--panel));
  border-color: rgba(52, 168, 83, 0.30);
}
.live-url-info { flex: 1; min-width: 240px; }
.live-url-h {
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--good); margin-bottom: 4px;
}
.live-url-sub code {
  background: var(--panel-2); padding: 1px 5px;
  border-radius: 4px; font-size: 11px;
}
.live-url-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.live-url {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px;
  font-size: 13px; font-family: 'Inter', monospace;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

/* ─────────────── AI Generate button + modal ─────────────── */
.btn-secondary.ai-btn {
  background: rgba(103, 58, 183, 0.08);
  border-color: rgba(103, 58, 183, 0.40);
  color: #673ab7;
}
.btn-secondary.ai-btn:hover {
  background: rgba(103, 58, 183, 0.14);
  border-color: #673ab7;
}

.ai-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(32, 33, 36, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  backdrop-filter: blur(2px);
}
.ai-modal[hidden] { display: none; }

.ai-modal-card {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto;
  padding: 26px 26px 22px; position: relative;
  box-shadow: 0 24px 60px rgba(60,64,67,0.30);
}
.ai-modal-card.wide { max-width: 760px; }

.lead-detail-modal-card { max-width: 520px; }
.lead-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin-bottom: 16px;
  font-size: 14px;
}
.lead-detail-message-wrap {
  margin-bottom: 18px;
}
.lead-detail-message-body {
  margin-top: 6px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.45;
}
.lead-detail-edit #ld-notes {
  width: 100%;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.lead-detail-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.lead-detail-footer-btns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.lead-detail-grid--tight {
  gap: 10px 16px;
  margin-bottom: 12px;
}
.lead-detail-page-row {
  margin-bottom: 14px;
  font-size: 14px;
}
.lead-detail-job-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.lead-detail-job-block .pill-toggle {
  margin-top: 6px;
}
#client-leads-table .lead-message-cell {
  max-width: 300px;
  font-size: 13px;
  line-height: 1.4;
  vertical-align: top;
  word-break: break-word;
}
.pill-toggle.lead-job-seg--compact button {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
#client-leads-table .lead-contact-cell {
  min-width: 110px;
  max-width: 220px;
  font-size: 13px;
  word-break: break-word;
}
button.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.btn-link:hover {
  opacity: 0.88;
}
.ai-modal-close {
  position: absolute; top: 8px; right: 12px;
  background: transparent; border: 0; color: var(--muted);
  font-size: 28px; line-height: 1; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
}
.ai-modal-close:hover { color: var(--text); background: var(--panel-2); }

.ai-modal-head h3 { margin: 0 0 6px; font-size: 20px; }
.ai-modal-head p  { margin: 0 0 18px; font-size: 13px; line-height: 1.5; }

/* Breathing room between top-level form sections inside any modal.
   Scoped to the direct children of <form> so nested .control elements
   (inside a .form-row) keep their tight inline spacing. The action row
   already has its own .form-actions margin-top rule. */
.ai-modal-card form > .control,
.ai-modal-card form > .form-row:not(.form-actions) {
  margin-bottom: 16px;
}

.ai-step { display: flex; flex-direction: column; gap: 14px; }

/* Loading state */
.ai-loader {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 28px 12px 12px; text-align: center;
}
.ai-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(0,0,0,0.10);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-spin 0.9s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-loader-text { font-size: 15px; font-weight: 600; }
.ai-loader-sub  { max-width: 360px; }

/* Error state */
.ai-error {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 4px 0;
}
.ai-error-h {
  font-weight: 700; color: var(--bad);
  display: flex; align-items: center; gap: 8px;
}
.ai-error-h::before { content: "⚠"; font-size: 16px; }

/* ─────────────── Info card (above-the-fold context note) ─────────────── */
.card.info-card {
  background: linear-gradient(180deg, rgba(26, 115, 232, 0.06), var(--panel));
  border-color: rgba(26, 115, 232, 0.25);
  margin-bottom: 16px;
  padding: 14px 18px;
  font-size: 13px;
  display: flex; gap: 8px; align-items: baseline;
  flex-wrap: wrap;
}

/* ─────────────── Brand profile editor ─────────────── */
.logo-preview {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.logo-preview img {
  width: 64px; height: 64px; border-radius: 10px;
  object-fit: cover; background: var(--panel-2);
  border: 1px solid var(--border);
}
.logo-preview img:not([src]),
.logo-preview img[src=""] { display: none; }

input[type="color"] {
  width: 56px; height: 38px; padding: 2px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
}

/* Generic editable list items used in profile + editor pages */
.list-item {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 10px;
}
.list-item .control { width: 100%; }

/* ─────────────── Subsection header inside a card ─────────────── */
.subhead-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 18px 0 10px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.subhead-row h4 {
  margin: 0; font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted);
}

/* ─────────────── Card grid (testimonials + media library tiles) ─────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.card-tile {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.card-tile .ct-head {
  display: flex; align-items: center; gap: 8px;
}
.card-tile .ct-head input,
.card-tile .ct-head select { flex: 1; }
.card-tile .ct-head .btn-ghost { flex-shrink: 0; }
.card-tile .ct-rating { display: flex; align-items: center; gap: 8px; }
.card-tile .ct-rating label { white-space: nowrap; }
.card-tile .ct-rating input { width: 70px; }

/* Inputs inside card tiles share the small-form styling */
.card-tile input[type="text"],
.card-tile input[type="number"],
.card-tile select,
.card-tile textarea {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 9px; font-size: 13px; font-family: inherit;
  outline: none; width: 100%;
  transition: border-color 0.15s;
}
.card-tile input:focus,
.card-tile select:focus,
.card-tile textarea:focus { border-color: var(--accent); }

/* Media-tile thumbnail at the top of a tile */
.media-tile .media-thumb-tile {
  width: 100%; height: 140px;
  border-radius: 7px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.media-tile .media-thumb-tile img {
  width: 100%; height: 100%; object-fit: cover;
}

/* URL field + Upload button — single horizontal row in each media tile */
.media-tile .m-url-row {
  display: flex; gap: 6px; align-items: stretch;
}
.media-tile .m-url-row .m-url { flex: 1; min-width: 0; }

/* Client portal — brand profile: essay spacing + photo-only tiles */
.profile-client-page .control textarea {
  margin-bottom: 1rem;
}
.profile-client-page #cp-current-promotions {
  margin-bottom: 2rem;
}
.profile-client-page .cp-logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.profile-client-page .cp-logo-preview-block {
  margin-top: 12px;
}
.profile-client-page .cp-logo-preview-box {
  width: 120px;
  height: 120px;
  margin-top: 6px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-client-page .cp-logo-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.cp-media-grid {
  margin-top: 4px;
}
.cp-media-tile {
  position: relative;
  padding-bottom: 8px;
}
.cp-media-tile .cp-media-thumb-wrap {
  height: 160px;
}
.cp-media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cp-media-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
}
.cp-media-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.media-tile .upload-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 0 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.media-tile .upload-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Value props — horizontal grid of compact cards (landing page editor) */
.lp-value-props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.lp-value-props-grid > .empty {
  grid-column: 1 / -1;
}
.lp-value-props-grid > .vp-edit-card {
  position: relative;
  margin: 0;
  padding: 14px 40px 14px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.lp-value-props-grid > .vp-edit-card .control:last-child {
  margin-bottom: 0;
}
.lp-value-props-grid .vp-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  line-height: 1;
}
.lp-value-props-grid .vp-desc {
  width: 100%;
  min-height: 52px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
}

/* FAQ editor — card grid (remove control top-right; Q then A) */
.lp-faq-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-top: 8px;
}
.lp-faq-items-grid > .empty {
  grid-column: 1 / -1;
}
.lp-faq-items-grid > .faq-edit-card {
  position: relative;
  margin: 0;
  padding: 14px 40px 14px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.lp-faq-items-grid > .faq-edit-card .control:last-child {
  margin-bottom: 0;
}
.lp-faq-items-grid .faq-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  line-height: 1;
}
.lp-faq-items-grid .faq-a {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
}

/* ─────────────── Template picker (editor) ─────────────── */
.template-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.template-card {
  text-align: left; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  font-family: inherit; color: var(--text);
  transition: all 0.15s;
}
.template-card:hover { border-color: var(--accent); }
.template-card.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(26,115,232,0.08), var(--panel-2));
  box-shadow: 0 0 0 1px var(--accent);
}
.template-card .tc-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.template-card .tc-desc { line-height: 1.45; margin-bottom: 8px; }
.template-card .tc-best { font-style: italic; }

/* ─────────────── Featured-media preview in editor ─────────────── */
.media-preview {
  margin-top: 12px; padding: 12px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; text-align: center;
}
.media-preview img {
  max-width: 100%; max-height: 200px;
  border-radius: 8px; margin-bottom: 8px;
}

/* ─────────────── LP editor collapsible sections (<details>) ─────────────── */
details.editor-section > summary.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  justify-content: flex-start;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
details.editor-section > summary.card-head::-webkit-details-marker {
  display: none;
}
details.editor-section > summary.card-head::before {
  content: "▸";
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  color: #444746;
  margin-top: 2px;
  transition: transform 0.15s ease, color 0.15s ease;
}
details.editor-section > summary.card-head:hover::before {
  color: var(--text);
}
details.editor-section[open] > summary.card-head::before {
  transform: rotate(90deg);
}
details.editor-section > summary.card-head > .editor-section-intro {
  flex: 1;
  min-width: 0;
}
details.editor-section[open] > summary.card-head {
  margin-bottom: 14px;
}
details.editor-section:not([open]) > summary.card-head {
  margin-bottom: 0;
}

/* ─────────────── Testimonial pick checklist ─────────────── */
.t-pick {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.t-pick:hover { border-color: var(--accent); }
.t-pick input[type="checkbox"] { margin-top: 4px; }

/* ─────────────── Section order list (up/down arrow rows) ─────────────── */
.section-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 6px;
}
.section-actions { display: flex; gap: 4px; }
.section-actions .btn-ghost {
  font-size: 14px; padding: 4px 8px; line-height: 1;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
}
.section-actions .btn-ghost:hover:not(:disabled) {
  border-color: var(--accent); color: var(--accent);
}
.section-actions .btn-ghost:disabled { opacity: 0.35; cursor: not-allowed; }
.section-label {
  flex: 1; display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-weight: 500;
}

/* ─────────────── Empty state for editable lists ─────────────── */
.empty {
  padding: 20px; text-align: center;
  border: 1px dashed var(--border); border-radius: 10px;
}

/* ---------- Campaign tree ---------- */
.campaign-tree { display: flex; flex-direction: column; gap: 12px; }
.campaign-tree .empty {
  padding: 24px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.campaign {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 14px;
}
.campaign > summary {
  list-style: none; cursor: pointer;
  padding: 12px 4px;
  display: flex; align-items: center; gap: 12px;
}
.campaign > summary::-webkit-details-marker { display: none; }
.campaign > summary::before {
  content: "▸"; color: var(--muted); font-size: 11px;
  transition: transform 0.15s; display: inline-block;
}
.campaign[open] > summary::before { transform: rotate(90deg); }
.campaign-title { font-weight: 600; font-size: 14px; }
.campaign > summary .muted { flex: 1; font-size: 12px; }

/* ──────── Ad-group sidebar layout (rail + pane) ────────
   Left rail: clickable list of ad groups. Right pane: keywords + ads
   for the SELECTED group only. Keeps the page scannable even with
   30 headlines + 8 descriptions per group. */
.ad-groups-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  margin-top: 6px;
  align-items: start;
}
@media (max-width: 900px) {
  .ad-groups-layout { grid-template-columns: 1fr; }
}

.ad-group-rail {
  display: flex; flex-direction: column; gap: 8px;
}
.rail-item {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%; text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit; color: var(--text); cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.rail-item:hover {
  background: var(--panel);
  border-left-color: rgba(26, 115, 232, 0.45);
}
.rail-item:active { transform: translateY(1px); }
.rail-item.active {
  background: var(--panel);
  border-color: rgba(26, 115, 232, 0.55);
  border-left-color: var(--accent);
  box-shadow: 0 2px 12px rgba(26, 115, 232, 0.10);
}
.rail-item .ag-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px;
  border-radius: 50%; background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted); font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.rail-item.active .ag-num {
  background: var(--accent); color: white; border-color: var(--accent);
}
.rail-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rail-item .ag-name {
  font-size: 14px; font-weight: 700; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-item .rail-stats { font-size: 11px; line-height: 1.4; }

.ad-group-pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.ad-group-pane-head {
  display: flex; align-items: baseline; gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.ad-group-pane-head .pane-title { font-size: 18px; font-weight: 700; }
.ad-group-pane .empty {
  padding: 24px; text-align: center;
  border: 1px dashed var(--border); border-radius: 10px;
}

.kw-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--text);
}
.chip.kw { background: rgba(26, 115, 232, 0.10); border-color: rgba(26, 115, 232, 0.25); }

/* ──────── Ad sub-cards inside each ad group ──────── */
.ads-list {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 16px;
}
.ad {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
}
.ad-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--accent); font-weight: 700; margin-bottom: 10px;
}

/* Sectioned label inside an ad (Headlines / Descriptions) */
.ad-section { margin-top: 12px; }
.ad-section:first-of-type { margin-top: 0; }
.ad-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted); font-weight: 600; margin-bottom: 8px;
}
.ad-section-label .small { text-transform: none; letter-spacing: 0; font-weight: 500; }

/* Headlines: 3-column numbered grid (auto-flows row by row) */
.hl-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  column-gap: 18px; row-gap: 4px;
  list-style: decimal; padding-left: 24px;
  margin: 0;
}
.hl-grid li {
  font-size: 13px; padding: 2px 0;
  color: var(--text);
}
@media (max-width: 1100px) { .hl-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .hl-grid { grid-template-columns: 1fr; } }

/* Descriptions: numbered single-column list with comfortable line-height */
.desc-list {
  list-style: decimal; padding-left: 24px;
  margin: 0;
}
.desc-list li {
  font-size: 13px; padding: 5px 0; line-height: 1.55;
  color: var(--muted);
}

/* ---------- Single-campaign card ---------- */
#campaign-card .empty {
  padding: 24px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  margin-top: 8px;
}
.campaign-state-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.campaign-title-block {
  display: flex; align-items: center; gap: 12px;
}
.campaign-title-block .campaign-title { font-size: 15px; }
.campaign-actions {
  display: flex; align-items: center; gap: 12px;
}

.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px;
}
.status-pill.draft { background: rgba(251, 188, 4, 0.16); color: #b06000; }
.status-pill.pub   { background: rgba(58, 195, 121, 0.16); color: #137333; }

/* On/off toggle (re-usable) */
.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-slider {
  position: relative; width: 36px; height: 20px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; transition: background 0.15s, border-color 0.15s;
}
.toggle-slider::before {
  content: ""; position: absolute;
  top: 2px; left: 2px; width: 14px; height: 14px;
  background: var(--muted); border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}
.toggle input:checked + .toggle-slider {
  background: rgba(26, 115, 232, 0.30);
  border-color: var(--accent);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px); background: var(--accent);
}
.toggle-label { font-size: 12px; color: var(--muted); min-width: 22px; }
.toggle input:disabled + .toggle-slider {
  opacity: 0.45; cursor: not-allowed;
}
.toggle:has(input:disabled) { cursor: not-allowed; }

/* Campaign payment-pause warning row — shown above the ad-groups layout
   when the campaign was auto-paused due to a failed payment. */
.campaign-payment-warning {
  background: rgba(234, 67, 53, 0.10);
  border: 1px solid rgba(234, 67, 53, 0.30);
  color: #c5221f;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 6px 0 12px;
}
.campaign-payment-warning a { color: #c5221f; font-weight: 600; }

/* Reusable mini-tile (used by various modal status blocks). */
.tile-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.7px; font-weight: 600; margin-bottom: 4px;
}
.tile-value { font-size: 18px; font-weight: 700; }

/* Dashboard topbar — "Today (sim)" badge sits next to the date controls. */
.sim-today-control { min-width: 0; }
.sim-today-badge {
  display: inline-block;
  padding: 7px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.sim-today-badge.simulated {
  color: var(--accent);
  background: rgba(26, 115, 232, 0.08);
  border-color: rgba(26, 115, 232, 0.35);
}

/* Live-client Simulate modal (Dashboard). */
.sim-status-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin: 14px 0 18px;
}
.sim-status-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}
.ss-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.7px; font-weight: 600; margin-bottom: 4px;
}
.ss-value { font-size: 16px; font-weight: 700; }
.sim-actions { gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.sim-actions .btn-ghost { margin-left: auto; }
.sim-advanced {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  margin: 4px 0 14px;
}
.sim-advanced > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: baseline; gap: 12px;
  padding: 6px 0;
}
.sim-advanced > summary::-webkit-details-marker { display: none; }
.sim-advanced > summary::before {
  content: "▸"; color: var(--muted); font-size: 11px;
  transition: transform 0.15s; display: inline-block;
}
.sim-advanced[open] > summary::before { transform: rotate(90deg); }
.sim-advanced[open] { padding-bottom: 14px; }
.sim-settings-row { align-items: end; gap: 14px; margin-bottom: 14px; }
.sim-settings-row .control { min-width: 220px; }
.sim-settings-row .input-affix { max-width: 130px; }
.sim-profile-warning {
  background: rgba(251, 188, 4, 0.10);
  border: 1px solid rgba(251, 188, 4, 0.35);
  color: #b06000;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.sim-profile-warning a { color: #b06000; font-weight: 600; }
.sim-log-wrap { margin-top: 8px; }
.sim-log-label { margin-bottom: 6px; }
.sim-log {
  max-height: 240px; overflow-y: auto;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px;
}
.sim-log .row {
  display: grid;
  grid-template-columns: 130px 130px 1fr;
  gap: 10px; padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.sim-log .row:last-child { border-bottom: 0; }
.sim-log .row.skipped { color: var(--muted); }
.sim-log .row .num { text-align: right; }
.sim-log .row .kind {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(26, 115, 232, 0.12); color: #1a73e8;
  display: inline-block; align-self: start;
}
.sim-log .row.kind-billing  .kind { background: rgba(52,168,83,0.12); color: #137333; }
.sim-log .row.kind-failure  .kind { background: rgba(234,67,53,0.14); color: #c5221f; }
.sim-log .row.kind-test     .kind { background: rgba(251,188,4,0.14);   color: #b06000; }
.sim-log .row.kind-lp       .kind { background: rgba(103,58,183,0.14);  color: #673ab7; }
.sim-log .row.kind-day      .kind { background: rgba(0,0,0,0.06); color: var(--muted); }
.sim-log .row.kind-campaign .kind { background: rgba(26,115,232,0.14); color: var(--accent); }
.sim-log .row.kind-client .kind { background: rgba(0, 150, 136, 0.14); color: #00897b; }
@media (max-width: 700px) {
  .sim-status-row { grid-template-columns: repeat(2, 1fr); }
}

/* Landing Pages → Split Test → Test Settings card. */
.test-settings-row { align-items: end; gap: 18px; }
.test-settings-row .control { min-width: 240px; }
.test-settings-row .input-affix { max-width: 130px; }
.test-settings-row .grow { line-height: 1.5; }

/* ===========================================================================
   Activity Log page (/i/activity/<id>)
   Shares chip palette with the Simulate modal log via the kind-* classes
   above (.kind-billing / .kind-failure / .kind-test / .kind-lp / .kind-day).
   =========================================================================== */
.activity-filter button { min-width: 70px; }
.activity-kpi { cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.activity-kpi:hover {
  border-color: rgba(26, 115, 232, 0.40);
  background: rgba(26, 115, 232, 0.04);
}
.activity-log {
  display: flex; flex-direction: column; gap: 0;
  font-size: 14px;
}
.activity-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: 0; }
.activity-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.activity-row-when {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
}
.activity-row-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.activity-row-summary {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
}
/* Re-use the simulate modal's chip palette so colors stay consistent. */
.activity-row .kind {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 4px;
  background: rgba(26, 115, 232, 0.12); color: var(--accent);
  display: inline-block;
  text-align: center;
}
.activity-row .kind-raw {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.activity-row.kind-billing  .kind { background: rgba(52,168,83,0.12); color: var(--good); }
.activity-row.kind-failure  .kind { background: rgba(234,67,53,0.14); color: var(--bad); }
.activity-row.kind-test     .kind { background: rgba(251,188,4,0.14); color: var(--warn); }
.activity-row.kind-lp       .kind { background: rgba(103,58,183,0.14); color: #673ab7; }
.activity-row.kind-day      .kind { background: rgba(0,0,0,0.06);     color: var(--muted); }
.activity-row.kind-campaign .kind { background: rgba(26,115,232,0.14); color: var(--accent); }
.activity-row.kind-client .kind { background: rgba(0, 150, 136, 0.14); color: #00897b; }
.activity-row.is-client-action { border-left: 3px solid #00897b; padding-left: 8px; }
.kind-with-actor {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px;
  align-self: center;
}
.activity-actor-pill {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(0, 150, 136, 0.18); color: #00695c;
}
@media (max-width: 800px) {
  .activity-row-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ----- Client creatives ----- */
.banner-inline {
  margin: 0 0 12px;
}
.creative-grid-wrap .card-head {
  justify-content: space-between;
}
.creative-empty .card {
  padding: 20px;
}
.creative-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 4px;
}
.creative-slot-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.creative-slot-label {
  font-weight: 700;
  font-size: 13px;
}
.creative-slot-imgwrap {
  background: white;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  overflow: hidden;
  min-height: 160px;
  display: grid;
  place-items: center;
}
.creative-slot-img {
  width: 100%; height: auto;
  display: block;
}
.creative-slot-actions {
  display: flex;
  gap: 8px;
}
.btn-icon {
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  font-size: 18px;
  padding: 4px 10px;
}
.btn-icon.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}
.creative-crit-input {
  width: 100%;
  min-height: 88px;
  max-height: min(40vh, 360px);
  resize: vertical;
  overflow-y: auto;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
}
.creative-admin-batch {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.creative-admin-batch summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}
.creative-admin-images-toolbar {
  margin: 12px 0 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.creative-admin-images-toolbar .creative-publish-row {
  flex: 1 1 100%;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.creative-slot-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.creative-slot-card {
  border: 1px solid var(--border, #e0e0e0);
  border-radius: var(--radius, 8px);
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Client portal creatives: allow critique textarea to grow/scroll (admin cards use overflow:hidden above). */
.creative-slot-card.creative-slot-card--client {
  overflow: visible;
}
.creative-slot-card--client .creative-slot-imgwrap {
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
}
.creative-slot-card--client .creative-lightbox-trigger img {
  max-height: min(56vh, 520px);
}

/* Client grid columns can be narrower than the global textarea min-width; keep box border-box and allow shrink. */
.creative-slot-card--client textarea.creative-crit-input {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.creative-slot-card-media {
  background: var(--panel-2, #f6f8fa);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}
.creative-lightbox-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
}
.creative-lightbox-trigger:focus-visible {
  outline: 2px solid var(--accent, #1a73e8);
  outline-offset: 2px;
}
.creative-lightbox-trigger img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  display: block;
}
.creative-slot-no-media {
  padding: 32px 16px;
  text-align: center;
  width: 100%;
}
.creative-slot-card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.creative-slot-card-title {
  font-weight: 600;
  font-size: 14px;
}
.creative-slot-feedback {
  margin-top: 8px;
}
.creative-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.creative-lightbox[hidden] {
  display: none !important;
}
.creative-lightbox-panel {
  position: relative;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  cursor: default;
}
.creative-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}
.creative-lightbox-close {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
  padding: 0;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
}
.creative-admin-slot-title {
  font-weight: 600;
}
blockquote.creative-admin-quote {
  margin: 8px 0 0;
  padding: 10px;
  border-left: 2px solid var(--panel-2);
  background: var(--panel);
  border-radius: 8px;
}

.strong {
  font-weight: 600;
}

/* Performance reports — admin + client */
.reports-admin-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
}
.reports-report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.pipeline-card-body {
  padding-top: 8px;
}
.reports-report-card {
  cursor: default;
  text-align: left;
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reports-report-card .reports-report-card-body {
  margin-top: 0;
}
.reports-report-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.reports-report-card-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
}
.reports-card-oid {
  font-size: 11px;
  margin-top: 6px;
  word-break: break-all;
}
.reports-admin-badge.err {
  background: #ffebee;
  color: #c62828;
}
.reports-admin-badge.pulse {
  animation: reports-badge-pulse 1.5s ease-in-out infinite;
}
@keyframes reports-badge-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}
button.reports-admin-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 2px;
  width: 100%;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: white;
  padding: 10px 12px;
}
button.reports-admin-row.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.12);
}
.reports-admin-row-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.reports-admin-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eee;
  color: #555;
}
.reports-admin-badge.ok {
  background: #e8f5e9;
  color: #2e7d32;
}
.reports-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border, #e0e0e0);
}
.reports-admin-row-dim {
  font-size: 12px;
  color: var(--muted-text, #757575);
}

.creative-prompt-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 8px 8px;
}
.creative-prompt-slot .strong {
  margin-bottom: 4px;
  display: block;
}
.creative-prompt-pre {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.45;
  background: #f6f8fa;
  padding: 12px;
  border-radius: var(--radius, 6px);
  max-height: 280px;
  overflow: auto;
  margin: 0;
}

/* Creatives admin: space between batch cards on the page background */
#creatives-admin-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.creative-pipeline-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.creative-pipeline-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin: 0;
  padding: 0 8px 12px;
}
@media (max-width: 720px) {
  .creative-pipeline-dl {
    grid-template-columns: 1fr;
  }
}
.creative-pipeline-dl > div {
  margin: 0;
}
.creative-pipeline-dl dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-text, #757575);
  margin-bottom: 4px;
}
.creative-pipeline-dl dd {
  margin: 0;
  font-size: 13px;
  word-break: break-all;
}
.creative-pipeline-dl .full-width {
  grid-column: 1 / -1;
}
span.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.creative-card-note {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--panel-2, #f6f8fa);
  border-radius: var(--radius, 6px);
  border: 1px solid var(--border, #e8e8e8);
}
.creative-pipeline-section {
  margin-bottom: 18px;
}
.creative-llm-details {
  border: 1px solid var(--border, #e0e0e0);
  border-radius: var(--radius, 6px);
  padding: 0 12px 8px;
  background: #fff;
}
.creative-llm-summary {
  cursor: pointer;
  font-weight: 600;
  padding: 10px 0 6px;
}
.creative-pipeline-dl--llm {
  grid-template-columns: 1fr;
  padding-top: 0;
}
.creative-fal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.creative-fal-table th,
.creative-fal-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #eee);
  vertical-align: top;
}
.creative-fal-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-text, #757575);
}
.creative-fal-rid {
  max-width: 280px;
}
.creative-fal-empty {
  margin: 0;
}
.creative-publish-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.break-all {
  word-break: break-all;
}

.report-document {
  padding: 8px 4px;
  line-height: 1.55;
}
.report-document--scroll {
  max-height: min(78vh, 920px);
  overflow: auto;
  padding: 12px 8px;
}
.report-document--pro {
  padding: 0;
}
/* Legacy class names — still used inside GPT body HTML */
.report-title {
  font-size: 1.6rem;
  margin: 0 0 6px;
  font-weight: 700;
}
.report-subtitle {
  margin: 0 0 16px;
  font-size: 15px;
}
ul.report-highlights {
  margin: 0 0 20px 1.25rem;
  padding: 0;
}
ul.report-highlights li {
  margin-bottom: 8px;
}
.report-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}
.report-section:last-child {
  border-bottom: none;
}
.report-section h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.report-section-inner p {
  margin: 0 0 10px;
}

/* ——— Performance report “pro” layout (hero, KPIs, CSS charts) ——— */
.report-pro {
  position: relative;
}

/* Infographic variant — richer colors, mix bars, hero wave */
.report-pro--infographic .report-pro-hero {
  background: linear-gradient(
    125deg,
    #1e1b4b 0%,
    #5b21b6 28%,
    #2563eb 58%,
    #0e7490 100%
  );
  margin-bottom: 0;
  box-shadow:
    0 18px 48px rgba(79, 70, 229, 0.35),
    0 2px 8px rgba(15, 23, 42, 0.25);
}
.report-pro-hero-mesh {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(circle at 12% 88%, rgba(244, 114, 182, 0.45), transparent 42%),
    radial-gradient(circle at 92% 18%, rgba(56, 189, 248, 0.55), transparent 38%),
    linear-gradient(
      165deg,
      rgba(255, 255, 255, 0.06) 0%,
      transparent 45%
    );
  pointer-events: none;
}
.report-pro-hero-wave {
  line-height: 0;
  margin: -1px 0 0;
  overflow: hidden;
}
.report-pro-hero-wave svg {
  display: block;
  width: 100%;
  height: 44px;
}
.report-pro-dashboard--viz {
  position: relative;
  padding-top: 8px;
}
.report-pro-mix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 720px) {
  .report-pro-mix-grid {
    grid-template-columns: 1fr;
  }
}
.report-pro-mix-card {
  border-radius: 14px;
  padding: 14px 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.98));
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.report-pro-mix-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6366f1;
  margin-bottom: 10px;
}
.report-pro-mix-bar {
  display: flex;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
  margin-bottom: 10px;
}
.report-pro-mix-seg {
  min-width: 3px;
  height: 100%;
  transition: width 0.4s ease;
}
.report-pro-mix-seg--violet {
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
}
.report-pro-mix-seg--cyan {
  background: linear-gradient(90deg, #0891b2, #22d3ee);
}
.report-pro-mix-seg--sunset {
  background: linear-gradient(90deg, #ea580c, #fb923c);
}
.report-pro-mix-seg--slate {
  background: linear-gradient(90deg, #475569, #94a3b8);
}
.report-pro-mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--text);
}
.report-pro-mix-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.report-pro-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.report-pro-dot--violet {
  background: linear-gradient(135deg, #7c3aed, #c4b5fd);
}
.report-pro-dot--cyan {
  background: linear-gradient(135deg, #0891b2, #67e8f9);
}
.report-pro-dot--sunset {
  background: linear-gradient(135deg, #ea580c, #fdba74);
}
.report-pro-dot--slate {
  background: linear-gradient(135deg, #475569, #cbd5e1);
}

.report-pro-kpi--glow {
  border: none !important;
  position: relative;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12) !important;
}
.report-pro-kpi--glow > * {
  position: relative;
  z-index: 1;
}
.report-pro-kpi--glow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.55), rgba(34, 211, 238, 0.35));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.report-pro-kpi--violet .report-pro-kpi-value {
  background: linear-gradient(90deg, #6d28d9, #2563eb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.report-pro-kpi--amber .report-pro-kpi-value {
  background: linear-gradient(90deg, #c2410c, #eab308);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.report-pro-kpi--teal .report-pro-kpi-value {
  background: linear-gradient(90deg, #0f766e, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.report-pro--infographic .report-pro-chart-card {
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-top: 4px solid #6366f1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.92));
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
}
.report-pro--infographic .report-pro-bar-track {
  height: 14px;
  background: rgba(15, 23, 42, 0.07);
}
.report-pro-hl-item.report-pro-hl--a {
  border-left: 4px solid #7c3aed;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.07), var(--panel));
}
.report-pro-hl-item.report-pro-hl--b {
  border-left: 4px solid #0891b2;
  background: linear-gradient(90deg, rgba(8, 145, 178, 0.08), var(--panel));
}
.report-pro-hl-item.report-pro-hl--c {
  border-left: 4px solid #ea580c;
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.08), var(--panel));
}
.report-pro-section.report-pro-section--infographic {
  border-left-width: 5px;
  border-left-color: #6366f1;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.98),
    rgba(238, 242, 255, 0.55)
  );
}

.report-preview-root.report-preview-loaded {
  padding: 0;
}
.report-preview-root.report-preview-loaded .report-pro {
  max-width: 920px;
  margin: 0 auto;
}
.report-preview-topbar .report-preview-back {
  margin-bottom: 6px;
}

.report-pro-hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  background: linear-gradient(
    135deg,
    #0f172a 0%,
    #1e3a5f 48%,
    #0c4a6e 100%
  );
  color: #f8fafc;
  box-shadow: var(--shadow);
}
.report-pro-hero-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 90% 60% at 80% 20%,
    rgba(56, 189, 248, 0.35),
    transparent 55%
  );
  pointer-events: none;
}
.report-pro-hero-inner {
  position: relative;
  padding: 28px 24px 26px;
}
.report-pro-title {
  margin: 0 0 10px;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.report-pro-subtitle {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  opacity: 0.92;
  font-weight: 400;
  color: rgba(248, 250, 252, 0.92);
}
.report-pro-hero-meta {
  margin-top: 16px;
}
.report-pro-hero-asof {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(248, 250, 252, 0.2);
}

.report-pro-dashboard {
  margin-bottom: 22px;
}
.report-pro-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 720px) {
  .report-pro-kpi-grid {
    grid-template-columns: 1fr;
  }
}
.report-pro-kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.report-pro-kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.report-pro-kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.report-pro-kpi-foot {
  margin-top: 8px;
  min-height: 22px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.report-pro-kpi-hint {
  font-size: 11px;
  opacity: 0.9;
}
.report-pro-delta {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.report-pro-delta.is-up {
  color: var(--good);
  background: rgba(24, 128, 56, 0.12);
}
.report-pro-delta.is-down {
  color: var(--bad);
  background: rgba(217, 48, 37, 0.1);
}
.report-pro-delta.is-flat {
  color: var(--muted);
  background: var(--panel-2);
}

.report-pro-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .report-pro-charts {
    grid-template-columns: 1fr;
  }
}
.report-pro-chart-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.report-pro-chart-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.report-pro-bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(80px, 3fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
@media (max-width: 520px) {
  .report-pro-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
.report-pro-bar-label {
  font-size: 12px;
  color: var(--muted);
}
.report-pro-bar-track {
  height: 12px;
  background: rgba(60, 64, 67, 0.12);
  border-radius: 999px;
  overflow: hidden;
}
.report-pro-bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.35s ease;
}
.report-pro-bar-fill--accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.report-pro-bar-fill--teal {
  background: linear-gradient(90deg, #0d9488, #2dd4bf);
}
.report-pro-bar-fill--muted {
  background: linear-gradient(90deg, #64748b, #94a3b8);
}
.report-pro-bar-num {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}

.report-pro-block-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.report-pro-highlights-wrap {
  margin-bottom: 24px;
}
.report-pro-highlights {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.report-pro-hl-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.report-pro-hl-num {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, monospace;
  color: var(--accent);
  opacity: 0.85;
  padding-top: 2px;
}
.report-pro-hl-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

.report-pro-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.report-pro-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}
.report-pro-section-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}
.report-pro-section-index {
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: rgba(26, 115, 232, 0.2);
  font-family: ui-monospace, monospace;
}
.report-pro-section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.report-pro-section-body p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}
.report-pro-section-body p:last-child {
  margin-bottom: 0;
}

.reports-client-list {
  display: grid;
  gap: 12px;
}
.reports-client-card {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.reports-client-card--rich {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.reports-client-card--rich:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.reports-client-card-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 148px;
}
@media (max-width: 560px) {
  .reports-client-card-actions {
    margin-left: 0;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
}
.reports-client-detail-card .reports-client-detail-title {
  margin: 12px 0 8px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.reports-client-detail-actions {
  margin-top: 20px;
}
.reports-client-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0.95;
  position: relative;
}
.reports-client-card-icon::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  border-bottom: none;
  border-right: none;
}
.reports-client-card-main {
  min-width: 0;
}
.reports-client-card-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 15px;
}
.reports-client-card-sub {
  margin-bottom: 4px;
  line-height: 1.4;
}
.reports-client-card-date {
  font-size: 12px;
}

/* Brand Profile — required field indicator (display only; see get_brand_profile_gaps) */
.required-mark {
  color: var(--bad);
  font-weight: 700;
  margin-left: 0.15em;
  font-size: 0.95em;
  vertical-align: middle;
  line-height: 1;
}
.profile-required-legend {
  margin: 0 0 12px;
}
.card-head h3 .required-mark {
  font-size: 1em;
}

/* ─── Client portal — billing / subscription ─── */
.mode-client .client-billing-card {
  max-width: 900px;
}
.client-billing-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 18px;
}
.client-billing-status-line .billing-status-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.chip.billing-paid {
  background: rgba(52, 168, 83, 0.11);
  border-color: rgba(52, 168, 83, 0.35);
  color: var(--good);
  font-weight: 600;
}
.chip.billing-due {
  background: rgba(251, 188, 4, 0.12);
  border-color: rgba(251, 188, 4, 0.42);
  color: var(--warn);
  font-weight: 600;
}
.chip.billing-issue {
  background: rgba(217, 48, 37, 0.08);
  border-color: rgba(217, 48, 37, 0.28);
  color: var(--bad);
  font-weight: 600;
}
.chip.billing-neutral {
  font-weight: 600;
}
.client-billing-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.45;
}
.client-billing-note.is-pending {
  border-color: rgba(251, 188, 4, 0.42);
  background: rgba(251, 188, 4, 0.06);
}
.mode-client .client-billing-card .form-actions {
  margin-top: 20px;
  padding-top: 4px;
}
.mode-client .client-billing-card #billing-client-metrics {
  margin-top: 4px;
}

.stripe-diag-actions {
  margin-top: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.stripe-diag-hint code {
  font-size: 11px;
}
.stripe-diag-pre {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 12px;
  line-height: 1.45;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.stripe-diag-pre.good {
  border-color: rgba(52, 168, 83, 0.35);
  background: rgba(52, 168, 83, 0.06);
}
.stripe-diag-pre.bad {
  border-color: rgba(217, 48, 37, 0.3);
  background: rgba(217, 48, 37, 0.05);
}
