:root {
  --adc-bg: #f6f8fb;
  --adc-card: #ffffff;
  --adc-border: rgba(15, 23, 42, 0.08);
  --adc-text: #0f172a;
  --adc-muted: rgba(15, 23, 42, 0.62);
  --adc-muted-2: rgba(15, 23, 42, 0.48);

  --adc-primary: #4f46e5; /* indigo */
  --adc-accent: #06b6d4; /* cyan */
  --adc-nav: #0b1220;

  --adc-radius: 14px;
  --adc-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);

  --sidebar-w: 220px;
  --sidebar-collapsed-w: 52px;
  --navbar-h: 56px;
}

html,
body {
  height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--adc-bg);
  color: var(--adc-text);
}

.adc-navbar {
  background: radial-gradient(1200px 500px at 0% 0%, rgba(79, 70, 229, 0.35), transparent 60%),
    radial-gradient(900px 450px at 100% 0%, rgba(6, 182, 212, 0.28), transparent 60%),
    var(--adc-nav);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.adc-logo {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  font-size: 18px;
}

.adc-badge {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.adc-pill {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.55);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.adc-pill--interactive {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.adc-pill--interactive:hover {
  background: rgba(30, 41, 59, 0.80);
  border-color: rgba(255, 255, 255, 0.38);
}

.adc-card {
  border: 1px solid var(--adc-border);
  border-radius: var(--adc-radius);
  box-shadow: var(--adc-shadow);
}

.adc-card .card-body {
  padding: 18px;
}

.adc-section {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.75);
}

.adc-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--adc-muted);
}

.adc-label {
  font-size: 12px;
  color: var(--adc-muted);
  font-weight: 600;
}

.adc-help {
  font-size: 12px;
  color: var(--adc-muted-2);
}

.adc-hr {
  border-top: 1px solid var(--adc-border);
  opacity: 1;
}

.adc-btn {
  background: linear-gradient(135deg, var(--adc-primary), #3b82f6);
  border: 0;
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.18);
}

.adc-btn:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

.adc-btn-soft {
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.18);
  color: #3730a3;
  font-weight: 700;
  border-radius: 12px;
}

.adc-btn-soft:hover {
  background: rgba(79, 70, 229, 0.12);
}

.adc-btn-soft.active {
  background: rgba(79, 70, 229, 0.18);
  border-color: rgba(79, 70, 229, 0.45);
  color: var(--adc-primary);
}

.adc-seg {
  border: 1px solid var(--adc-border);
  color: rgba(15, 23, 42, 0.75);
  background: #fff;
  font-weight: 700;
}

.btn-check:checked + .adc-seg {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.25);
  color: #312e81;
}

.adc-kpi {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), #fff);
  border: 1px solid var(--adc-border);
  border-radius: var(--adc-radius);
  padding: 14px 14px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.adc-kpi-label {
  font-size: 12px;
  color: var(--adc-muted);
  font-weight: 700;
}

.adc-kpi-value {
  margin-top: 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.adc-kpi-compact .adc-kpi-value {
  font-size: 20px;
}

.adc-kpi-delta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--adc-muted);
  font-variant-numeric: tabular-nums;
}

.adc-cell {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.adc-cell-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.adc-cell-delta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--adc-muted-2);
  font-variant-numeric: tabular-nums;
}

.adc-state {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--adc-muted);
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--adc-border);
  padding: 10px 12px;
  border-radius: 12px;
}

.adc-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--adc-primary), var(--adc-accent));
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.adc-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--adc-muted);
  font-weight: 600;
  font-size: 13px;
}

/* Full-screen job overlay (Rerun Segments) */
.adc-job-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080; /* above Bootstrap modal layers */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 18, 32, 0.62);
  backdrop-filter: blur(3px);
}
.adc-job-overlay[hidden] {
  display: none;
}
.adc-job-overlay__panel {
  background: var(--adc-card);
  border: 1px solid var(--adc-border);
  border-radius: var(--adc-radius);
  box-shadow: var(--adc-shadow);
  padding: 40px 48px;
  max-width: 440px;
  text-align: center;
}
.adc-job-overlay__spinner {
  width: 3.5rem;
  height: 3.5rem;
  border-width: 0.3rem;
  color: var(--adc-primary);
  margin-bottom: 20px;
}
.adc-job-overlay__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--adc-text);
  margin-bottom: 8px;
}
.adc-job-overlay__sub {
  font-size: 0.9rem;
  color: var(--adc-muted);
  line-height: 1.45;
  margin-bottom: 16px;
}
.adc-job-overlay__timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--adc-primary);
}

