/* ============================================================
   MAXXOMETRO V4 — Stylesheet
   ============================================================
   V4 — Simulazione guidata (wizard step-by-step)
     - Modal overlay full-screen con backdrop blur
     - Progress bar fluida + step counter
     - Architettura step dichiarativa (Express + Guidato)
     - Animazioni transizione tra step
     - Stili wizard-option (radio cards) + wizard-table (input multi)
     - Auto-trigger alla prima visita via localStorage

   V3 — PAC (Piano di Accumulo del Capitale):
     - Nuovo setting-group nella settings-bar per il versamento mensile
     - Stili kpi-sublabel per riepilogo arricchito quando PAC > 0
     - Linea "Capitale investito" sul chart (oro chiaro, tratteggiata)
   ============================================================
   Estensione di V1 con:
   - Toggle V1/V2 nell'header (mostra/nasconde feature avanzate)
   - Sistema .v2-only nascosto in body.v1-mode
   - Stili nuovi: mode-switch (toggle V1/V2 stilizzato), preset-dropdown,
     scenario-b cards (palette azzurra), comparison-table, toast,
     stili @media print per export PDF
   - Palette: dark navy + oro Maxx + accento azzurro per Scenario B
   ============================================================ */

/* ============================================================
   VARIABILI NEUTRE (non dipendono dal tema)
   Radii, font, e ogni token che NON cambia tra light/dark deve stare
   qui — altrimenti il fallback a :root non riesce a risolverli quando
   l'altro tema non li ridefinisce, e si rompe il rendering.
   ============================================================ */
:root {
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

/* ============================================================
   THEME: DARK — applicata via body.theme-dark
   (V4: il tema chiaro è ora il default — vedi blocco body.theme-light più sotto,
    aliasato come :root per evitare flash al boot)
   ============================================================ */
body.theme-dark {
  --bg-primary:      #0a1929;
  --bg-elevated:     #122439;
  --bg-card:         #16293f;
  --bg-card-hover:   #1a3147;
  --bg-input:        #0e1f33;
  --bg-disclaimer:   #050d17;

  --border-soft:     #1f3a52;
  --border-strong:   #2a4a66;
  --border-accent:   #d4a847;

  --text-primary:    #e8eaed;
  --text-secondary:  #a0adb8;
  --text-muted:      #6b7785;
  --text-on-gold:    #0a1929;

  --gold:            #d4a847;
  --gold-dark:       #b8862b;
  --gold-light:      #e8c068;
  --green-maxx:      #10b981;
  --red-loss:        #ef4444;
  --orange-warn:     #f59e0b;

  --color-azioni:    #4a90e2;
  --color-opzioni:   #10b981;
  --color-forex:     #d4a847;
  --color-crypto:    #a855f7;

  --color-scenario-b: #38bdf8;
  --color-scenario-b-dark: #0284c7;
  --color-mc-range:   #d4a847;

  --shadow-soft:     0 1px 2px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-card:     0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-pop:      0 12px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Chart.js theming vars — leggibili da JS via getComputedStyle */
  --chart-grid:        rgba(160, 173, 184, 0.10);
  --chart-tick:        #6b7785;
  --chart-tick-strong: #a0adb8;
  --chart-tooltip-bg:  rgba(10, 25, 41, 0.95);
  --chart-tooltip-title: #d4a847;
  --chart-tooltip-body:  #e8eaed;
  --chart-doughnut-border: #0a1929;
  /* V3: linea "Capitale investito" (PAC) — colore distinto, ben contrastato sul dark */
  --chart-pac-color: rgba(232, 192, 104, 0.85);  /* oro chiaro tratteggiato */

  /* Header gradient */
  --header-bg-1: #122439;
  --header-bg-2: #0a1929;

  /* Watermark */
  --watermark-color: rgba(212, 168, 71, 0.07);

  /* Logo Large Trader — in dark mode il frame bianco viene rimosso
     e il logo viene "invertito" via CSS filter per leggibilità su navy
     mantenendo i blu del brand (hue-rotate compensa l'invert).
     Versione scelta dopo test side-by-side (variante 7). */
  --lt-frame-bg: transparent;
  --lt-frame-shadow: none;
  --lt-img-filter: invert(1) hue-rotate(180deg) brightness(0.95) saturate(1.1);
}

/* ============================================================
   THEME: LIGHT (default V4) — ispirata alla piattaforma Large Trader
   (sfondo paper warm chiaro + accenti blu institutional + oro Maxx)
   Aliasato a :root così le variabili si applicano anche prima che JS
   aggiunga la classe theme-light al body (no flash al boot).
   ============================================================ */
:root,
body.theme-light {
  --bg-primary:      #f5f1e8;       /* paper warm chiaro */
  --bg-elevated:     #ffffff;
  --bg-card:         #ffffff;
  --bg-card-hover:   #faf5e9;
  --bg-input:        #ffffff;
  --bg-disclaimer:   #2a3340;       /* dark accent per disclaimer (resta scuro per separazione visiva) */

  --border-soft:     #e2dcc8;
  --border-strong:   #c8bfa3;
  --border-accent:   #b8862b;

  --text-primary:    #1a1f2e;
  --text-secondary:  #4a5568;
  --text-muted:      #6b7280;
  --text-on-gold:    #0a1929;

  --gold:            #b8862b;
  --gold-dark:       #8e6720;
  --gold-light:      #d4a847;
  --green-maxx:      #047857;       /* verde più scuro per leggibilità su bianco */
  --red-loss:        #b91c1c;
  --orange-warn:     #b45309;

  --color-azioni:    #2563eb;
  --color-opzioni:   #047857;
  --color-forex:     #b8862b;
  --color-crypto:    #7c3aed;

  --color-scenario-b: #0284c7;
  --color-scenario-b-dark: #075985;
  --color-mc-range:   #b8862b;  /* oro scuro per il range Monte Carlo su sfondo paper */

  --shadow-soft:     0 1px 2px rgba(45, 35, 15, 0.06), 0 2px 8px rgba(45, 35, 15, 0.04);
  --shadow-card:     0 1px 3px rgba(45, 35, 15, 0.08), 0 4px 16px rgba(45, 35, 15, 0.05);
  --shadow-pop:      0 4px 12px rgba(45, 35, 15, 0.15), 0 12px 32px rgba(45, 35, 15, 0.12);

  --chart-grid:        rgba(0, 0, 0, 0.06);
  --chart-tick:        #6b7280;
  --chart-tick-strong: #4a5568;
  --chart-tooltip-bg:  rgba(26, 31, 46, 0.96);
  --chart-tooltip-title: #d4a847;
  --chart-tooltip-body:  #f8fafc;
  --chart-doughnut-border: #ffffff;
  --chart-pac-color: rgba(74, 85, 104, 0.85);  /* grigio scuro su light, ben visibile */

  --header-bg-1: #ffffff;
  --header-bg-2: #faf5e9;

  --watermark-color: rgba(184, 134, 43, 0.10);

  --lt-frame-bg: transparent;
  --lt-frame-shadow: none;
  --lt-img-filter: none;  /* logo originale, niente filter (sfondo è già chiaro) */
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.kpi-value,
.result-value,
.results-table .num,
.input-row input,
input[type="number"],
input[type="text"][inputmode="numeric"],
.value-tag,
.kpi-range {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ============================================================
   V2-ONLY VISIBILITY SYSTEM
   ============================================================ */

body.v1-mode .v2-only {
  display: none !important;
}

/* ============================================================
   HEADER
   ============================================================ */

.app-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
  padding: 16px 32px;
  background: linear-gradient(180deg, var(--header-bg-1) 0%, var(--header-bg-2) 100%);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ============================================================
   CO-BRANDING (Maxxometro + Large Trader)
   ============================================================ */

.brand-cobrand {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-self: start;
}

.brand-divider {
  width: 1px;
  height: 36px;
  background: var(--border-strong);
  flex-shrink: 0;
}

.lt-cobrand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}
.lt-cobrand:hover {
  background: var(--bg-card);
}
.lt-cobrand:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.lt-cobrand-prefix {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-style: italic;
}

/* Frame bianco semitrasparente attorno al logo per garantire leggibilità
   su sfondo dark navy (il logo Large Trader è pensato per sfondo bianco) */
.lt-logo-frame {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;   /* identico in entrambi i temi → no shift al toggle */
  background: var(--lt-frame-bg);
  border-radius: 8px;
  box-shadow: var(--lt-frame-shadow);
  transition: background 0.25s ease;
}
.lt-cobrand:hover .lt-logo-img {
  transform: scale(1.02);
  transition: transform 0.15s ease, filter 0.25s ease;
}

.lt-logo-img {
  height: 56px;
  width: auto;
  display: block;
  filter: var(--lt-img-filter, none);
  transition: filter 0.25s ease;
}

/* ============================================================
   FOOTER CREDIT (Powered by Large Trader)
   ============================================================ */

.lt-footer-credit {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(212, 168, 71, 0.12);
}

.lt-footer-prefix {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-style: italic;
}

.lt-footer-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-on-dark, var(--text-secondary));
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease;
  opacity: 0.92;
}
.lt-footer-link:hover { opacity: 1; }
.lt-footer-link:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

