/* ============================================================
   MGM REAL ESTATE OS — Design System v3.0
   Monochrome · Montserrat · Institutional · Swiss Standard
   Palette: #000 / #0a0a0a / #161616 / #1e1e1e / #2a2a2a
            #ffffff / #f5f5f5 / #e8e8e8 / #c8c8c8 / #7f7d7d
   Accent:  #C6A75E (mustard — SOLO grafici e micro-detail)
   ============================================================ */

/* === CSS VARIABLES ======================================== */
:root {
  /* Superfici scure (struttura 25%) */
  --black:          #000000;
  --charcoal:       #0a0a0a;
  --dark-surface:   #161616;
  --mid-surface:    #1e1e1e;
  --border-dark:    #2a2a2a;

  /* Superfici chiare (dominanti 75%) */
  --white:          #ffffff;
  --soft-surface:   #f5f5f5;
  --grey-pale:      #e8e8e8;
  --grey-light:     #c8c8c8;
  --grey-mid:       #7f7d7d;

  /* Testo — contrasti WCAG AA garantiti */
  --text-primary:   #0f0f0f;
  --text-secondary: #3a3a3a;
  --text-muted:     #636363;
  --text-on-dark:   #ffffff;
  --text-on-dark-2: rgba(255,255,255,0.82);
  --text-on-dark-3: rgba(255,255,255,0.50);

  /* Bordi */
  --border-light:   rgba(0,0,0,0.09);
  --border-mid:     rgba(0,0,0,0.14);
  --border-on-dark: rgba(255,255,255,0.08);

  /* Mustard — SOLO grafici e micro-accenti */
  --mustard:        #C6A75E;
  --mustard-light:  #D4B97A;
  --mustard-dark:   #A8893A;
  --mustard-fade:   rgba(198,167,94,0.10);

  /* Alias semantici (compatibilità JS esistente) */
  --nero:           #000000;
  --oro:            #C6A75E;
  --oro-chiaro:     #D4B97A;
  --avorio:         #f5f5f5;

  /* Semaforo — solo dati/tabelle */
  --rosso:          #c0392b;
  --giallo:         #b8860b;
  --verde:          #2e7d32;
  --blu:            #1a4a8a;

  /* Grigio scala alias */
  --grigio-100:     #e8e8e8;
  --grigio-200:     #d0d0d0;
  --grigio-300:     #c8c8c8;
  --grigio-400:     #636363;   /* ≥4.5:1 su bianco — WCAG AA */
  --grigio-500:     #3a3a3a;   /* ≥9:1 su bianco */
  --radius:         0px;       /* ZERO — design squadrato */

  /* Legacy alias (non rimuovere — usati nei JS) */
  --gold:           #C6A75E;
  --gold-light:     #D4B97A;
  --gold-dark:      #7a6030;   /* WCAG AA su bianco: ≥4.6:1 */
  --gold-fade:      rgba(0,0,0,0.04);
  --ivory:          #f5f5f5;
  --ivory-card:     #ffffff;
  --ivory-dark:     #e2e2e2;
  --text-dark:      #0f0f0f;   /* alias → text-primary */
  --text-mid:       #3a3a3a;   /* alias → text-secondary */
  --text-light:     #636363;   /* alias → text-muted, WCAG AA */
  --black-soft:     #161616;
  --black-card:     #1e1e1e;
  --black-border:   rgba(255,255,255,0.08);

  /* Struttura — ZERO: design squadrato istituzionale */
  --radius-sm:      0px;
  --radius-md:      0px;
  --radius-lg:      0px;
  --shadow:         0 1px 8px rgba(0,0,0,0.07);
  --shadow-md:      0 4px 20px rgba(0,0,0,0.10);
  --transition:     180ms ease;

  --sidebar-w:      260px;
  --topbar-h:       56px;   /* altezza topbar contenuto */
  --topbar-full-h:  56px;   /* alias usato in calc() */

  /* Font — SOLO Montserrat */
  --font:           'Montserrat', system-ui, sans-serif;
  --font-display:   'Montserrat', system-ui, sans-serif;
  --font-ui:        'Montserrat', system-ui, sans-serif;
}

/* Classi testo semaforo */
.text-verde  { color: var(--verde); }
.text-rosso  { color: var(--rosso); }
.text-giallo { color: var(--giallo); }

/* === RESET & BASE ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-weight: 400;
  background: var(--soft-surface);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === TOPBAR =============================================== */
.topbar {
  position: fixed;
  top: 0;
  /* inizia DOPO la sidebar, non la copre */
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--black-topbar, #0d0d0d);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-left: 1px solid rgba(255,255,255,0.05);
  z-index: 800;   /* SOTTO la sidebar (z: 900) */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 24px;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* === TOPBAR: IDENTITÀ GESTIONALE ========================= */

/* Blocco nome gestionale — area sinistra fissa */
.topbar-identity {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.07);
  padding-right: 18px;
  margin-right: 18px;
  height: var(--topbar-h);
}

.topbar-system-name {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 1;
}

/* "ATLAS" — nome primario */
.topbar-system-name-primary {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  line-height: 1;
}

/* "RE · Real Estate OS" — sottomodulo */
.topbar-system-name-module {
  font-family: var(--font);
  font-size: 9px;
  font-weight: 500;
  color: rgba(255,255,255,0.38);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  line-height: 1;
  margin-top: 3px;
}

/* Separatore breadcrumb (usato solo se identity è presente) */
.topbar-sep {
  color: rgba(255,255,255,0.14);
  font-size: 10px;
  margin: 0 10px;
  flex-shrink: 0;
}

/* Breadcrumb pagina corrente */
.topbar-breadcrumb-current {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.60);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === TOPBAR: ECOSISTEMA MODULI =========================== */

/* Wrapper chip moduli — centro topbar */
.topbar-ecosystem {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin: 0 auto;  /* centra orizzontalmente tra left e right */
}

/* Singolo chip modulo */
.topbar-module-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.topbar-module-chip i { font-size: 9px; }

/* Chip — modulo ATTIVO (questo gestionale) */
.topbar-module-chip.active {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.16);
  color: var(--white);
}

/* Chip — modulo DISPONIBILE ma non attivo */
.topbar-module-chip.available {
  background: transparent;
  border-color: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.35);
}
.topbar-module-chip.available:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.60);
}

/* Chip — modulo PROSSIMAMENTE (locked) */
.topbar-module-chip.locked {
  background: transparent;
  border-color: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.18);
  cursor: default;
  pointer-events: none;
}
.topbar-module-chip.locked i { opacity: 0.5; }

/* Punto status online/offline */
.topbar-module-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.topbar-module-chip.active   .topbar-module-dot { background: #4ade80; }  /* verde vivo = attivo */
.topbar-module-chip.available .topbar-module-dot { background: rgba(255,255,255,0.18); }
.topbar-module-chip.locked    .topbar-module-dot { display: none; }

/* Divider verticale tra chip */
.topbar-ecosystem-div {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
  margin: 0 2px;
}

/* === TOPBAR: CONTROLLI DESTRA ============================ */

.topbar-title {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 300;
  color: var(--text-on-dark-3);
  letter-spacing: 0.5px;
}

.topbar-island-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-on-dark-3);
  cursor: pointer;
  padding: 5px 12px;
  border: 1px solid var(--border-on-dark);
  transition: var(--transition);
  user-select: none;
  letter-spacing: 0.3px;
}
.topbar-island-selector:hover {
  border-color: rgba(255,255,255,0.2);
  color: var(--text-on-dark-2);
}
.topbar-island-selector i { font-size: 10px; }

