:root {
  --bg: #0a0a0f;
  --bg2: #0f0f14;
  --bg3: #1a1a24;
  --text: #f5f2ec;
  --text-muted: #c8bfb4;
  --accent: #c9a84c;
  --accent-light: #e8d28a;
  --border-c: rgba(201, 168, 76, 0.18);
  --card-bg: #060913;
  --sidebar-bg-start: #09090d;
  --sidebar-bg-end: #0f0f14;
  --sidebar-text: var(--text);
  --nav-muted: #aaa095;
  --nav-hover-bg: rgba(201, 168, 76, 0.04);
  --nav-active-bg: rgba(201, 168, 76, 0.08);
  --control-bg: var(--bg3);
  --card-border: rgba(201, 168, 76, 0.28);
  --button-text-on-accent: #09090d;
  --sidebar-w: 240px;
  --danger: #e58a7f;
  --success: #9ecb91;
  --warning: #d8b55c;
  color-scheme: dark;
}

body.theme-gold {
  --bg: #0f0b06;
  --bg2: #171008;
  --bg3: #24180d;
  --text: #fff6dc;
  --text-muted: #d6c6a5;
  --accent: #d7ad45;
  --accent-light: #f3d47a;
  --border-c: rgba(215, 173, 69, 0.24);
  --card-bg: #0b0a08;
  --sidebar-bg-start: #0d0905;
  --sidebar-bg-end: #191006;
  --sidebar-text: var(--text);
  --nav-muted: #bca477;
  --nav-hover-bg: rgba(215, 173, 69, 0.08);
  --nav-active-bg: rgba(215, 173, 69, 0.14);
  --control-bg: #21160b;
  --card-border: rgba(215, 173, 69, 0.36);
}

body.theme-light {
  --bg: #f4f1e8;
  --bg2: #ebe5d7;
  --bg3: #fffaf0;
  --text: #19150f;
  --text-muted: #685d4d;
  --accent: #9b7627;
  --accent-light: #6e531c;
  --border-c: rgba(155, 118, 39, 0.22);
  --card-bg: #fffaf0;
  --sidebar-bg-start: #09090d;
  --sidebar-bg-end: #0f0f14;
  --sidebar-text: #f5f2ec;
  --nav-muted: #aaa095;
  --nav-hover-bg: rgba(201, 168, 76, 0.04);
  --nav-active-bg: rgba(201, 168, 76, 0.08);
  --control-bg: #ffffff;
  --card-border: rgba(155, 118, 39, 0.28);
  --button-text-on-accent: #fffaf0;
  color-scheme: light;
}

body.theme-light .crm-sidebar {
  --text: #f5f2ec;
  --text-muted: #c8bfb4;
  --accent: #c9a84c;
  --accent-light: #e8d28a;
  --border-c: rgba(201, 168, 76, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 14px;
}

body.haven-body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: var(--accent-light);
}

a:hover {
  color: var(--text);
}

.crm-wrap {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.crm-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  max-height: 100dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
  border-right: 1px solid var(--border-c);
}

.sidebar__logo {
  flex-shrink: 0;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-c);
}

.crm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
}

.crm-brand:hover {
  color: var(--sidebar-text);
}

.crm-brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  color: var(--accent-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1;
}

.crm-brand-wordmark {
  color: var(--sidebar-text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.crm-brand-wordmark span {
  color: var(--accent);
}

.crm-nav {
  flex: 1 1 auto;
  min-height: 100px;
  overflow-y: auto;
  padding: 18px 0;
}

.crm-nav-group {
  margin-bottom: 16px;
}

.crm-nav-label {
  display: block;
  position: relative;
  cursor: pointer;
  list-style: none;
  padding: 9px 20px 5px;
  border-block: 1px solid var(--border-c);
  background: color-mix(in srgb, var(--accent) 14%, var(--sidebar-bg-end));
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35em;
}

.crm-nav-label::-webkit-details-marker {
  display: none;
}

.crm-nav-label::after {
  content: "+";
  position: absolute;
  right: 8px;
  letter-spacing: 0;
}

.crm-nav-group[open] > .crm-nav-label::after {
  content: "−";
}

.crm-nav-label:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: -3px;
}

.crm-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 12px 20px;
  border-left: 2px solid transparent;
  color: var(--nav-muted);
  text-decoration: none;
}