/* TomSelect tweaks */
.ts-control {
  border-radius: 12px !important;
  border-color: var(--adc-border) !important;
  padding: 8px 2.5rem 8px 10px !important;
}

.ts-dropdown {
  border-radius: 12px !important;
  border-color: var(--adc-border) !important;
  box-shadow: var(--adc-shadow) !important;
}

/* Dashboard customer picker: the underlying <select> carries `form-select`,
   which TomSelect copies onto its wrapper. That makes the bootstrap5 theme
   suppress its own caret while Bootstrap paints one on the wrapper, colliding
   with the selected name. Suppress the wrapper caret, draw a single caret on
   the control, reserve room, and ellipsize long names. */
.ts-wrapper.wo-customer-select.form-select {
  background-image: none !important;
}
.ts-wrapper.wo-customer-select .ts-control {
  padding-right: 2.75rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.9rem center !important;
  background-size: 16px 12px !important;
}
.ts-wrapper.wo-customer-select.single .ts-control > .item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Anomalies page */
.adc-sticky-filters {
  position: sticky;
  top: 10px;
  z-index: 5;
}

.adc-details {
  border: 1px solid var(--adc-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.adc-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
}

.adc-details > summary::-webkit-details-marker {
  display: none;
}

.adc-details-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.adc-details-day {
  margin-bottom: 12px;
}

.adc-details-day[open] > summary {
  border-bottom: 1px solid var(--adc-border);
}

.adc-details-sev {
  margin: 0 12px;
}

.adc-details-metric {
  margin: 0 12px;
}

.adc-details-sev[open] > summary,
.adc-details-metric[open] > summary {
  border-bottom: 1px solid var(--adc-border);
}

.adc-table thead th {
  font-size: 12px;
  color: var(--adc-muted);
  font-weight: 800;
  border-bottom: 1px solid var(--adc-border) !important;
}

.adc-table tbody td {
  font-size: 13px;
  border-top: 1px solid rgba(15, 23, 42, 0.06) !important;
}

/* Heatmap + expandable day table */
.adc-heat-table tbody tr.adc-click-row {
  cursor: pointer;
}

.adc-heat-table tbody tr.adc-click-row:hover td {
  filter: brightness(0.99);
}

.adc-heat-table tbody tr.adc-click-row.is-open td {
  box-shadow: inset 0 0 0 9999px rgba(79, 70, 229, 0.04);
}

.adc-heat {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  border-radius: 8px;
}

.adc-expand-inner {
  border: 1px solid var(--adc-border);
  border-radius: 12px;
  padding: 12px 12px;
  background: rgba(255, 255, 255, 0.75);
}

.adc-mini-card {
  border: 1px solid var(--adc-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.03);
}

/* ═══════════════════════════════════════════════════════════════
   Report Intro (collapsible)
   ═══════════════════════════════════════════════════════════════ */

.adc-report-intro {
  border: 1px solid rgba(79, 70, 229, 0.12);
  border-radius: var(--adc-radius);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.03), rgba(6, 182, 212, 0.03));
  margin-bottom: 16px;
  overflow: hidden;
}

.adc-report-intro summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--adc-primary);
  user-select: none;
  transition: background 0.15s;
}

.adc-report-intro summary:hover {
  background: rgba(79, 70, 229, 0.04);
}

.adc-report-intro summary::-webkit-details-marker {
  display: none;
}

.adc-report-intro summary::before {
  content: "▸";
  display: inline-block;
  font-size: 11px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.adc-report-intro[open] summary::before {
  transform: rotate(90deg);
}

.adc-report-intro-body {
  padding: 0 16px 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--adc-muted);
}

/* ═══════════════════════════════════════════════════════════════
   Search Term Intelligence Report
   ═══════════════════════════════════════════════════════════════ */

.st-ngram-scroll {
  max-height: 480px;
  overflow-y: auto;
}

.st-waste-scroll {
  max-height: 360px;
  overflow-y: auto;
}