.lt-logo-frame-mini {
  padding: 7px 14px;
  border-radius: 6px;
  background: var(--lt-frame-bg);
  box-shadow: var(--lt-frame-shadow);
}
.lt-logo-img-mini {
  height: 38px;
  width: auto;
  display: block;
  /* V6: il footer ha sfondo scuro (--bg-disclaimer) in entrambi i temi
     (chiaro e scuro). Forziamo l'inversione del logo Large Trader SEMPRE qui
     (stesso filter usato per il logo header in tema scuro — variante 7
     dello studio CSS che mantiene leggibilità senza alterare il blu del brand). */
  filter: invert(1) hue-rotate(180deg) brightness(0.95) saturate(1.1);
  transition: filter 0.25s ease;
}

.brand-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-light) 100%);
  color: var(--text-on-gold);
  font-family: var(--font-serif);
  font-weight: 700; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(212, 168, 71, 0.25);
}

.brand-text { line-height: 1.15; }
.brand-line-1 {
  font-weight: 800; font-size: 16px;
  letter-spacing: 2px; color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
}
.version-badge {
  background: var(--gold);
  color: var(--text-on-gold);
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 3px;
  transition: background 0.2s ease;
}
body.v2-mode .version-badge {
  background: var(--color-scenario-b);
  color: white;
}
.brand-line-2 {
  font-size: 13px; color: var(--gold);
  font-weight: 500; margin-top: 2px;
}

/* HEADER CENTER: mode switch V1/V2 + theme toggle */
.header-center {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme toggle button */
.theme-toggle-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}
.theme-toggle-btn:hover {
  border-color: var(--gold);
  transform: rotate(15deg);
  box-shadow: 0 0 0 3px rgba(212, 168, 71, 0.12);
}
.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.theme-icon {
  width: 18px;
  height: 18px;
}
body.theme-dark  .theme-icon-moon { display: none; }
body.theme-light .theme-icon-sun  { display: none; }

/* ============================================================
   V5 — MENU IMPOSTAZIONI (dropdown nell'header-actions)
   ============================================================ */

.settings-menu-wrap {
  position: relative;
  display: inline-flex;
}

.btn-icon {
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
}
.btn-icon svg {
  color: var(--text-secondary);
  transition: color 0.15s ease, transform 0.15s ease;
}
.btn-icon:hover svg {
  color: var(--gold);
  transform: rotate(20deg);
}
.btn-icon[aria-expanded="true"] svg {
  color: var(--gold);
}

.settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  animation: settingsMenuIn 0.16s ease-out;
}
.settings-menu[hidden] { display: none; }

@keyframes settingsMenuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: background 0.12s ease;
}
.settings-menu-item:hover,
.settings-menu-item:focus-visible {
  background: var(--bg-card-hover);
  outline: none;
}
.settings-menu-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.settings-menu-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-menu-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.settings-menu-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.mode-switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}
.mode-switch input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.mode-switch-track {
  display: inline-flex;
  width: 200px;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  position: relative;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: border-color 0.2s ease;
}
.mode-switch-track:hover {
  border-color: var(--gold);
}
.mode-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 96px;
  height: 28px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-light) 100%);
  border-radius: 14px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.mode-switch-label-off,
.mode-switch-label-on {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 36px;
  transition: color 0.2s ease;
}
.mode-switch-label-off { color: var(--text-on-gold); }
.mode-switch-label-on  { color: var(--text-muted); }
.mode-switch input:checked + .mode-switch-track .mode-switch-thumb {
  transform: translateX(98px);
  background: linear-gradient(135deg, var(--color-scenario-b-dark) 0%, var(--color-scenario-b) 100%);
}
.mode-switch input:checked + .mode-switch-track .mode-switch-label-off { color: var(--text-muted); }
.mode-switch input:checked + .mode-switch-track .mode-switch-label-on  { color: white; }
.mode-switch input:focus-visible + .mode-switch-track {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.header-actions {
  display: flex;
  gap: 10px;
  justify-self: end;
  align-items: center;
}

/* ============================================================
   PRESET DROPDOWN
   ============================================================ */

.preset-dropdown {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4a847' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease;
}
.preset-dropdown:hover {
  border-color: var(--gold);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: var(--text-on-gold);
  border-color: var(--gold-dark);
}
.btn-primary:hover {
  background: var(--gold-light);
  box-shadow: 0 4px 12px rgba(212, 168, 71, 0.3);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--gold);
}

/* ============================================================
   INFO BUTTON + POPOVER (invariati da V1)
   ============================================================ */

.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%; border: 0;
  background: transparent;
  color: var(--gold);
  padding: 0; margin-left: 4px;
  cursor: pointer; line-height: 1;
  vertical-align: middle;
  transition: color 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
}
.info-btn svg { width: 16px; height: 16px; display: block; }
.info-btn:hover { color: var(--gold-light); transform: scale(1.1); }
.info-btn:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 50%;
}
.info-btn.active { color: var(--gold-light); }