.crm-nav-link:hover {
  color: var(--sidebar-text);
  background: var(--nav-hover-bg);
}

.crm-nav-link.is-active {
  color: var(--sidebar-text);
  background: var(--nav-active-bg);
  border-left-color: var(--accent);
}

.crm-nav-link.is-disabled,
.crm-footer-link.is-disabled {
  color: var(--nav-muted);
  cursor: default;
}

.crm-sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--border-c);
}

.crm-user-card {
  padding-bottom: 12px;
}

.crm-user-name {
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 700;
}

.crm-user-email {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.crm-footer-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 14px;
}

.crm-footer-actions form {
  margin: 0;
}

.crm-footer-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-light);
  font-size: 12px;
  text-decoration: none;
}

.crm-footer-link:hover {
  color: var(--text);
}

.crm-display-label {
  margin-bottom: 8px;
  color: var(--nav-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.crm-display-buttons {
  display: flex;
  gap: 8px;
}

.crm-display-buttons form {
  margin: 0;
}

.crm-display-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-c);
  border-radius: 4px;
  background: var(--bg3);
}

.crm-display-button--gold {
  background: var(--accent);
}

.crm-display-button--light {
  background: #f5f2ec;
}

.crm-display-button.is-active {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.16);
}

.main-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  width: calc(100% - var(--sidebar-w));
}

.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border-c);
}

.topbar__title {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.page-content {
  width: 100%;
  padding: 32px;
}

.crm-auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--bg);
}

.crm-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.crm-eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35em;
}

.crm-title {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1.15;
}

.crm-subtitle {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.crm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.dashboard-span-4 {
  grid-column: span 4;
}

.dashboard-span-3 {
  grid-column: span 3;
}

.dashboard-span-6 {
  grid-column: span 6;
}

.dashboard-span-12 {
  grid-column: span 12;
}

.crm-card {
  min-height: 150px;
  padding: 24px;
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--card-bg);
}

.dashboard-card-fill {
  height: 100%;
}

.crm-card-header,
.crm-card-body {
  padding: 0;
}

.crm-card-header {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-c);
}

.crm-card-title {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.2;
}

.crm-card-kicker {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.26em;
}

.crm-stat {
  min-height: 128px;
}

.crm-stat-value {
  color: var(--accent-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  line-height: 1.2;
}

.crm-stat-label {
  margin-top: 8px;
  color: var(--text-muted);
  line-height: 1.5;
}

.crm-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid rgba(201, 168, 76, 0.32);
  border-radius: 999px;
  color: var(--accent-light);
  background: rgba(201, 168, 76, 0.08);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.crm-badge--success {
  border-color: rgba(158, 203, 145, 0.42);
  color: var(--success);
  background: rgba(158, 203, 145, 0.1);
}

.crm-badge--warning {
  border-color: rgba(216, 181, 92, 0.42);
  color: var(--warning);
  background: rgba(216, 181, 92, 0.1);
}

.crm-badge--danger {
  border-color: rgba(229, 138, 127, 0.45);
  color: var(--danger);
  background: rgba(229, 138, 127, 0.1);
}

.crm-badge--neutral {
  border-color: rgba(200, 191, 180, 0.28);
  color: var(--text-muted);
  background: rgba(200, 191, 180, 0.06);
}

.lead-state-badge {
  min-height: 22px;
  padding: 2px 8px;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Leads list presentation only; shared state badges and Lead Detail stay unchanged. */
.lead-list-score--premium {
  color: #e8c66a;
  border-color: rgba(232, 198, 106, 0.42);
  background: rgba(232, 198, 106, 0.1);
}

.lead-list-score--quality {
  color: #6ed5c4;
  border-color: rgba(110, 213, 196, 0.42);
  background: rgba(110, 213, 196, 0.1);
}

.lead-list-score--standard {
  color: #c4a0ef;
  border-color: rgba(196, 160, 239, 0.42);
  background: rgba(196, 160, 239, 0.1);
}

/* Reserved display colours; classification awaits an authoritative source contract. */
.lead-list-source--lp {
  color: #f4ac67;
  border-color: rgba(244, 172, 103, 0.42);
  background: rgba(244, 172, 103, 0.1);
}

.lead-list-source--meta {
  color: #83b9ff;
  border-color: rgba(131, 185, 255, 0.42);
  background: rgba(131, 185, 255, 0.1);
}

.crm-definition-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.crm-definition-row {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-c);
}

.crm-definition-row:last-child {
  border-bottom: 0;
}

.crm-definition-row dt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.crm-definition-row dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
}