/* Logo PNG topbar */
.topbar-logo-img {
  height: 22px;
  width: auto;
  max-width: 90px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  /* Logo nero su bianco → invert per topbar scura */
  filter: brightness(0) invert(1);
  opacity: 0.70;
}

/* Logo PNG onboarding modal */
.onboarding-logo-img {
  height: 52px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
  /* Su sfondo scuro: invert */
  filter: brightness(0) invert(1);
  opacity: 0.90;
  margin-bottom: 22px;
}

/* Hamburger mobile */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-on-dark-3);
  font-size: 15px;
  padding: 4px 8px;
  margin-left: -8px;
}

/* Topbar icon buttons */
.topbar-btn {
  position: relative;
  width: 32px; height: 32px;
  border: 1px solid var(--border-on-dark);
  background: transparent;
  color: var(--text-on-dark-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}
.topbar-btn:hover {
  border-color: rgba(255,255,255,0.22);
  color: var(--text-on-dark-2);
}

.topbar-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--charcoal);
  color: var(--text-on-dark);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font);
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid var(--mid-surface);
}

/* Primary add button */
.btn-topbar-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--white);
  color: var(--charcoal);
  border: none;
  padding: 7px 16px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-topbar-add:hover {
  background: var(--grey-pale);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* === SIDEBAR ============================================== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark-surface);
  border-right: 1px solid var(--border-on-dark);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}

/* ── SIDEBAR BRAND ─────────────────────────────────────────
   Layout: tutto centrato verticalmente e orizzontalmente.
   Riga 1: [Logo] [separatore verticale] [ATLAS RE]
   Riga 2: payoff centrato sotto, larghezza max = riga 1
   ────────────────────────────────────────────────────────── */
.sidebar-brand {
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;          /* centra orizzontalmente tutto */
  justify-content: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* Riga superiore: logo + divisore + nome — tutti centrati verticalmente */
.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;                       /* gap gestito da padding divisore */
}

/* Logo PNG — invertito per sfondo scuro */
.sidebar-logo-img {
  height: 26px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  object-position: center;
  display: block;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
  opacity: 0.90;
}

/* Divisore verticale tra logo e nome — elegante, proporzionato */
.sidebar-brand-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.14);
  margin: 0 13px;
  flex-shrink: 0;
}

/* Nome ATLAS RE — affiancato al logo, stessa altezza ottica */
.sidebar-atlas-name {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,0.82);
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Payoff — 2 righe centrate sotto la coppia logo/nome */
.sidebar-atlas-sub {
  font-family: var(--font);
  font-size: 8px;
  font-weight: 400;
  color: rgba(255,255,255,0.42);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  line-height: 1.55;
  text-align: center;
  white-space: normal;
  max-width: 180px;             /* forza il wrap entro la sidebar */
  word-break: break-word;
}

/* Fallback legacy */
.sidebar-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  object-position: left center;
  filter: brightness(0) invert(1);
  display: block;
}
.sidebar-tagline {
  font-size: 10px;
  font-weight: 300;
  color: var(--text-on-dark-3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}
/* Rimuovi vecchia mgm-logo-text (sostituita da sidebar-atlas-tag) */
.mgm-logo-text { display: none; }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 8px 0 8px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.18);
  padding: 16px 20px 4px;
  pointer-events: none;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin: 1px 8px;
  font-size: 12.5px;
  font-weight: 400;
  font-family: var(--font);
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  border-left: 2px solid transparent;
  letter-spacing: 0.1px;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.80);
}
.nav-item.active {
  background: rgba(255,255,255,0.07);
  color: var(--white);
  border-left-color: var(--white);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--white); }

.nav-icon {
  font-size: 13px;
  min-width: 16px;
  text-align: center;
  color: rgba(255,255,255,0.28);
  flex-shrink: 0;
  transition: var(--transition);
}
.nav-item:hover .nav-icon { color: rgba(255,255,255,0.60); }

.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.70);
  font-size: 9px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-family: var(--font);
}

.nav-divider {
  height: 1px;
  background: var(--border-on-dark);
  margin: 6px 14px;
}

/* Sidebar footer / user */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-on-dark);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--mid-surface);
  border: 1px solid var(--border-on-dark);
  color: rgba(255,255,255,0.70);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 600;
  flex-shrink: 0;
}
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.80);
  font-family: var(--font);
}
.user-role {
  font-size: 10px;
  font-weight: 300;
  color: var(--text-on-dark-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

/* === MAIN CONTENT ========================================= */
.main-content {
  margin-left: var(--sidebar-w);   /* non finire sotto la sidebar */
  padding-top: var(--topbar-h);    /* non finire sotto la topbar */
  min-height: 100vh;
  background: var(--soft-surface);
  /* nessun overflow:hidden — altrimenti blocca lo scroll orizzontale delle tabelle */
}

.page-content {
  padding: 32px;
}

/* === PAGE HEADER ========================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 28px;
}

.page-header-left h1,
.page-title {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font);
  letter-spacing: 0.1px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* === KPI CARDS (legacy flat pattern support) ============= */
/* Supporta sia il pattern nuovo (kpi-icon-wrap + kpi-info)
   sia il pattern legacy flat (kpi-icon + kpi-label + kpi-value) */
.kpi-card .kpi-icon {
  font-size: 22px;
  color: var(--grey-mid);
  flex-shrink: 0;
  min-width: 28px;
  text-align: center;
}
.kpi-card.kpi-gold .kpi-icon { color: var(--mustard-dark); }
.kpi-card.kpi-verde .kpi-icon,
.kpi-card.kpi-green .kpi-icon { color: var(--verde); }
.kpi-card.kpi-rosso .kpi-icon,
.kpi-card.kpi-red .kpi-icon   { color: var(--rosso); }

/* Quando il pattern legacy è usato senza kpi-info wrapper */
.kpi-card > .kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
  min-width: 0;
}
.kpi-card > .kpi-value {
  font-family: var(--font);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-left: auto;
  white-space: nowrap;
}
.kpi-card > .kpi-delta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0;
}

/* === KPI CARDS =========================================== */
.kpi-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-6 { grid-template-columns: repeat(6, 1fr); }
.kpi-grid-auto { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.kpi-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: default;
}
.kpi-card:hover {
  border-color: var(--grey-light);
  box-shadow: var(--shadow-md);
}

.kpi-icon-wrap {
  width: 40px; height: 40px;
  background: var(--soft-surface);
  color: var(--grey-mid);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}
.kpi-icon-wrap.alert {
  background: rgba(192,57,43,0.06);
  color: var(--rosso);
  border-color: rgba(192,57,43,0.14);
}
.kpi-icon-wrap.success {
  background: rgba(46,125,50,0.07);
  color: var(--verde);
  border-color: rgba(46,125,50,0.14);
}

.kpi-info { flex: 1; min-width: 0; }

