/* Bunny Fonts — GDPR-compliant drop-in replacement for Google Fonts (hosted in EU, no IP logging) */
@import url('https://fonts.bunny.net/css2?family=inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0f172a;
  --navy-mid: #1e3a5f;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --emerald: #059669;
  --emerald-light: #d1fae5;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --violet: #7c3aed;
  --violet-light: #ede9fe;
  --slate: #64748b;
  --slate-light: #f1f5f9;
  --border: #e2e8f0;
  --bg: #f0f4f8;
  --white: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-hover: 0 4px 8px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #1e40af 100%);
  color: white;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}


.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-wordmark {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: white;
  background: transparent;
  line-height: 1;
}

.header-wordmark span {
  color: #60a5fa;
}

/* Wordmark su sfondo chiaro */
.wm-t {
  background: linear-gradient(90deg, #2563eb 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 900;
}

/* Override per sfondo scuro (header app/demo) */
.header-wordmark .wm-t {
  background: none;
  -webkit-text-fill-color: #60a5fa;
  color: #60a5fa;
  font-weight: 900;
}

.header-wordmark small {
  display: block; font-size: 0.55rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255,255,255,0.65); margin-top: 0.1rem;
}

.header-sub {
  font-size: 0.72rem;
  opacity: 0.55;
  font-weight: 400;
}

.header-rates {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.rate-pill {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
}

.rate-pill strong { color: #86efac; font-weight: 700; }

/* ── Filtri ── */
.filtri-wrapper {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.filtri {
  padding: 0.875rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}

.filtro-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.filtro-group label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate);
}

.filtro-group select,
.filtro-group input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.38rem 0.65rem;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  min-width: 130px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  padding-right: 1.6rem;
}

.filtro-group input {
  background-image: none;
  padding-right: 0.65rem;
}

.filtro-group select:focus,
.filtro-group input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.flag-group {
  display: flex;
  gap: 0.35rem;
}

.flag-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.38rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--slate);
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.flag-btn:hover { background: var(--slate-light); }

.flag-btn.active[data-flag="under36"] {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #be185d;
  font-weight: 700;
}
.flag-btn.active[data-flag="green"] {
  background: var(--emerald-light);
  border-color: #6ee7b7;
  color: #065f46;
  font-weight: 700;
}
.flag-btn.active[data-flag="prima_casa_garanzia"] {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
  font-weight: 700;
}

.flag-icon { font-style: normal; }

.btn-reset {
  padding: 0.38rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--slate);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  align-self: flex-end;
  transition: all 0.15s;
}
.btn-reset:hover { background: var(--slate-light); border-color: #cbd5e1; color: #334155; }

/* ── Risultati header ── */
.risultati-header {
  padding: 1.1rem 2rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#risultati-count {
  font-size: 0.78rem;
  color: var(--slate);
  font-weight: 500;
}

/* ── Grid prodotti ── */
.prodotti-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  padding: 0.5rem 2rem 3rem;
}

.no-results, .no-data {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--slate);
  font-size: 0.95rem;
}

.no-data p { margin-bottom: 0.5rem; line-height: 1.6; }
.no-data code {
  display: block;
  margin-top: 1rem;
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  color: #475569;
  text-align: left;
  width: fit-content;
  margin-inline: auto;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* Barra colorata sinistra per tipo_tasso */
.card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
}
.card.fisso::before   { background: var(--emerald); }
.card.variabile::before { background: var(--amber); }
.card.misto::before   { background: var(--violet); }

