/* ==========================================================================
   VEXONE — DESIGN SYSTEM (main.css)
   Palette derivata dal logo: Blue, Lime, inchiostro blu scuro
   ========================================================================== */

/* ── 1. DESIGN TOKENS ──────────────────────────────────────────────────────
   Unica fonte di verità per colori, testi, angoli e ombre.
   Il blu è il colore della marca: azione principale, link, stati attivi, icone.
   Pulsanti: blu = azione principale della pagina, scuro = secondaria, contorno = terziaria.
   Il lime è solo un accento: piccoli dettagli (la X del logo, spunte, numeri e badge su
   sfondo scuro), mai su pulsanti o grandi superfici.
   ────────────────────────────────────────────────────────────────────────── */
:root {
  /* Marca */
  --color-dark:    #0A1324;          /* inchiostro blu: superfici scure, pulsanti secondari */
  --color-dark-hover: #1A2742;
  --color-blue:    #0078FF;
  --color-blue-hover: #0064D9;
  --color-blue-soft: #EAF3FF;        /* sfondi chiari di icone, selezioni, suggerimenti */
  --color-lime:    #B8FF00;          /* solo accento */
  --color-lime-hover: #C9FF3D;

  /* Neutri (testi con contrasto AA su bianco) */
  --color-white:   #FFFFFF;
  --color-bg:      #F3F6FA;          /* sfondo pagine app e sezioni alterne (grigio appena blu) */
  --color-surface: #FFFFFF;          /* card, modali */
  --color-border:  #DFE5EE;
  --color-border-light: #EBEFF5;
  --color-text:    #0A1324;          /* testo principale */
  --color-text-secondary: #4B5563;   /* paragrafi, descrizioni */
  --color-text-muted: #6B7280;       /* etichette, note */

  /* Stati */
  --color-success: #16A34A;
  --color-warning: #D97706;
  --color-error:   #DC2626;

  /* Angoli: 3 livelli + pillola */
  --radius-xs: 6px;                   /* elementi minuti (badge quadrati) */
  --radius-sm: 8px;                   /* campi, pulsanti piccoli */
  --radius-md: 12px;                  /* pulsanti, card piccole */
  --radius-lg: 20px;                  /* card, sezioni, modali */
  --radius-pill: 9999px;

  /* Tipografia */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: clamp(30px, 4.2vw, 44px);
  --text-display: clamp(44px, 7vw, 80px);

  /* Ombre */
  --shadow-sm:  0 1px 2px rgba(10, 19, 36, .05);
  --shadow-md:  0 2px 8px rgba(10, 19, 36, .06), 0 0 0 1px rgba(10, 19, 36, .03);
  --shadow-lg:  0 12px 32px rgba(10, 19, 36, .08), 0 0 0 1px rgba(10, 19, 36, .03);
  --shadow-xl:  0 30px 70px rgba(10, 19, 36, .12);

  /* Movimento */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --duration: .25s;
}

/* ── 2. RESET & BASE ── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--color-text);
  margin: 0;
  background: var(--color-bg);
  line-height: 1.5;
}

a {
  color: var(--color-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── 3. SCROLLBAR ── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-xs);
}

/* ── 4. ANIMATIONS ── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── 4b. TOP BAR (sopra la navbar, generata da app.js: avviso, Assistenza, lingua) ──
   Scorre via con la pagina: resta fissa solo la navbar. Sotto 640px mostra solo l'avviso. */