.kpi-value {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value.alert-val { color: var(--rosso); }
.kpi-value.gold-val  { color: var(--mustard-dark); }
.kpi-value.green-val { color: var(--verde); }

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-delta {
  font-size: 11px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  color: var(--text-muted);
}
.kpi-delta.up   { color: var(--verde); }
.kpi-delta.down { color: var(--rosso); }

/* === BUTTONS ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

/* Primary — nero */
.btn-gold,
.btn-primary {
  background: var(--charcoal);
  color: var(--white);
  border-color: var(--charcoal);
  padding: 10px 22px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.btn-gold:hover,
.btn-primary:hover {
  background: var(--dark-surface);
  border-color: var(--dark-surface);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Danger */
.btn-danger {
  background: var(--rosso);
  color: #fff;
  border-color: var(--rosso);
}
.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
  transform: translateY(-1px);
}

/* Ghost / outline */
.btn-outline,
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--grey-light);
  padding: 10px 22px;
  font-size: 12.5px;
  font-weight: 500;
}
.btn-outline:hover,
.btn-ghost:hover {
  border-color: var(--grey-mid);
  color: var(--text-primary);
  background: var(--soft-surface);
}

/* Dark (su sfondo scuro) */
.btn-dark {
  background: var(--white);
  color: var(--charcoal);
  border-color: var(--white);
  padding: 10px 22px;
  font-size: 12.5px;
  font-weight: 600;
}
.btn-dark:hover {
  background: var(--grey-pale);
  border-color: var(--grey-pale);
}

/* Small */
.btn-sm {
  padding: 6px 14px;
  font-size: 11.5px;
}

/* Icon button */
.btn-icon {
  width: 32px; height: 32px;
  border: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}
.btn-icon:hover {
  border-color: var(--grey-mid);
  color: var(--text-primary);
  background: var(--soft-surface);
}
.btn-icon.danger:hover {
  border-color: var(--rosso);
  color: var(--rosso);
  background: rgba(192,57,43,0.05);
}

/* === CARD ================================================= */
.card {
  background: var(--white);
  border: 1px solid var(--border-light);
  /* NON usare overflow:clip/hidden — blocca lo scroll orizzontale dei figli .table-scroll */
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.1px;
}

.card-body {
  padding: 20px 22px;
}

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Card header scuro */
.card-dark-header .card-header {
  background: var(--dark-surface);
  border-bottom: 1px solid var(--border-on-dark);
}
.card-dark-header .card-title { color: rgba(255,255,255,0.85); }

/* === GRID LAYOUTS ======================================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-7-5 { display: grid; grid-template-columns: 7fr 5fr; gap: 20px; }
.grid-6-6 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* === SPACING UTILITIES ==================================== */
.mb-4  { margin-bottom:  4px; }
.mb-8  { margin-bottom:  8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-28 { margin-bottom: 28px; }
.mb-32 { margin-bottom: 32px; }
.mt-8  { margin-top:  8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

/* === TABLE ================================================ */
.table-scroll {
  display: block;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}
.table-scroll::-webkit-scrollbar { height: 5px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--grey-pale); border-radius: 3px; }
.table-scroll table {
  width: 100%;
  min-width: 600px;   /* soglia ridotta — le tabelle compatte non scorrono su schermi medi */
}

.table-container {
  background: var(--white);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: var(--font);
}

thead th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--soft-surface);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-mid);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--soft-surface); }

.td-muted  { color: var(--text-muted); font-size: 12px; }
.td-gold   { color: var(--mustard-dark); font-weight: 600; }
.td-strong { font-weight: 700; }
.td-mono   { font-family: 'Montserrat', monospace; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.3px; }
.td-label  { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; padding-right: 16px !important; }

/* Tabella dettaglio (2 colonne: label + valore) */
.detail-table { border-collapse: collapse; }
.detail-table tr { border-bottom: 1px solid var(--border-light); }
.detail-table tr:last-child { border-bottom: none; }
.detail-table td { padding: 7px 4px; font-size: 12.5px; }

/* ── Piano Pagamenti SAL / Personalizzato ─────────────────── */
.sal-tab-bar {
  display: flex;
  gap: 0;
  background: var(--soft-surface);
  border: 1px solid var(--border-light);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}
.sal-tab {
  flex: 1;
  padding: 9px 14px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  border-right: 1px solid var(--border-light);
}
.sal-tab:last-child { border-right: none; }
.sal-tab:hover { background: rgba(0,0,0,0.04); color: var(--text-primary); }
.sal-tab.active {
  background: var(--mustard);
  color: #fff;
  font-weight: 700;
}
.sal-tab.active i { color: #fff; }
/* panel sotto i tab SAL */
.sal-panel {
  display: none;
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: var(--white);
  padding: 16px;
}
.sal-panel.active { display: block; }
/* tabella rate */
.sal-rate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.sal-rate-table th {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
  background: var(--soft-surface);
}
.sal-rate-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.sal-rate-table tr:last-child td { border-bottom: none; }
.sal-rate-table tr.pagata-row { background: rgba(76,175,80,0.04); }
.sal-rate-table td input,
.sal-rate-table td select {
  width: 100%;
  padding: 4px 7px;
  font-family: var(--font);
  font-size: 12px;
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  background: var(--white);
  color: var(--text-primary);
  min-width: 70px;
}
.sal-rate-table td input[type="checkbox"] {
  width: auto;
  min-width: unset;
  accent-color: var(--verde);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
/* badge rata pagata */
.sal-rata-pagata {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--verde);
  background: rgba(76,175,80,0.10);
  padding: 2px 7px;
  border-radius: 10px;
}
/* totale summary sotto la tabella rate */
.sal-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--soft-surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 8px 14px;
  margin-top: 10px;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.sal-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.sal-summary-item .sal-s-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.sal-summary-item .sal-s-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.sal-summary-item .sal-s-value.ok { color: var(--verde); }
.sal-summary-item .sal-s-value.warn { color: var(--orange); }
/* barra avanzamento incasso */
.sal-progress-wrap {
  background: var(--grey-pale);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  flex: 1;
  min-width: 60px;
}
.sal-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--verde), var(--mustard));
  transition: width 0.3s ease;
}
/* pulsante aggiungi rata (personalizzato) */
.sal-add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mustard-dark);
  background: rgba(198,167,94,0.10);
  border: 1px dashed var(--mustard);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}
.sal-add-row-btn:hover {
  background: rgba(198,167,94,0.20);
}
/* hint sotto la barra tab sal */
.sal-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  margin: 6px 0 10px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
/* read-only view rate nel dettaglio */
.sal-det-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.sal-det-table th {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 5px 8px;
  border-bottom: 2px solid var(--border-light);
  background: var(--soft-surface);
  white-space: nowrap;
}
.sal-det-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.sal-det-table tr:last-child td { border-bottom: none; }
.sal-det-table tr.pagata td { background: rgba(76,175,80,0.04); }