.card-inner {
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

/* ── Card top ── */
.card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.bank-logo-wrap {
  width: 48px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
}

.bank-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.bank-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.card-top-text {
  flex: 1;
  min-width: 0;
}

.banca-nome {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nome-prodotto {
  font-size: 0.72rem;
  color: var(--slate);
  line-height: 1.4;
  margin-top: 0.15rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-fisso     { background: var(--emerald-light); color: var(--emerald); }
.badge-variabile { background: var(--amber-light); color: var(--amber); }
.badge-misto     { background: var(--violet-light); color: var(--violet); }

/* ── Rata stimata ── */
.rata-box {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rata-left {}

.rata-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3b82f6;
  display: block;
  margin-bottom: 0.1rem;
}
.rata-value {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.04em;
  line-height: 1;
}
.rata-nota {
  font-size: 0.6rem;
  color: var(--slate);
  margin-top: 0.2rem;
  display: block;
}
.rata-right {
  text-align: right;
}
.rata-totale-label {
  font-size: 0.6rem;
  color: #3b82f6;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
}
.rata-totale-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e40af;
}

/* ── Tassi ── */
.rates {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  padding: 0.75rem 0;
  border-top: 1px solid var(--slate-light);
  border-bottom: 1px solid var(--slate-light);
}

.rate-block { display: flex; flex-direction: column; gap: 0.1rem; }

.rate-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
}
.rate-label-live { color: var(--emerald); }

.rate-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.04em;
  line-height: 1;
}
.rate-value.secondary {
  font-size: 1rem;
  color: var(--slate);
  font-weight: 600;
}
.rate-value-live { color: var(--emerald); }

/* ── Spread row ── */
.spread-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.7rem;
  color: var(--slate);
  background: var(--slate-light);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
}
.spread-label {
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
}

/* ── Dettagli ── */
.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
}
.detail { display: flex; flex-direction: column; gap: 0.1rem; }
.detail span {
  font-size: 0.58rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.detail strong { font-size: 0.8rem; color: #334155; font-weight: 600; }

/* ── Tag chips ── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.tag-under36        { background: #fce7f3; color: #be185d; }
.tag-green          { background: #d1fae5; color: #065f46; }
.tag-garanzia       { background: #dbeafe; color: #1d4ed8; }
.tag-prima_casa     { background: #f0fdf4; color: #15803d; }
.tag-seconda_casa   { background: #fafafa; color: #525252; border: 1px solid #e5e5e5; }
.tag-surroga        { background: #f5f3ff; color: #6d28d9; }
.tag-ristrutturazione { background: #fff7ed; color: #c2410c; }
.tag-acquisto       { background: #f0f9ff; color: #0369a1; }
.tag-liquidita          { background: #fefce8; color: #854d0e; }
.tag-prima_casa_garanzia { background: #dbeafe; color: #1d4ed8; }

/* ── Links ── */
.links-row {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.fi-link {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--slate-light);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
  font-family: inherit;
}
.fi-link:hover { background: var(--blue-light); border-color: #bfdbfe; color: #1d4ed8; }
.fi-link.no-link {
  color: #94a3b8;
  cursor: not-allowed;
  pointer-events: none;
}
.fi-link-secondary {
  color: var(--slate);
  flex: 0 0 auto;
  font-size: 0.72rem;
}
.fi-link-secondary:hover { background: var(--slate-light); border-color: #cbd5e1; color: #1e293b; }

/* ── Disclaimer card ── */
.card-disclaimer {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.67rem;
  line-height: 1.5;
  color: var(--slate);
  font-weight: 400;
  font-style: italic;
}

/* ── Garanzia statale badge ── */
.garanzia-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(15,23,42,0.2), 0 2px 8px rgba(15,23,42,0.12);
  width: 100%;
  max-width: 620px;
  position: relative;
  animation: modalIn 0.2s ease;
}

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

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: var(--slate-light);
  color: var(--slate);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); color: var(--text); }

/* ── Modal header ── */
.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-logo-wrap {
  width: 54px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
}
.modal-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.modal-avatar {
  width: 48px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
}
.modal-header-text { flex: 1; min-width: 0; }
.modal-banca { font-size: 0.78rem; color: var(--slate); font-weight: 500; margin-bottom: 0.15rem; }
.modal-prodotto { font-size: 1rem; font-weight: 700; color: var(--navy); line-height: 1.3; padding-right: 2rem; }
.modal-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ── Modal rata hero (se disponibile) ── */
.modal-rata-hero {
  margin: 1rem 1.5rem;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.modal-rata-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #3b82f6; }
.modal-rata-val { font-size: 2rem; font-weight: 900; color: var(--navy); letter-spacing: -0.04em; line-height: 1; }
.modal-rata-totale { text-align: right; }
.modal-rata-totale-label { font-size: 0.6rem; color: #3b82f6; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.modal-rata-totale-val { font-size: 0.9rem; font-weight: 700; color: #1e40af; }

/* ── Modal sezioni ── */
.modal-body { padding: 0 1.5rem 1.5rem; }

.modal-section { margin-top: 1.25rem; }
.modal-section-title {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
}
.modal-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.modal-field { display: flex; flex-direction: column; gap: 0.15rem; }
.modal-field-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
}
.modal-field-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.modal-field-value.big {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--navy);
}
.modal-field-value.emerald { color: var(--emerald); }
.modal-field-value.amber { color: var(--amber); }
.modal-field-value.muted { color: var(--text-muted); font-weight: 400; }
.modal-field-sub { font-size: 0.65rem; color: var(--slate); margin-top: 0.05rem; }

.modal-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }

.modal-note {
  background: var(--slate-light);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.6;
  margin-top: 0.65rem;
}

.modal-links {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.modal-link-btn {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s;
  font-family: inherit;
  border: 1.5px solid transparent;
  cursor: pointer;
}
.modal-link-primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.modal-link-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.modal-link-secondary {
  background: var(--slate-light);
  color: var(--slate);
  border-color: var(--border);
}
.modal-link-secondary:hover { background: var(--border); color: var(--text); }

.modal-aggiornato {
  text-align: center;
  font-size: 0.63rem;
  color: #94a3b8;
  margin-top: 1rem;
}

/* card clickable */
.card { cursor: pointer; }

/* ── Responsive ── */
@media (max-width: 640px) {
  /* Header */
  header { padding: 0.85rem 1rem; gap: 0.6rem; }
  .header-wordmark { font-size: 1.05rem; }
  .header-rates { gap: 0.5rem; font-size: 0.68rem; }
  .rate-pill { padding: 0.2rem 0.5rem; font-size: 0.65rem; }
  .logout-btn { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

  /* Demo banner */
  .demo-banner { padding: 0.65rem 1rem; }
  .demo-cta-btn { margin-left: 0; font-size: 0.78rem; padding: 0.4rem 0.8rem; }

  /* Filtri — scrollabili orizzontalmente su mobile */
  .filtri-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .filtri { padding: 0.65rem 1rem; flex-wrap: nowrap; gap: 0.5rem; min-width: max-content; }
  .filtro-group select, .filtro-group input { min-width: 100px; font-size: 0.78rem; padding: 0.35rem 1.4rem 0.35rem 0.55rem; }
  .filtro-group label { font-size: 0.58rem; }

  /* Grid prodotti — 1 colonna, padding ridotto */
  .prodotti-grid { grid-template-columns: 1fr; padding: 0.5rem 0.75rem 2rem; gap: 0.75rem; }
  .risultati-header { padding: 0.6rem 0.75rem 0.2rem; font-size: 0.72rem; }

  /* Card */
  .card-inner { padding: 1rem; }
  .banca-header { gap: 0.6rem; }
  .banca-logo { width: 44px; height: 44px; }
  .rate-value { font-size: 1.35rem; }
  .rata-value { font-size: 1.35rem; }
  .card-rates-grid { gap: 0.6rem; }
  .card-bottom { flex-wrap: wrap; gap: 0.5rem; }
  .card-btn { font-size: 0.78rem; padding: 0.5rem 0.9rem; }

  /* Modal */
  .modal-overlay { padding: 1rem 0.75rem; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; max-width: 100%; }
  .modal-header { padding: 1.25rem 1.25rem 1rem; }
  .modal-body { padding: 0 1.25rem 1.5rem; }
  .modal-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; }
  .modal-grid-3 { grid-template-columns: 1fr 1fr; }
  .modal-field-value.big { font-size: 1.15rem; }
  .modal-section-title { font-size: 0.62rem; }
}

/* ═══════════════════════════════════════════════════════════
   LOGOUT BUTTON (app header)
═══════════════════════════════════════════════════════════ */

.logout-btn {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.logout-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   DEMO BANNER
═══════════════════════════════════════════════════════════ */

.demo-banner {
  background: linear-gradient(90deg, #1e3a5f 0%, #1e40af 100%);
  color: #fff;
  padding: 0.75rem 2rem;
}
.demo-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
}
.demo-badge {
  background: #f59e0b;
  color: #0f172a;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  flex-shrink: 0;
}
.demo-cta-btn {
  margin-left: auto;
  background: #fff;
  color: #1e3a5f;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: 7px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.demo-cta-btn:hover { opacity: 0.88; }

/* ═══════════════════════════════════════════════════════════
   LANDING PAGE
═══════════════════════════════════════════════════════════ */

body.page-landing {
  background: #fff;
  color: var(--text);
}

/* Nav */
.lp-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.lp-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lp-nav-demo {
  font-size: 0.88rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  padding: 0.4rem 1rem;
  border: 1.5px solid #2563eb;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.lp-nav-demo:hover { background: #2563eb; color: #fff; }

/* Hero */
.lp-hero {
  background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 55%, #1e40af 100%);
  color: #fff;
  padding: 6rem 2rem 5rem;
}
.lp-hero-inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}
.lp-pill {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.88);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.75rem;
}
.lp-h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}
.lp-h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lp-sub {
  font-size: 1.05rem;
  line-height: 1.75;
  color: rgba(255,255,255,0.78);
  margin-bottom: 2.5rem;
}
.lp-sub strong { color: #fff; }
.lp-hero-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.lp-btn-primary {
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 2.2rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.lp-btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
.lp-btn-ghost {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 2.2rem;
  border-radius: 10px;
  text-decoration: none;
  border: 1.5px solid rgba(255,255,255,0.25);
  transition: background 0.2s;
}
.lp-btn-ghost:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Come funziona */
.lp-how {
  padding: 5rem 2rem;
  background: var(--slate-light);
}
.lp-how-inner { max-width: 1100px; margin: 0 auto; }
.lp-section-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
  text-align: center;
  color: var(--navy);
}
.lp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.lp-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.lp-card-num {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #2563eb;
  margin-bottom: 0.75rem;
}
.lp-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--navy);
}
.lp-card p {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* Login section */
.lp-login {
  padding: 5rem 2rem;
  background: #fff;
  display: flex;
  justify-content: center;
}
.lp-login-card {
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.lp-login-logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  margin-bottom: 0.2rem;
  text-align: center;
}
.lp-login-logo span { color: #2563eb; }
.lp-login-tagline {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}
.lp-field {
  margin-bottom: 1.1rem;
}
.lp-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.4rem;
}
.lp-field input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s;
}
.lp-field input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.lp-submit {
  width: 100%;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 0.8rem;
  font-size: 0.97rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 0.4rem;
  transition: background 0.2s, transform 0.15s;
}
.lp-submit:hover:not(:disabled) { background: #1d4ed8; transform: translateY(-1px); }
.lp-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.lp-error {
  color: #dc2626;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.75rem;
}
.lp-demo-hint {
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 1.4rem;
}
.lp-demo-hint a { color: #2563eb; text-decoration: none; font-weight: 500; }
.lp-demo-hint a:hover { text-decoration: underline; }

/* Footer */
.lp-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 1.5rem 2rem;
  font-size: 0.82rem;
}

@media (max-width: 600px) {
  .lp-hero { padding: 4rem 1.25rem 3.5rem; }
  .lp-how, .lp-login { padding: 3rem 1.25rem; }
  .lp-nav-inner { padding: 0.8rem 1.25rem; }
  .lp-login-card { padding: 2rem 1.5rem; }
  .demo-banner { padding: 0.75rem 1rem; }
  .demo-cta-btn { margin-left: 0; }
}

/* ── Footer Miglia Group ── */
.footer-miglia {
  background: var(--white);
  border-top: 2px solid var(--border);
  margin-top: 3rem;
  padding: 2rem;
}

.footer-miglia-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-logo {
  width: 180px;
  height: auto;
  flex-shrink: 0;
}

.footer-miglia-text {
  flex: 1;
  min-width: 240px;
}

.footer-miglia-title {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.footer-miglia-title strong {
  color: var(--navy);
}

.footer-miglia-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

.footer-miglia-contacts {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-contact-btn {
  display: inline-block;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: white;
  text-decoration: none;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.footer-contact-btn:hover { opacity: 0.85; }

.footer-contact-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 600px) {
  .footer-miglia-inner { flex-direction: column; gap: 1.25rem; }
  .footer-logo { width: 140px; }
}

/* ─────────────────────────────────────────────
   FOOTER LEGALE — link Privacy / Cookie
───────────────────────────────────────────── */
.footer-legal {
  text-align: center;
  padding: 0.75rem 1.5rem 1rem;
  background: #0b0f1a;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
}
.footer-legal a, .footer-legal button {
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
  font-size: 0.75rem;
}
.footer-legal a:hover, .footer-legal button:hover { color: #60a5fa; text-decoration: underline; }

/* ─────────────────────────────────────────────
   COOKIE BANNER
───────────────────────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2.5rem);
  max-width: 680px;
  background: #1a2235;
  border: 1px solid rgba(96,165,250,0.25);
  border-radius: 14px;
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 9000;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
}
#cookie-banner p { margin: 0; flex: 1; }
#cookie-banner a { color: #60a5fa; }
#cookie-banner-btn {
  flex-shrink: 0;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}
#cookie-banner-btn:hover { background: #1d4ed8; }
@media (max-width: 560px) {
  #cookie-banner { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  #cookie-banner-btn { width: 100%; text-align: center; }
}

/* ─────────────────────────────────────────────
   PAGINE LEGALI (privacy.html, cookie.html)
───────────────────────────────────────────── */
.legal-page {
  min-height: 100vh;
  background: #0b0f1a;
  color: rgba(255,255,255,0.88);
  font-family: inherit;
}
.legal-header {
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.legal-header-logo { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; text-decoration: none; }
.legal-header-logo span { color: #60a5fa; }
.legal-main {
  max-width: 780px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}
.legal-main h1 {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: #fff;
}
.legal-main .legal-updated {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.legal-main h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 2rem 0 0.6rem;
}
.legal-main h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin: 1.2rem 0 0.4rem;
}
.legal-main p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.75);
  margin-bottom: 0.75rem;
}
.legal-main ul {
  margin: 0.5rem 0 0.75rem 1.3rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.75);
}
.legal-main ul li { margin-bottom: 0.3rem; }
.legal-main a { color: #60a5fa; }
.legal-main .legal-box {
  background: rgba(96,165,250,0.08);
  border: 1px solid rgba(96,165,250,0.2);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.8);
}
.legal-main .legal-box strong { color: #60a5fa; }
.legal-main .legal-disclaimer {
  background: rgba(250,204,21,0.06);
  border: 1px solid rgba(250,204,21,0.2);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 2.5rem 0 0;
  font-size: 0.8rem;
  color: rgba(250,204,21,0.8);
  line-height: 1.5;
}

/* Cookie table */
.cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 1rem 0 1.5rem;
}
.cookie-table th {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cookie-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.72);
  vertical-align: top;
}
.cookie-table tr:last-child td { border-bottom: none; }
.badge-tecnico {
  background: rgba(52,211,153,0.12);
  color: #6ee7b7;
  border: 1px solid rgba(52,211,153,0.2);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .legal-main { padding: 1.5rem 1rem 3rem; }
  .legal-main h1 { font-size: 1.35rem; }
  .cookie-table { font-size: 0.73rem; }
  .cookie-table th, .cookie-table td { padding: 0.45rem 0.5rem; }
}

/* ─────────────────────────────────────────────
   FORM — checkbox privacy
───────────────────────────────────────────── */
.lp-privacy-check {
  margin: 0.85rem 0 0;
}
.lp-privacy-check label {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #475569;
}
.lp-privacy-check input[type="checkbox"] {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: #2563eb;
  cursor: pointer;
}
.lp-privacy-check a { color: #60a5fa; }
.lp-field-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.3rem;
  line-height: 1.4;
}