.info-popover {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 18px 20px 16px;
  max-width: 400px; min-width: 300px;
  z-index: 1000;
  font-size: 13.5px; line-height: 1.6;
  color: var(--text-primary);
  animation: popIn 0.14s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.info-popover h4 {
  font-weight: 700; font-size: 15px;
  margin: 0 0 10px 0;
  color: var(--gold);
  padding-right: 26px;
  line-height: 1.3;
}
.info-popover p { margin: 0 0 10px 0; color: var(--text-primary); }
.info-popover p:last-child { margin-bottom: 0; }
.info-popover .example {
  background: var(--bg-elevated);
  border-left: 3px solid var(--green-maxx);
  padding: 10px 12px; margin-top: 12px;
  font-size: 12.5px; color: var(--text-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.info-popover .example strong {
  color: var(--green-maxx);
  font-weight: 700; text-transform: uppercase;
  font-size: 10.5px; letter-spacing: 0.8px;
  display: block; margin-bottom: 4px;
}
.info-popover .formula {
  background: var(--bg-primary);
  border: 1px dashed var(--border-strong);
  padding: 8px 12px; margin: 10px 0;
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px; color: var(--gold-light);
}
.info-popover-close {
  position: absolute; top: 10px; right: 10px;
  background: transparent; border: none;
  color: var(--text-muted);
  font-size: 20px; line-height: 1;
  cursor: pointer; padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.info-popover-close:hover { background: var(--bg-elevated); color: var(--text-primary); }

/* ============================================================
   CONTAINER
   ============================================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  /* Il container resta CENTRATO. La sidebar è position:absolute
     rispetto al container e "appoggiata" a sinistra fuori, quando c'è
     abbastanza spazio nella viewport (>= 1660px). Altrimenti, va in flusso. */
  position: relative;
}

.main-content {
  /* In flusso normale: tutto il contenuto va sotto in colonna,
     come prima del refactor a grid. */
  display: block;
}

/* ============================================================
   SIDEBAR-ACTIONS — pulsante Simulazione guidata
   In flusso (sopra il container) su viewport piccoli/medi;
   "appoggiato" a sinistra del container su viewport grandi.
   ============================================================ */

.sidebar-actions {
  /* Default: in flusso, allineato a sinistra del container,
     compatto in modo da non dominare la pagina */
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px 0;
}

.btn-wizard-side {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  /* V6: gradient più morbido — oro chiaro/cream invece di pieno saturato.
     Meno aggressivo sul testo navy mantenendo l'accento gold del brand. */
  background: linear-gradient(
    135deg,
    var(--gold-light) 0%,
    var(--gold) 100%
  );
  color: var(--text-on-gold);
  border: 1px solid rgba(212, 168, 71, 0.55);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  box-shadow: 0 2px 6px rgba(212, 168, 71, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  flex-shrink: 0;
}
/* In tema chiaro il gold-light è quasi paglierino — perfetto per leggibilità */
body.theme-light .btn-wizard-side {
  background: linear-gradient(
    135deg,
    #e8c068 0%,
    var(--gold-light) 100%
  );
  border-color: rgba(184, 134, 43, 0.45);
  box-shadow: 0 2px 6px rgba(184, 134, 43, 0.16);
}
.btn-wizard-side:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(212, 168, 71, 0.32);
  filter: brightness(1.05);
}
.btn-wizard-side:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 2px;
}
.btn-wizard-side svg {
  flex-shrink: 0;
  opacity: 0.95;
  width: 18px;
  height: 18px;
}
.btn-wizard-side-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.btn-wizard-side-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.btn-wizard-side-sub {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.78;
  letter-spacing: 0.3px;
}

/* Pulse animation */
.btn-wizard-side.pulse {
  position: relative;
}
.btn-wizard-side.pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: calc(var(--radius-md) + 4px);
  border: 2px solid var(--gold);
  opacity: 0.6;
  animation: btnPulse 1.6s ease-out infinite;
  pointer-events: none;
}

.sidebar-hint {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
  max-width: 280px;
}

/* V6: pulsante "📚 Tutte le guide" — sopra il Wizard nella sidebar.
   Stile complementare: tinte morbide, accent blu institutional, look "library card". */
.btn-guides-index {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-guides-index:hover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.10);
}
.btn-guides-index:active {
  transform: translateY(0);
}
.btn-guides-index:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.btn-guides-index svg {
  flex-shrink: 0;
  color: var(--gold);
}
body.theme-light .btn-guides-index svg {
  color: var(--gold-dark);
}
.btn-guides-index-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.btn-guides-index-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.btn-guides-index-sub {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ── DESKTOP GRANDE: sidebar allineata col bordo sinistro del logo M ──
   Su viewport ≥ 1680px c'è spazio sufficiente a sinistra del container
   centrato (max-width 1200) per "ancorare" la sidebar a esattamente
   32px dal bordo sinistro della viewport (= stesso left-edge del logo M
   nell'header, che ha padding-left: 32px).

   Calcolo del left (relativo al .container centrato):
     container_left_edge_x  =  (vw - 1200) / 2
     vogliamo                =  32px  (visibile dal viewport)
     ⇒ left_attr            =  32px - container_left_edge_x
                             =  32px - (100vw - 1200px) / 2
   Su schermi più stretti (< 1680px), resta in flusso sopra le card. */
@media (min-width: 1680px) {
  .sidebar-actions {
    position: absolute;
    top: 28px;        /* allineato al padding-top del .container */
    /* Allineamento esatto col bordo sinistro del logo M (= 32px viewport) */
    left: calc(32px - (100vw - 1200px) / 2);
    width: 200px;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .btn-wizard-side,
  .btn-guides-index {
    width: 100%;
    padding: 13px 14px;
  }
  .sidebar-hint {
    max-width: none;
    padding: 0 2px;
  }
}

/* ============================================================
   SETTINGS BAR
   ============================================================ */

.settings-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: grid;
  /* 4 colonne ben proporzionate:
     - Modalità (segmented toggle, ~auto)
     - Periodo % (dropdown, ~auto)
     - Orizzonte (input + slider, prende lo spazio rimanente)
     - PAC (input, ~auto) */
  grid-template-columns:
    minmax(180px, auto)
    minmax(150px, auto)
    minmax(220px, 1fr)
    minmax(200px, auto);
  gap: 28px;
  align-items: end;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}
/* Divider visivo verticale tra i setting-group */
.settings-bar .setting-group:not(:last-child) {
  position: relative;
}
.settings-bar .setting-group:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -14px;
  top: 18%;
  height: 64%;
  width: 1px;
  background: var(--border-soft);
  opacity: 0.7;
}

/* Periodo della %: dropdown leggermente più largo per leggibilità */
#ratePeriod {
  min-width: 130px;
  font-weight: 600;
}

/* PAC group: larghezza compatta ma comoda */
.setting-group-pac {
  min-width: 180px;
  max-width: 260px;
}
.setting-group-pac .input-row {
  width: 100%;
}
.setting-group-pac .input-row input {
  text-align: right;
  font-weight: 600;
}
.setting-group-pac .input-row .suffix {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}
.settings-bar-b {
  margin-bottom: 14px;
  border-left: 3px solid var(--color-scenario-b);
  background: rgba(56, 189, 248, 0.04);
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.setting-label .value-tag {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--gold);
  text-transform: none;
  font-size: 13px;
  letter-spacing: normal;
  font-style: italic;
  margin-left: auto;
}

/* V5: nel Livello 2, i value-tag accanto a label slider hanno una pill
   semi-trasparente per maggior leggibilità (i tag mostrano valori live
   tipo "0 mesi (disattivo)", "-20%", "500"). */
.level-body .setting-label .value-tag {
  background: rgba(212, 168, 71, 0.10);
  border: 1px solid rgba(212, 168, 71, 0.22);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  white-space: nowrap;
}
body.theme-light .level-body .setting-label .value-tag {
  background: rgba(184, 134, 43, 0.08);
  border-color: rgba(184, 134, 43, 0.20);
  color: var(--gold-dark);
}

/* SEGMENTED TOGGLE */
.segmented-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
  width: max-content;
}
.segmented-toggle .seg-btn {
  padding: 7px 16px;
  background: transparent;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
}
.segmented-toggle .seg-btn:not(.active):hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.segmented-toggle .seg-btn.active {
  background: var(--gold);
  color: var(--text-on-gold);
}
.settings-bar-b .seg-btn.active {
  background: var(--color-scenario-b);
  color: white;
}