/* === BADGES ============================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.badge-green,
.badge-verde  { background: rgba(46,125,50,0.09);   color: var(--verde); }
.badge-red,
.badge-rosso  { background: rgba(192,57,43,0.09);   color: var(--rosso); }
.badge-orange,
.badge-giallo { background: rgba(184,134,11,0.10);  color: var(--giallo); }
.badge-blue,
.badge-blu    { background: rgba(26,74,138,0.09);   color: var(--blu); }
.badge-grey,
.badge-grigio { background: rgba(0,0,0,0.06);       color: var(--text-secondary); }
.badge-gold,
.badge-oro    { background: rgba(198,167,94,0.12);  color: var(--mustard-dark); }
.badge-black,
.badge-nero   { background: var(--charcoal);        color: rgba(255,255,255,0.75); }

/* Semaforo dot */
.semaforo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 400;
  font-family: var(--font);
}
.semaforo-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.semaforo-verde  .semaforo-dot  { background: var(--verde); }
.semaforo-giallo .semaforo-dot  { background: var(--giallo); }
.semaforo-rosso  .semaforo-dot  { background: var(--rosso); }
.semaforo-verde  { color: var(--verde); }
.semaforo-giallo { color: var(--giallo); }
.semaforo-rosso  { color: var(--rosso); }

/* === PROGRESS BAR ======================================== */
.progress-bar-wrap {
  width: 100%;
  background: var(--grey-pale);
  height: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--charcoal);
  transition: width 0.5s ease;
}
.progress-bar.pb-green { background: var(--verde); }
.progress-bar.pb-red   { background: var(--rosso); }
.progress-bar.pb-blue  { background: var(--blu); }
.progress-bar.pb-gold  { background: var(--mustard); }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-family: var(--font);
  font-weight: 500;
}

/* === FORM ================================================= */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  font-family: var(--font);
}
.form-label .req { color: var(--rosso); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
  background: var(--white);
  border: 1px solid var(--border-mid);
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  box-sizing: border-box;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--oro);
  box-shadow: 0 0 0 3px rgba(198,167,94,0.12);
}
.form-input::placeholder { color: var(--grigio-300); font-size: 12px; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: auto; cursor: pointer; }

/* Grids */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0 14px; }
.form-grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 0 16px; }
.form-grid-1-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 0 16px; }

/* Full-width inside grid */
.form-group.full-width { grid-column: 1 / -1; }

.form-section-title {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--oro-dark);
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border-light);
  margin: 12px 0 16px;
}

/* Hint testo sotto un campo */
.form-hint {
  font-size: 11px;
  color: var(--grigio-300);
  margin-top: -10px;
  margin-bottom: 8px;
}

/* === DOPPIA VALUTA — EUR / CVE =========================== */

/* Display doppia valuta (visualizzazione) */
.curr-dual {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.curr-primary {
  font-size: 13.5px;
  font-weight: 700;
  color: inherit;
}
.curr-secondary {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}
.curr-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.curr-cve-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.curr-empty {
  color: var(--text-muted);
}

/* Badge tasso cambio */
.curr-rate-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--soft-surface);
  border: 1px solid var(--border-light);
  padding: 3px 8px;
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Widget input doppia valuta */
.curr-input-group {
  /* estende .form-group */
}
.curr-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-mid);
  background: var(--white);
  transition: border-color 0.18s, box-shadow 0.18s;
  overflow: hidden;
}
.curr-input-wrap:focus-within {
  border-color: var(--oro);
  box-shadow: 0 0 0 3px rgba(198,167,94,0.12);
}
.curr-toggle {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  flex-shrink: 0;
}
.curr-btn {
  flex: 1;
  padding: 0 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--soft-surface);
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.14s, color 0.14s;
  line-height: 1;
  font-family: var(--font);
  text-transform: uppercase;
}
.curr-btn:hover {
  background: var(--grey-pale);
  color: var(--text-primary);
}
.curr-btn.active {
  background: var(--charcoal);
  color: #fff;
}
.curr-btn-eur.active {
  background: var(--charcoal);
}
.curr-btn-cve.active {
  background: var(--mustard-dark);
  color: #fff;
}
.curr-input.form-input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  flex: 1;
  min-width: 0;
  /* rimuove l'outline al focus (gestito dal wrapper) */
  outline: none !important;
}
/* Hint conversione live */
.curr-hint {
  font-size: 10.5px;
  color: var(--mustard-dark);
  min-height: 16px;
  margin-top: 4px;
  font-weight: 500;
  transition: opacity 0.2s;
}

/* Colori contestuali su .curr-dual */
.curr-dual.positive .curr-primary { color: var(--verde, #2e7d32); }
.curr-dual.negative .curr-primary { color: var(--rosso, #c0392b); }
.curr-dual.gold     .curr-primary { color: var(--mustard-dark); }

/* Riga tasso in header tesoreria */
.treasury-rate-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--soft-surface);
  border-bottom: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-muted);
}

/* === PERMITTING — Upload documenti allegati ============== */

/* Zona drop / upload */
.perm-upload-zone {
  border: 1.5px dashed var(--grey-light);
  border-radius: 3px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  background: var(--soft-surface);
}
.perm-upload-zone:hover {
  border-color: var(--mustard);
  background: var(--mustard-fade);
}
.perm-upload-zone input[type="file"] {
  display: none;
}
.perm-upload-zone .perm-upload-label {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.3;
}
.perm-upload-zone .perm-upload-label strong {
  color: var(--mustard-dark);
}

/* Lista file allegati */
.perm-doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.perm-doc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  transition: border-color 0.15s;
}
.perm-doc-row:hover {
  border-color: var(--grey-light);
}
.perm-doc-icon {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}
.perm-doc-icon.pdf   { background: rgba(198,0,0,0.08);   color: #c00; }
.perm-doc-icon.word  { background: rgba(0,83,163,0.08);  color: #0053a3; }
.perm-doc-icon.excel { background: rgba(0,122,61,0.08);  color: #007a3d; }
.perm-doc-icon.img   { background: rgba(0,0,0,0.06);     color: var(--grey-mid); }
.perm-doc-icon.other { background: var(--soft-surface);  color: var(--grey-mid); }

.perm-doc-info {
  flex: 1;
  min-width: 0;
}
.perm-doc-nome {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark, var(--text-primary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perm-doc-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.perm-doc-scad {
  font-size: 10.5px;
  color: var(--text-muted);
}
.perm-doc-scad.scad-alert {
  color: #c0392b;
  font-weight: 600;
}
.perm-doc-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Pannello allegati all'interno di una riga/card */
.perm-attach-panel {
  background: var(--soft-surface);
  border-top: 1px solid var(--border-light);
  padding: 12px 16px;
}
.perm-attach-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.perm-attach-count {
  background: var(--mustard);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 6px;
  letter-spacing: 0;
}

/* === MODAL ================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-container {
  background: var(--white);
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  animation: modalIn 200ms ease;
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.modal-container.modal-lg { max-width: 780px; }
.modal-container.modal-xl { max-width: 960px; }

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

.modal-header {
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: var(--soft-surface);
}
.modal-title {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

.modal-close {
  width: 30px; height: 30px;
  border: 1px solid var(--border-mid);
  background: var(--white);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition);
  flex-shrink: 0;
}
.modal-close:hover {
  border-color: var(--rosso);
  color: var(--rosso);
  background: rgba(192,57,43,0.04);
}

.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--soft-surface);
}

/* === TOAST ================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--charcoal);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 400;
  color: rgba(255,255,255,0.9);
  animation: slideInRight 280ms ease;
}

.toast-icon { font-size: 14px; flex-shrink: 0; }
.toast.toast-success .toast-icon { color: var(--mustard); }
.toast.toast-error   .toast-icon { color: #e05050; }
.toast.toast-warning .toast-icon { color: var(--mustard); }
.toast.toast-default .toast-icon { color: var(--grey-light); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* === FILTER BAR ========================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.filter-search i {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}
.filter-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border-mid);
  background: var(--white);
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.filter-search input:focus { border-color: var(--grey-mid); }
.filter-search input::placeholder { color: var(--text-muted); }

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border-mid);
  background: var(--white);
  font-family: var(--font);
  font-size: 12px;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--grey-mid); }

/* === ALERT BOX =========================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  font-size: 12.5px;
  font-family: var(--font);
  font-weight: 400;
  margin-bottom: 12px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert i { font-size: 13px; margin-top: 1px; flex-shrink: 0; }
.alert-verde  { background: rgba(46,125,50,0.07);  color: var(--verde); border-color: rgba(46,125,50,0.15); }
.alert-giallo { background: rgba(184,134,11,0.07); color: var(--giallo); border-color: rgba(184,134,11,0.15); }
.alert-rosso  { background: rgba(192,57,43,0.07);  color: var(--rosso); border-color: rgba(192,57,43,0.15); }
.alert-blu    { background: rgba(26,74,138,0.07);  color: var(--blu); border-color: rgba(26,74,138,0.15); }
.alert-gold   { background: var(--mustard-fade);   color: var(--mustard-dark); border-color: rgba(198,167,94,0.20); }

/* === TABS ================================================= */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-mid);
  margin-bottom: 24px;
  gap: 0;
}
.tab {
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.2px;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--charcoal);
  font-weight: 700;
}

/* === EMPTY STATE ========================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
}
.empty-state i {
  font-size: 2rem;
  color: var(--grey-light);
  margin-bottom: 16px;
}
.empty-state-title {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state-text {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.6;
}

/* === LOADING ============================================= */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--grey-pale);
  border-top-color: var(--charcoal);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === QUICKNAV STRIP (dashboard) ========================= */
.quicknav-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.quicknav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--white);
  border: 1px solid var(--border-mid);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}