.topbar {
  background: var(--color-blue);
  color: rgba(255, 255, 255, .9);
  font: 500 var(--text-xs) / 1.3 var(--font-sans);
}
.topbar-inner {
  max-width: 1560px;
  margin: 0 auto;
  min-height: 36px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
}
@media (min-width: 1024px) { .topbar-inner { padding: 0 24px; } }
.topbar-notice { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.topbar-icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--color-lime); }
.topbar.is-warning .topbar-icon { color: var(--color-warning); }
.topbar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-notice-link {
  flex-shrink: 0;
  color: var(--color-white);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.topbar-notice-link:hover { color: var(--color-lime); }
.topbar-side { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-weight: 600;
}
.topbar-link:hover { color: var(--color-white); text-decoration: none; }
.topbar-link .icon { width: 14px; height: 14px; }
@media (max-width: 639px) {
  .topbar-inner { padding: 0 16px; }
  .topbar-side { display: none; }
  .topbar:not(.has-notice) { display: none; }
}

/* Selettore di lingua IT / EN (top bar, menu da telefono, footer, pagine di accesso) */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: var(--radius-pill); background: var(--color-bg); }
.lang-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font: 700 11px / 1.4 var(--font-sans);
  letter-spacing: .03em;
  color: var(--color-text-muted);
  text-decoration: none;
}
.lang-opt:hover { color: var(--color-text); text-decoration: none; }
.lang-opt.on { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.lang-flag { width: 16px; height: 11px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.lang-switch-dark { background: rgba(255, 255, 255, .08); }
.lang-switch-dark .lang-opt { color: rgba(255, 255, 255, .6); }
.lang-switch-dark .lang-opt:hover { color: var(--color-white); }
.lang-switch-dark .lang-opt.on { background: rgba(255, 255, 255, .16); color: var(--color-white); box-shadow: none; }
.topbar .lang-opt { padding: 2px 8px; }
.mob-lang { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px; border-top: 1px solid var(--color-border-light); }
.mob-lang-k { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }

/* ── 5. NAVIGATION (Light Universal Navbar) ── */
#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid #E5E7EB;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-logo {
  height: 28px;
  width: auto;
  display: block;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #4B5563;
  cursor: pointer;
  transition: all var(--duration);
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-text);
  text-decoration: none;
}

.nav-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .nav-container {
    padding: 14px 24px;
  }
}

/* ══ PREVENT HORIZONTAL OVERFLOW WITHOUT BREAKING STICKY ══ */
html {
  overflow-x: clip;
}
body {
  overflow-x: clip;
  max-width: 100%;
}

/* ══ GUEST VS AUTH NAVBAR VISIBILITY MATRIX ══ */
/* Default: GUEST MODE (Hide all auth links and actions) */
.nav-links-auth,
.nav-actions-auth {
  display: none !important;
}

.nav-links-guest {
  display: none;
  align-items: center;
  gap: 28px;
}

.nav-actions-guest {
  display: none;
  align-items: center;
  gap: 12px;
}

@media (min-width: 1024px) {
  html:not(.is-logged-in) .nav-links-guest {
    display: flex !important;
  }
}

@media (min-width: 640px) {
  html:not(.is-logged-in) .nav-actions-guest {
    display: flex !important;
  }
}

/* AUTHENTICATED STATE (html.is-logged-in) */
html.is-logged-in .nav-links-guest,
html.is-logged-in .nav-actions-guest {
  display: none !important;
}

html.is-logged-in .nav-links-auth {
  display: none;
  align-items: center;
  gap: 28px;
}

@media (min-width: 1024px) {
  html.is-logged-in .nav-links-auth {
    display: flex !important;
  }
}

html.is-logged-in .nav-actions-auth {
  display: flex !important;
  align-items: center;
  gap: 12px;
}

.nav-ham-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background var(--duration);
  flex-shrink: 0;
  box-sizing: border-box;
}

.nav-ham-btn:hover {
  background: var(--color-bg);
}

.nav-link-cta {
  color: var(--color-white);
  background: var(--color-blue);
  padding: 7px 14px;
  border-radius: 9999px;
  font-weight: 600;
}
.nav-link-cta:hover { background: var(--color-blue-hover); color: var(--color-white); }
.nav-link.nav-link-cta.active { color: var(--color-white); box-shadow: 0 0 0 3px rgba(0, 120, 255, .2); }

.nav-link.active {
  color: #0078FF;
  font-weight: 600;
}

/* Home Navbar Action Buttons */
.nav-btn-secondary,
.nav-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  font: 600 var(--text-sm) / 1 var(--font-sans);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--duration), border-color var(--duration), box-shadow var(--duration);
}
.nav-btn-secondary { background: #FFFFFF; color: var(--color-text); border-color: var(--color-border); }
.nav-btn-secondary:hover { border-color: var(--color-dark); color: var(--color-dark); }
.nav-btn-primary { background: var(--color-blue); color: var(--color-white); }
.nav-btn-primary:hover { background: var(--color-blue-hover); color: var(--color-white); box-shadow: 0 6px 20px rgba(0, 120, 255, .3); }

/* ── Navbar utente: campanella, saldo e profilo senza bordi. Campanella e profilo sono
   trasparenti e prendono lo sfondo grigio al passaggio; il saldo è una pillola grigia. ── */
.notif-btn,
.nav-wallet-pill,
.nav-user-chip {
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text);
  box-sizing: border-box;
  transition: background var(--duration), color var(--duration);
}
.notif-btn:hover, .notif-btn.open,
.nav-user-chip:hover, .nav-user-chip.open {
  background: var(--color-bg);
}
.notif-btn:focus-visible, .nav-wallet-pill:focus-visible, .nav-user-chip:focus-visible, .nav-ham-btn:focus-visible {
  outline: 2px solid var(--color-dark);
  outline-offset: 2px;
}

