/* ============================================
   BASE
   ============================================ */

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: #0a0f1e;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] body {
  background: #0a0f1e;
}

/* --- Background Particles --- */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-particles::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(26, 86, 219, 0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(1deg); }
  66% { transform: translate(-20px, 20px) rotate(-1deg); }
}

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

.app-header {
  position: relative;
  z-index: var(--z-header);
  background: transparent;
  padding: 14px 16px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.header-controls-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.header-tagline {
  width: 100%;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-top: 0;
}

@media (max-width: 640px) {
  .header-logo-wise {
    font-size: 0.85rem;
  }
  .header-logo-text {
    font-size: 1.0rem;
  }
  .header-logo-sep {
    font-size: 0.85rem;
  }
}

.header-logo-img {
  height: 28px;
  width: auto;
  flex-shrink: 0;
  display: none;
}

@media (min-width: 560px) {
  .header-logo-img { display: block; }
}

.header-logo-wise {
  font-size: 1.0rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.header-logo-sep {
  color: var(--color-border);
  font-weight: 300;
}

.header-logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-restart {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.header-restart:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.header-restart.hidden {
  visibility: hidden;
}

/* ============================================
   GLOBAL PROGRESS — WIZARD DOTS (#17)
   ============================================ */

.global-progress {
  position: sticky;
  top: 56px;
  z-index: calc(var(--z-header) - 1);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  display: flex;
  justify-content: center;
}

.global-progress.hidden {
  display: none;
}

.wizard-steps {
  display: flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0;
  max-width: 480px;
  width: 100%;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  position: relative;
}

.wizard-step-connector {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  transition: background 400ms ease;
  min-width: 8px;
  align-self: flex-start;
  margin-top: 15px; /* centro verticale del dot */
}

.wizard-step-connector.done {
  background: var(--color-primary);
}

.wizard-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 300ms ease, background 300ms ease, transform 300ms ease, box-shadow 300ms ease;
  position: relative;
}

.wizard-dot-inner {
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-muted);
  transition: color 300ms ease;
  line-height: 1;
}

.wizard-step-label {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  transition: color 300ms ease;
  text-align: center;
}

/* Step completato */
.wizard-step.done .wizard-dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.wizard-step.done .wizard-dot-inner {
  color: #fff;
  font-size: 0; /* nasconde il numero */
}

.wizard-step.done .wizard-dot-inner::after {
  content: '✓';
  font-size: 12px;
  color: #fff;
}

.wizard-step.done .wizard-step-label {
  color: var(--color-primary);
}

/* Step attivo */
.wizard-step.active .wizard-dot {
  border-color: var(--color-primary);
  background: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(26, 95, 122, 0.15);
  transform: scale(1.1);
}

.wizard-step.active .wizard-dot-inner {
  color: #fff;
}

.wizard-step.active .wizard-step-label {
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

/* Su mobile nascondi le label per risparmiare spazio */
@media (max-width: 380px) {
  .wizard-step-label { display: none; }
  .wizard-dot { width: 26px; height: 26px; }
  .wizard-step-connector { margin-top: 13px; }
}

/* ============================================
   PROGRESS BAR STEP
   ============================================ */

.step-progress {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-2) var(--space-4);
}

.step-progress-track {
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.step-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  transition: width 300ms ease;
}

.step-progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.step-progress-label span:first-child {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

/* Su desktop la global-progress dà già il contesto: nascondiamo la step-progress
   per evitare la doppia barra (vedi TODO_FUTURE #27). */
@media (min-width: 768px) {
  .step-progress {
    display: none;
  }
}

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

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================
   SCREEN / STEP CONTAINER
   ============================================ */

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeSlideIn 250ms ease forwards;
}

.screen.active {
  display: flex;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.screen.leaving {
  animation: fadeSlideOut 200ms ease forwards;
}

/* ============================================
   SCREEN CONTENT
   ============================================ */

.screen-content {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-12);
  flex: 1;
}

.screen-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-2);
}

.screen-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: var(--line-height-relaxed);
}

/* ============================================
   STEP FORM NAVIGATION
   ============================================ */