.quicknav-item i {
  font-size: 11px;
  color: var(--text-muted);
  transition: var(--transition);
}
.quicknav-item:hover {
  border-color: var(--grey-mid);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.quicknav-item:hover i { color: var(--text-secondary); }

/* === DASHBOARD =========================================== */
.dashboard-welcome {
  background: var(--charcoal);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.dashboard-welcome::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 65%);
  pointer-events: none;
}
.dashboard-welcome h1 {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}
.dashboard-welcome h1 span { color: var(--mustard); }
.dashboard-welcome p {
  font-size: 12px;
  color: var(--text-on-dark-3);
  font-weight: 300;
}
.welcome-date-day {
  font-family: var(--font);
  font-size: 44px;
  font-weight: 200;
  color: rgba(255,255,255,0.15);
  line-height: 1;
}
.welcome-date-rest {
  font-size: 10px;
  color: var(--text-on-dark-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
  text-align: right;
}

/* Alert strip */
.alert-strip {
  background: var(--white);
  border: 1px solid var(--border-light);
  padding: 0;
  display: flex;
  align-items: stretch;
  margin-bottom: 24px;
  overflow: hidden;
}
.alert-strip-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding: 18px 22px;
}
.alert-strip-icon {
  width: 34px; height: 34px;
  background: var(--soft-surface);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--grey-mid);
  flex-shrink: 0;
}
.alert-strip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 3px;
  font-family: var(--font);
  font-weight: 600;
}
.alert-strip-value {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.alert-strip-divider {
  width: 1px;
  background: var(--border-light);
  flex-shrink: 0;
}

/* Project row card */
.project-row-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 8px 2.5fr 1fr 1fr 1fr 1fr 90px;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
  margin-bottom: 8px;
}
.project-row-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--grey-light);
}

/* Treasury band */
.treasury-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-light);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
}
.treasury-cell {
  background: var(--white);
  padding: 18px 20px;
  text-align: center;
}
.treasury-cell-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-family: var(--font);
  font-weight: 600;
}
.treasury-cell-value {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
}
.treasury-positive { color: var(--verde); }
.treasury-negative { color: var(--rosso); }
.treasury-neutral  { color: var(--text-primary); }

/* SPV Card */
.spv-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  padding: 20px;
  transition: box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}
.spv-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--grey-light);
}
.spv-card-name {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}
.spv-card-type {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-top: 2px;
  font-weight: 400;
}
.spv-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}
.spv-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  font-family: var(--font);
  font-weight: 600;
}
.spv-stat-value {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Island badge */
.island-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font);
}
.island-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--grey-mid);
}

/* Isole grid */
.isole-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.isola-item {
  background: var(--mid-surface);
  border: 1px solid var(--border-on-dark);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.isola-item:hover {
  background: var(--border-dark);
  border-color: rgba(255,255,255,0.14);
}
.isola-nome { font-size: 11px; color: rgba(255,255,255,0.55); font-family: var(--font); font-weight: 500; }
.isola-count {
  font-family: var(--font);
  font-size: 18px;
  color: var(--white);
  font-weight: 700;
}

/* Value box */
.value-box {
  background: var(--soft-surface);
  padding: 12px 16px;
  border-left: 2px solid var(--charcoal);
  border: 1px solid var(--border-light);
}
.value-box-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-family: var(--font);
  font-weight: 600;
}
.value-box-value {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* NIF badge */
.nif-badge {
  font-family: monospace;
  font-size: 12px;
  background: var(--grey-pale);
  color: var(--text-secondary);
  padding: 2px 8px;
  letter-spacing: 1px;
  display: inline-block;
  border: 1px solid var(--border-mid);
}

/* Action row */
.action-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 20px 0;
}

/* Misc text */
.text-gold   { color: var(--mustard-dark); }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }

/* === SCROLLBAR =========================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-pale); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-light); }

/* ============================================================
   ONBOARDING MODAL
   ============================================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(10px);
  z-index: 19999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInBg 350ms ease;
}
@keyframes fadeInBg {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.onboarding-card {
  background: var(--white);
  width: 100%;
  max-width: 640px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55);
  overflow: hidden;
  animation: slideUpIn 360ms cubic-bezier(0.22,0.9,0.36,1);
  border: 1px solid var(--border-light);
}
@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-hero {
  background: var(--dark-surface);
  padding: 40px 44px 36px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-on-dark);
}
.onboarding-hero::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 65%);
  pointer-events: none;
}

.onboarding-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  margin-bottom: 22px;
  display: block;
}
.onboarding-headline {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.4px;
}
.onboarding-headline span { color: var(--mustard); }
.onboarding-sub {
  font-size: 12.5px;
  color: var(--text-on-dark-3);
  font-weight: 300;
  letter-spacing: 0.2px;
}

.onboarding-body {
  padding: 32px 44px 36px;
}

.onboarding-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
.onboarding-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.onboarding-feature-icon {
  width: 32px; height: 32px;
  background: var(--soft-surface);
  color: var(--grey-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}
.onboarding-feature-text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  font-family: var(--font);
}
.onboarding-feature-text span {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.onboarding-cta {
  display: flex;
  gap: 10px;
  align-items: center;
}
.onboarding-cta .btn-gold {
  flex: 1;
  justify-content: center;
  padding: 13px 24px;
  font-size: 13.5px;
}
.onboarding-cta-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  font-family: var(--font);
}
.onboarding-link {
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  padding: 13px 18px;
  white-space: nowrap;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-mid);
  font-family: var(--font);
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
}
.onboarding-link:hover {
  border-color: var(--grey-mid);
  color: var(--text-primary);
  background: var(--soft-surface);
}

/* ============================================================
   DEMO BANNER
   ============================================================ */