.crm-table th {
  padding: 11px 12px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  border-bottom: 1px solid var(--border-c);
}

.crm-table td {
  padding: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--border-c);
}

.crm-table tr:last-child td {
  border-bottom: 0;
}

.lead-overview-table tbody tr {
  transition: background-color 120ms ease;
}

.lead-overview-table tbody tr:hover {
  background: rgba(201, 168, 76, 0.045);
}

.lead-overview-table td {
  border-bottom-color: rgba(201, 168, 76, 0.24);
}

.crm-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.affiliate-table--wide {
  min-width: 1180px;
}

.affiliate-table time,
.affiliate-table .crm-badge {
  white-space: nowrap;
}

.crm-technical {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.lead-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  align-items: end;
}

.lead-filters > div {
  min-width: 0;
}

.lead-filters .form-label {
  display: block;
  margin-bottom: 8px;
}

.lead-filters .form-control,
.lead-filters .btn {
  min-height: 44px;
}

.lead-filters select.form-control {
  padding-right: 32px;
}

.lead-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.lead-refresh-controls:not([hidden]),
.lead-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lead-refresh-controls {
  flex-wrap: wrap;
  margin-top: 0.75rem;
  column-gap: 0.875rem;
}

.lead-refresh-toggle input {
  accent-color: var(--accent);
}

.lead-refresh-toggle input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lead-refresh-controls [data-leads-status][data-warning] {
  color: var(--warning);
}

.merchant-workspace-header {
  margin-bottom: 14px;
}

.merchant-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 920px;
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--card-bg);
}

.merchant-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  border-right: 1px solid var(--border-c);
}

.merchant-summary-item:last-child {
  border-right: 0;
}

.merchant-summary-item span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.merchant-summary-item strong {
  color: var(--accent-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
}

.merchant-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 420px));
  gap: 16px;
  align-items: stretch;
}

.merchant-workspace-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 220px;
  padding: 20px;
  border: 1px solid var(--card-border);
  border-top: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--card-bg);
}

.merchant-workspace-card__topline,
.merchant-workspace-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.merchant-workspace-card__topline .crm-card-kicker {
  margin: 0;
}

.merchant-workspace-card__body {
  flex: 1;
  padding: 22px 0 18px;
}

.merchant-workspace-card__title {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  line-height: 1.25;
}

.merchant-workspace-card__ref {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.merchant-workspace-card__footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-c);
}

.merchant-workspace-card__timestamp {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.merchant-workspace-card__timestamp span {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.merchant-workspace-card__timestamp time {
  color: var(--text);
}

.merchant-workspace-card__link {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 4px;
  color: var(--accent-light);
  font-weight: 700;
  text-decoration: none;
}

.merchant-workspace-card__link:hover {
  color: var(--text);
  background: rgba(201, 168, 76, 0.08);
}

.merchant-workspace-card__link:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
}

.merchant-empty-state {
  max-width: 856px;
  min-height: 120px;
}

.vertical-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(150px, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.audit-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(4, minmax(145px, 1fr)) auto;
  gap: 16px;
  align-items: end;
}

.verification-range-panel {
  display: grid;
  gap: 16px;
  min-height: 0;
}

.verification-preset-links,
.verification-custom-range,
.verification-section-heading,
.verification-history-counts {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
}

.verification-custom-range {
  padding-top: 14px;
  border-top: 1px solid var(--border-c);
}

.verification-section-heading {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.verification-review-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(145px, 1fr)) auto;
  gap: 16px;
  align-items: end;
}

