/* AI Governance Assistant — iXa
   Un solo sistema di stile per sito, web-app, modulo pubblico e documenti. */

:root {
  --petrol: #1B3A4B;
  --petrol-deep: #12283A;
  --petrol-soft: #E4ECF0;
  --ink: #17262E;
  --muted: #5C6B73;
  --paper: #F4F6F7;
  --white: #FFFFFF;
  --line: #D9E0E4;
  --red: #C0392B;
  --red-deep: #7B241C;
  --amber: #B8720E;
  --green: #2F7D5B;
  --grey: #8A959B;
  --radius: 6px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--petrol); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #F2A79E; outline-offset: 2px;
}
h1, h2, h3 { font-weight: 800; line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 0.4em; color: var(--petrol); }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; margin-top: 2.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); font-size: 0.92rem; }
.small { font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- pulsanti e form ---------- */
.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: 0.95rem;
  padding: 10px 18px; border-radius: var(--radius); border: 1.5px solid var(--petrol);
  background: var(--petrol); color: var(--white); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--petrol-deep); }
.btn-primary { background: var(--red); border-color: var(--red); }
.btn-primary:hover { background: #A5301F; }
.btn-ghost { background: transparent; color: var(--petrol); }
.btn-ghost:hover { background: var(--petrol-soft); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--line); }
.btn-danger:hover { background: #FBEDEB; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
form label { display: block; margin-top: 16px; font-weight: 700; font-size: 0.9rem; color: var(--petrol); }
form label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
form input[type=text], form input[type=email], form input[type=password], form input[type=number],
form input[type=date], form textarea, form select {
  width: 100%; font: inherit; padding: 10px 12px; margin-top: 6px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--ink);
}
form textarea { min-height: 96px; resize: vertical; }
form input:focus, form textarea:focus, form select:focus { border-color: var(--petrol); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-actions { margin-top: 26px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.radio-group { display: grid; gap: 8px; margin-top: 8px; }
.radio-group label { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white); font-weight: 500; cursor: pointer; }
.radio-group label:has(input:checked) { border-color: var(--petrol); background: var(--petrol-soft); }
.radio-group input { margin-top: 4px; }
.form-narrow { max-width: 680px; }
.inline-form { display: inline; }
fieldset { border: 0; padding: 0; margin: 0; }

/* ---------- messaggi ---------- */
.flash { padding: 12px 16px; margin-bottom: 20px; border-radius: var(--radius);
  background: var(--petrol-soft); border-left: 4px solid var(--petrol); }
.flash.error { background: #FBEDEB; border-left-color: var(--red); }

/* ---------- stati (punto colorato + testo) ---------- */
.st { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 0.88rem; white-space: nowrap; }
.st::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--grey); flex: none; }
.st-vietato::before { background: var(--red-deep); }
.st-alto::before { background: var(--red); }
.st-trasparenza::before { background: var(--amber); }
.st-minimo::before { background: var(--green); }
.st-attesa::before { background: var(--grey); }
.st-alto-r::before { background: var(--red); }
.st-medio-r::before { background: var(--amber); }
.st-basso-r::before { background: var(--green); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 0.78rem; font-weight: 700;
  background: var(--petrol-soft); color: var(--petrol); }