.st-ngram-link {
  color: var(--adc-primary);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.st-ngram-link:hover {
  color: #3730a3;
  text-decoration: underline solid;
}

.st-term-cell {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  word-break: break-all;
}

.st-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.st-sortable:hover {
  color: var(--adc-primary);
}

.st-delta-up {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

.st-delta-down {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

.st-delta-flat {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--adc-muted-2);
  background: rgba(15, 23, 42, 0.04);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Make n-gram tables compact in full mode */
#ngramSection .adc-table th,
#ngramSection .adc-table td {
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

#tableRaw th,
#tableRaw td {
  padding: 6px 8px;
  font-size: 12px;
}

/* Waste section KPI cards small adjustment */
#wasteSection .adc-kpi-compact {
  padding: 10px 14px;
}

#wasteSection .adc-kpi-value {
  font-size: 18px;
}

/* Search-term coverage strip: inline label + value on one line */
#coverageRow .adc-kpi {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
}

#coverageRow .adc-kpi-value {
  margin-top: 0;
  font-size: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   Portfolio Health Dashboard
   ═══════════════════════════════════════════════════════════════ */

.ph-sticky-controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--adc-bg);
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--adc-border);
  margin: -16px -0px 16px;
  padding-left: 4px;
  padding-right: 4px;
}

/* Summary bar KPI cards */
.ph-summary-bar {
  background: linear-gradient(135deg, rgba(79,70,229,0.04), rgba(6,182,212,0.04));
  border: 1px solid var(--adc-border);
  border-radius: var(--adc-radius);
  padding: 16px;
}

.ph-kpi-card {
  background: #fff;
  border: 1px solid var(--adc-border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(15,23,42,0.04);
}

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

.ph-kpi-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.ph-kpi-delta {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.ph-kpi-baseline {
  font-weight: 500;
  opacity: 0.7;
}

/* Delta coloring */
.ph-delta-good { color: #16a34a; }
.ph-delta-bad  { color: #dc2626; }
.ph-delta-flat { color: var(--adc-muted-2); }

/* Health table */
.ph-health-table-card {
  border-radius: var(--adc-radius);
}

.ph-table thead th {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--adc-muted);
}

.ph-table tbody td {
  font-size: 13px;
  vertical-align: middle;
}

.ph-table-row:hover {
  background: rgba(79,70,229,0.03) !important;
}

.ph-health-score {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.ph-status-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.ph-why-btn {
  font-size: 11px;
  font-weight: 700;
  color: var(--adc-primary);
  text-decoration: underline dotted;
}

/* Client Health Cards */
.ph-client-card {
  background: #fff;
  border: 1px solid var(--adc-border);
  border-radius: var(--adc-radius);
  box-shadow: 0 8px 24px rgba(15,23,42,0.05);
  overflow: hidden;
  transition: box-shadow 0.3s, border-color 0.3s;
}

.ph-client-card:hover {
  box-shadow: 0 12px 32px rgba(15,23,42,0.08);
}

.ph-card-highlight {
  border-color: var(--adc-primary) !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15), 0 12px 32px rgba(15,23,42,0.08) !important;
  animation: ph-pulse 0.6s ease;
}

@keyframes ph-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.003); }
  100% { transform: scale(1); }
}

.ph-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--adc-border);
  background: rgba(15,23,42,0.015);
}

.ph-card-issue {
  color: var(--adc-muted);
}

.ph-card-section {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(15,23,42,0.04);
}

.ph-card-section:last-child {
  border-bottom: none;
}

.ph-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--adc-muted-2);
  margin-bottom: 6px;
}

.ph-metric-cell {
  text-align: center;
}

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

.ph-metric-value {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.ph-metric-delta {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.ph-metric-baseline {
  font-weight: 500;
  opacity: 0.65;
}

.ph-trend-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--adc-muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.ph-trend-canvas {
  width: 100% !important;
  height: 50px !important;
}

/* Triage buckets */
.ph-bucket-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.ph-bucket-attention { color: #991b1b; }
.ph-bucket-watch     { color: #92400e; }
.ph-bucket-healthy   { color: #166534; }

.ph-bucket-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ph-bucket-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--adc-muted);
  background: rgba(15,23,42,0.05);
  border-radius: 999px;
  padding: 1px 9px;
}

.ph-watch-row, .ph-quiet-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--adc-border);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 6px;
  font-size: 13px;
}

.ph-quiet-row { padding: 5px 14px; color: var(--adc-muted); }

.ph-reason {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12.5px;
  line-height: 1.45;
  padding: 3px 0;
}

.ph-reason-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

.ph-seg-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 4px;
  border-top: 1px solid rgba(15,23,42,0.05);
  font-size: 12.5px;
}

