:root {
  --primary: #0369a1;
  --primary-dark: #075985;
  --primary-light: #e0f2fe;
  --accent: #0891b2;
  --ink: #0f172a;
  --muted: #64748b;
  --surface: #ffffff;
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --border: #e2e8f0;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 6px -2px rgba(15,23,42,0.05), 0 10px 20px -4px rgba(15,23,42,0.08);
  --shadow-lg: 0 20px 40px -12px rgba(3,105,161,0.25);
  --max-w: 1180px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
ul { padding-left: 1.2rem; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.top-banner { background: var(--primary-dark); color: white; font-size: 0.85rem; padding: 8px 0; }
.top-banner .container { display: flex; gap: 24px; flex-wrap: wrap; justify-content: flex-end; }
.top-banner a { color: white; font-weight: 600; }
.nav-row { display: flex; align-items: center; gap: 32px; padding: 16px 20px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; font-weight: 800; font-size: 1.3rem;
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-size: 1.1rem; letter-spacing: -0.02em; }
.logo-text span { font-size: 0.75rem; color: var(--muted); }
.main-nav { display: flex; gap: 28px; margin-left: auto; margin-right: 24px; }
.main-nav a { color: var(--ink); font-weight: 500; font-size: 0.95rem; position: relative; padding: 6px 0; }
.main-nav a.active::after, .main-nav a:hover::after {
  content: ""; position: absolute; bottom: -2px; left: 0; right: 0; height: 2px; background: var(--primary); border-radius: 2px;
}
.main-nav a.active { color: var(--primary); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 10px; font-weight: 600; font-family: inherit; font-size: 0.95rem; border: 1px solid transparent; cursor: pointer; transition: all 0.15s; text-decoration: none; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); color: white; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--primary-light); border-color: var(--primary); }

/* Hero */
.hero { padding: 72px 0 80px; background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; align-items: center; }
.eyebrow { display: inline-block; font-size: 0.8rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 18px; padding: 4px 12px; background: white; border-radius: 999px; border: 1px solid var(--border); }
.hero h1 em { color: var(--primary); font-style: normal; }
.lead { font-size: 1.15rem; color: var(--muted); margin-bottom: 32px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 48px; }
.trust-row { display: flex; gap: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.trust-row > div { display: flex; flex-direction: column; }
.trust-row strong { font-size: 1.8rem; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.trust-row span { font-size: 0.85rem; color: var(--muted); }

/* Hero card */
.hero-card { background: white; border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.hero-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.hero-card-header h3 { margin: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); display: inline-block; }
.pulse { animation: pulse 2s infinite; box-shadow: 0 0 0 0 rgba(5,150,105,0.4); }
@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(5,150,105,0); }
  100% { box-shadow: 0 0 0 0 rgba(5,150,105,0); }
}
.quick-link { display: flex; align-items: center; gap: 16px; padding: 14px 12px; border-radius: 10px; color: var(--ink); margin-bottom: 4px; transition: background 0.15s; }
.quick-link:hover { background: var(--bg-alt); color: var(--ink); }
.quick-link .icon { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.quick-link small { display: block; color: var(--muted); font-size: 0.85rem; }

/* News strip */
.news-strip { padding: 28px 0; background: white; border-bottom: 1px solid var(--border); }
.news-strip .container { display: flex; gap: 16px; align-items: center; overflow-x: auto; }
.news-card { background: var(--bg-alt); border-radius: 10px; padding: 12px 16px; min-width: 220px; border: 1px solid var(--border); }
.news-card.urgent { border-color: var(--danger); background: #fef2f2; }
.news-card .tag { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary); margin-bottom: 4px; }
.news-card.urgent .tag { color: var(--danger); }
.news-card strong { display: block; font-size: 0.95rem; }
.news-card small { color: var(--muted); font-size: 0.8rem; }
.news-more { margin-left: auto; font-weight: 600; white-space: nowrap; }

/* Services */
.services { padding: 80px 0; }
.services h2, .section-head h2 { text-align: center; }
.section-lead { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 48px; font-size: 1.05rem; }
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.service-card { display: block; padding: 28px; background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); transition: all 0.2s; color: var(--ink); }
.service-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow-lg); color: var(--ink); }
.service-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--primary-light); color: var(--primary); font-weight: 800; display: grid; place-items: center; margin-bottom: 20px; }
.service-card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 16px; }
.service-cta { color: var(--primary); font-weight: 600; font-size: 0.9rem; }