/* Saldo (su schermi stretti è nel menu laterale) */
.nav-wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 12px;
  background: var(--color-bg);
  font: 700 var(--text-sm) / 1 var(--font-display);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
.nav-wallet-pill:hover { color: var(--color-text); text-decoration: none; background: var(--color-border-light); }
.nav-wallet-pill svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-text-muted); }
.nav-wallet-pill .plus-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--color-blue);
  color: var(--color-white);
  font: 700 16px / 1 var(--font-sans);
  margin-left: 2px;
  transition: background var(--duration);
}
.nav-wallet-pill:hover .plus-badge { background: var(--color-blue-hover); }
@media (max-width: 639px) {
  .nav-wallet-pill { display: none !important; }
}

/* Profilo */
.nav-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 4px;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  position: relative;
}
.nav-user-info { text-align: left; line-height: 1.2; min-width: 0; }
.nav-user-plan {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.2;
}
.nav-user-name {
  font: 700 13px / 1.2 var(--font-display);
  color: var(--color-text);
  margin: 0;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.nav-user-chip.open .nav-chevron { transform: rotate(180deg); color: var(--color-text); }

/* Avatar unico del sito: iniziali lime su inchiostro blu, come il logo (navbar, menu, Account, admin) */
.vex-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-dark);
  color: var(--color-lime);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font: 700 var(--text-sm) / 1 var(--font-display);
  letter-spacing: .02em;
  user-select: none;
}
.vex-avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.vex-avatar-md { width: 36px; height: 36px; font-size: var(--text-xs); }
.vex-avatar-lg { width: 52px; height: 52px; font-size: var(--text-base); }

/* ── Notifiche: pulsante e pannello ── */
.notif-wrap {
  position: relative;
}

.notif-btn {
  width: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
}
.notif-btn svg { width: 18px; height: 18px; color: var(--color-text); }

.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 18px;
  height: 18px;
  background: var(--color-blue);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-surface);
  padding: 0 3px;
  line-height: 1;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px #E5E7EB;
  width: 320px;
  max-width: 90vw;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all 0.2s var(--ease-out);
}

.notif-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration);
  text-decoration: none;
  color: inherit;
}

.notif-item:hover {
  background: #F9FAFB;
}

.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0078FF;
  margin-top: 5px;
  flex-shrink: 0;
}

.notif-dot.read {
  background: #D1D5DB;
}

/* ── Universal Dropdown Menu ── */
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all 0.2s var(--ease-out);
}

.nav-dropdown-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.nav-dd-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #F3F4F6;
  margin-bottom: 4px;
}

.nav-dd-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  transition: all var(--duration);
}

.nav-dd-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #0078FF;
  transition: transform 0.15s ease, color 0.15s ease;
}

.nav-dd-link:hover {
  background: #F3F4F6;
  color: #111827;
  text-decoration: none;
}

.nav-dd-link:hover svg {
  color: #0056B3;
  transform: translateX(2px);
}

.nav-dd-link.danger {
  color: #DC2626;
}

.nav-dd-link.danger svg {
  color: #DC2626 !important;
}

.nav-dd-link.danger:hover {
  background: #FEF2F2;
  color: #B91C1C;
}

.nav-dd-link.danger:hover svg {
  color: #B91C1C !important;
  transform: translateX(2px);
}

/* ── Universal Navigation: Guest Comparison Auth Overlay ── */
.guest-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 10, 11, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

.guest-auth-modal.open {
  display: flex;
  opacity: 1;
}

.guest-auth-box {
  background: #FFFFFF;
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  border: 1px solid #E5E7EB;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  box-sizing: border-box;
}