.step-nav {
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  display: flex;
  gap: var(--space-3);
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

/* Versione full-bleed per footer */
.step-nav-wrapper {
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.step-nav-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  gap: var(--space-3);
}

/* ============================================
   RISULTATI — GRID CARD
   ============================================ */

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.results-grid .card-main {
  grid-column: 1 / -1;
}

@media (min-width: 480px) {
  .results-grid {
    gap: var(--space-4);
  }
}

/* ============================================
   GAUGE BREAKEVEN
   ============================================ */

.gauge-container {
  margin: var(--space-6) 0;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
}

.gauge-current-label {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.gauge-track {
  position: relative;
  height: 24px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: visible;
  margin-bottom: var(--space-3);
}

.gauge-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 600ms ease, background 600ms ease;
  max-width: 100%;
}

.gauge-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 32px;
  background: var(--color-text);
  border-radius: var(--radius-full);
  transform: translateX(-50%);
  transition: left 600ms ease;
}

.gauge-marker-label {
  position: absolute;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.gauge-interpretation {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-medium);
}

.gauge-interpretation.above {
  background: rgba(45, 155, 110, 0.1);
  color: #065f46;
  border: 1px solid rgba(45, 155, 110, 0.2);
}

.gauge-interpretation.close {
  background: rgba(244, 162, 97, 0.1);
  color: #92400e;
  border: 1px solid rgba(244, 162, 97, 0.25);
}

.gauge-interpretation.below {
  background: rgba(230, 57, 70, 0.08);
  color: #991b1b;
  border: 1px solid rgba(230, 57, 70, 0.2);
}

/* ============================================
   SCENARIO TABLE MOBILE
   ============================================ */

.scenario-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.scenario-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 2px solid var(--color-border);
  position: relative;
}

.scenario-card.best {
  border-color: var(--color-success);
  background: rgba(45, 155, 110, 0.03);
}

.scenario-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
}

.scenario-card-title {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);
}

.scenario-card-subtitle {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.explainer-box {
  background: #EBF8FF;
  border: 1px solid #BEE3F8;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  line-height: 1.5;
}

.scenario-card-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.scenario-card-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
}

.scenario-card-row .label {
  color: var(--color-text-muted);
}

.scenario-card-row .value {
  font-weight: var(--font-weight-semibold);
}

.scenario-card-row .value.positive {
  color: var(--color-success);
}

/* ============================================
   PRICING VERDICT
   ============================================ */

.verdict-box {
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  margin-bottom: var(--space-6);
}

.verdict-box.under-priced {
  background: rgba(244, 162, 97, 0.1);
  border: 2px solid rgba(244, 162, 97, 0.3);
}

.verdict-box.balanced {
  background: rgba(45, 155, 110, 0.08);
  border: 2px solid rgba(45, 155, 110, 0.25);
}

.verdict-box.aggressive {
  background: rgba(244, 162, 97, 0.10);
  border: 2px solid rgba(244, 162, 97, 0.35);
}

.verdict-emoji {
  font-size: 40px;
  margin-bottom: var(--space-3);
  line-height: 1;
}

.verdict-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-2);
}

.verdict-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-4);
}

.verdict-suggested {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.verdict-suggested strong {
  font-size: var(--font-size-md);
  color: var(--color-primary);
}

/* ============================================
   REPORT ACTIONS
   ============================================ */

.report-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ============================================
   CTA FINALE
   ============================================ */

.cta-highlight {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  text-align: center;
}

.cta-highlight-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-2);
}

.cta-highlight-label {
  font-size: var(--font-size-sm);
  opacity: 0.85;
}

.cta-or-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.cta-or-divider::before,
.cta-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.cta-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cta-footer-link {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.cta-footer-link a {
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================
   WELCOME SCREEN
   ============================================ */

.welcome-hero {
  text-align: center;
  padding: var(--space-8) var(--space-4) var(--space-6);
}

.welcome-hero-icon {
  font-size: 56px;
  margin-bottom: var(--space-4);
  line-height: 1;
}

.welcome-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin-bottom: var(--space-3);
  line-height: var(--line-height-tight);
}

.welcome-tagline {
  font-size: var(--font-size-lg);
  color: var(--color-text);
  line-height: var(--line-height-relaxed);
  max-width: 400px;
  margin: 0 auto var(--space-4);
  font-weight: 500;
}

.welcome-subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  line-height: var(--line-height-relaxed);
  max-width: 400px;
  margin: 0 auto var(--space-6);
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 360px;
  margin: 0 auto var(--space-8);
  text-align: left;
}

