/* ═══════════════════════════════════════════════════════════════
   P&L Design System — Single source of truth
   Dark theme only. Avanza-inspired.
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap');

/* Design tokens — loaded first so components can reference them */
@import 'tokens.css';

/* Component library */
@import 'components/cards.css';
@import 'components/tables.css';
@import 'components/buttons.css';
@import 'components/badges.css';
@import 'components/inputs.css';
@import 'components/alerts.css';
@import 'components/navigation.css';
@import 'components/charts.css';
@import 'components/news.css';
@import 'components/bento.css';


/* ═══════════════════════════════════
   CSS VARIABLES
   ═══════════════════════════════════ */

:root {
  /* Bakgrunder */
  --bg-base:     #031D20;
  --bg-nav:      #072528;
  --bg-card:     #072528;
  --bg-raised:   #0C3034;
  --bg-negative: #30121D;
  --bg-overlay:  #031D20;

  /* Text */
  --text-primary:   #FFFFFF;
  --text-secondary: #AEAEAE;
  --text-muted:     #C0CBCE;
  --text-link:      #3BB3C2;

  /* Finansiella accentfarger */
  --positive:         #47B2FF;
  --positive-large:   #23A3FF;
  --positive-bg:      #043F69;
  --positive-text:    #F0F9FF;
  --negative:         #FFA6BF;
  --negative-large:   #FF618E;
  --negative-bg:      #440013;
  --negative-text:    #FFC5D5;
  --accent-green:     #00C281;
  --accent-teal:      #3BB3C2;

  /* Borders */
  --border:        #0C3034;
  --border-hover:  rgba(255,255,255,0.15);
  --border-strong: rgba(255, 255, 255, 0.20);

  /* Komponenter */
  --card-radius:   12px;
  --badge-radius:  4px;
  --pill-radius:   500px;
  --card-shadow:   rgba(0,0,0,0.6) 0px 1px 11px 0px;
  --card-padding:  20px 16px;

  /* Typografi */
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing — canonical definitions in tokens.css
     --space-xs through --space-2xl live there */

  /* Chart.js defaults */
  --chart-positive:   #00C281;
  --chart-negative:   #D0184D;
  --chart-grid:       #0C3034;
  --chart-reference:  #C28103;
  --chart-text:       #AEAEAE;
  --chart-tooltip-bg: #072528;

  /* ── Legacy variable aliases (used by existing templates) ── */
  --color-ink:           var(--text-primary);
  --color-ink-secondary: var(--text-secondary);
  --color-ink-tertiary:  var(--text-muted);
  --color-text-link:     var(--text-link);

  --color-background:           var(--bg-base);
  --color-background-secondary: var(--bg-raised);
  --color-background-grid:      transparent;
  --color-surface:              var(--bg-card);

  --color-bg-base:      var(--bg-base);
  --color-bg-nav:       var(--bg-nav);
  --color-bg-raised:    var(--bg-raised);
  --color-bg-ticker:    #07383E;
  --color-bg-negative:  var(--bg-negative);
  --color-bg-overlay:   var(--bg-overlay);

  --color-positive:    var(--positive);
  --color-positive-bg: var(--positive-bg);
  --color-negative:    var(--negative);
  --color-negative-bg: var(--negative-bg);
  --color-warning:     #C28103;
  --color-warning-bg:  rgba(194, 129, 3, 0.12);
  --color-neutral:     var(--text-muted);
  --color-signal:      var(--accent-green);
  --color-signal-light: rgba(0, 194, 129, 0.10);

  --color-border:           var(--border);
  --color-border-secondary: rgba(255, 255, 255, 0.06);
  --color-border-strong:    var(--border-strong);

  --font-primary: var(--font-sans);

  /* Legacy spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Legacy type scale */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 21px;
  --text-2xl: 27px;
  --text-3xl: 35px;
  --text-4xl: 45px;

  /* Font weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}


/* ═══════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════ */

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.2px;
  margin: 0;
}

h1, h2, h3 {
  color: var(--text-primary);
  font-weight: 500;
}

.subtitle {
  color: var(--text-secondary);
}