.guest-auth-modal.open .guest-auth-box {
  transform: translateY(0) scale(1);
}

/* ── 6. MOBILE DRAWER ── */
#mob-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000; /* sopra il FAB "Nuova Spedizione" (900) */
  pointer-events: none;
}

#mob-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 11, .4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .3s;
}

#mob-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--color-white);
  transform: translateX(100%);
  transition: transform .3s var(--ease-out);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#mob-drawer.open {
  pointer-events: auto;
}

#mob-drawer.open #mob-overlay {
  opacity: 1;
}

#mob-drawer.open #mob-panel {
  transform: translateX(0);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .1);
}

.mob-sep {
  height: 1px;
  background: #F3F4F6;
  margin: 8px 0;
}

.mob-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  display: block;
}

.mob-link:hover {
  background: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
}

/* ── 7. UNIVERSAL APPLICATION LAYOUT & PAGE HEADERS ── */
.app-page-container {
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
  padding-top: 36px;
  padding-bottom: 80px;
}

@media (min-width: 640px) {
  .app-page-container {
    padding-left: 32px;
    padding-right: 32px;
  }
}

@media (min-width: 1024px) {
  .app-page-container {
    padding-left: 48px;
    padding-right: 48px;
    padding-top: 44px;
    padding-bottom: 96px;
  }
}

.page-header {
  margin-bottom: 36px;
}

.page-eyebrow {
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 6px 0;
}

.page-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: #4B5563;
  margin: 0;
  line-height: 1.5;
  max-width: 680px;
}

/* ── 8. UNIVERSAL FOOTER (generato da app.js in <footer id="vex-footer">) ── */
.vex-footer {
  background: var(--color-dark);
  color: #FFFFFF;
  padding: 56px 0 28px;
  margin-top: 56px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.foot-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 2.5rem;
}
@media (min-width: 900px) {
  .foot-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
}
.foot-brand p {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.6;
  color: rgba(255,255,255,.5);
  max-width: 300px;
  margin: 0;
}
.foot-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin: 0 0 14px;
}
.foot-link {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  padding: 4px 0;
  transition: color .2s;
}
.foot-link:hover {
  color: #FFFFFF;
  text-decoration: none;
}
.foot-sep {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 36px 0 20px;
}
.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.4);
}

/* ── 8. PULSANTI ──
   .btn + variante (.btn-primary | .btn-secondary | .btn-outline) + taglia (.btn-sm | .btn-lg).
   I nomi storici restano validi: .btn-lime = principale (ora blu), .btn-dark = secondario, .btn-ghost = contorno. */
.btn,
.btn-lime,
.btn-dark,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  font: 600 var(--text-sm) / 1 var(--font-sans);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--duration), color var(--duration), border-color var(--duration), box-shadow var(--duration), transform var(--duration);
}
.btn:focus-visible,
.btn-lime:focus-visible,
.btn-dark:focus-visible,
.btn-ghost:focus-visible { outline: 3px solid rgba(0, 120, 255, .35); outline-offset: 2px; }
.btn:disabled, .btn-lime:disabled, .btn-dark:disabled, .btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary, .btn-lime { background: var(--color-blue); color: var(--color-white); }
.btn-primary:hover, .btn-lime:hover { background: var(--color-blue-hover); color: var(--color-white); box-shadow: 0 6px 20px rgba(0, 120, 255, .3); }

.btn-secondary, .btn-dark { background: var(--color-dark); color: var(--color-white); }
.btn-secondary:hover, .btn-dark:hover { background: var(--color-dark-hover); color: var(--color-white); }

.btn-outline, .btn-ghost { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover, .btn-ghost:hover { border-color: var(--color-blue); color: var(--color-blue); }

.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: var(--text-base); }
.btn-block { width: 100%; }