.verification-pagination {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.verification-channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.verification-history-counts {
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-c);
  color: var(--text-muted);
}

.verification-history-counts strong {
  color: var(--accent-light);
}

.verification-recovery-actions {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-c);
}

.verification-action-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border-c);
  border-radius: 10px;
  background: var(--panel-2);
}

.verification-action-form h3 {
  margin: 0;
  font-size: 15px;
}

.verification-action-form .btn {
  justify-self: start;
}

.verification-activity-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.verification-activity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-c);
}

.verification-activity-list li:last-child {
  border-bottom: 0;
}

.verification-activity-list time {
  color: var(--text-muted);
  font-size: 12px;
}

.user-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(2, minmax(150px, 1fr)) auto;
  gap: 16px;
  align-items: end;
}

.reporting-filter-panel {
  display: grid;
  gap: 14px;
}

.reporting-filters,
.reporting-lead-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  gap: 14px;
  align-items: end;
}

.reporting-lead-filters {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.reporting-acquisition-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

.reporting-acquisition-more {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--border-c);
}

.reporting-acquisition-more summary,
.acquisition-diagnostics summary {
  color: var(--accent-light);
  cursor: pointer;
  font-weight: 700;
}

.reporting-acquisition-more summary:focus-visible,
.acquisition-diagnostics summary:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 4px;
}

.reporting-acquisition-advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.reporting-acquisition-actions {
  grid-column: 1 / -1;
}

.reporting-status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.reporting-synthetic-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-color: rgba(224, 171, 79, 0.62);
  background: rgba(224, 171, 79, 0.1);
}

.reporting-synthetic-banner .crm-card-kicker,
.reporting-synthetic-banner .crm-card-title {
  margin-bottom: 0;
}

.reporting-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

[data-reporting-filter][aria-busy="true"] {
  opacity: 0.72;
}

.reporting-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.reporting-kpi-grid--acquisition {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.reporting-kpi-grid--acquisition .reporting-kpi {
  min-height: 132px;
}

.reporting-progression {
  padding: 18px;
  border: 1px solid var(--border-c);
  border-radius: 6px;
  background: var(--card-bg);
}

.reporting-progression-heading {
  margin-bottom: 14px;
}

.reporting-progression-heading > .crm-stat-label {
  max-width: 440px;
  text-align: right;
}

.reporting-kpi {
  position: relative;
  min-height: 154px;
  overflow: hidden;
}

.reporting-kpi--primary {
  border-color: rgba(201, 168, 76, 0.55);
  background: linear-gradient(145deg, rgba(201, 168, 76, 0.13), var(--card-bg) 68%);
}

.reporting-kpi-value {
  margin: 9px 0 12px;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

.reporting-kpi p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.reporting-kpi progress,
.reporting-bar-row progress,
.reporting-rate progress {
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg3);
  accent-color: var(--accent);
}

.reporting-kpi progress::-webkit-progress-bar,
.reporting-bar-row progress::-webkit-progress-bar,
.reporting-rate progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--bg3);
}

.reporting-kpi progress::-webkit-progress-value,
.reporting-bar-row progress::-webkit-progress-value,
.reporting-rate progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.reporting-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.reporting-chart-card {
  min-height: 300px;
}

.reporting-bar-list {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.reporting-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.reporting-bar-label strong {
  color: var(--text);
}

.reporting-chart-note,
.reporting-heading-note,
.reporting-filter-guidance {
  color: var(--text-muted);
  line-height: 1.55;
}

.reporting-chart-note {
  margin: 14px 0 0;
}

.reporting-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.reporting-section-heading .crm-card-kicker,
.reporting-section-heading .crm-card-title {
  margin-bottom: 0;
}

.reporting-merchant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.reporting-merchant-item {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border-c);
  border-radius: 6px;
  background: var(--panel-2);
}

.reporting-merchant-item span {
  color: var(--text-muted);
  font-size: 12px;
}

.reporting-inline-empty,
.reporting-empty-copy {
  color: var(--text-muted);
}