.mono { font-family: var(--font-mono); }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

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

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-raised); border-radius: 4px; }


/* ═══════════════════════════════════
   NAVIGATION BAR
   ═══════════════════════════════════ */

.main-nav {
  background: var(--bg-nav);
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-x: auto;
  overflow-y: hidden;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 12px 12px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  white-space: nowrap;
  font-weight: var(--weight-medium);
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.main-nav a:hover {
  color: #fff;
}

.main-nav a.active {
  color: #fff;
  border-bottom-color: var(--accent-green);
}

.main-nav .nav-settings {
  margin-left: auto;
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.7);
}

.main-nav .nav-settings svg {
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.main-nav .nav-settings:hover svg {
  opacity: 1;
}

/* Tenant switcher dropdown in navbar */
.tenant-switcher {
  margin-left: auto;
  flex-shrink: 0;
}

.tenant-select {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  outline: none;
}

.tenant-select:hover,
.tenant-select:focus {
  border-color: var(--accent-green);
  background: rgba(255,255,255,0.15);
}

.tenant-select option {
  background: var(--bg-nav);
  color: #fff;
}


/* ═══════════════════════════════════
   PAGE CONTENT WRAPPER
   ═══════════════════════════════════ */

.page-content {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-5);
}

.page-content.wide {
  max-width: 1400px;
}


/* ═══════════════════════════════════
   ICONS (Lucide)
   ═══════════════════════════════════ */

.icon, [data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  top: -0.05em;
}

.icon-sm, [data-lucide].icon-sm {
  width: 14px;
  height: 14px;
  top: -0.05em;
}

.icon-lg, [data-lucide].icon-lg {
  width: 20px;
  height: 20px;
  top: -0.05em;
}

button [data-lucide],
td [data-lucide],
th [data-lucide],
.badge [data-lucide],
.status-badge [data-lucide] {
  vertical-align: middle;
  top: -0.05em;
}

h1 [data-lucide], h2 [data-lucide],
h3 [data-lucide], strong [data-lucide] {
  vertical-align: middle;
  top: -0.08em;
}


/* ═══════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════ */

.delta .up { color: var(--positive); }
.delta .down { color: var(--negative-large); }

.trend-up, .up { color: var(--positive); }
.trend-down, .down { color: var(--negative); }
.trend-flat { color: var(--text-muted); }


/* ═══════════════════════════════════
   CARDS
   ═══════════════════════════════════ */

.ds-card,
.card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--card-radius);
  box-shadow: none;
  padding: var(--space-6);
  position: relative;
  z-index: 1;
}


/* ═══════════════════════════════════
   KPI CARDS (legacy class names)
   .kpi-card base → components/cards.css
   ═══════════════════════════════════ */

.kpi-label,
.kpi .label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}

.kpi-value,
.kpi .value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi .value.positive { color: var(--positive-large); }
.kpi .value.negative { color: var(--negative-large); }

.kpi-change {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin-top: var(--space-2);
}

.kpi-change.positive { color: var(--positive); }
.kpi-change.negative { color: var(--negative); }

.kpi-subtext {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.kpi-row {
  border-bottom-color: rgba(255, 255, 255, 0.04);
}


/* ═══════════════════════════════════
   BUTTONS
   ═══════════════════════════════════ */

.btn-primary,
.btn-secondary,
.btn-signal {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
  border: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: transparent;
  color: var(--accent-teal);
  border: 1px solid #006774;
  border-radius: var(--pill-radius);
}

.btn-primary:hover {
  background: rgba(59, 179, 194, 0.1);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--pill-radius);
}

.btn-secondary:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.btn-signal {
  background: var(--accent-green);
  color: var(--bg-base);
  border-radius: var(--pill-radius);
}

.btn-signal:hover {
  background: #00A86B;
}

/* Generic button element in dark mode
   .btn base class → components/buttons.css */
button {
  background: var(--accent-green);
  color: var(--bg-base);
}

button:hover {
  background: #00A86B;
}


/* ═══════════════════════════════════
   BADGES
   ═══════════════════════════════════ */