/* ── 8b. TIPOGRAFIA ── */
/* Il colore resta ereditato (titoli su sfondo scuro); le classi .t-* lo impostano esplicitamente */
h1, h2, h3, .t-display, .t-h1, .t-h2, .t-h3 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}
.t-display, .t-h1, .t-h2, .t-h3 { color: var(--color-text); }
.t-display { font-size: var(--text-display); font-weight: 700; line-height: .95; margin: 0; }
.t-h1 { font-size: var(--text-3xl); font-weight: 700; line-height: 1.05; margin: 0; }
.t-h2 { font-size: var(--text-2xl); font-weight: 700; line-height: 1.15; margin: 0; }
.t-h3 { font-size: var(--text-xl); font-weight: 600; line-height: 1.25; margin: 0; }
.t-lead { font-size: var(--text-lg); line-height: 1.6; color: var(--color-text-secondary); margin: 0; }
.t-body { font-size: var(--text-base); line-height: 1.6; color: var(--color-text-secondary); margin: 0; }
.t-small { font-size: var(--text-sm); line-height: 1.55; color: var(--color-text-secondary); margin: 0; }
.eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-blue);
  margin: 0 0 14px;
}
.text-accent { color: var(--color-blue); }

/* ── 9. FORM CONTROLS ── */
.lbl {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: 6px;
}

.inp {
  width: 100%;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 10px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color .2s;
  background: var(--color-white);
  color: var(--color-text);
}

.inp:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(0, 120, 255, .08);
}

.inp::placeholder {
  color: var(--color-text-muted);
  font-weight: 400;
}

.inp-sm {
  min-height: 36px;
  padding: 0 10px;
  font-size: var(--text-sm);
}

.inp.err {
  border-color: var(--color-error);
  background-color: #FEF2F2;
}

.inp:disabled {
  background-color: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Menu a tendina: freccia unica per tutto il sito, al posto di quella del browser */
select.inp {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  cursor: pointer;
  text-overflow: ellipsis;
}
select.inp:hover:not(:disabled) { border-color: #C7CBD3; }
select.inp:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A1324' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
select.inp.inp-sm { padding-right: 34px; background-position: right 11px center; background-size: 14px 14px; }
select.inp::-ms-expand { display: none; }

/* ── 9b. MODULI: griglia campi, selettore a segmenti, aiuti CAP, caselle ── */
.fields { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.f-6 { grid-column: span 6; }
.f-4 { grid-column: span 4; }
.f-3 { grid-column: span 3; }
.f-2 { grid-column: span 2; }
@media (max-width: 640px) {
  .f-4, .f-3 { grid-column: span 6; }
  .f-2 { grid-column: span 3; }
}
.req::after { content: ' *'; color: var(--color-error); }

/* Selettore a segmenti (Privato/Azienda, tipo collo, ritiro) */
.seg {
  display: inline-flex;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}
.seg button {
  border: none;
  background: transparent;
  font: 600 var(--text-xs) / 1 var(--font-sans);
  color: var(--color-text-secondary);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration), color var(--duration), box-shadow var(--duration);
}
.seg button.on { background: var(--color-surface); color: var(--color-blue); box-shadow: var(--shadow-sm); }

.place-hint { font-size: var(--text-xs); color: var(--color-text-muted); margin: 6px 0 0; min-height: 16px; }
.place-hint.ok { color: var(--color-success); font-weight: 600; }
.place-hint.err { color: var(--color-error); font-weight: 600; }
.place-manual { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 8px; margin-top: 8px; }
.place-manual[hidden] { display: none; }
/* Suggerimenti dei comuni scrivendo il nome nel campo CAP (assets/js/cap.js) */
.place-suggest {
  margin-top: 6px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  max-height: 290px;
  overflow-y: auto;
}
.place-suggest[hidden] { display: none; }
.place-opt {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font: 500 var(--text-sm) / 1.3 var(--font-sans);
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
}
.place-opt:hover, .place-opt.on { background: var(--color-blue-soft); }
.place-opt-city { font-weight: 600; min-width: 0; }
.place-opt-pr { font-weight: 500; color: var(--color-text-muted); }
.place-opt-cap { font-size: var(--text-xs); color: var(--color-blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--color-text-secondary); cursor: pointer; margin-top: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--color-blue); }

/* ── 10. CARDS ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
}

/* ── 11. ACCOUNT DROPDOWN ── */

/* ── 12. TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--color-dark);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all .32s cubic-bezier(.23,1,.32,1);
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  pointer-events: none;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,0.14);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #B8FF00;
  box-shadow: 0 0 6px rgba(184, 255, 0, 0.6);
  flex-shrink: 0;
  display: inline-block;
}

.toast-action {
  background: var(--color-blue);
  color: var(--color-white);
  border: none;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  margin-left: 4px;
}

/* ── 12b. MODALI (overlay + box condivisi da tutte le pagine) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 11, .6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 520px;
  max-width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 40px 80px rgba(0, 0, 0, .2);
  transform: translateY(18px);
  transition: transform .3s var(--ease-out);
}
.modal-overlay.open .modal-box { transform: translateY(0); }
@media (max-width: 640px) {
  .modal-box { padding: 22px 20px; }
}

/* ── 12b2. BARRA "ACCEDI COME" (admin che usa l'account di un cliente, generata da app.js) ── */
.imp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  padding: 8px 16px;
  background: var(--color-warning);
  color: var(--color-white);
  font: 600 var(--text-xs) / 1.4 var(--font-sans);
  text-align: center;
}
.imp-bar-btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  background: var(--color-white);
  color: var(--color-dark);
  font: 700 var(--text-xs) / 1 var(--font-sans);
  cursor: pointer;
}