.pill-red { background: #FBEDEB; color: var(--red); }
.pill-grey { background: #ECEFF1; color: var(--muted); }

/* ---------- tabelle ---------- */
table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.94rem; }
th { font-size: 0.82rem; color: var(--muted); font-weight: 700; background: #FAFBFC; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--petrol-soft); }
td .sub { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.table-wrap { overflow-x: auto; }
.empty { padding: 28px 20px; background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- pannelli ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; margin-bottom: 18px; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.panel-accent { border-left: 4px solid var(--red); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.9rem; }
.kv dd { margin: 0; }
.motivazione { background: var(--petrol-soft); padding: 14px 16px; border-radius: var(--radius); margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- numeri di sintesi ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-size: 1.9rem; font-weight: 800; color: var(--petrol); line-height: 1.1; }
.stat.warn b { color: var(--red); }
.stat span { color: var(--muted); font-size: 0.88rem; }

/* ---------- barra a segmenti (rischio dichiarazioni) ---------- */
.segbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--line); margin: 10px 0 6px; }
.segbar i { display: block; height: 100%; }
.segbar .r-alto { background: var(--red); } .segbar .r-medio { background: var(--amber); } .segbar .r-basso { background: var(--green); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.88rem; color: var(--muted); }

/* ---------- tab ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 24px 0 22px; flex-wrap: wrap; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 700; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--petrol); border-bottom-color: var(--red); }
.tabs a .pill { margin-left: 6px; }

/* ======================================================================
   LAYOUT APP (barra laterale)
   ====================================================================== */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--petrol); color: var(--white); padding: 22px 18px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: var(--white); text-decoration: none; font-weight: 800; font-size: 1.15rem; margin-bottom: 18px; display: block; }