/* ORIZZONTE */
.orizzonte-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.orizzonte-row input[type="number"] {
  flex: 0 0 auto;
  width: 86px;
  font-weight: 600;
  text-align: right;
}
.unit-suffix {
  font-style: italic;
  color: var(--text-muted);
  font-size: 13px;
}
/* Display friendly tipo "1 anno e 2 mesi" — accanto all'input mesi */
.orizzonte-friendly {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.2px;
  padding-left: 8px;
  border-left: 1px solid var(--border-soft);
  white-space: nowrap;
}
body.theme-light .orizzonte-friendly {
  color: var(--gold-dark);
}

/* ============================================================
   INPUTS
   ============================================================ */

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.15s ease;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: 2px solid var(--gold);
  outline-offset: -1px;
  border-color: var(--gold);
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0adb8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
  appearance: none;
  -webkit-appearance: none;
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  margin: 6px 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; background: var(--border-strong); border-radius: 2px;
}
input[type="range"]::-moz-range-track {
  height: 4px; background: var(--border-strong); border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  background: var(--gold);
  border-radius: 50%; cursor: pointer;
  border: 2px solid var(--bg-primary);
  margin-top: -6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--gold); border-radius: 50%; cursor: pointer;
  border: 2px solid var(--bg-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Input rows con prefisso/suffisso */
.input-row {
  display: flex; align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
}
.input-row:focus-within {
  outline: 2px solid var(--gold); outline-offset: -1px;
}
.input-row .prefix,
.input-row .suffix {
  padding: 8px 10px;
  background: var(--bg-elevated);
  color: var(--gold);
  font-weight: 600; font-size: 14px;
}
.input-row .prefix { border-right: 1px solid var(--border-strong); }
.input-row .suffix { border-left: 1px solid var(--border-strong); }
.input-row input {
  border: none !important;
  flex: 1;
  outline: none !important;
  background: transparent;
}

/* ============================================================
   SUMMARY CARD
   ============================================================ */

.summary-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-soft);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.summary-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.summary-header h2 {
  font-size: 14px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted); margin: 0;
}

.summary-mode-badge {
  background: var(--color-scenario-b);
  color: white;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 3px;
  margin-left: auto;
  text-transform: uppercase;
}

.summary-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.kpi {
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted);
}
.kpi-sublabel {
  font-size: 10.5px;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1.2;
  margin-top: -2px;
}
.kpi-value {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 28px;
  color: var(--text-primary);
  line-height: 1.1; letter-spacing: -0.5px;
}
.kpi-value.gold    { color: var(--gold); }
.kpi-value.green   { color: var(--green-maxx); }
.kpi-value.red     { color: var(--red-loss); }
.kpi-value.primary { color: var(--gold-light); }

.kpi-range {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

/* SECTION HEADER */
.section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.section-header h2 {
  font-size: 14px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted); margin: 0;
}

.scenario-label {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.5px;
  text-transform: none;
  margin-left: 4px;
}

/* ============================================================
   PRODUCTS GRID
   ============================================================ */

.products-section { margin-bottom: 18px; }

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.products-grid-b {
  margin-top: 8px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
  transition: opacity 0.2s ease;
}
.product-card.disabled {
  opacity: 0.5;
}
.product-card.disabled .product-fields { pointer-events: none; }

/* Scenario B cards: accent azzurro */
.product-card.scenario-b-card {
  border-left: 3px solid var(--color-scenario-b);
}

.product-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.product-title {
  display: flex; align-items: center; gap: 8px;
}
.product-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-azioni  { background: var(--color-azioni); }
.dot-opzioni { background: var(--color-opzioni); }
.dot-forex   { background: var(--color-forex); }
.dot-crypto  { background: var(--color-crypto); }
.product-name {
  font-weight: 700; font-size: 15px;
  color: var(--text-primary);
}
.product-tag {
  font-size: 10px; color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 6px; border-radius: 3px;
  font-weight: 500; text-transform: lowercase;
}
.product-fields {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 12px;
}
.field {
  display: flex; flex-direction: column; gap: 5px;
}
.field-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
}
.period-tag {
  font-size: 10px; color: var(--gold);
  font-style: italic; font-weight: 500;
  /* V4: ora il period-tag ospita un <select> per scegliere il periodo per asset.
     Lo span resta inline next al label "% Profitto". */
  display: inline-flex;
  align-items: center;
}
/* Dropdown compatto del periodo per asset (dentro a .period-tag) */
.period-tag-select {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  font-style: italic;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 18px 1px 6px;
  cursor: pointer;
  letter-spacing: 0.2px;
  /* Custom arrow */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23d4a847' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  background-size: 9px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.period-tag-select:hover {
  border-color: var(--gold);
  background-color: rgba(212, 168, 71, 0.06);
}
.period-tag-select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}
.period-tag-select option {
  color: var(--text-primary);
  background: var(--bg-card);
  font-style: normal;
}
/* In tema chiaro */
body.theme-light .period-tag-select {
  color: var(--gold-dark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23b8862e' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Scenario B: tinta blu coerente */
[data-period-tag-b] .period-tag-select {
  color: var(--color-scenario-b, #38bdf8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2338bdf8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.product-result {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.result-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.result-value {
  font-family: var(--font-serif);
  font-weight: 700; font-size: 18px;
  color: var(--gold);
}
.result-value.neg { color: var(--red-loss); }

/* SWITCH TOGGLE */
.switch-toggle {
  display: inline-flex; align-items: center;
  cursor: pointer; user-select: none;
}
.switch-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; display: inline-block;
  width: 36px; height: 20px;
  background: var(--border-strong);
  border-radius: 20px;
  transition: background 0.2s ease;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.switch-toggle input:checked + .switch-track { background: var(--green-maxx); }
.switch-toggle input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch-toggle input:focus-visible + .switch-track {
  outline: 2px solid var(--gold); outline-offset: 2px;
}

/* WARNING BOX */
.warning-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid var(--orange-warn);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--orange-warn);
}

/* CHART / TABLE / DISTRIBUTION CARDS */
.chart-card, .distribution-card, .table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}

.chart-wrapper {
  position: relative;
  height: 380px;
  overflow: hidden;
}
.chart-wrapper canvas { position: relative; z-index: 1; }

.watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-22deg);
  font-family: var(--font-sans);
  font-weight: 900; font-size: 58px;
  letter-spacing: 12px;
  color: var(--watermark-color);
  white-space: nowrap;
  pointer-events: none; user-select: none;
  z-index: 2;
}