.demo-banner {
  background: var(--dark-surface);
  border-bottom: 1px solid var(--border-on-dark);
  padding: 8px 24px 8px calc(var(--sidebar-w) + 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--text-on-dark-3);
  font-family: var(--font);
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  z-index: 800;
  animation: slideDownBanner 380ms ease;
}
@keyframes slideDownBanner {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.demo-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.demo-banner-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--mustard);
  animation: demoPulse 2s ease-in-out infinite;
}
@keyframes demoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.demo-banner em {
  font-style: normal;
  color: var(--mustard);
  font-weight: 600;
}
.demo-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.demo-banner-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.14);
  background: transparent;
  color: rgba(255,255,255,0.65);
  font-family: var(--font);
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.demo-banner-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--white);
}
.demo-banner-dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.22);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  transition: color var(--transition);
}
.demo-banner-dismiss:hover { color: rgba(255,255,255,0.55); }

/* Offset content quando demo banner visibile */
.main-content.with-demo-banner {
  padding-top: calc(var(--topbar-h) + 36px);
}
@media (max-width: 900px) {
  .demo-banner {
    padding-left: 20px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .main-content.with-demo-banner {
    padding-top: calc(var(--topbar-h) + 60px);
  }
}

/* ============================================================
   HELP CHIP (topbar)
   ============================================================ */
.topbar-help-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-on-dark-3);
  font-family: var(--font);
  padding: 4px 11px;
  border: 1px solid var(--border-on-dark);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.3px;
}
.topbar-help-chip:hover {
  border-color: rgba(255,255,255,0.20);
  color: var(--text-on-dark-2);
}
.topbar-help-chip i { font-size: 10px; }

/* ============================================================
   KPI VARIANTS
   ============================================================ */
/* KPI dark (hero) */
.kpi-card.kpi-dark {
  background: var(--dark-surface);
  border-color: var(--border-on-dark);
}
.kpi-card.kpi-dark .kpi-label { color: var(--text-on-dark-3); }
.kpi-card.kpi-dark .kpi-value { color: rgba(255,255,255,0.92); }
.kpi-card.kpi-dark .kpi-delta { color: var(--text-on-dark-3); }
.kpi-card.kpi-dark .kpi-icon-wrap {
  background: rgba(255,255,255,0.06);
  color: var(--grey-light);
  border-color: var(--border-on-dark);
}

/* KPI gold — mustard accent */
.kpi-card.kpi-gold {
  background: var(--dark-surface);
  border-color: rgba(198,167,94,0.18);
}
.kpi-card.kpi-gold .kpi-value { color: var(--mustard); }
.kpi-card.kpi-gold .kpi-label { color: var(--text-on-dark-3); }
.kpi-card.kpi-gold .kpi-icon { color: var(--mustard); font-size: 18px; margin-bottom: 6px; display: block; }
.kpi-card.kpi-gold .kpi-delta { color: var(--text-on-dark-3); }

/* KPI verde */
.kpi-card.kpi-verde {
  border-color: rgba(46,125,50,0.18);
}
.kpi-card.kpi-verde .kpi-icon { color: var(--verde); font-size: 18px; margin-bottom: 6px; display: block; }
.kpi-card.kpi-verde .kpi-value { color: var(--verde); }
.kpi-card.kpi-verde .kpi-icon-wrap { background: rgba(46,125,50,0.07); color: var(--verde); border-color: rgba(46,125,50,0.14); }

/* KPI giallo */
.kpi-card.kpi-giallo {
  border-color: rgba(184,134,11,0.18);
}
.kpi-card.kpi-giallo .kpi-icon { color: var(--giallo); font-size: 18px; margin-bottom: 6px; display: block; }
.kpi-card.kpi-giallo .kpi-value { color: var(--giallo); }
.kpi-card.kpi-giallo .kpi-icon-wrap { background: rgba(184,134,11,0.08); color: var(--giallo); border-color: rgba(184,134,11,0.14); }

/* KPI rosso */
.kpi-card.kpi-rosso {
  border-color: rgba(192,57,43,0.18);
}
.kpi-card.kpi-rosso .kpi-icon { color: var(--rosso); font-size: 18px; margin-bottom: 6px; display: block; }
.kpi-card.kpi-rosso .kpi-value { color: var(--rosso); }
.kpi-card.kpi-rosso .kpi-icon-wrap { background: rgba(192,57,43,0.06); color: var(--rosso); border-color: rgba(192,57,43,0.14); }

/* KPI blu */
.kpi-card.kpi-blu {
  border-color: rgba(26,74,138,0.18);
}
.kpi-card.kpi-blu .kpi-icon { color: var(--blu); font-size: 18px; margin-bottom: 6px; display: block; }
.kpi-card.kpi-blu .kpi-value { color: var(--blu); }
.kpi-card.kpi-blu .kpi-icon-wrap { background: rgba(26,74,138,0.08); color: var(--blu); border-color: rgba(26,74,138,0.14); }

/* Legacy kpi-icon generico */
.kpi-card .kpi-icon { font-size: 18px; color: var(--grey-mid); margin-bottom: 6px; }

/* ============================================================
   CALENDARIO URGENZE MINI
   ============================================================ */
.urgency-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.urgency-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--soft-surface);
  border-left: 2px solid var(--grey-pale);
  transition: var(--transition);
}
.urgency-row.scaduta  { border-left-color: var(--rosso); background: rgba(192,57,43,0.04); }
.urgency-row.urgente  { border-left-color: var(--giallo); background: rgba(184,134,11,0.04); }
.urgency-row.prossima { border-left-color: var(--grey-mid); }
.urgency-row-date {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 55px;
  font-family: var(--font);
}
.urgency-row.scaduta  .urgency-row-date { color: var(--rosso); }
.urgency-row.urgente  .urgency-row-date { color: var(--giallo); }
.urgency-row-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.urgency-row-cat {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ============================================================
   EQUITY DONUT WRAPPER
   ============================================================ */
.equity-chart-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}
.equity-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.equity-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font);
}
.equity-legend-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 6px;
}
.equity-legend-name {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.equity-legend-pct {
  font-weight: 700;
  color: var(--text-primary);
  margin-left: 8px;
}

/* ============================================================
   REPORT EXPORT BAR
   ============================================================ */
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dark-surface);
  border: 1px solid var(--border-on-dark);
  padding: 16px 24px;
  margin-bottom: 24px;
}
.export-bar-title {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.1px;
}
.export-bar-sub {
  font-size: 11px;
  color: var(--text-on-dark-3);
  margin-top: 3px;
  font-family: var(--font);
  font-weight: 300;
}
.export-bar-actions {
  display: flex;
  gap: 8px;
}
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 11.5px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.btn-export:hover {
  background: rgba(255,255,255,0.12);
  color: var(--white);
  border-color: rgba(255,255,255,0.25);
}

/* ============================================================
   EXEC SUMMARY GRID
   ============================================================ */