/* Explainer + Chat preview */
.explainer { padding: 80px 0; background: linear-gradient(180deg, var(--bg) 0%, var(--primary-light) 100%); }
.explainer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.bullet-list { list-style: none; padding: 0; }
.bullet-list li { padding: 10px 0 10px 32px; position: relative; font-weight: 500; }
.bullet-list li::before { content: "OK"; position: absolute; left: 0; top: 10px; background: var(--primary); color: white; width: 22px; height: 22px; border-radius: 50%; font-size: 0.65rem; font-weight: 800; display: grid; place-items: center; }
.chat-preview { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; }
.chat-header { padding: 16px 20px; background: var(--primary-dark); color: white; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.chat-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.bubble { padding: 12px 16px; border-radius: 16px; max-width: 85%; font-size: 0.95rem; line-height: 1.5; }
.bubble.user { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.bot { background: white; color: var(--ink); align-self: flex-start; border: 1px solid var(--border); border-bottom-left-radius: 4px; }

/* News full */
.news-full { padding: 80px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.section-head h2 { margin: 0; }
.link-arrow { font-weight: 600; }
.news-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.news-list article { background: white; padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.news-list article h4 { margin: 8px 0 4px; }
.news-list article small { color: var(--muted); font-size: 0.85rem; }
.news-list article p { margin: 12px 0 0; color: var(--muted); font-size: 0.95rem; }
.news-list article .tag { display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary); padding: 3px 8px; background: var(--primary-light); border-radius: 4px; }
.news-list article .tag.urgent { color: var(--danger); background: #fef2f2; }

/* CTA Bar */
.cta-bar { padding: 56px 0; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; }
.cta-bar .container { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.cta-bar h2 { margin: 0 0 8px; color: white; }
.cta-bar p { margin: 0; opacity: 0.9; }
.cta-actions { display: flex; gap: 12px; }
.cta-bar .btn-primary { background: white; color: var(--primary); }
.cta-bar .btn-primary:hover { background: var(--bg); color: var(--primary-dark); }
.cta-bar .btn-ghost { color: white; border-color: rgba(255,255,255,0.3); }
.cta-bar .btn-ghost:hover { background: rgba(255,255,255,0.1); border-color: white; }

/* Footer */
.site-footer { background: var(--ink); color: #cbd5e1; padding: 64px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; padding-bottom: 40px; }
.site-footer .logo-text strong { color: white; }
.site-footer .logo-text span { color: #94a3b8; }
.site-footer h5 { color: white; margin-bottom: 16px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { padding: 4px 0; font-size: 0.9rem; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 20px 0; font-size: 0.85rem; color: #94a3b8; }
.footer-bottom .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.proto-tag { background: rgba(255,255,255,0.1); padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; }

/* Page styles -- common */
.page-hero { padding: 48px 0 32px; background: var(--primary-light); border-bottom: 1px solid var(--border); }
.page-hero h1 { margin-bottom: 8px; }
.page-hero .lead { margin-bottom: 0; }
.page-content { padding: 48px 0 80px; }
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }

/* Calcolatore */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.form-card, .result-card { background: white; padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-group small { color: var(--muted); font-size: 0.8rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border); font-family: inherit; font-size: 1rem; background: var(--bg); transition: border 0.15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); background: white; }
.slider-row { display: flex; align-items: center; gap: 16px; }
.slider-row input[type="range"] { flex: 1; }
.slider-value { min-width: 60px; font-weight: 700; font-size: 1.3rem; color: var(--primary); text-align: right; }
.result-total { font-size: 2.4rem; font-weight: 800; color: var(--primary); margin: 8px 0; letter-spacing: -0.02em; }
.result-sub { color: var(--muted); }
.result-breakdown { margin: 24px 0; }
.result-breakdown dl { margin: 0; }
.result-breakdown .row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 0.95rem; }
.result-breakdown .row:last-child { border-bottom: none; font-weight: 700; padding-top: 14px; border-top: 2px solid var(--ink); border-bottom: none; }
.result-breakdown .row small { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 2px; }

/* Wizard reclami */
.wizard { background: white; padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); max-width: 720px; margin: 0 auto; }
.wizard-steps { display: flex; justify-content: space-between; margin-bottom: 32px; position: relative; }
.wizard-steps::before { content: ""; position: absolute; top: 18px; left: 20px; right: 20px; height: 2px; background: var(--border); z-index: 0; }
.wizard-step { position: relative; z-index: 1; text-align: center; flex: 1; }
.wizard-step .circle { width: 36px; height: 36px; border-radius: 50%; background: white; border: 2px solid var(--border); color: var(--muted); display: grid; place-items: center; font-weight: 700; margin: 0 auto 6px; transition: all 0.2s; }
.wizard-step.active .circle { background: var(--primary); border-color: var(--primary); color: white; }
.wizard-step.done .circle { background: var(--success); border-color: var(--success); color: white; }
.wizard-step small { font-size: 0.75rem; color: var(--muted); }
.wizard-step.active small { color: var(--primary); font-weight: 600; }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-actions { display: flex; justify-content: space-between; margin-top: 32px; gap: 12px; }
.wizard-summary { background: var(--bg-alt); padding: 20px; border-radius: 10px; margin-bottom: 24px; }
.wizard-summary dt { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wizard-summary dd { margin: 2px 0 12px; font-weight: 600; }

/* Tariffe */
.tariff-filter { background: white; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 32px; display: flex; gap: 16px; flex-wrap: wrap; align-items: end; }
.tariff-filter .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }
.tariff-table { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; }
.tariff-row { display: grid; grid-template-columns: 2fr 1fr 1fr; padding: 16px 20px; border-bottom: 1px solid var(--border); align-items: center; gap: 16px; }
.tariff-row.header { background: var(--bg-alt); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.tariff-row:last-child { border-bottom: none; }
.tariff-row .value { font-weight: 700; color: var(--primary); text-align: right; }
.tariff-row .unit { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.tariff-note { margin-top: 12px; padding: 12px 16px; background: var(--primary-light); border-radius: 8px; font-size: 0.9rem; color: var(--primary-dark); }

/* Qualita' */
.quality-head { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 48px; align-items: center; }
.quality-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.metric-card { background: white; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); text-align: center; }
.metric-card strong { display: block; font-size: 1.8rem; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }
.metric-card span { font-size: 0.85rem; color: var(--muted); }
.metric-card.ok strong { color: var(--success); }
.chart-card { background: white; padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.chart-card h3 { margin-bottom: 24px; }
.chart-legend { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }

/* Chat widget */
#chat-widget { position: fixed; bottom: 24px; right: 24px; z-index: 200; }
.chat-bubble {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white; display: grid; place-items: center;
  box-shadow: 0 12px 30px rgba(3,105,161,0.4);
  cursor: pointer; font-size: 1.6rem; font-weight: 800;
  transition: transform 0.2s;
  border: none;
}
.chat-bubble:hover { transform: scale(1.08); }
.chat-window {
  position: absolute; bottom: 80px; right: 0; width: 380px; max-width: calc(100vw - 48px);
  background: white; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 30px 60px -12px rgba(15,23,42,0.3), 0 12px 24px rgba(15,23,42,0.15);
  display: none; flex-direction: column; height: 520px; max-height: calc(100vh - 128px);
  border: 1px solid var(--border);
}
.chat-window.open { display: flex; }
.chat-window .chat-header { justify-content: space-between; }
.chat-window .chat-header button { background: transparent; border: none; color: white; cursor: pointer; font-size: 1.3rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.chat-input { display: flex; padding: 12px; gap: 8px; border-top: 1px solid var(--border); background: white; }
.chat-input input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 20px; font-family: inherit; font-size: 0.95rem; }
.chat-input input:focus { outline: none; border-color: var(--primary); }
.chat-input button { background: var(--primary); color: white; border: none; padding: 10px 18px; border-radius: 20px; font-weight: 600; cursor: pointer; }
.chat-suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 12px; background: var(--bg); }
.chat-suggest button { background: white; border: 1px solid var(--border); color: var(--primary); padding: 6px 12px; border-radius: 14px; font-size: 0.8rem; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.chat-suggest button:hover { background: var(--primary-light); }

/* Responsive */
@media (max-width: 900px) {
  .hero-grid, .explainer-grid, .quality-head, .calc-grid { grid-template-columns: 1fr; gap: 32px; }
  .service-grid, .news-list { grid-template-columns: 1fr; }
  .quality-metrics { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .main-nav { display: none; }
  .top-banner .container { justify-content: flex-start; font-size: 0.75rem; gap: 12px; }
  .nav-row { flex-wrap: wrap; gap: 12px; }
}