.sidebar .brand small { display: block; font-weight: 500; font-size: 0.78rem; color: #B9CBD4; }
.sidebar a.nav { color: #D6E2E8; text-decoration: none; padding: 9px 12px; border-radius: var(--radius); font-weight: 600; font-size: 0.94rem; }
.sidebar a.nav:hover, .sidebar a.nav.active { background: rgba(255,255,255,0.10); color: var(--white); }
.sidebar .spacer { flex: 1; }
.sidebar .user { font-size: 0.85rem; color: #B9CBD4; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.15); }
.sidebar .user b { display: block; color: var(--white); }
.content { padding: 34px 40px 80px; max-width: 1180px; width: 100%; }
.breadcrumb { font-size: 0.88rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }

/* ======================================================================
   SITO PUBBLICO
   ====================================================================== */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.site-header .in { max-width: 1120px; margin: 0 auto; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.site-header .brand { font-weight: 800; font-size: 1.25rem; color: var(--petrol); text-decoration: none; }
.site-header .brand em { font-style: normal; color: var(--red); }
.site-header nav { display: flex; gap: 22px; align-items: center; }
.site-header nav a { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.site-header nav a.btn { color: var(--white); }
.section { max-width: 1120px; margin: 0 auto; padding: 72px 24px; }
.section.tight { padding-top: 40px; padding-bottom: 40px; }
.section h2 { font-size: 1.8rem; margin-top: 0; }
.section .lead { font-size: 1.15rem; max-width: 640px; color: var(--muted); }
.band { background: var(--white); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band-dark { background: var(--petrol); color: var(--white); }
.band-dark h2, .band-dark a { color: var(--white); }
.band-dark .lead { color: #C9D8DF; }

/* hero: titolo a sinistra, calendario delle scadenze come elemento portante */
.hero { max-width: 1120px; margin: 0 auto; padding: 72px 24px 56px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 4.2vw, 3.2rem); line-height: 1.05; margin-bottom: 20px; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 520px; margin-bottom: 28px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; border-left: 3px solid var(--line); position: relative; }
.timeline li { position: relative; padding: 0 0 22px 22px; }
.timeline li::before { content: ""; position: absolute; left: -31px; top: 6px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--red); border: 3px solid var(--paper); box-shadow: 0 0 0 2px var(--red); }
.timeline li.done::before { background: var(--petrol); box-shadow: 0 0 0 2px var(--petrol); }
.timeline li.future::before { background: var(--white); box-shadow: 0 0 0 2px var(--grey); }
.timeline .d { font-weight: 800; font-size: 1.15rem; color: var(--petrol); display: block; }
.timeline li.done .d::after { content: "in vigore"; margin-left: 10px; font-size: 0.75rem; font-weight: 700; color: var(--white); background: var(--petrol); padding: 2px 8px; border-radius: 99px; vertical-align: middle; }
.timeline li.now .d::after { content: "in vigore da agosto"; margin-left: 10px; font-size: 0.75rem; font-weight: 700; color: var(--white); background: var(--red); padding: 2px 8px; border-radius: 99px; vertical-align: middle; }
.timeline li.future .d::after { content: "differito dal Digital Omnibus"; margin-left: 10px; font-size: 0.75rem; font-weight: 700; color: var(--muted); background: #ECEFF1; padding: 2px 8px; border-radius: 99px; vertical-align: middle; }
.timeline .t { color: var(--ink); }
.timeline-note { margin-top: 10px; font-size: 0.85rem; color: var(--muted); padding-left: 44px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.feature { padding: 28px 26px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feature:nth-child(3n) { border-right: 0; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--muted); margin: 0; font-size: 0.95rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: block; font-size: 1.6rem; font-weight: 800; color: var(--red); margin-bottom: 6px; }
.steps b { display: block; margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: 0.9rem; }

.usage { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.usage ul { padding-left: 20px; }
.usage li { margin-bottom: 8px; }
.mock { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; font-size: 0.9rem; }
.mock .row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.mock .row:last-child { border-bottom: 0; }
.mock .row b { font-weight: 700; }

.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.price { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 26px; }
.price.featured { border-color: var(--petrol); border-width: 2px; }
.price h3 { margin-bottom: 4px; }
.price .amount { font-size: 1.9rem; font-weight: 800; color: var(--petrol); margin: 10px 0 2px; }
.price .amount small { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.price ul { padding-left: 18px; margin: 14px 0 0; color: var(--ink); font-size: 0.93rem; }
.price li { margin-bottom: 6px; }

.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { font-weight: 700; cursor: pointer; color: var(--petrol); }
.faq p { margin: 10px 0 0; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 30px 24px; color: var(--muted); font-size: 0.88rem; }
.site-footer .in { max-width: 1120px; margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ======================================================================
   MODULO PUBBLICO / LOGIN (pagina centrata)
   ====================================================================== */
.centered { max-width: 640px; margin: 0 auto; padding: 48px 24px 80px; }
.centered.narrow { max-width: 420px; }
.centered .brand { font-weight: 800; color: var(--petrol); text-decoration: none; font-size: 1.15rem; display: block; margin-bottom: 26px; }
.centered .brand em { font-style: normal; color: var(--red); }

/* ======================================================================
   DOCUMENTI STAMPABILI
   ====================================================================== */
.doc { max-width: 860px; margin: 0 auto; padding: 40px 32px 80px; background: var(--white); }
.doc .head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--petrol); padding-bottom: 14px; margin-bottom: 26px; }
.doc .head .brand { font-weight: 800; font-size: 1.2rem; color: var(--petrol); }
.doc .head .brand em { font-style: normal; color: var(--red); }
.doc h1 { font-size: 1.7rem; }
.doc h2 { font-size: 1.15rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.doc table { font-size: 0.88rem; }
.doc .print-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.doc .firma { margin-top: 48px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.doc .firma div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 0.88rem; color: var(--muted); }
@media print {
  body { background: var(--white); }
  .doc { padding: 0; max-width: none; }
  .print-bar, .no-print { display: none !important; }
  a { color: inherit; text-decoration: none; }
}

/* ======================================================================
   RESPONSIVE
   ====================================================================== */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 48px; }
  .features, .pricing, .grid-3 { grid-template-columns: 1fr 1fr; }
  .feature:nth-child(3n) { border-right: 1px solid var(--line); }
  .feature:nth-child(2n) { border-right: 0; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px 16px; }
  .sidebar .brand { margin: 0 14px 0 0; }
  .sidebar .brand small { display: none; }
  .sidebar .spacer { display: none; }
  .sidebar .user { border: 0; padding: 0 0 0 8px; margin-left: auto; }
  .sidebar .user b { display: inline; margin-right: 8px; }
  .content { padding: 22px 18px 60px; }
}
@media (max-width: 640px) {
  .features, .pricing, .grid-2, .grid-3, .usage, .form-row { grid-template-columns: 1fr; }
  .feature { border-right: 0 !important; }
  .steps { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; }
  .site-header nav { gap: 12px; }
  .site-header nav a:not(.btn) { display: none; }
  h1 { font-size: 1.6rem; }
}