.badge-high,
.badge-medium,
.badge-low,
.badge-warning,
.badge-estimated {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--badge-radius);
  letter-spacing: 0.02em;
}

.badge-high {
  background: rgba(71, 178, 255, 0.15);
  color: var(--positive);
}

.badge-medium {
  background: rgba(59, 179, 194, 0.12);
  color: var(--accent-teal);
}

.badge-low {
  background: rgba(255, 97, 142, 0.15);
  color: var(--negative);
}

.badge-warning {
  background: rgba(194, 129, 3, 0.15);
  color: var(--color-warning);
}

.badge-estimated {
  background: rgba(107, 79, 187, 0.12);
  color: #9B8ADB;
}


/* ═══════════════════════════════════
   ALERTS / BANNERS
   ═══════════════════════════════════ */

.alert-critical,
.alert-warning,
.alert-info,
.alert-success {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.alert-critical svg,
.alert-warning svg,
.alert-info svg,
.alert-success svg,
.alert-critical > [data-lucide],
.alert-warning > [data-lucide],
.alert-info > [data-lucide],
.alert-success > [data-lucide] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  top: 0;
}

.alert-critical {
  background: var(--bg-negative);
  color: var(--negative);
  border: 1px solid rgba(255, 97, 142, 0.2);
}

.alert-warning {
  background: rgba(194, 129, 3, 0.10);
  color: var(--color-warning);
  border: 1px solid rgba(194, 129, 3, 0.2);
}

.alert-info {
  background: rgba(59, 179, 194, 0.08);
  color: var(--accent-teal);
  border: 1px solid rgba(59, 179, 194, 0.2);
}

.alert-success {
  background: rgba(0, 194, 129, 0.08);
  color: var(--accent-green);
  border: 1px solid rgba(0, 194, 129, 0.2);
}

.alert-critical strong,
.alert-warning strong,
.alert-info strong,
.alert-success strong {
  font-weight: var(--weight-semibold);
}

/* Alert box (CEO CM2 warning) */
.alert-box {
  background: rgba(194, 129, 3, 0.08);
}

.alert-box.critical {
  background: var(--bg-negative);
}


/* ═══════════════════════════════════
   DATA TABLES
   ═══════════════════════════════════ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  background: var(--bg-card);
}

.data-table thead th {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-raised);
  padding: var(--space-sm) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-medium);
}

.data-table thead th.num {
  text-align: right;
}

.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tbody td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: var(--weight-regular);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody td.positive {
  color: var(--positive);
}

.data-table tbody td.negative {
  color: var(--negative);
}

.data-table tbody td.estimated {
  color: var(--text-muted);
  font-style: italic;
}

/* Generic table styling */
table th {
  background: var(--bg-raised);
  color: var(--text-muted);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

table td {
  color: var(--text-primary);
  border-bottom-color: rgba(255, 255, 255, 0.04);
}

table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Products: hierarchy rows */
.L1:hover { background: rgba(255, 255, 255, 0.03); }
.L2 { background: #051E21; }
.L2:hover { background: rgba(255, 255, 255, 0.03); }
.L3 { background: var(--bg-raised); }


/* ═══════════════════════════════════
   SELECTS AND INPUTS
   ═══════════════════════════════════ */

select {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}

select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

input[type="text"],
input[type="number"],
input[type="file"],
textarea {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border-strong);
}


/* ═══════════════════════════════════
   RANGE INPUTS / SLIDERS
   ═══════════════════════════════════ */

.slider-wrapper {
  margin-bottom: var(--space-4);
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.slider-value {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background-color: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  background-image: linear-gradient(var(--accent-green), var(--accent-green));
  background-size: var(--fill-percent, 50%) 100%;
  background-repeat: no-repeat;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-green);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(0, 194, 129, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-green);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb:hover {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(0, 194, 129, 0.2);
}

input[type="range"]::-moz-range-progress {
  background: var(--accent-green);
  height: 6px;
  border-radius: 3px 0 0 3px;
}

input[type="range"]:focus { outline: none; }
input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(0, 194, 129, 0.15);
}


/* ═══════════════════════════════════
   HELP TOOLTIPS
   ═══════════════════════════════════ */

.help-tooltip {
  position: absolute;
  z-index: 9999;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--card-shadow);
  padding: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}