.reporting-inline-empty {
  display: grid;
  gap: 6px;
  min-height: 110px;
  place-content: center;
  text-align: center;
}

.reporting-inline-empty strong {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.reporting-quality-pills,
.reporting-delivery-list,
.reporting-delivery-list > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reporting-delivery-list {
  display: grid;
}

.reporting-rate {
  display: grid;
  min-width: 110px;
  gap: 5px;
}

.reporting-leads-table time {
  white-space: nowrap;
}

.acquisition-correlation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.acquisition-no-activity {
  min-height: 0;
}

.acquisition-no-activity p {
  margin-top: 10px;
  color: var(--text-muted);
}

.acquisition-diagnostics {
  min-height: 0;
}

.acquisition-diagnostics > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  list-style-position: outside;
}

.acquisition-diagnostics > summary .crm-card-kicker,
.acquisition-diagnostics > summary .crm-card-title {
  display: block;
  margin-bottom: 0;
}

.acquisition-diagnostics-body {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-c);
}

.acquisition-diagnostics-body > p {
  margin-top: 0;
}

.acquisition-correlation-item {
  display: grid;
  gap: 5px;
  min-height: 126px;
  padding: 15px;
  border: 1px solid var(--border-c);
  border-radius: 6px;
  background: var(--panel-2);
}

.acquisition-correlation-item > span,
.acquisition-correlation-item > small {
  color: var(--text-muted);
}

.acquisition-correlation-item > strong {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  line-height: 1;
}

.reporting-acquisition-table th:first-child,
.reporting-acquisition-table td:first-child {
  min-width: 220px;
}

.lead-filter-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.lead-filter-actions > .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 4px;
  font: inherit;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.crm-row-link {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.crm-row-link:hover {
  color: var(--accent-light);
}

.lead-back-link {
  margin-bottom: 14px;
}

.detail-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.crm-warning-panel {
  min-height: 96px;
  padding: 18px 20px;
  border: 1px solid rgba(216, 181, 92, 0.38);
  border-left: 3px solid var(--warning);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
}

.crm-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
}

.crm-json-block {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-c);
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.audit-details-row td {
  padding-top: 0;
  background: rgba(201, 168, 76, 0.03);
}

.audit-details-list .crm-definition-row {
  grid-template-columns: 150px 1fr;
}

.crm-mini-breakdown {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
}

.crm-mini-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-c);
}

.crm-mini-breakdown dt {
  color: var(--text-muted);
  font-weight: 600;
}

.crm-mini-breakdown dd {
  margin: 0;
  color: var(--accent-light);
  font-weight: 700;
}

/* Leads statistics only; retain the shared card, badge and theme conventions. */
.lead-statistics .crm-card {
  min-width: 0;
}

.lead-statistics .crm-card-kicker {
  margin-bottom: 12px;
}