.chart-legend {
  display: flex; gap: 14px;
  font-size: 12px; color: var(--text-secondary);
  margin-left: auto; flex-wrap: wrap;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 6px;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.legend-dash {
  display: inline-block;
  width: 16px; height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
}

/* DISTRIBUTION */
.distribution-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

/* ============================================================
   V5 — CHART + DISTRIBUTION wrapper + toggle "affianca"
   ----------------------------------------------------------------
   Strategia: quando il toggle è ON, il wrapper ROMPE FUORI dal
   container centrato (max-width 1200) per occupare più spazio
   orizzontale. Il chart-card mantiene la sua larghezza originale
   (~1152px effettivi); la distribuzione card si posiziona nello
   spazio "aggiuntivo" guadagnato a destra. Il chart NON viene
   compresso. Solo su viewport ≥ 1500px (sotto: fallback stacked).
   ============================================================ */

.chart-distribution-wrap {
  display: block;
}

@media (min-width: 1500px) {
  .chart-distribution-wrap.side-by-side {
    /* Calcolo larghezza espansa: max 1700px o 100vw-48 (margini sicurezza) */
    width: min(calc(100vw - 48px), 1700px);
    /* Margine sinistro negativo per estendersi simmetricamente. 100% nel
       contesto margin si risolve alla larghezza del containing block
       (= .main-content effective width ≈ 1152px). */
    margin-left: calc((100% - min(calc(100vw - 48px), 1700px)) / 2);

    display: grid;
    /* Chart card a 1152px (la sua larghezza ORIGINALE quando il toggle era OFF);
       distribuzione card prende lo spazio rimanente (min 280px). */
    grid-template-columns: minmax(0, 1152px) minmax(280px, 1fr);
    gap: 18px;
    align-items: stretch;
  }
  .chart-distribution-wrap.side-by-side .chart-card,
  .chart-distribution-wrap.side-by-side .distribution-card {
    margin-bottom: 18px;
    min-width: 0; /* permette al grid cell di stringere correttamente */
    overflow: hidden; /* nessuna pillola legend può sforare visivamente */
  }
  /* Distribuzione interna: pie sopra, legend sotto (single col) per
     ottimizzare lo spazio nella colonna più stretta. */
  .chart-distribution-wrap.side-by-side .distribution-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* Su viewport < 1500px: side-by-side non praticabile (chart resterebbe stretto).
   Il toggle visualmente diventa "soft-disabled" via opacity. Il layout torna stacked. */
@media (max-width: 1499px) {
  .chart-distribution-wrap.side-by-side {
    display: block;
  }
  .side-by-side-toggle {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
  }
}

/* Toggle "Affianca distribuzione" — pill switch piccolo */
.side-by-side-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.side-by-side-toggle:hover {
  color: var(--text-primary);
}
.side-by-side-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.side-by-side-track {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.side-by-side-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease;
}
.side-by-side-toggle input:checked + .side-by-side-track {
  background: var(--gold);
  border-color: var(--gold);
}
.side-by-side-toggle input:checked + .side-by-side-track .side-by-side-thumb {
  transform: translateX(16px);
  background: var(--text-on-gold);
}
.side-by-side-toggle input:focus-visible + .side-by-side-track {
  box-shadow: 0 0 0 3px rgba(212, 168, 71, 0.20);
}
.side-by-side-label {
  letter-spacing: 0.2px;
}
@media (max-width: 720px) {
  /* Su mobile, nascondi il toggle (non avrebbe senso il side-by-side) */
  .side-by-side-toggle { display: none; }
}

/* Quando side-by-side è ATTIVO, nascondi il toggle gemello nella card
   distribuzione (il toggle "ufficiale" è nella chart card a sinistra).
   Quando side-by-side è OFF, nascondi quello nella chart card e mostra
   solo quello nella distribuzione (l'utente lo vede sotto, scoprendo la feature). */
.chart-distribution-wrap:not(.side-by-side) .chart-card .side-by-side-toggle {
  /* Mantieni visibile anche nella chart card, è comodo */
}
.chart-distribution-wrap.side-by-side .side-by-side-toggle-dist {
  display: none;
}
.distribution-chart-wrap {
  position: relative; height: 220px;
}
.distribution-legend {
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
  width: 100%;
}
/* V5 fix: niente più justify-content:space-between (separava troppo il nome
   dal %). Layout flex con gap piccolo → nome e % SEMPRE vicini, anche su
   card larghe. Il bg della pillola continua a riempire la riga per coerenza
   visiva, ma nome + % stanno raggruppati a sinistra. */
.distribution-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 14px;                  /* spazio tra "Opzioni" e "100.0%" */
  padding: 8px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.distribution-legend .legend-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 500;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.distribution-legend .legend-pct {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--gold);
  font-size: 15px;
  flex-shrink: 0;             /* il % non si comprime mai */
  white-space: nowrap;
}

/* ============================================================
   LEVEL SECTIONS
   ============================================================ */

.level-section {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  overflow: hidden;
}
.level-section summary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  list-style: none; user-select: none;
}
.level-section summary::-webkit-details-marker { display: none; }
.level-section summary::before {
  content: '▸';
  color: var(--gold);
  font-size: 12px;
  transition: transform 0.2s ease;
  display: inline-block;
}
.level-section[open] summary::before {
  transform: rotate(90deg);
}
.level-section summary:hover { background: var(--bg-card-hover); }

.level-badge {
  background: var(--gold);
  color: var(--text-on-gold);
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}
.level-3 .level-badge {
  background: var(--color-azioni);
  color: white;
}
.level-badge-comparison {
  background: var(--color-scenario-b);
  color: white;
}

.level-title { color: var(--text-primary); font-weight: 600; }
.level-sub {
  color: var(--text-muted); font-size: 12px;
  font-style: italic; margin-left: 4px; margin-right: 8px;
}

/* V6 — Launcher laterale "Guida" — pulsantino verticale fuori dalla card.
   IMPORTANTE: il <button> deve essere FUORI dal <details> (i figli del details
   chiuso vengono nascosti automaticamente dal browser). Usiamo un wrapper
   .section-with-side-guide che fa da contenitore relative. */
.section-with-side-guide {
  position: relative;
}

.side-guide-launcher {
  display: none; /* default: nascosto su viewport stretti */
}

@media (min-width: 1280px) {
  .side-guide-launcher {
    position: absolute;
    /* Allineamento verticale: launcher centrato sulla riga summary del details.
       Summary ha padding 14px verticale + content ~16px → altezza ~44px.
       Launcher altezza ~44px (5+18+2+11+5). top: 1px li allinea top-to-top. */
    top: 1px;
    /* Posizionato APPENA fuori dal bordo sinistro della card: 44 (width) +
       10 (gap) = 54px a sinistra dell'inizio della card. */
    left: -54px;
    width: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 3px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.15s ease;
    z-index: 2;
  }
  .side-guide-launcher:hover {
    border-color: var(--gold);
    background: var(--bg-card-hover);
    transform: translateX(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
  }
  .side-guide-launcher:active {
    transform: translateX(0);
  }
  .side-guide-launcher:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }
  .side-guide-launcher svg {
    color: var(--gold);
    width: 18px;
    height: 18px;
  }
  body.theme-light .side-guide-launcher svg {
    color: var(--gold-dark);
  }
  /* Variante "blu" per Livello 3 e Scenario B (coerente col badge della sezione) */
  .side-guide-launcher-blue svg {
    color: var(--color-scenario-b);
  }
  .side-guide-launcher-blue:hover {
    border-color: var(--color-scenario-b);
  }
  .side-guide-launcher-text {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-secondary);
  }
}

/* V5 — pulsante "Guida completa" nel summary del Livello 2
   Design "ti chiamo": gold-tinted ma più carico, leggermente più grande e
   con sottile glow, in modo da essere chiaramente identificabile come
   call-to-action didattica senza dominare il summary. */
.btn-guide-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 6px 14px;
  background: linear-gradient(
    135deg,
    rgba(212, 168, 71, 0.22) 0%,
    rgba(212, 168, 71, 0.14) 100%
  );
  border: 1px solid var(--gold);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.3px;
  box-shadow: 0 1px 3px rgba(212, 168, 71, 0.20);
  transition: all 0.15s ease;
}
.btn-guide-inline:hover {
  background: linear-gradient(
    135deg,
    rgba(212, 168, 71, 0.36) 0%,
    rgba(212, 168, 71, 0.24) 100%
  );
  box-shadow: 0 3px 10px rgba(212, 168, 71, 0.35);
  transform: translateY(-1px);
}
.btn-guide-inline:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(212, 168, 71, 0.18);
}
body.theme-light .btn-guide-inline {
  color: var(--gold-dark);
  background: linear-gradient(
    135deg,
    rgba(184, 134, 43, 0.20) 0%,
    rgba(184, 134, 43, 0.12) 100%
  );
  border-color: var(--gold-dark);
  box-shadow: 0 1px 3px rgba(184, 134, 43, 0.18);
}
body.theme-light .btn-guide-inline:hover {
  background: linear-gradient(
    135deg,
    rgba(184, 134, 43, 0.32) 0%,
    rgba(184, 134, 43, 0.22) 100%
  );
  box-shadow: 0 3px 10px rgba(184, 134, 43, 0.32);
}