.ph-seg-row:first-child { border-top: none; }

/* ═══════════════════════════════════════════════════════════════
   Weekly Overview Table
   ═══════════════════════════════════════════════════════════════ */

.wo-table thead th {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--adc-muted);
  border-bottom: 2px solid var(--adc-border) !important;
  padding: 10px 14px;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.015);
}

.wo-table tbody td {
  font-size: 13px;
  padding: 9px 14px;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  border-top: 1px solid rgba(15, 23, 42, 0.05) !important;
}

.wo-table tbody tr:hover td {
  background: rgba(79, 70, 229, 0.025);
}

.wo-date-cell {
  white-space: nowrap;
  color: var(--adc-text);
  font-weight: 600;
}

.wo-sep-row td {
  padding: 2px 0 !important;
  border: none !important;
}

/* Collapsed "Start of Week" rows + See more/less toggle */
.wo-hidden-week {
  display: none;
}

.wo-seemore-row td {
  padding: 4px 0 !important;
  border: none !important;
}

.wo-seemore-btn {
  border: none;
  background: none;
  color: var(--adc-primary, #4f46e5);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.wo-seemore-btn:hover {
  background: rgba(79, 70, 229, 0.08);
}

.wo-divider-row td {
  padding: 0 !important;
  border-top: 2px solid var(--adc-border) !important;
}

.wo-summary-row td {
  background: rgba(79, 70, 229, 0.04) !important;
  border-top: none !important;
  font-weight: 700;
}

.wo-change-row td {
  background: rgba(79, 70, 229, 0.02) !important;
  border-top: 1px solid rgba(79, 70, 229, 0.08) !important;
}

/* Partial-period rows – current week/month/quarter that hasn't fully closed yet.
   Instead of greying the row out (which made it easy to miss), we give it a
   soft amber background + left border and stack an explicit "In progress" badge
   underneath the date so readers immediately see it's a partial period. */
.wo-partial-week td {
  /* Stronger amber tint + diagonal stripe so a partial period is
     unmistakable at a glance and also legible in grayscale / print. */
  background:
    repeating-linear-gradient(
      135deg,
      rgba(245, 158, 11, 0.14) 0 10px,
      rgba(245, 158, 11, 0.22) 10px 20px
    ) !important;
  font-style: normal;
  opacity: 1;
}

.wo-partial-week td:first-child {
  border-left: 5px solid #f59e0b !important;
}

/* Numeric cells on a partial row are not directly comparable to completed
   periods, so render them in italics as a visual cue. */
.wo-partial-week td.text-end {
  font-style: italic;
  color: #78350f;
}

.wo-date-main {
  font-weight: 600;
  line-height: 1.2;
}

.wo-partial-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: #7c2d12;
  background: rgba(245, 158, 11, 0.28);
  border: 1.5px solid #f59e0b;
  border-radius: 999px;
  white-space: normal;    /* allow wrapping onto multiple lines */
  max-width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Subtle "*partial data*" note used for older (>6 weeks) partial periods.
   These rows aren't the live/current period, so the loud amber treatment
   is overkill — just a small italic hint is enough for the reader to know
   the totals aren't directly comparable. */
.wo-partial-note {
  margin-top: 2px;
  font-size: 11px;
  font-style: italic;
  font-weight: 400;
  color: #94a3b8;
  line-height: 1.2;
}

/* Older partial rows get a much quieter treatment than the current
   live period: no amber stripes, no italicized numbers, no colored
   border. The small "*partial data*" note is the only visual cue. */
.wo-partial-week.wo-partial-week-subtle td {
  background: transparent !important;
  color: inherit !important;
}
.wo-partial-week.wo-partial-week-subtle td:first-child {
  border-left: 0 !important;
}
.wo-partial-week.wo-partial-week-subtle td.text-end {
  font-style: normal;
  color: inherit;
}

/* Small help icon next to the first column header that explains the
   partial-period treatment. */
.wo-help-icon {
  display: inline-block;
  margin-left: 6px;
  color: #f59e0b;
  cursor: help;
  font-size: 13px;
  vertical-align: -1px;
}


/* Delta badges */
.wo-delta-good {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
}

.wo-delta-bad {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
}

.wo-delta-flat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--adc-muted-2);
  background: rgba(15, 23, 42, 0.04);
  padding: 2px 8px;
  border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════ */