.lead-statistics .lead-statistics-total {
  margin: 16px 0 10px;
  color: var(--accent-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 3vw, 3.5rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.lead-statistics .crm-stat-label {
  margin-bottom: 0;
}

.lead-statistics .crm-mini-breakdown {
  gap: 0;
}

.lead-statistics .crm-mini-breakdown > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  padding: 10px 0;
}

.lead-statistics .crm-mini-breakdown dt {
  min-width: 0;
  margin: 0;
}

.lead-statistics .lead-state-badge {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  text-align: left;
}

.lead-statistics .crm-mini-breakdown dd {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Leads light mode only: warm surfaces with readable semantic colours. */
body.theme-light .leads-page {
  --text: #292218;
  --text-muted: #665842;
  --accent: #876020;
  --accent-light: #73501a;
  --success: #315f28;
  --warning: #785414;
  --danger: #933c30;
  --card-bg: #fffdf7;
  --card-border: #987b50;
  --border-c: #987b50;
  --control-bg: #ffffff;
  --lead-badge-text: #674916;
  --lead-badge-bg: #f5ead1;
  --lead-badge-border: #98743a;
}

body.theme-light .leads-page .crm-card {
  box-shadow: 0 2px 8px rgba(77, 56, 20, 0.07);
}

body.theme-light .leads-page .crm-card-kicker,
body.theme-light .leads-page .form-label {
  color: #51412a;
}

body.theme-light .leads-page .crm-badge {
  color: var(--lead-badge-text);
  border-color: var(--lead-badge-border);
  background: var(--lead-badge-bg);
}

body.theme-light .leads-page .crm-badge--success {
  --lead-badge-text: #315f28;
  --lead-badge-bg: #e5efda;
  --lead-badge-border: #648254;
}

body.theme-light .leads-page .crm-badge--warning {
  --lead-badge-text: #785414;
  --lead-badge-bg: #fff0cd;
  --lead-badge-border: #a17930;
}

body.theme-light .leads-page .crm-badge--danger {
  --lead-badge-text: #933c30;
  --lead-badge-bg: #fae4dd;
  --lead-badge-border: #b46959;
}

body.theme-light .leads-page .crm-badge--neutral {
  --lead-badge-text: #5d554a;
  --lead-badge-bg: #eee9e1;
  --lead-badge-border: #8b7e70;
}

body.theme-light .leads-page .lead-list-score--premium {
  --lead-badge-text: #75500b;
  --lead-badge-bg: #fff0c2;
  --lead-badge-border: #94701b;
}

body.theme-light .leads-page .lead-list-score--quality {
  --lead-badge-text: #145b50;
  --lead-badge-bg: #dff1e9;
  --lead-badge-border: #3c806e;
}

body.theme-light .leads-page .lead-list-score--standard {
  --lead-badge-text: #64408c;
  --lead-badge-bg: #eee5f8;
  --lead-badge-border: #8865a7;
}

body.theme-light .leads-page .lead-list-source--lp {
  --lead-badge-text: #8a471b;
  --lead-badge-bg: #ffead5;
  --lead-badge-border: #b07543;
}

body.theme-light .leads-page .lead-list-source--meta {
  --lead-badge-text: #245797;
  --lead-badge-bg: #e3edfd;
  --lead-badge-border: #6486b2;
}

body.theme-light .leads-page .crm-table th {
  color: #51412a;
  background: #eee3cc;
}

body.theme-light .leads-page .lead-overview-table td {
  border-bottom-color: var(--border-c);
}

body.theme-light .leads-page .lead-overview-table tbody tr:hover {
  background: #f4ecd9;
}

body.theme-light .leads-page .crm-row-link {
  color: var(--accent-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.theme-light .leads-page .crm-row-link:hover {
  color: #51370e;
}

body.theme-light .leads-page .form-control {
  border-color: #816c4b;
}

body.theme-light .leads-page .form-control::placeholder {
  color: #756853;
  opacity: 1;
}

body.theme-light .leads-page .btn-secondary {
  color: #624416;
  border-color: #816c4b;
  background: #f5ead7;
}

body.theme-light .leads-page .btn-secondary:hover {
  color: #624416;
  background: #e8d8b7;
}

body.theme-light .leads-page .form-control:focus,
body.theme-light .leads-page .btn-secondary:focus-visible,
body.theme-light .leads-page .crm-row-link:focus-visible {
  outline: 2px solid #7a5217;
  outline-offset: 3px;
  box-shadow: none;
}

body.theme-light .leads-page .form-control:disabled,
body.theme-light .leads-page .btn-secondary:disabled,
body.theme-light .leads-page .btn-secondary.disabled,
body.theme-light .leads-page .btn-secondary[aria-disabled="true"] {
  color: #63594c;
  border-color: #887b68;
  background: #e6dfd2;
  opacity: 1;
}

body.theme-light .leads-page .form-control:disabled::placeholder {
  color: #63594c;
}

.form-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.form-control {
  min-height: 42px;
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 4px;
  background: var(--control-bg);
  color: var(--text);
}

.form-control:focus {
  border-color: var(--accent);
  background: var(--control-bg);
  color: var(--text);
  box-shadow: 0 0 0 0.15rem rgba(201, 168, 76, 0.16);
}

.form-text,
.text-danger,
.field-validation-error {
  color: var(--text-muted) !important;
}

.btn {
  min-height: 40px;
  border-radius: 4px;
  font-weight: 700;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--button-text-on-accent);
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--accent-light);
  background: var(--accent-light);
  color: var(--button-text-on-accent);
}

.btn-secondary {
  border-color: rgba(201, 168, 76, 0.32);
  background: transparent;
  color: var(--accent-light);
}

.btn-secondary:hover,
.btn-secondary:focus {
  border-color: var(--accent);
  background: rgba(201, 168, 76, 0.08);
  color: var(--text);
}

.btn-danger {
  border-color: rgba(229, 138, 127, 0.7);
  background: rgba(229, 138, 127, 0.16);
  color: var(--danger);
}

.btn-danger:hover,
.btn-danger:focus {
  border-color: var(--danger);
  background: rgba(229, 138, 127, 0.24);
  color: var(--text);
}

.alert {
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.28);
  background: var(--card-bg);
  color: var(--text);
}

.alert-info {
  color: var(--accent-light);
}

.alert-danger {
  border-color: rgba(229, 138, 127, 0.45);
  color: var(--danger);
}

.crm-auth-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid rgba(201, 168, 76, 0.28);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--card-bg);
}