/* V5 — Toggle "Attiva V2 Avanzato" inline nel summary Livello 2 */
.level-v2-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  transition: all 0.15s ease;
}
.level-v2-toggle:hover {
  border-color: var(--gold);
  color: var(--text-primary);
}
.level-v2-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.level-v2-toggle-track {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.level-v2-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease;
}
.level-v2-toggle input:checked + .level-v2-toggle-track {
  background: var(--gold);
  border-color: var(--gold);
}
.level-v2-toggle input:checked + .level-v2-toggle-track .level-v2-toggle-thumb {
  transform: translateX(14px);
  background: var(--text-on-gold);
}
.level-v2-toggle input:checked ~ .level-v2-toggle-label {
  color: var(--gold);
}
.level-v2-toggle-label {
  letter-spacing: 0.2px;
  transition: color 0.15s ease;
}

.level-body {
  padding: 8px 24px 22px;
  border-top: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
.level-body-full {
  grid-template-columns: 1fr;
}
.level-body .setting-group {
  flex-direction: column;
}
.level-body .hint {
  font-size: 11.5px; color: var(--text-muted);
  margin: 4px 0 0 0; line-height: 1.5;
}

/* V5 — separatore tra righe del Livello 2 */
.level-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px;
  font-family: var(--font-sans);
}
.level-divider::before,
.level-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border-soft) 50%,
    transparent 100%
  );
}
.level-divider-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* V5 — gruppo seed: limito la larghezza per non sbilanciare la riga 3 del grid */
.setting-group-seed {
  /* Su level-body grid 3-col, il seed occupa solo la prima cella per
     mantenere il visual focus sulla riproducibilità senza estendere
     un input gigantesco a tutto schermo. */
  max-width: 360px;
}

/* V5 — riga seed + pulsante "🎲 Random" */
.seed-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.seed-row #seed {
  flex: 1;
  min-width: 0;
}
.btn-seed-random {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn-seed-random:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}
.btn-seed-random:active {
  transform: translateY(0);
}
.btn-seed-random-icon {
  font-size: 14px;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-seed-random:hover .btn-seed-random-icon {
  transform: rotate(180deg);
}
.btn-seed-random-label {
  letter-spacing: 0.2px;
}

/* ============================================================
   V5 — Slider con casella numerica affiancata (Livello 2)
   Design eye-friendly: slider il più lungo possibile, casella compatta
   con frecce spin native VISIBILI. La casella è abbastanza larga da
   ospitare numeri tipo "500", "-20", "999.999" senza troncamento.
   ============================================================ */
.slider-row {
  display: grid;
  /* Casella ~120px: include input (frecce native ~18-24px in base al browser)
     + suffix testuale. Larghezza scelta per ospitare numeri fino a 6 cifre
     (es. "999.999") senza troncamento, anche con browser che disegnano
     spin button più larghi (Chrome/Edge ~24px). */
  grid-template-columns: 1fr 120px;
  gap: 14px;
  align-items: center;
}
.slider-row input[type="range"] {
  width: 100%;
  margin: 0;
}
.slider-num-wrap {
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
}
.slider-num {
  /* Larghezza generosa: 86px lasciano ~50-55px per il testo dopo le frecce
     spin native (su Chrome ~24px, Firefox ~18px). Abbastanza per "999.999",
     "2000", "-100", "5.5" in tutti i browser. */
  width: 86px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 5px 4px 5px 8px;
  text-align: right;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  /* Frecce spin native VISIBILI — coerente con asset card */
}
.slider-num:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 168, 71, 0.15);
}
.slider-num-suffix {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.2px;
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  min-width: 24px; /* spazio per "mesi", "sim.", "%" */
}

/* Comparison */
.level-comparison summary::before { color: var(--color-scenario-b); }
.level-comparison {
  border-left: 3px solid var(--color-scenario-b);
}

.comparison-table-wrap {
  margin-top: 20px;
}
.comparison-table-title {
  font-size: 12px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--color-scenario-b);
  margin: 0 0 10px 0;
}

/* ============================================================
   TABLE
   ============================================================ */

.table-wrap { overflow-x: auto; }
.results-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.results-table thead th {
  text-align: left;
  font-weight: 700; font-size: 11px;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--gold);
  padding: 10px 14px;
  border-bottom: 2px solid var(--border-strong);
  background: var(--bg-elevated);
}
.results-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
}
.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tbody tr:hover { background: var(--bg-card-hover); }
.results-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.results-table .num.pos { color: var(--green-maxx); font-weight: 600; }
.results-table .num.neg { color: var(--red-loss); font-weight: 600; }
.results-table .num.gold { color: var(--gold); font-weight: 600; }
.results-table .num.blue { color: var(--color-scenario-b); font-weight: 600; }
.results-table .empty {
  text-align: center; padding: 30px;
  color: var(--text-muted); font-style: italic;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13.5px;
  color: var(--text-primary);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 360px;
}
.toast.toast-success {
  border-color: var(--green-maxx);
  border-left-color: var(--green-maxx);
}
@keyframes toastSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.toast.fading {
  animation: toastSlideOut 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}
@keyframes toastSlideOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* ============================================================
   DISCLAIMER
   ============================================================ */

.disclaimer {
  background: var(--bg-disclaimer);
  border-top: 3px solid var(--gold-dark);
  padding: 24px 32px;
  font-size: 11.5px;
  line-height: 1.65;
  color: #c5cdd6;
}
/* Wrapper interno centrato — allineato con .container (max-width 1200px) */
.disclaimer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}
.disclaimer strong { color: var(--gold-light); }
body.theme-light .disclaimer { color: #d1d5db; }
.disclaimer p { margin: 0 0 10px 0; }
.disclaimer strong { color: var(--gold-light); }
.disclaimer-foot {
  font-style: italic; color: var(--text-muted);
  margin-top: 14px !important;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 10.5px;
}

/* ============================================================
   WIZARD MODAL — Simulazione guidata
   ============================================================ */

/* Keyframes pulse (riutilizzato da .btn-wizard-side.pulse) */
@keyframes btnPulse {
  0%   { transform: scale(1);     opacity: 0.6; }
  100% { transform: scale(1.18);  opacity: 0; }
}

.wizard-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Fix V4: `.wizard-modal` ha display:flex che sovrascrive l'attributo HTML `hidden`.
   Quando hidden è presente, forziamo display:none altrimenti il modal resta visibile. */
.wizard-modal[hidden] {
  display: none !important;
}

.wizard-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 25, 41, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdropFadeIn 0.2s ease-out;
}
@keyframes backdropFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.wizard-container {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius-lg);
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: wizardSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
@keyframes wizardSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* HEADER */
.wizard-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
}

.wizard-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wizard-icon {
  font-size: 22px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.wizard-brand strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  line-height: 1.2;
}
.wizard-subtitle {
  display: block;
  font-size: 11px;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.6px;
}