.help-tooltip-title {
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.help-tooltip-section {
  margin-top: var(--space-3);
}

.help-tooltip-label {
  display: block;
  font-weight: var(--weight-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

.help-tooltip-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
}

.help-tooltip-close:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.help-popup {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: var(--card-shadow);
  color: var(--text-secondary);
}

.help-popup-title {
  color: var(--text-primary);
}

.help-icon {
  background: var(--bg-raised);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.help-icon:hover {
  background: #07383E;
  color: var(--text-primary);
}


/* ═══════════════════════════════════
   CHART TOOLTIP (external HTML)
   ═══════════════════════════════════ */

#chartjs-tooltip {
  position: absolute;
  z-index: 9998;
  pointer-events: none;
  transition: opacity 100ms ease;
  opacity: 0;
}

/* .chart-tooltip base → components/charts.css */

.chart-tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.5;
}

.chart-tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}


/* ═══════════════════════════════════
   SECTION HEADER TYPOGRAPHY
   ═══════════════════════════════════ */

.page-content h2,
.page-content .h2 {
  font-size: var(--font-size-h2, 18px);
  font-weight: var(--font-size-h2-weight, 600);
  color: var(--text-primary);
}

.page-content h3,
.page-content .h3 {
  font-size: var(--font-size-h3, 14px);
  font-weight: var(--font-size-h3-weight, 500);
  color: var(--text-secondary);
}

.section-header__period {
  font-size: var(--text-xs);
  color: var(--color-ink-tertiary);
}


/* ═══════════════════════════════════
   COLLAPSIBLE SECTIONS
   ═══════════════════════════════════ */

.section-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.section-toggle:hover h2,
.section-toggle:hover h3 {
  color: var(--text-secondary);
}

.toggle-icon {
  transition: transform 200ms ease;
  color: var(--text-muted);
}

.toggle-icon.open {
  transform: rotate(180deg);
}

.collapsible-section {
  overflow: hidden;
  transition: max-height 200ms ease;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.section-header:hover {
  background: var(--bg-raised);
}

.section-header:hover .section-title {
  color: var(--text-secondary);
}

.section-header .toggle-icon {
  transition: transform 200ms ease;
  color: var(--text-muted);
}

.section-header.open .toggle-icon {
  transform: rotate(180deg);
}


/* ═══════════════════════════════════
   TEXT LINKS
   ═══════════════════════════════════ */

.text-link {
  background: none;
  border: none;
  color: var(--accent-teal);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-style: dotted;
}

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

.toggle-link {
  color: var(--text-secondary);
}

.toggle-link:hover {
  color: var(--text-primary);
}

.load-more-container {
  text-align: center;
  padding: var(--space-4) 0;
}


/* ═══════════════════════════════════
   SEGMENTED CONTROLS (PILL FILTERS)
   ═══════════════════════════════════ */

/* Container — wrapper provides grouping background */
.channel-select,
.period-select,
.filter-pills {
  display: inline-flex;
  flex-direction: row;
  gap: 2px;
  flex-wrap: wrap;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 500px;
}

/* Shared pill base */
.channel-select a,
.period-select a,
.filter-pills a {
  display: inline-block;
  border-radius: 500px;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  background: transparent;
  color: #AEAEAE;
  border: none;
  transition: color 0.15s ease, background 0.15s ease;
}

/* Size variants */
.channel-select a,
.filter-pills a {
  padding: 6px 16px;
}

.period-select a {
  padding: 4px 12px;
}

/* Hover */
.channel-select a:hover,
.period-select a:hover,
.filter-pills a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* Active */
.channel-select a.active,
.period-select a.active,
.filter-pills a.active {
  background: var(--accent-green);
  color: #031D20;
  border: none;
}

/* Compare toggle links (CEO) — removed, now handled by pill classes */

/* Filter buttons (Insights) */
.filter-bar button {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
  border-radius: var(--pill-radius);
}

.filter-bar button:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-bar button.active {
  background: var(--accent-green);
  color: var(--bg-base);
  border-color: var(--accent-green);
}

/* Country filter pills (Products, LTV, Forecast) */
.filters a {
  color: var(--text-secondary);
  border-color: var(--border);
  border-radius: var(--pill-radius);
}

.filters a:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filters a.active {
  background: var(--accent-green);
  color: var(--bg-base);
  border-color: var(--accent-green);
}

/* Details/summary */
details summary {
  color: var(--text-secondary);
}


/* ═══════════════════════════════════
   INSIGHT CARDS
   ═══════════════════════════════════ */

.insight-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--card-radius);
  box-shadow: none;
  border-left: 4px solid var(--text-muted) !important;
}