.adc-footer {
  margin-top: 40px;
  padding: 14px 24px;
  border-top: 1px solid var(--adc-border);
  background: #fff;
  font-size: 12px;
  color: var(--adc-muted);
}

.adc-footer-left {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.adc-footer-link {
  color: var(--adc-muted);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  font-weight: 600;
}

.adc-footer-link:hover {
  color: var(--adc-primary);
  text-decoration: underline solid;
}

.adc-footer-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--adc-muted);
}

.adc-btn-logout {
  font-size: 11px;
  font-weight: 700;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 8px;
  padding: 3px 10px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.adc-btn-logout:hover {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

/* Legal pages */
.adc-legal-hero {
  padding: 8px 0 20px;
}

.adc-legal-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--adc-primary);
  margin-bottom: 10px;
}

.adc-legal-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.adc-legal-lead {
  max-width: 820px;
  margin: 14px 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--adc-muted);
}

.adc-legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--adc-muted);
}

.adc-legal-card {
  overflow: hidden;
}

.adc-legal-card .card-body {
  padding: 28px;
}

.adc-legal-section + .adc-legal-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--adc-border);
}

.adc-legal-section h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.adc-legal-section p {
  margin: 0 0 10px;
  line-height: 1.75;
  color: rgba(15, 23, 42, 0.76);
}

.adc-legal-list {
  margin: 0;
  padding-left: 1.25rem;
  color: rgba(15, 23, 42, 0.76);
}

.adc-legal-list li + li {
  margin-top: 8px;
}

@media (max-width: 767.98px) {
  .adc-footer .d-flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .adc-legal-card .card-body {
    padding: 20px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Analysis dropdown — grouped with icons
   ═══════════════════════════════════════════════════════════════ */

.adc-analysis-menu {
  min-width: 240px;
  padding: 6px 0;
}

.adc-analysis-menu .dropdown-header {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--adc-muted-2);
  padding: 10px 14px 4px;
}

.adc-analysis-menu .dropdown-header:first-child {
  padding-top: 4px;
}

.adc-analysis-menu .dropdown-item {
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 0;
  color: var(--adc-text);
  transition: background 0.12s;
}

.adc-analysis-menu .dropdown-item i {
  font-size: 13px;
  opacity: 0.55;
  width: 18px;
  flex-shrink: 0;
  margin-right: 8px;
}

.adc-analysis-menu .dropdown-item:hover {
  background: rgba(79, 70, 229, 0.06);
  color: var(--adc-primary);
}

.adc-analysis-menu .dropdown-item:hover i {
  opacity: 1;
}

.adc-analysis-menu .dropdown-item.active,
.adc-analysis-menu .dropdown-item:active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--adc-primary);
  font-weight: 700;
}

.adc-analysis-menu .dropdown-item.active i {
  opacity: 1;
}

.adc-soon-item {
  opacity: 0.65;
}

.adc-soon-item:hover {
  opacity: 1 !important;
}

.adc-soon-badge {
  margin-left: auto;
  font-size: .62rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 5px;
  padding: 1px 5px;
  letter-spacing: .02em;
}

/* Admin nested submenus */
.dropdown-submenu {
  position: relative;
}

.adc-submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.adc-submenu-toggle::after {
  display: none;
}

.adc-submenu-arrow {
  font-size: 0.65rem;
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.dropdown-submenu.show .adc-submenu-arrow {
  opacity: 1;
}

.adc-submenu {
  top: 0;
  left: auto;
  right: 100%;
  margin-top: -4px;
  display: none;
  min-width: 200px;
}

.dropdown-submenu.show > .adc-submenu {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar layout
   ═══════════════════════════════════════════════════════════════ */

.adc-layout-body {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - var(--navbar-h));
}

.adc-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--navbar-h);
  max-height: calc(100vh - var(--navbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--adc-card);
  border-right: 1px solid var(--adc-border);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--adc-border) transparent;
}

.adc-sidebar.is-collapsed {
  width: var(--sidebar-collapsed-w);
}

.adc-main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Toggle button */
.adc-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--adc-border);
  cursor: pointer;
  color: var(--adc-muted-2);
  font-size: 11px;
  transition: color 0.15s;
}

.adc-sidebar-toggle:hover {
  color: var(--adc-primary);
}

.adc-sidebar-toggle i {
  transition: transform 0.2s ease;
}

.adc-sidebar.is-collapsed .adc-sidebar-toggle {
  justify-content: center;
}