.wizard-progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wizard-progress {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  min-width: 120px;
  max-width: 240px;
}
.wizard-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark) 0%, var(--gold-light) 100%);
  border-radius: 3px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.wizard-step-counter {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.3px;
  min-width: 80px;
  text-align: right;
}

.wizard-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.wizard-close-btn:hover {
  background: var(--bg-input);
  color: var(--red-loss);
  border-color: var(--red-loss);
}

/* BODY */
.wizard-body {
  padding: 28px 32px;
  overflow-y: auto;
  flex: 1;
  position: relative;
  min-height: 360px;
  outline: none;
}

.wizard-step {
  animation: stepFadeIn 0.25s ease-out;
}
@keyframes stepFadeIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.wizard-step.fade-out {
  animation: stepFadeOut 0.18s ease-in forwards;
}
@keyframes stepFadeOut {
  to { opacity: 0; transform: translateX(-12px); }
}

.wizard-step-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  color: var(--text-primary);
  margin: 0 0 8px 0;
  line-height: 1.25;
  letter-spacing: -0.3px;
}

.wizard-step-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 22px 0;
}
.wizard-step-description strong { color: var(--text-primary); }

.wizard-step-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

/* WIZARD OPTION CARD (radio) */
.wizard-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-input);
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.wizard-option:hover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
}
.wizard-option input[type="radio"],
.wizard-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.wizard-option.selected {
  border-color: var(--gold);
  background: rgba(212, 168, 71, 0.08);
  box-shadow: 0 0 0 3px rgba(212, 168, 71, 0.12);
}
.wizard-option-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}
.wizard-option-content {
  flex: 1;
}
.wizard-option-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}
.wizard-option-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.wizard-option-tag {
  display: inline-block;
  background: var(--gold-dark);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.wizard-option-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  transition: border-color 0.15s ease;
}
.wizard-option.selected .wizard-option-radio {
  border-color: var(--gold);
}
.wizard-option.selected .wizard-option-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--gold);
}

/* WIZARD CHECK (per checkbox multipli) */
.wizard-option .wizard-option-check {
  width: 22px; height: 22px;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.wizard-option.selected .wizard-option-check {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--text-on-gold);
}
.wizard-option.selected .wizard-option-check::after {
  content: '✓';
  font-weight: 800;
  font-size: 14px;
}

/* WIZARD INPUT (number/text) */
.wizard-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}
.wizard-input-row .field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.wizard-input-row .field-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.wizard-input-row .input-row {
  width: 180px;
}

/* WIZARD HINT (espandibile) */
.wizard-hint {
  background: var(--bg-elevated);
  border-left: 3px solid var(--gold);
  padding: 12px 14px;
  margin-top: 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.wizard-hint strong { color: var(--gold); }
.wizard-hint .wizard-example {
  display: block;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(212, 168, 71, 0.25);
  font-style: italic;
}

.wizard-expandable {
  margin-top: 14px;
}
.wizard-expandable summary {
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
  color: var(--gold);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  user-select: none;
}
.wizard-expandable summary::-webkit-details-marker { display: none; }
.wizard-expandable summary::before {
  content: '▸';
  font-size: 10px;
  transition: transform 0.2s ease;
}
.wizard-expandable[open] summary::before { transform: rotate(90deg); }

/* WIZARD ASSETS-MATRIX (per step strumenti + capitale + rendimento) */
.wizard-assets-matrix {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wizard-asset-row {
  display: grid;
  /* 3 colonne: [nome+checkbox] [capitale] [rendimento%+periodo]
     La colonna rendimento è più larga per ospitare input numerico + select. */
  grid-template-columns: minmax(110px, 130px) minmax(140px, 1fr) minmax(200px, 1.4fr);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.wizard-asset-row select.wizard-period-select {
  width: auto;
  flex: 0 0 auto;
  min-width: 92px;
  max-width: 110px;
  padding: 7px 26px 7px 10px;
  font-size: 12px;
  background-color: var(--bg-primary);
  font-weight: 600;
  background-position: right 6px center;
  background-size: 12px;
}
/* Container flex per input% + select: garantisce che l'input sia
   sempre visibile e che il select non lo "schiacci" a zero. */
.wizard-asset-row .wizard-rate-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.wizard-asset-row .wizard-rate-row .input-row {
  flex: 1 1 0;
  min-width: 0; /* permette al flex item di restringersi correttamente */
}
.wizard-asset-row.disabled {
  opacity: 0.45;
}
.wizard-asset-row.disabled .input-row { pointer-events: none; }
.wizard-asset-row.enabled {
  border-color: var(--border-strong);
}
.wizard-asset-row .asset-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  min-width: 90px;
}
.wizard-asset-row .wizard-mini-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 3px;
}
.wizard-asset-row .input-row {
  background: var(--bg-primary);
}

/* WIZARD SLIDER */
.wizard-slider-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}
.wizard-slider-row .slider-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.wizard-slider-row .slider-value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 32px;
  color: var(--gold);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.wizard-slider-row .slider-unit {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 6px;
  font-style: italic;
}

/* V4 fix: preset chips per orizzonte (sostituiscono i range-ticks confusi) */
.wizard-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.wizard-chip {
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 18px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.15s ease;
  font-variant-numeric: tabular-nums;
}
.wizard-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--gold);
}
.wizard-chip.active {
  background: var(--gold);
  color: var(--text-on-gold);
  border-color: var(--gold-dark);
  box-shadow: 0 1px 4px rgba(212, 168, 71, 0.3);
}

/* WIZARD SUMMARY (step finale riepilogo) */
.wizard-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.wizard-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
  font-size: 13px;
}
.wizard-summary-row .label {
  color: var(--text-muted);
  font-weight: 500;
}
.wizard-summary-row .value {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.wizard-preview {
  margin-top: 14px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}
.wizard-preview-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px 0;
}
.wizard-preview-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}
.wizard-preview-kpi {
  display: flex;
  flex-direction: column;
}
.wizard-preview-kpi .kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.wizard-preview-kpi .kpi-value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.wizard-preview-kpi .kpi-value.gold { color: var(--gold); }
.wizard-preview-kpi .kpi-value.green { color: var(--green-maxx); }

.wizard-preview-chart {
  position: relative;
  height: 120px;
}

/* FOOTER */
.wizard-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-elevated);
}
.wizard-footer-center {
  display: flex;
  justify-content: center;
}
.wizard-dont-show {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.wizard-dont-show input { cursor: pointer; }

.wizard-back:disabled, .wizard-next:disabled,
#wizardBackBtn:disabled, #wizardNextBtn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* WIZARD VALIDATION ERROR */
.wizard-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 4px solid var(--red-loss);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--red-loss);
}