.insight-card.problem {
  border-left-color: var(--negative-large) !important;
}

.insight-card.opportunity {
  border-left-color: var(--positive) !important;
}

.insight-card.observation {
  border-left-color: var(--color-warning) !important;
}

/* ── Insight card text hierarchy ────── */
.insight-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.insight-body {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  line-height: 1.6;
}

.insight-impact {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 6px;
  margin-top: var(--space-sm);
}

.insight-action {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

.insight-action strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Insight details toggle ─────────── */
.insight-details {
  margin-top: var(--space-sm);
}

.insight-details__toggle {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.insight-details__toggle::-webkit-details-marker {
  display: none;
}

.insight-details__toggle::before {
  content: '\25B6';
  display: inline-block;
  font-size: 10px;
  transition: transform 0.2s;
}

.insight-details[open] .insight-details__toggle::before {
  transform: rotate(90deg);
}

.insight-details__body {
  margin-top: var(--space-xs);
  font-size: 12px;
  color: var(--text-muted);
}

.insight-details__body p {
  margin: var(--space-xs) 0 0;
}


/* ═══════════════════════════════════
   STATUS BADGES (Insights)
   ═══════════════════════════════════ */

.status-identified {
  background: rgba(59, 179, 194, 0.12);
  color: var(--accent-teal);
}

.status-in-progress {
  background: rgba(194, 129, 3, 0.15);
  color: var(--color-warning);
}

.status-resolved {
  background: rgba(0, 194, 129, 0.12);
  color: var(--accent-green);
}

.status-dismissed {
  background: var(--bg-raised);
  color: var(--text-muted);
}


/* ═══════════════════════════════════
   NEWS ITEMS (Insights)
   ═══════════════════════════════════ */

.news-item {
  background: var(--bg-card) !important;
  border: none !important;
  border-radius: var(--card-radius) !important;
  box-shadow: none !important;
}

.news-item a {
  color: var(--text-primary);
}

.news-item a:hover {
  color: var(--accent-teal);
}

.news-badge-regulatory {
  background: rgba(194, 129, 3, 0.15) !important;
  color: var(--color-warning) !important;
}

.news-badge-source {
  background: var(--bg-raised) !important;
  color: var(--text-muted) !important;
}


/* ═══════════════════════════════════
   SUFFIX BADGES (Products)
   ═══════════════════════════════════ */

.sfx-UA { background: rgba(59, 179, 194, 0.12); color: var(--accent-teal); }
.sfx-UB { background: rgba(0, 194, 129, 0.12); color: var(--accent-green); }
.sfx-UC { background: rgba(194, 129, 3, 0.12); color: var(--color-warning); }
.sfx-UD { background: rgba(107, 79, 187, 0.12); color: #9B8ADB; }
.sfx-UF { background: rgba(255, 97, 142, 0.12); color: var(--negative); }
.sfx-base { background: var(--bg-raised); color: var(--text-muted); }
.sfx-combo { background: var(--bg-raised); color: var(--text-secondary); }


/* ═══════════════════════════════════
   OPPORTUNITY BOX (Products)
   ═══════════════════════════════════ */

.opportunity-box {
  background: var(--bg-card);
  border-color: var(--positive);
}

.opp-stat .big {
  color: var(--positive);
}

.cvr-green { color: var(--positive); }
.cvr-red { color: var(--negative); }


/* ═══════════════════════════════════
   CONFIDENCE BADGES (Forecast)
   ═══════════════════════════════════ */

.confidence-high {
  background: rgba(0, 194, 129, 0.12);
  color: var(--accent-green);
}

.confidence-medium {
  background: rgba(59, 179, 194, 0.12);
  color: var(--accent-teal);
}

.confidence-low {
  background: rgba(194, 129, 3, 0.12);
  color: var(--color-warning);
}

.peak-badge {
  background: rgba(59, 179, 194, 0.12);
  color: var(--accent-teal);
}


/* ═══════════════════════════════════
   SALE BADGE & TOOLTIP (LTV)
   ═══════════════════════════════════ */

.sale-badge {
  background: rgba(194, 129, 3, 0.15);
  color: var(--color-warning);
  border-color: rgba(194, 129, 3, 0.3);
}

.sale-tooltip {
  background: var(--bg-card);
  border-color: rgba(194, 129, 3, 0.3);
  box-shadow: var(--card-shadow);
  color: var(--text-secondary);
}

.sale-tooltip-title {
  color: var(--color-warning);
}

.summer-sale-row {
  background: rgba(194, 129, 3, 0.06);
}

.summer-sale-row:hover {
  background: rgba(194, 129, 3, 0.10);
}


/* ═══════════════════════════════════
   CUSTOMER CARDS (Sales)
   ═══════════════════════════════════ */

.customer-card {
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.06);
}

.country-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}

.margin-signal {
  color: var(--text-muted);
}

.margin-signal .signal-toggle:hover {
  color: var(--text-primary);
}


/* ═══════════════════════════════════
   CUSTOMER SEGMENTS (CMO)
   ═══════════════════════════════════ */

.customer-compare .segment {
  background: var(--bg-raised);
  border-color: rgba(255, 255, 255, 0.06);
}


/* ═══════════════════════════════════
   SECTION CARDS (Products, LTV)
   ═══════════════════════════════════ */

.section {
  background: var(--bg-card);
  border: none;
  border-radius: var(--card-radius);
  box-shadow: none;
}


/* ═══════════════════════════════════
   SETUP & ADMIN PAGES
   ═══════════════════════════════════ */

.setup-section {
  background: var(--bg-card);
  border: none;
  border-radius: var(--card-radius);
  box-shadow: none;
}

.section-body {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.channel-item {
  border-bottom-color: rgba(255, 255, 255, 0.04);
}

.admin-card,
.setup-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--card-radius);
  box-shadow: none;
}