.adc-sidebar.is-collapsed .adc-sidebar-toggle i {
  transform: rotate(180deg);
}

/* Sections */
.adc-sidebar-section {
  padding: 6px 0;
  border-bottom: 1px solid var(--adc-border);
}

.adc-sidebar-section:last-of-type {
  border-bottom: none;
}

.adc-sidebar-heading {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--adc-muted-2);
  padding: 6px 14px 2px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s, max-height 0.2s;
  max-height: 30px;
}

.adc-sidebar.is-collapsed .adc-sidebar-heading {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.adc-sidebar-subheading {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--adc-muted-2);
  opacity: 0.75;
  padding: 8px 14px 2px 22px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s, max-height 0.2s;
  max-height: 26px;
}

.adc-sidebar.is-collapsed .adc-sidebar-subheading {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Nav items */
.adc-sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--adc-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.12s, color 0.12s;
}

.adc-sidebar-item i {
  font-size: 14px;
  opacity: 0.5;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  transition: opacity 0.12s;
}

.adc-sidebar-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.adc-sidebar.is-collapsed .adc-sidebar-item {
  justify-content: center;
  padding: 9px 0;
}

.adc-sidebar.is-collapsed .adc-sidebar-item span {
  display: none;
}

.adc-sidebar-item:hover {
  background: rgba(79, 70, 229, 0.06);
  color: var(--adc-primary);
}

.adc-sidebar-item:hover i {
  opacity: 1;
}

.adc-sidebar-item.active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--adc-primary);
  font-weight: 700;
}

.adc-sidebar-item.active i {
  opacity: 1;
}

/* Admin items — indigo accent */
.adc-admin-item {
  border-left: 2px solid #6366f1;
  padding-left: 12px;
  color: rgba(15, 23, 42, 0.72);
  background: rgba(99, 102, 241, 0.035);
}

.adc-admin-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

.adc-admin-item.active {
  background: rgba(99, 102, 241, 0.14);
  color: #4f46e5;
}

.adc-sidebar.is-collapsed .adc-admin-item {
  border-left: none;
  border-top: 2px solid #6366f1;
  padding-left: 0;
}

/* Admin-only Workspace section */
.adc-admin-section {
  background: rgba(99, 102, 241, 0.02);
}

.adc-admin-section .adc-sidebar-heading {
  color: #6366f1;
}

/* Soon items in sidebar */
.adc-sidebar-item.adc-soon-item {
  opacity: 0.6;
}

/* Muted items in sidebar — pages not yet polished enough to promote */
.adc-sidebar-item.adc-muted-item {
  opacity: 0.45;
  color: var(--adc-text-muted, #9ca3af);
}

.adc-sidebar-item.adc-muted-item:hover {
  opacity: 0.8;
}

.adc-sidebar-item.adc-soon-item:hover {
  opacity: 1;
}

.adc-sidebar-item .adc-soon-badge {
  margin-left: 5px;
}

/* Review Changes CTA */
.adc-sidebar-cta {
  padding: 10px;
  margin-top: auto;
  border-top: 1px solid var(--adc-border);
}

.adc-sidebar-review {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  background: linear-gradient(135deg, var(--adc-primary), #6366f1);
  color: #fff !important;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.adc-sidebar-review:hover {
  opacity: 0.88;
}

.adc-sidebar.is-collapsed .adc-sidebar-review span {
  display: none;
}

.adc-sidebar.is-collapsed .adc-sidebar-cta {
  padding: 8px 6px;
}

/* Mobile: auto-collapse sidebar below lg */
@media (max-width: 991.98px) {
  .adc-sidebar {
    width: var(--sidebar-collapsed-w);
  }
}

/* ── Brain Loader Component ──────────────────────────────────────────────────
   Usage:  {% from '_brain_loader.html' import brain_loader %}
           {{ brain_loader() }}                    — default medium (52px)
           {{ brain_loader(size='sm') }}            — 36px
           {{ brain_loader(size='lg') }}            — 72px
           {{ brain_loader(size='xl') }}            — 96px
           {{ brain_loader(label='Fetching data') }} — custom aria-label
   ───────────────────────────────────────────────────────────────────────── */

.adc-loader {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}

.adc-loader-svg {
  display: block;
  animation: adc-brain-breathe 2s ease-in-out infinite;
  will-change: transform, filter;
}

/* sizes */
.adc-loader--sm .adc-loader-svg { width: 36px;  height: 36px; }
.adc-loader--md .adc-loader-svg { width: 52px;  height: 52px; }  /* default */
.adc-loader--lg .adc-loader-svg { width: 72px;  height: 72px; }
.adc-loader--xl .adc-loader-svg { width: 96px;  height: 96px; }

/* bars inside the brain */
.adc-loader-bar {
  transform-box:    fill-box;
  transform-origin: 50% 100%;  /* scale from bottom */
}
.adc-loader-bar--1 { animation: adc-bar 1.1s ease-in-out infinite 0s; }
.adc-loader-bar--2 { animation: adc-bar 1.1s ease-in-out infinite .2s; }
.adc-loader-bar--3 { animation: adc-bar 1.1s ease-in-out infinite .4s; }

/* optional text label */
.adc-loader-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--adc-muted);
  letter-spacing: .01em;
}