/* NUDGE banner sotto KPI (prima visita, dopo close del wizard) */
.wizard-nudge {
  background: linear-gradient(90deg, rgba(212, 168, 71, 0.10) 0%, rgba(212, 168, 71, 0.04) 100%);
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  animation: nudgeSlideIn 0.4s ease-out;
}
@keyframes nudgeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wizard-nudge-icon { font-size: 22px; }
.wizard-nudge-text { flex: 1; font-size: 13px; color: var(--text-primary); }
.wizard-nudge-text strong { color: var(--gold); }
.wizard-nudge-actions { display: flex; gap: 8px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
  .settings-bar {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .settings-bar .setting-group:not(:last-child)::after {
    display: none;
  }
  .setting-group-pac {
    max-width: none;
  }
}

@media (max-width: 920px) {
  .container {
    padding: 18px 14px 32px;
  }
  .sidebar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .btn-wizard-side {
    padding: 11px 14px;
    justify-content: center;
  }
  .sidebar-hint {
    display: none; /* su mobile spazio prezioso */
  }
  .disclaimer-inner { max-width: none; }
  .app-header {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px 18px;
  }
  .brand-cobrand, .header-center, .header-actions { justify-self: stretch; }
  .brand-cobrand { flex-wrap: wrap; }
  .header-center { justify-self: center; }
  .header-actions { justify-content: flex-end; flex-wrap: wrap; }
  .lt-logo-img { height: 46px; }
  .brand-divider { height: 44px; }
  .settings-bar { grid-template-columns: 1fr; gap: 14px; }
  .summary-kpis { grid-template-columns: repeat(2, 1fr); }
  .products-grid { grid-template-columns: 1fr; }
  .distribution-body { grid-template-columns: 1fr; }
  .level-body { grid-template-columns: 1fr; }
  .watermark { font-size: 32px; letter-spacing: 6px; }
  .mode-switch-track { width: 180px; }
  .mode-switch-thumb { width: 86px; }
  .mode-switch input:checked + .mode-switch-track .mode-switch-thumb { transform: translateX(88px); }
}

@media (max-width: 540px) {
  .summary-kpis { grid-template-columns: 1fr; }
  .product-fields { grid-template-columns: 1fr; }
  .info-popover { max-width: calc(100vw - 24px); min-width: 0; }
  .kpi-value { font-size: 22px; }
  .brand-divider { display: none; }
  .lt-cobrand-prefix { display: none; }
  .lt-logo-img { height: 38px; }
  .lt-logo-frame { padding: 7px 12px; }
}

/* Wizard responsive (V4) */
@media (max-width: 720px) {
  .wizard-container {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: var(--radius-md);
  }
  .wizard-body { padding: 22px 18px; }
  .wizard-step-title { font-size: 18px; }
  .wizard-header { padding: 12px 14px; grid-template-columns: 1fr auto; }
  .wizard-progress-wrap { grid-column: 1 / -1; }
  .wizard-footer { grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px; }
  .wizard-footer-center { display: none; }
  .wizard-asset-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .wizard-asset-row .asset-name { grid-column: 1 / -1; }
  .wizard-preview-kpis { grid-template-columns: 1fr; gap: 8px; }
}

/* Wizard nascosto in stampa */
@media print {
  .wizard-modal, .wizard-nudge, .btn-wizard, .btn-wizard-side, .sidebar-actions { display: none !important; }
  .guide-modal { display: none !important; }
}

/* ============================================================
   V5 — MODAL "Guida completa al Realismo statistico"
   Stile "documento/articolo" per testo lungo. Backdrop + scroll interno.
   ============================================================ */
.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.guide-modal[hidden] { display: none !important; }

.guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 25, 41, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: guideBackdropIn 0.2s ease-out;
}
@keyframes guideBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.guide-container {
  position: relative;
  width: 100%;
  max-width: 820px;
  max-height: calc(100vh - 48px);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  animation: guideContainerIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes guideContainerIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.guide-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.guide-eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.guide-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
}
.guide-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}
.guide-close:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: rotate(90deg);
}

.guide-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 32px 30px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
  outline: none;
}
.guide-body::-webkit-scrollbar {
  width: 10px;
}
.guide-body::-webkit-scrollbar-track {
  background: transparent;
}
.guide-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
.guide-body::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.guide-lede {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background: rgba(212, 168, 71, 0.08);
  border-left: 4px solid var(--gold);
  padding: 16px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 0 0 24px;
}
body.theme-light .guide-lede {
  background: rgba(184, 134, 43, 0.07);
}

.guide-section {
  margin-bottom: 28px;
}
.guide-section:last-child {
  margin-bottom: 0;
}
.guide-section h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.guide-section p {
  margin: 0 0 12px;
}
.guide-section p:last-of-type {
  margin-bottom: 0;
}
.guide-section strong {
  color: var(--text-primary);
  font-weight: 700;
}

.guide-list {
  margin: 8px 0 12px;
  padding-left: 22px;
}
.guide-list li {
  margin-bottom: 7px;
  line-height: 1.6;
}
.guide-list li::marker {
  color: var(--gold);
}

.guide-example {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.guide-example strong:first-child {
  display: inline-block;
  color: var(--gold);
  margin-right: 4px;
}

.guide-section-summary {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-top: 32px;
}
.guide-section-summary h3 {
  border-bottom: 0;
  padding-bottom: 0;
}
.guide-closing {
  font-style: italic;
  margin-top: 14px !important;
  color: var(--text-secondary);
}

.guide-footer {
  padding: 14px 28px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* V6 — Index "📚 Tutte le guide": griglia di card cliccabili */
.guide-index-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 8px;
}
@media (min-width: 720px) {
  .guide-index-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.guide-index-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: all 0.15s ease;
}
.guide-index-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(212, 168, 71, 0.18);
}
.guide-index-card:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.guide-index-icon {
  font-size: 26px;
  text-align: center;
  line-height: 1;
}
.guide-index-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.guide-index-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.guide-index-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}
.guide-index-arrow {
  font-size: 18px;
  color: var(--gold);
  font-weight: 600;
  transition: transform 0.15s ease;
}
.guide-index-card:hover .guide-index-arrow {
  transform: translateX(3px);
}

/* Responsive */
@media (max-width: 720px) {
  .guide-modal { padding: 12px; }
  .guide-header { padding: 18px 20px 14px; }
  .guide-header h2 { font-size: 22px; }
  .guide-body { padding: 18px 22px 22px; font-size: 13.5px; }
  .guide-section h3 { font-size: 17px; }
  .guide-footer { padding: 12px 20px; }
}

/* ============================================================
   PRINT — Export PDF via window.print()
   ============================================================ */

@media print {
  body {
    background: white !important;
    color: #0a1929 !important;
  }
  .app-header, .header-actions, .header-center,
  .settings-bar, .level-section,
  .info-btn, .toast-container,
  .switch-toggle, .preset-dropdown,
  #warningBox {
    display: none !important;
  }
  .container {
    max-width: 100%;
    padding: 0;
  }
  .brand-cobrand {
    display: flex !important;
    margin-bottom: 16px;
    align-items: center;
    gap: 16px;
  }
  .brand {
    display: flex !important;
  }
  .brand-line-1, .brand-line-2 { color: #0a1929 !important; }
  .brand-divider { background: #ccc !important; }
  .lt-cobrand { display: flex !important; }
  .lt-cobrand-prefix { color: #6b7785 !important; }
  .lt-logo-frame {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .lt-footer-credit { border-top-color: #ccc !important; }
  .lt-footer-prefix { color: #6b7785 !important; }
  .lt-logo-frame-mini {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .summary-card, .chart-card, .distribution-card, .table-card,
  .product-card {
    background: white !important;
    border: 1px solid #ccc !important;
    color: #0a1929 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .summary-card { border-top: 3px solid #d4a847 !important; }
  .kpi-label, .section-header h2, .result-label { color: #6b7785 !important; }
  .kpi-value { color: #0a1929 !important; }
  .kpi-value.gold { color: #b8862b !important; }
  .kpi-value.green { color: #047857 !important; }
  .kpi-value.red { color: #b91c1c !important; }
  .product-name { color: #0a1929 !important; }
  .watermark {
    color: rgba(212, 168, 71, 0.18) !important;
  }
  .results-table thead th {
    background: #f5f0e0 !important;
    color: #8e6720 !important;
  }
  .results-table tbody td {
    border-bottom: 1px solid #ddd !important;
    color: #0a1929 !important;
  }
  .disclaimer {
    background: white !important;
    color: #0a1929 !important;
    page-break-before: always;
  }
}