.crm-auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.crm-auth-brand .crm-brand-mark {
  width: 40px;
  height: 40px;
}

.crm-auth-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.crm-auth-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.crm-auth-card form {
  padding: 0;
}

.crm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.user-merchant-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.user-merchant-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

.user-merchant-option input {
  margin-top: 4px;
}

.user-merchant-option strong,
.user-merchant-option small {
  display: block;
}

.user-merchant-option small {
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .crm-wrap {
    display: block;
  }

  .crm-sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

  .main-wrap {
    width: 100%;
    margin-left: 0;
  }

  .page-content {
    padding: 20px;
  }

  .crm-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-span-4,
  .dashboard-span-3,
  .dashboard-span-6,
  .dashboard-span-12 {
    grid-column: 1;
  }

  .lead-filters {
    grid-template-columns: 1fr;
  }

  .verification-review-filters,
  .verification-channel-grid {
    grid-template-columns: 1fr;
  }

  .reporting-filters,
  .reporting-lead-filters,
  .reporting-acquisition-filters,
  .reporting-acquisition-advanced-grid,
  .reporting-kpi-grid,
  .reporting-chart-grid,
  .acquisition-correlation-grid {
    grid-template-columns: 1fr;
  }

  .reporting-synthetic-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .reporting-progression-heading > .crm-stat-label {
    max-width: none;
    text-align: left;
  }

  .acquisition-diagnostics > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .merchant-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .merchant-summary-item:nth-child(2) {
    border-right: 0;
  }

  .merchant-summary-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border-c);
  }

  .merchant-card-grid {
    grid-template-columns: 1fr;
  }

  .crm-definition-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .merchant-summary-strip {
    grid-template-columns: 1fr;
  }

  .merchant-summary-item,
  .merchant-summary-item:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--border-c);
  }

  .merchant-summary-item:last-child {
    border-bottom: 0;
  }

  .merchant-workspace-card__footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* Marketing Administration */
.marketing-admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.marketing-admin-outcomes {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.5rem;
}

.marketing-admin-outcomes label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

@media (max-width: 760px) {
    .marketing-admin-form-grid { grid-template-columns: 1fr; }
}

.merchant-feedback-label {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.merchant-feedback-label--warning { color: var(--warning); }

body.theme-light .merchant-feedback-card {
  --success: #315f28;
  --warning: #785414;
  --danger: #933c30;
}

body.theme-light .merchant-performance-table .merchant-feedback-label--warning { color: #785414; }

.merchant-feedback-card { min-height: auto; }
.merchant-feedback-card .crm-card-header { margin-bottom: 12px; }

.merchant-feedback-delivery + .merchant-feedback-delivery {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-c);
}

.merchant-feedback-delivery summary { cursor: pointer; }

.merchant-performance-table { min-width: 680px; }

.merchant-milestone progress {
  accent-color: var(--metric-accent);
}

.merchant-milestone progress::-webkit-progress-value {
  background: var(--metric-accent);
}

.merchant-milestone progress::-moz-progress-bar {
  background: var(--metric-accent);
}

@media (min-width: 861px) {
  .merchant-performance-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  }
}