.welcome-feature {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.welcome-feature-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================
   INPUT STEPS
   ============================================ */

.input-step {
  display: none;
}

/* ——— Campi opzionali con toggle ——— */

.optional-field-group {
  border-top: 1px dashed var(--color-border);
  padding-top: var(--space-4);
  margin-top: var(--space-2);
}

.optional-input-wrapper {
  margin-top: var(--space-3);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  margin-top: var(--space-2);
}

.toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-checkbox:checked + .toggle-track {
  background: var(--color-primary);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-checkbox:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

.toggle-checkbox:focus-visible + .toggle-track {
  outline: 3px solid rgba(26, 95, 122, 0.5);
  outline-offset: 2px;
}

.toggle-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

.input-step.active {
  display: block;
  animation: fadeSlideIn 250ms ease forwards;
}

/* ============================================
   LANGUAGE SELECTOR
   ============================================ */

#lang-selector-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  transition: border-color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}

.lang-btn:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

.lang-btn:hover .lang-code,
.lang-btn:hover .lang-arrow {
  color: var(--color-primary);
}

.lang-flag-img {
  display: block;
  width: 24px;
  height: 18px;
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
}

.lang-code {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

/* Bounce leggero al primo caricamento per attirare l'attenzione */
@keyframes langBtnBounce {
  0%, 100% { transform: translateY(0); }
  20%      { transform: translateY(-4px); }
  40%      { transform: translateY(0); }
  60%      { transform: translateY(-2px); }
  80%      { transform: translateY(0); }
}

.lang-btn.lang-btn-attract {
  animation: langBtnBounce 1.2s ease 600ms 1;
}

.lang-arrow {
  font-size: 10px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.lang-dropdown.open ~ * .lang-arrow,
.lang-btn[aria-expanded="true"] .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  min-width: 180px;
  max-height: 320px;
  overflow-y: auto;
  z-index: var(--z-overlay);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.lang-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  transition: background var(--transition-fast);
  border-radius: 0;
}

.lang-option:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.lang-option:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); }

.lang-option:hover {
  background: var(--color-bg);
}

.lang-option.selected {
  background: rgba(26, 95, 122, 0.08);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

.lang-name {
  flex: 1;
}

/* ============================================
   UTILITY
   ============================================ */

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.font-bold { font-weight: var(--font-weight-bold); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.gap-3 { gap: var(--space-3); }

/* Feedback inline copy button */
.copy-feedback {
  display: inline-block;
  font-size: var(--font-size-xs);
  color: var(--color-success);
  margin-left: var(--space-2);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.copy-feedback.visible {
  opacity: 1;
}

/* ——— INFO BOX (disclaimer) ——— */

.info-box {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  background: rgba(46, 134, 171, 0.06);
  border: 1px solid rgba(46, 134, 171, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0 var(--space-5);
  text-align: left;
}

.info-box.info-box-soft {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.info-box p {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-muted);
}

.info-box-icon {
  font-size: 18px;
  line-height: 1.4;
  flex-shrink: 0;
}

/* ——— RADIO GROUP (profilazione lead) ——— */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  font-size: var(--font-size-sm);
}

.radio-option:hover {
  border-color: var(--color-primary-light);
  background: rgba(46, 134, 171, 0.04);
}

.radio-option input[type="radio"] {
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.radio-option:has(input:focus-visible) {
  outline: 3px solid rgba(26, 95, 122, 0.4);
  outline-offset: 1px;
}

.radio-option:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(26, 95, 122, 0.06);
}

/* ——— APP FOOTER LEGALE ——— */

.app-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-8);
  text-align: center;
  background: var(--color-surface);
}

.app-footer p {
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.app-footer a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.app-footer a:hover {
  text-decoration: underline;
}

.footer-sep {
  margin: 0 var(--space-2);
  color: var(--color-border);
}

/* ——— CTA POTENZIATA ——— */

.cta-dynamic-headline {
  text-align: center;
  background: linear-gradient(135deg, rgba(26,95,122,0.06) 0%, rgba(87,197,182,0.08) 100%);
  border: 1px solid rgba(26,95,122,0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  margin-bottom: var(--space-6);
}

.cta-dynamic-amount {
  font-size: var(--font-size-4xl, 48px);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  line-height: 1.1;
}

.cta-dynamic-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  line-height: var(--line-height-relaxed);
}

/* ——— CTA RIEPILOGO NUMERI ——— */

.cta-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.cta-summary-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-2);
  text-align: center;
}

.cta-summary-label {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cta-summary-value {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--color-primary);
}

.cta-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cta-benefits li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.cta-benefit-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.cta-comparison {
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.cta-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.cta-comparison-table th {
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: var(--font-weight-semibold);
}

.cta-comparison-table th:first-child {
  background: var(--color-text-muted);
  border-radius: var(--radius-sm) 0 0 0;
}

.cta-comparison-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.cta-comparison-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.cta-comparison-table tr:nth-child(even) td {
  background: var(--color-bg);
}

.cta-comparison-table td:last-child {
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
}

.cta-social-proof {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: var(--space-5);
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* ——— MARKET HOOK (Pricing screen) ——— */

.market-hook {
  background: rgba(87, 197, 182, 0.08);
  border: 1px solid rgba(87, 197, 182, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.market-hook p {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
}

/* ——— GRAFICO ANNUALE (ROI screen) ——— */

.chart-card {
  padding: var(--space-4) var(--space-4) var(--space-3);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.chart-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11px;
  color: var(--color-text-muted);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-legend-positive { background: var(--color-success); opacity: 0.85; }

.chart-legend-line {
  width: 18px;
  height: 2px;
  background: var(--color-danger);
  opacity: 0.7;
  border-radius: 1px;
  margin-left: var(--space-2);
}

.chart-container svg {
  display: block;
  overflow: visible;
}

/* ——— SELETTORE MESI APERTURA (form step 2) ——— */

.open-months-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.open-months-row .input-select {
  flex: 1;
  min-width: 110px;
}

.open-months-sep {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.open-months-count {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
}

/* ——— WHAT-IF PANEL (ROI screen) ——— */

.whatif-panel {
  margin-top: var(--space-6);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.whatif-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  transition: background var(--transition-fast);
  user-select: none;
}

.whatif-header:hover {
  background: rgba(26,95,122,0.04);
}

.whatif-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.whatif-chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}

.whatif-header[aria-expanded="true"] .whatif-chevron {
  transform: rotate(180deg);
}

.whatif-body {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.whatif-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.whatif-control {
  margin-bottom: var(--space-4);
}

.whatif-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.whatif-value {
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

.whatif-result {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.whatif-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.whatif-result-value {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.whatif-delta-row {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
  margin-top: var(--space-1);
}

.whatif-delta {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
}

.whatif-delta.positive { color: var(--color-success); }
.whatif-delta.negative { color: var(--color-danger); }
.whatif-delta.neutral  { color: var(--color-text-muted); }

/* ——— EMAIL REPORT FORM (Pricing screen) ——— */

.email-report-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.email-report-feedback {
  font-size: var(--font-size-sm);
  text-align: center;
  min-height: 20px;
}

/* ============================================
   ILLUSTRAZIONI SVG SCHERMATE (#14)
   ============================================ */

.screen-illustration {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
  opacity: 0.9;
}

.screen-illustration svg {
  filter: drop-shadow(0 2px 6px rgba(26, 95, 122, 0.15));
}

/* In dark mode schiarisci leggermente le illustrazioni */
[data-theme="dark"] .screen-illustration svg {
  filter: drop-shadow(0 2px 8px rgba(77, 168, 200, 0.2)) brightness(1.15);
}

/* ============================================
   ANIMAZIONI RISULTATI (#11)
   ============================================ */

/* Pulse sul numero principale della card ROI */
@keyframes pulseNumber {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.06); }
  60%  { transform: scale(0.98); }
  100% { transform: scale(1); }
}

.card-value.animate-pop {
  animation: pulseNumber 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Glow verde sulle card di successo dopo il count-up */
@keyframes glowSuccess {
  0%   { box-shadow: var(--shadow-elevated); }
  40%  { box-shadow: 0 0 0 4px rgba(45, 155, 110, 0.25), 0 8px 24px rgba(45, 155, 110, 0.2); }
  100% { box-shadow: var(--shadow-elevated); }
}

.card-success.animate-glow {
  animation: glowSuccess 900ms ease forwards;
}

/* Glow rosso sulle card danger */
@keyframes glowDanger {
  0%   { box-shadow: var(--shadow-elevated); }
  40%  { box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.2), 0 8px 24px rgba(230, 57, 70, 0.15); }
  100% { box-shadow: var(--shadow-elevated); }
}

.card-danger.animate-glow {
  animation: glowDanger 900ms ease forwards;
}

/* ——— CONFETTI (ROI alto > 20%) ——— */

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ============================================
   SKELETON LOADER (#15)
   ============================================ */

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, #f0f4f7 50%, var(--color-border) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-title {
  height: 32px;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton-subtitle {
  height: 14px;
  width: 80%;
  margin-bottom: var(--space-3);
}

.skeleton-btn {
  height: 48px;
  border-radius: var(--radius-full);
  margin-top: var(--space-6);
}

/* Schermata skeleton welcome */
#screen-skeleton {
  display: none;
  flex-direction: column;
  flex: 1;
}

#screen-skeleton.active {
  display: flex;
}

.skeleton-welcome {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

/* ============================================
   ONBOARDING TOOLTIP (#16)
   ============================================ */

.onboarding-coachmark {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 10px);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(26, 95, 122, 0.35);
  animation: coachmarkAppear 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             coachmarkFade 500ms ease 5s forwards;
}

.onboarding-coachmark::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--color-primary);
  border-top: none;
}

@keyframes coachmarkAppear {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes coachmarkFade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Posiziona relativamente il campo con coachmark */
.coachmark-anchor {
  position: relative;
}

/* ============================================
   DARK MODE (#12)
   ============================================ */

[data-theme="dark"] {
  --color-primary: #4DA8C8;
  --color-primary-light: #5BBBD8;
  --color-accent: #57C5B6;
  --color-accent-warm: #F4A261;
  --color-success: #3DBE82;
  --color-danger: #F06370;
  --color-bg: #0F1923;
  --color-surface: #19262F;
  --color-text: #E8EFF5;
  --color-text-muted: #8BA5B5;
  --color-border: #2A3D4A;
  --color-warning: #F4A261;
  --color-info: #4DA8C8;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .global-progress,
[data-theme="dark"] .app-header,
[data-theme="dark"] .step-nav-wrapper {
  border-color: var(--color-border);
}

[data-theme="dark"] .gauge-interpretation.above {
  background: rgba(61, 190, 130, 0.12);
  color: #86efac;
  border-color: rgba(61, 190, 130, 0.25);
}

[data-theme="dark"] .gauge-interpretation.close {
  background: rgba(244, 162, 97, 0.12);
  color: #fed7aa;
  border-color: rgba(244, 162, 97, 0.25);
}

[data-theme="dark"] .gauge-interpretation.below {
  background: rgba(240, 99, 112, 0.12);
  color: #fca5a5;
  border-color: rgba(240, 99, 112, 0.25);
}

[data-theme="dark"] .cta-comparison-table th {
  background: #1A5F7A;
}

[data-theme="dark"] .explainer-box {
  background: rgba(77, 168, 200, 0.1);
  border-color: rgba(77, 168, 200, 0.25);
  color: #a8d8ea;
}

[data-theme="dark"] .info-box {
  background: rgba(77, 168, 200, 0.08);
  border-color: rgba(77, 168, 200, 0.2);
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, #2a3d4a 50%, var(--color-border) 75%);
}

/* Toggle dark mode in header */
.theme-toggle-btn {
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
  transform: rotate(20deg) scale(1.1);
}