/* ── 12c. SPINNER ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}

/* ── 13b. BADGE DI STATO (spedizioni, movimenti) ── */
.b-blue  { background: #EFF6FF; color: #0078FF; }
.b-green { background: #F0FDF4; color: #16A34A; }
.b-amber { background: #FFFBEB; color: #D97706; }
.b-gray  { background: #F3F4F6; color: #4B5563; }
.b-red   { background: #FEF2F2; color: #DC2626; }

/* ── FLOATING ACTION BUTTON (FAB: + NUOVA SPEDIZIONE) ── */

/* ── 13. CHIPS & BADGES ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.chip-blue    { background: rgba(0, 120, 255, .08);  color: var(--color-blue); }
.chip-green   { background: rgba(22, 163, 74, .08);  color: var(--color-success); }

.chip-dark    { background: var(--color-dark);         color: var(--color-lime); }

/* ── 13c. DOMANDE FREQUENTI (details/summary, homepage e assistenza) ── */
.faq { display: grid; gap: 10px; }
.faq-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  font-weight: 600;
  font-size: var(--text-base);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { margin: 0; padding: 0 24px 22px; font-size: var(--text-sm); line-height: 1.65; color: var(--color-text-secondary); }
.faq-icon { position: relative; width: 14px; height: 14px; flex-shrink: 0; }
.faq-icon::before, .faq-icon::after {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-text-muted);
  transition: transform var(--duration);
}
.faq-icon::after { transform: rotate(90deg); }
.faq-item[open] .faq-icon::after { transform: rotate(0); }

/* ── 14. LUCIDE ICONS INLINE ── */
.icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ── 15. TABLES ── */
.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.tbl td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.tbl tr:last-child td {
  border-bottom: none;
}

.tbl tbody tr:hover {
  background: rgba(0, 0, 0, .015);
}

/* ── 16. UTILITY ── */

/* Page variant: white background (landing, legal) */
body.bg-white {
  background: var(--color-white);
}

/* ── 17. CARRIER LOGOS COMPONENT (Orig. Next.js Style) ── */
.carrier-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
  animation: .35s cubic-bezier(.23,1,.32,1) carrierLogoIn;
}
.carrier-logo-wrap-named {
  gap: 10px;
}
.carrier-logo-icon {
  flex-shrink: 0;
  object-fit: contain;
  background: transparent;
  transition: transform .25s cubic-bezier(.23,1,.32,1);
}
.carrier-logo-fallback {
  border-radius: 22%;
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.23,1,.32,1);
}
.carrier-logo-wrap:hover .carrier-logo-icon,
.carrier-logo-wrap:hover .carrier-logo-fallback,
.carrier-logo-icon:hover {
  transform: scale(1.08) rotate(-2deg);
}
.carrier-logo-fallback {
  letter-spacing: .02em;
  -webkit-user-select: none;
  user-select: none;
  justify-content: center;
  align-items: center;
  font-style: italic;
  font-weight: 900;
  display: inline-flex;
}
.carrier-logo-name {
  color: inherit;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}
@keyframes carrierLogoIn {
  0% { opacity: 0; transform: translateY(4px) scale(.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── 17b. RIQUADRO LOGO CORRIERE (dimensione fissa, uguale per tutti) ── */
.carrier-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 64px;
  padding: 12px 18px;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.carrier-tile img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
a.imp-bar-btn { text-decoration: none; display: inline-block; }