.progress-dot {
  border-color: var(--border);
  background: var(--bg-card);
}


/* ═══════════════════════════════════
   HARDCODED COLOR OVERRIDES (inline styles)
   ═══════════════════════════════════ */

/* eBay marketplace card (CMO) */
[style*="F3F0FF"] {
  background: rgba(107, 79, 187, 0.10) !important;
  border-color: rgba(107, 79, 187, 0.20) !important;
}

[style*="color:#6B4FBB"] {
  color: #9B8ADB !important;
}

tr[style*="F3F0FF"] {
  background: rgba(107, 79, 187, 0.06) !important;
}

[style*="color:#2563EB"] {
  color: var(--accent-teal) !important;
}

[style*="color:#92600A"] {
  color: var(--color-warning) !important;
}

[style*="background:#EBF4FF"],
[style*="EBF4FF"] {
  background: rgba(59, 179, 194, 0.08) !important;
}

[style*="background:rgba(232,160,32"] {
  background: rgba(194, 129, 3, 0.12) !important;
}

/* Anomaly card: burgundy zone */
[style*="color-warning-bg"] {
  background: var(--bg-negative) !important;
  border-color: rgba(255, 97, 142, 0.15) !important;
}

[style*="color-warning-bg"] [style*="color-surface"] {
  background: #3D1525 !important;
  border: none !important;
}

/* ═══════════════════════════════════
   SPA Navigation Progress Bar
   ═══════════════════════════════════ */
#spa-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent-teal, #3BB3C2);
  z-index: 9999;
  width: 0;
  opacity: 0;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  pointer-events: none;
}