.merchant-feedback-secondary {
  margin-top: 3px;
}

.merchant-feedback-badge {
  min-height: 17px;
  padding: 1px 6px;
  font-size: 10px;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.leads-page .merchant-feedback-badge.crm-badge--info {
  color: #a9d2ff;
  border-color: #526f96;
  background: #1b304b;
}

body.theme-light .leads-page .merchant-feedback-badge.crm-badge--info {
  color: #174f83;
  border-color: #587da2;
  background: #e7eff8;
}

.leads-page .merchant-feedback-badge.crm-badge--muted-warning {
  color: var(--warning);
  border-color: var(--card-border);
  background: var(--bg2);
}

.merchant-performance-selector {
  min-width: 0;
}

.merchant-performance-selector .merchant-performance-search {
  margin-bottom: 8px;
}

.merchant-performance-selector .form-control,
.merchant-performance-selector option {
  background-color: var(--control-bg);
  color: var(--text);
}

.merchant-performance-selector .form-control::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.merchant-performance-selector .form-control:hover,
.merchant-performance-selector .form-control:focus {
  border-color: var(--accent);
}

.merchant-performance-selector .form-control:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.merchant-performance-selector option:hover,
.merchant-performance-selector option:checked {
  background-color: var(--bg2);
  background-color: color-mix(in srgb, var(--accent) 20%, var(--control-bg));
  color: var(--text);
}

.merchant-performance-selector .form-select {
  --bs-form-select-bg-img: none;
  appearance: auto;
  color-scheme: inherit;
  padding-right: 12px;
}

.merchant-performance-no-results {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.merchant-performance-grid,
.merchant-milestone {
  --metric-accent: light-dark(#967323, #d5b66a);
  --metric-bg: light-dark(#fcf7e9, #1b1a15);
}

.merchant-performance-grid .merchant-metric-contact,
.merchant-milestone.merchant-metric-contact {
  --metric-accent: light-dark(#356a9c, #8ab8e6);
  --metric-bg: light-dark(#edf4fc, #131e2d);
}

.merchant-performance-grid .merchant-metric-duplicates,
.merchant-milestone.merchant-metric-duplicates {
  --metric-accent: light-dark(#b04e59, #f0a0a4);
  --metric-bg: light-dark(#fcecef, #2b191f);
}

.merchant-performance-grid .merchant-metric-appointments,
.merchant-milestone.merchant-metric-appointments {
  --metric-accent: light-dark(#7955b0, #c6b0f3);
  --metric-bg: light-dark(#f1ebfc, #211a32);
}

.merchant-performance-grid .merchant-metric-quotations,
.merchant-milestone.merchant-metric-quotations {
  --metric-accent: light-dark(#287e76, #85ccc4);
  --metric-bg: light-dark(#e8f5f2, #142625);
}

.merchant-performance-grid .merchant-metric-sales,
.merchant-milestone.merchant-metric-sales {
  --metric-accent: light-dark(#32794d, #8bd4ab);
  --metric-bg: light-dark(#eaf5ed, #14251e);
}

.merchant-performance-grid {
  --grid-gap: 0.625rem;
  /* Reserve empty tracks so a short row keeps the same card width as a full row. */
  --six-column-width: calc((100% - 5 * var(--grid-gap)) / 6);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(14rem, var(--six-column-width))), 1fr));
  gap: var(--grid-gap);
}

.merchant-performance-grid .reporting-kpi {
  min-height: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid light-dark(#d2d2cf, #404044);
  border-top: 3px solid var(--metric-accent);
  background: var(--metric-bg);
  overflow: visible;
  overflow-wrap: anywhere;
}

.merchant-performance-grid .crm-card-kicker {
  margin: 0;
  letter-spacing: 0.12em;
}

.merchant-performance-grid .reporting-kpi-value {
  margin: 0.2rem 0;
  font-size: clamp(1.75rem, 2.4vw, 2.25rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.merchant-performance-history p {
  margin: 0.35rem 0;
}