@keyframes adc-brain-breathe {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 4px rgba(79,110,247,.28));
  }
  50% {
    transform: scale(1.07);
    filter: drop-shadow(0 0 12px rgba(139,63,216,.55));
  }
}

@keyframes adc-bar {
  0%, 100% { transform: scaleY(1); }
  50%       { transform: scaleY(.18); }
}

/* overlay helper — wrap a relative container with this */
.adc-loader-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(246,248,251,.75);
  backdrop-filter: blur(3px);
  border-radius: inherit;
  z-index: 10;
}

/* ── Collapsible dashboard control panel ───────────────────── */
.adc-controls-toggle-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}
.adc-controls-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  background: none;
  border: 1px solid var(--adc-border);
  border-radius: 8px;
  color: var(--adc-muted-2);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.adc-controls-toggle:hover {
  color: var(--adc-primary);
  border-color: var(--adc-primary);
}
.adc-controls-hidden > .adc-controls-col {
  display: none !important;
}
.adc-controls-hidden > [class*="col-"]:not(.adc-controls-col) {
  flex: 0 0 100% !important;
  max-width: 100% !important;
}

/* ── Global filters (campaign include/exclude) ──────────────────────────── */
.adc-gf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.adc-gf-toggle.adc-gf-active {
  border-color: rgba(79, 110, 247, 0.9);
  background: rgba(79, 110, 247, 0.25);
}
.adc-gf-count {
  font-weight: 600;
  font-size: 11px;
}
.adc-gf-warn {
  font-size: 11px;
}
.adc-gf-panel {
  position: fixed;
  z-index: 1080;
  width: 320px;
  max-width: calc(100vw - 16px);
  background: #fff;
  color: var(--adc-text, #1e293b);
  border: 1px solid var(--adc-border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}
.adc-gf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--adc-border, #e2e8f0);
}
.adc-gf-title {
  font-weight: 600;
  font-size: 13px;
}
.adc-gf-x {
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}
.adc-gf-body {
  padding: 12px 14px;
}
.adc-gf-incap {
  background: #fff8e6;
  border: 1px solid #f6d488;
  color: #7a5b00;
  font-size: 12px;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.adc-gf-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 6px;
}
.adc-gf-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--adc-border, #e2e8f0);
  border-radius: 8px;
}
.adc-gf-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
}
.adc-gf-item:hover {
  background: #f1f5f9;
}
.adc-gf-empty {
  padding: 12px;
  font-size: 12px;
  color: #94a3b8;
}
.adc-gf-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--adc-border, #e2e8f0);
}
.adc-gf-summary {
  margin-right: auto;
  font-size: 12px;
  color: #64748b;
}

/* ── Notice banners (adcBanner) — snap below the top nav ─────────────────── */
#adcBannerHost {
  position: sticky;
  top: 0;
  z-index: 1030;
}
.adc-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 18px;
  font-size: 13px;
  line-height: 1.45;
  border-bottom: 1px solid transparent;
}
.adc-banner__icon {
  flex: 0 0 auto;
  font-size: 15px;
  margin-top: 1px;
}
.adc-banner__msg {
  flex: 1 1 auto;
}
.adc-banner__close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 2px;
}
.adc-banner__close:hover {
  opacity: 1;
}
.adc-banner--info {
  background: #e7f1ff;
  border-bottom-color: #9ec5fe;
  color: #084298;
}
.adc-banner--warning {
  background: #fff3cd;
  border-bottom-color: #ffe69c;
  color: #664d03;
}
.adc-banner--alert {
  background: #f8d7da;
  border-bottom-color: #f1aeb5;
  color: #842029;
}