.exec-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-light);
  overflow: hidden;
  border: 1px solid var(--border-light);
  margin-bottom: 24px;
}
.exec-summary-cell {
  background: var(--white);
  padding: 20px 22px;
  text-align: center;
}
.exec-summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  font-family: var(--font);
  font-weight: 700;
  margin-bottom: 8px;
}
.exec-summary-value {
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.exec-summary-value.gold  { color: var(--mustard-dark); }
.exec-summary-value.verde { color: var(--verde); }
.exec-summary-delta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font);
}

/* ============================================================
   DOC ICON MAP
   ============================================================ */
.doc-icon {
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.doc-icon.pdf   { background: rgba(192,57,43,0.08);  color: var(--rosso); border-color: rgba(192,57,43,0.14); }
.doc-icon.word  { background: rgba(26,74,138,0.08);  color: var(--blu); border-color: rgba(26,74,138,0.14); }
.doc-icon.excel { background: rgba(46,125,50,0.08);  color: var(--verde); border-color: rgba(46,125,50,0.14); }
.doc-icon.legal { background: rgba(198,167,94,0.10); color: var(--mustard-dark); border-color: rgba(198,167,94,0.18); }
.doc-icon.other { background: var(--soft-surface);   color: var(--text-muted); border-color: var(--border-light); }

/* ============================================================
   TAB SYSTEM — generico (mgm-tab-bar / mgm-tab / mgm-tab-pane)
   ============================================================ */
.mgm-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 2px solid var(--border-light);
  background: var(--soft-surface);
  padding: 8px 16px 0;
}
.mgm-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
  white-space: nowrap;
  transition: var(--transition);
  letter-spacing: 0.2px;
}
.mgm-tab i { font-size: 10px; }
.mgm-tab:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.04);
}
.mgm-tab.active {
  color: var(--text-primary);
  background: var(--white);
  border-color: var(--border-mid);
  border-bottom-color: var(--white);
  font-weight: 700;
}
/* badge contatore su tab */
.mgm-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  background: var(--grey-pale);
  color: var(--text-muted);
  line-height: 1;
}
.mgm-tab.active .mgm-tab-count {
  background: var(--mustard);
  color: #fff;
}
.mgm-tab-count.verde { background: var(--verde); color: #fff; }
.mgm-tab-count.rosso { background: var(--rosso); color: #fff; }
/* pannelli tab — ogni pane gestisce il proprio overflow */
.mgm-tab-pane {
  display: none;
  overflow-x: auto;           /* scroll orizzontale interno al pane se necessario */
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.mgm-tab-pane::-webkit-scrollbar { height: 5px; }
.mgm-tab-pane::-webkit-scrollbar-track { background: transparent; }
.mgm-tab-pane::-webkit-scrollbar-thumb { background: var(--grey-pale); border-radius: 3px; }
.mgm-tab-pane.active {
  display: block;
}
/* contenitore esplicito a scroll (usato nel tab Dettaglio) */
.mgm-tab-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mgm-tab-scroll::-webkit-scrollbar { height: 5px; }
.mgm-tab-scroll::-webkit-scrollbar-track { background: transparent; }
.mgm-tab-scroll::-webkit-scrollbar-thumb { background: var(--grey-pale); border-radius: 3px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .kpi-grid-5, .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .treasury-band { grid-template-columns: repeat(2, 1fr); }
  .grid-7-5 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    width: 260px;
    transform: translateX(-260px);
    transition: transform 0.26s ease;
    z-index: 950;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 940;
  }
  .sidebar.open ~ .sidebar-overlay { display: block; }
  .main-content { margin-left: 0; }
  /* Topbar su mobile: torna left:0 perché sidebar è nascosta */
  .topbar { left: 0; border-left: none; }
  .sidebar-toggle { display: flex !important; }
  /* Nasconde chips ecosistema su mobile — troppo stretti */
  .topbar-ecosystem { display: none; }
  .topbar-identity { padding-right: 12px; margin-right: 12px; }
  .grid-2, .grid-3, .grid-6-6 { grid-template-columns: 1fr; }
  .page-content { padding: 20px 16px; }
  .project-row-card { grid-template-columns: 8px 1fr; }
  .project-row-card > *:nth-child(n+3) { display: none; }
  .isole-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .kpi-grid-4, .kpi-grid-3, .kpi-grid-5 { grid-template-columns: 1fr 1fr; }
  .topbar-island-selector { display: none; }
  .form-grid-2, .form-grid-3, .form-grid-4, .form-grid-3-1, .form-grid-1-3 { grid-template-columns: 1fr; }
  .modal-container {
    max-height: 90vh;
    align-self: flex-end;
    margin-top: auto;
    max-width: 100%;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .form-input, .form-select, .form-textarea { font-size: 16px; }
}

/* ============================================================
   SIMULATORE FATTIBILITÀ — Layout & Componenti
   ============================================================ */

/* Layout a due colonne */
.fatt-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* Colonna input */
.fatt-inputs {
  background: var(--white);
  border: 1px solid var(--border-light);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--grey-pale) transparent;
}

/* Tabs navigazione input */
.fatt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--border-light);
  background: var(--soft-surface);
  padding: 8px 10px 0;
  gap: 4px;
}
.fatt-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;

  background: transparent;
  transition: var(--transition);
  white-space: nowrap;
  margin-bottom: -1px;
  letter-spacing: 0.2px;
}
.fatt-tab i { font-size: 10px; }
.fatt-tab:hover { color: var(--text-primary); background: rgba(0,0,0,0.03); }
.fatt-tab.active {
  color: var(--text-primary);
  border-color: var(--border-mid);
  border-bottom-color: var(--white);
  background: var(--white);
  font-weight: 700;
}

/* Pannelli tab */
.fatt-tab-panel {
  display: none;
  padding: 22px 22px 28px;
}
.fatt-tab-panel.active { display: block; }

/* Titolo sezione */
.fatt-section-title {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fatt-section-title i { color: var(--text-muted); font-size: 12px; }

/* Sottosezione */
.fatt-subsection {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 18px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

/* Hint label */
.fatt-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

/* Info box */
.fatt-info-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--soft-surface);
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font);
  margin-top: 16px;
  line-height: 1.5;
}
.fatt-info-box i { color: var(--text-muted); font-size: 12px; margin-top: 1px; flex-shrink: 0; }

/* Alert box */
.fatt-alert-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(26,74,138,0.05);
  border: 1px solid rgba(26,74,138,0.12);
  padding: 12px 14px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font);
  margin-top: 16px;
  line-height: 1.55;
}
.fatt-alert-box i { color: var(--blu); font-size: 13px; margin-top: 1px; flex-shrink: 0; }
.fatt-alert-box strong { color: var(--text-primary); }
.fatt-alert-warn { background: rgba(184,134,11,0.06); border-color: rgba(184,134,11,0.16); }
.fatt-alert-warn i { color: var(--giallo); }

/* Recap costo inline */
.fatt-cost-recap {
  margin-top: 14px;
}
.fatt-recap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--charcoal);
  font-size: 12px;
  color: rgba(255,255,255,0.70);
  font-family: var(--font);
}
.fatt-recap-row strong {
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
}

/* grid-3 per form */
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }

/* ── COLONNA OUTPUT ───────────────────────────────────────── */
.fatt-output {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Rating box */
.fatt-rating {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border-light);
  background: var(--white);
}
.fatt-rating-verde  { border-left: 4px solid var(--verde);  background: rgba(46,125,50,0.03); }
.fatt-rating-giallo { border-left: 4px solid var(--giallo); background: rgba(184,134,11,0.04); }
.fatt-rating-rosso  { border-left: 4px solid var(--rosso);  background: rgba(192,57,43,0.04); }
.fatt-rating-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.fatt-rating-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.fatt-rating-verde  .fatt-rating-icon { color: var(--verde); }
.fatt-rating-giallo .fatt-rating-icon { color: var(--giallo); }
.fatt-rating-rosso  .fatt-rating-icon { color: var(--rosso); }
.fatt-rating-label {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.fatt-rating-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font);
}
.fatt-rating-kpis {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
}
.fatt-rating-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.fatt-rating-kpi-val {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.fatt-rating-kpi-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* KPI griglia 2×3 */
.fatt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.fatt-kpi-item {
  background: var(--white);
  border: 1px solid var(--border-light);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: box-shadow var(--transition);
}
.fatt-kpi-item:hover { box-shadow: var(--shadow-md); }
.fatt-kpi-icon {
  width: 34px; height: 34px;
  background: var(--soft-surface);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.fatt-kpi-body { flex: 1; min-width: 0; }
.fatt-kpi-val {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.fatt-kpi-lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 5px;
}
.fatt-kpi-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Card output */
.fatt-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.fatt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--soft-surface);
}
.fatt-card-title {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.fatt-card-title i { color: var(--text-muted); font-size: 12px; }
.fatt-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font);
}
.fatt-card-sub strong { color: var(--text-primary); font-weight: 700; }

/* Cost stack barre */
.fatt-cost-stack {
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-light);
}
.fatt-cost-bar-row {}
.fatt-cost-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font);
  margin-bottom: 5px;
  font-weight: 500;
}
.fatt-cost-bar-label small {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}
.fatt-cost-bar-track {
  width: 100%;
  height: 6px;
  background: var(--grey-pale);
  overflow: hidden;
}
.fatt-cost-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.bar-dark   { background: var(--charcoal); }
.bar-mid    { background: #555; }
.bar-light  { background: var(--grey-mid); }
.bar-accent { background: var(--mustard-dark); }

/* Detail righe costi */
.fatt-cost-detail {
  padding: 12px 18px 16px;
}
.fatt-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font);
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.fatt-cost-row:last-child { border-bottom: none; }
.fatt-cost-subtotal {
  font-weight: 700;
  color: var(--text-primary);
  border-top: 1px solid var(--border-mid) !important;
  margin-top: 4px;
  padding-top: 8px !important;
  font-size: 12.5px;
}
.fatt-cost-total {
  font-weight: 700;
  color: var(--text-primary);
  border-top: 2px solid var(--charcoal) !important;
  margin-top: 6px;
  padding-top: 10px !important;
  font-size: 13.5px;
}
.fatt-cost-positive { color: var(--verde) !important; }
.fatt-cost-negative { color: var(--rosso) !important; }

/* Analisi per unità */
.fatt-unit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-light);
}
.fatt-unit-item {
  background: var(--white);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fatt-unit-highlight { background: var(--soft-surface); }
.fatt-unit-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.fatt-unit-val {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Break-even */
.fatt-be-wrap { padding: 16px 18px; }
.fatt-be-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.fatt-be-item { text-align: center; }
.fatt-be-val {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.fatt-be-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 5px;
}
.fatt-be-bar-wrap { }
.fatt-be-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.fatt-be-bar-track {
  width: 100%;
  height: 8px;
  background: var(--grey-pale);
  overflow: hidden;
}
.fatt-be-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--charcoal);
  transition: width 0.5s ease;
}

/* Assorbimento */
.fatt-absorb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-light);
}
.fatt-absorb-item {
  background: var(--white);
  padding: 16px 14px;
  text-align: center;
}
.fatt-absorb-year {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.fatt-absorb-unita {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.fatt-absorb-ricavi {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 8px;
}
.fatt-absorb-bar {
  width: 100%;
  height: 4px;
  background: var(--grey-pale);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.fatt-absorb-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--charcoal);
  transition: width 0.4s ease;
}
.fatt-absorb-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.fatt-absorb-note {
  font-size: 10px;
  color: var(--giallo);
  margin-top: 3px;
}

/* Struttura finanziaria */
.fatt-finance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-light);
}
.fatt-finance-item {
  background: var(--white);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fatt-finance-debt { background: var(--soft-surface); }
.fatt-finance-highlight { background: var(--charcoal); }
.fatt-finance-highlight .fatt-finance-label,
.fatt-finance-highlight .fatt-finance-sub { color: rgba(255,255,255,0.50); }
.fatt-finance-highlight .fatt-finance-val  { color: var(--white); }
.fatt-finance-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.fatt-finance-val {
  font-family: var(--font);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.fatt-finance-sub {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Tabella sensibilità */
.fatt-sensitivity-table {
  padding: 0 0 4px;
}
.fatt-sensi-header,
.fatt-sensi-row {
  display: grid;
  grid-template-columns: 80px 100px 1fr 80px 80px 80px;
  gap: 0;
  padding: 9px 18px;
  font-size: 11.5px;
  font-family: var(--font);
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}
.fatt-sensi-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--soft-surface);
}
.fatt-sensi-row { color: var(--text-secondary); }
.fatt-sensi-row:last-child { border-bottom: none; }
.fatt-sensi-base {
  background: var(--charcoal);
  color: rgba(255,255,255,0.80);
  font-weight: 600;
}
.fatt-sensi-neg { background: rgba(192,57,43,0.03); }
.fatt-sensi-pos { background: rgba(46,125,50,0.03); }
.fatt-neg { color: var(--rosso) !important; font-weight: 600; }
.fatt-pos { color: var(--verde) !important; font-weight: 600; }

/* Disclaimer */
.fatt-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font);
  padding: 12px 0 4px;
  line-height: 1.6;
}
.fatt-disclaimer i { font-size: 11px; margin-top: 2px; flex-shrink: 0; }

/* Responsive simulatore */
@media (max-width: 1300px) {
  .fatt-layout { grid-template-columns: 1fr; }
  .fatt-inputs { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .fatt-kpi-grid         { grid-template-columns: 1fr; }
  .fatt-absorb-grid      { grid-template-columns: 1fr; }
  .fatt-unit-grid        { grid-template-columns: 1fr; }
  .fatt-finance-grid     { grid-template-columns: 1fr; }
  .fatt-be-numbers       { grid-template-columns: 1fr; }
  .fatt-sensi-header,
  .fatt-sensi-row        { grid-template-columns: 60px 1fr 70px 70px; }
  .fatt-sensi-header span:nth-child(3),
  .fatt-sensi-row   span:nth-child(3),
  .fatt-sensi-header span:nth-child(5),
  .fatt-sensi-row   span:nth-child(5) { display: none; }
  .fatt-rating           { flex-direction: column; align-items: flex-start; }
  .fatt-rating-kpis      { gap: 12px; }
  .form-grid-3           { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .kpi-grid-4, .kpi-grid-3, .kpi-grid-5 { grid-template-columns: 1fr; }
  .topbar-title { display: none; }
  .topbar-sep { display: none; }
}
