/* Stile copiato dal prototipo (docs/prototipo_app_bisogni.html): non modificare qui, aggiungere in app.css */
:root {
  --navy: #224676;
  --celeste: #8AADC7;
  --celeste-bg: #EDF3F8;
  --rosso: #B03A2E;
  --ambra: #C9862B;
  --verde: #3D7A4F;
  --verde-testo: #2F6B40;
  --riga: #DBE3EC;
  --bg: #F6F8FB;
  --bg-panel: #ffffff;
  --testo: #26303B;
  --testo-soft: #5A6472;
  --titolo: #224676;
  --font: 'Poppins', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark; --verde-testo: #7CC593;
    --bg: #14181f; --bg-panel: #1c222c; --testo: #e7ecf2; --testo-soft: #aab4c2;
    --celeste-bg: #1b2836; --riga: #313d4c; --titolo: #9DBBD6;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark; --verde-testo: #7CC593;
  --bg: #14181f; --bg-panel: #1c222c; --testo: #e7ecf2; --testo-soft: #aab4c2;
  --celeste-bg: #1b2836; --riga: #313d4c; --titolo: #9DBBD6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--testo); font-family: var(--font); line-height: 1.5; }
img { max-width: 100%; }
button, input, select, textarea { font-family: var(--font); }
:focus-visible { outline: 2px solid var(--celeste); outline-offset: 2px; }

/* ---------- guscio app ---------- */
.topbar {
  background: var(--bg-panel); border-bottom: 2px solid var(--celeste);
  display: flex; align-items: center; gap: 14px; padding: 10px 18px; position: sticky; top: 0; z-index: 20;
}
.topbar .logo { background: #fff; border-radius: 6px; padding: 3px 6px; display: flex; }
.topbar img { height: 36px; width: auto; }
.topbar h1 { font-size: 1.02rem; font-weight: 600; color: var(--titolo); margin: 0; white-space: nowrap; }
.profilo { position: relative; }
.profilo-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--riga); background: var(--bg-panel); color: var(--testo); border-radius: 20px; padding: 4px 5px 4px 12px; font-size: .84rem; cursor: pointer; white-space: nowrap; }
.profilo-btn.vuoto #profiloNome { color: var(--ambra); font-weight: 600; }
.profilo-vista { background: var(--navy); color: #fff; border-radius: 12px; padding: 2px 9px; font-size: .72rem; font-weight: 600; }
.profilo-panel { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; background: var(--bg-panel); border: 1px solid var(--riga); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.14); padding: 12px; z-index: 45; }
.profilo-panel .lbl { display: block; font-size: .8rem; color: var(--testo-soft); margin: 10px 0 4px; }
.profilo-panel .seg { display: flex; }
.profilo-panel .seg button { flex: 1; }
.rinomina { margin-top: 12px; padding: 10px; border-radius: 8px; background: var(--celeste-bg); font-size: .82rem; }
.rinomina p { margin: 0 0 8px; }
.rin-btn { display: flex; gap: 8px; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.cambia-int { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; width: 100%; }
.cambia-int input { flex: 1 1 200px; }
.topbar p { margin: 0; font-size: .76rem; color: var(--testo-soft); }
.seg { display: inline-flex; border: 1.5px solid var(--navy); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: transparent; color: var(--titolo); font-size: .82rem; font-weight: 500; padding: 6px 12px; cursor: pointer; }
.seg button.on { background: var(--navy); color: #fff; }

.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.shell > * { min-width: 0; }
.nav { background: var(--navy); padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 761px) { .nav-wrap { background: var(--navy); } .nav { position: sticky; top: 60px; } }
.nav button {
  background: transparent; color: #D9E4EF; border: none; text-align: left; padding: 10px 12px;
  border-radius: 7px; font-size: .9rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.nav button:hover { background: rgba(255,255,255,.08); }
.nav button.active { background: #fff; color: var(--navy); font-weight: 600; }
.nav .count { background: var(--ambra); color: #fff; border-radius: 10px; font-size: .7rem; padding: 1px 7px; font-weight: 600; }
.nav .sep { border-top: 1px solid rgba(255,255,255,.15); margin: 10px 4px; }
.main { padding: 22px 26px 40px; min-width: 0; }
.screen { display: none; max-width: 980px; }
.screen.active { display: block; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { position: static; }
  .topbar p { display: none; }
  .nav-wrap { position: sticky; top: 0; z-index: 15; }
  .nav { flex-direction: row; overflow-x: auto; padding: 8px; }
  .nav button { white-space: nowrap; flex: none; }
  .nav .sep { display: none; }
  .main { padding: 16px 12px 40px; }
  .topbar { flex-wrap: wrap; }
    }

.screen-head { margin-bottom: 18px; }
.screen-head h2 { margin: 0; font-size: 1.35rem; color: var(--titolo); font-weight: 600; }
.screen-head p { margin: 2px 0 0; color: var(--testo-soft); font-size: .88rem; }

.panel { background: var(--bg-panel); border: 1px solid var(--riga); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 1rem; color: var(--titolo); font-weight: 600; }
.hint { font-size: .78rem; color: var(--testo-soft); }
.panel .hint { margin: -6px 0 10px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--bg-panel); border: 1px solid var(--riga); border-left: 4px solid var(--navy); border-radius: 8px; padding: 12px 14px; }
.kpi .v { font-size: 1.6rem; font-weight: 600; color: var(--titolo); line-height: 1.2; }
.kpi .l { font-size: .78rem; color: var(--testo-soft); }
.kpi.warn { border-left-color: var(--ambra); }
.kpi-link { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.kpi-link:hover { background: var(--celeste-bg); }
.kpi.ok { border-left-color: var(--verde); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }

/* ---------- liste ---------- */
.row-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 8px; border-bottom: 1px solid var(--riga); cursor: pointer; border-radius: 6px;
}
.row-item:last-child { border-bottom: none; }
.row-item:hover { background: var(--celeste-bg); }
.row-item .t { font-weight: 500; }
.row-item .s { font-size: .78rem; color: var(--testo-soft); }
.row-item .r { text-align: right; font-size: .78rem; color: var(--testo-soft); }
.empty { color: var(--testo-soft); font-size: .88rem; padding: 10px 4px; }
.stato { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 10px; color: #fff; white-space: nowrap; }
.stato.da_contattare { background: #7A8594; }
.stato.in_trattativa { background: var(--ambra); }
.stato.chiusa_polizza { background: var(--verde); }
.stato.nessun_interesse { background: #9A5B52; }
.scaduto { color: var(--rosso); font-weight: 600; }
.ric-oggi { color: var(--ambra); font-weight: 600; }
.ric-presto { color: var(--titolo); font-weight: 600; }
.ric-dopo { color: var(--titolo); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.filters > * { flex: 1 1 180px; }

/* ---------- form ---------- */
fieldset { border: 1px solid var(--riga); border-radius: 10px; padding: 14px 16px 18px; margin: 0 0 16px; background: var(--bg-panel); }
legend { font-weight: 600; color: var(--titolo); padding: 0 6px; font-size: .95rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
label { display: block; font-size: .8rem; color: var(--testo-soft); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font-size: .92rem; color: var(--testo); background: var(--bg-panel);
  border: 1px solid var(--riga); border-radius: 7px; padding: 8px 10px;
}
textarea { min-height: 54px; resize: vertical; }
.check-row { display: flex; align-items: flex-start; gap: 8px; grid-column: 1/-1; }
.check-row input { width: auto; margin-top: 3px; }
.check-row label { margin: 0; color: var(--testo); font-size: .85rem; }

.btn { font-weight: 600; font-size: .9rem; border: none; border-radius: 8px; padding: 10px 20px; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-secondary { background: transparent; color: var(--titolo); border: 1.5px solid var(--navy); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 20px; }
.status { font-size: .85rem; color: var(--testo-soft); margin: 8px 2px; min-height: 1.2em; }
.status.err { color: var(--rosso); font-weight: 500; }

/* ---------- documento analisi ---------- */
.doc { background: #fff; color: #26303B; border: 1px solid #DBE3EC; border-radius: 10px; padding: 14px;
  margin: 0 auto 14px; max-width: 190mm; }
.band { background: #224676; color: #fff; border-radius: 8px; padding: 7px 12px; margin-bottom: 8px; border-bottom: 2px solid #8AADC7; }
.band h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.band p { margin: 2px 0 0; font-size: .74rem; color: #D9E4EF; font-weight: 300; line-height: 1.35; }
.apertura { border-left: 3px solid #8AADC7; background: #F6F9FC; color: #224676; font-style: italic; font-size: .95rem; padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 0 0 16px; break-inside: avoid; }
.sit-table { border: 1px solid #DBE3EC; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.sit-row { display: flex; border-bottom: 1px solid #DBE3EC; border-left: 3px solid #8AADC7; }
.sit-row:last-child { border-bottom: none; }
.sit-label { flex: 0 0 152px; font-size: .68rem; font-weight: 600; color: #224676; padding: 4px 10px; background: #EDF3F8; line-height: 1.35; }
.sit-text { flex: 1; padding: 4px 10px; font-size: .78rem; line-height: 1.35; }
@media (max-width: 560px) { .sit-row { flex-direction: column; } .sit-label { flex: none; } }
.bisogni-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid #DBE3EC; }
table.bisogni { width: 100%; border-collapse: collapse; min-width: 520px; font-size: .76rem; }
table.bisogni th { background: #224676; color: #fff; text-align: left; padding: 5px 9px; font-weight: 500; font-size: .7rem; }
table.bisogni td { padding: 4px 9px; border-bottom: 1px solid #DBE3EC; vertical-align: top; line-height: 1.3; }
table.bisogni tr:last-child td { border-bottom: none; }
table.bisogni tr:nth-child(even) td { background: #EDF3F8; }
.b-num { color: #8AADC7; font-weight: 700; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.doc-head img { height: 30px; width: auto; }
.doc-head .contatti { font-size: .64rem; color: #5A6472; text-align: right; line-height: 1.35; }
/* la frase che dice che cos'è questo foglio: non è consulenza (chiesta il 05/10/2026) */
.doc-nota { margin: 6px 0 0; font-size: .68rem; color: #5A6472; line-height: 1.35; }
.doc-nota b { color: #26303B; font-weight: 600; }
.doc-marchi { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.doc-marchi img { height: 13px; width: auto; }
.avvisi { border: 1px solid var(--ambra); background: rgba(201,134,43,.08); border-radius: 10px; padding: 12px 16px; margin: 0 0 14px; }
.avvisi h3 { margin: 0 0 6px; font-size: .95rem; color: var(--testo); }
.avvisi ul { margin: 0 0 10px; padding-left: 18px; font-size: .86rem; }
.banner-mod { border-left: 4px solid var(--ambra); background: var(--bg-panel); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: .86rem; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick button { border: 1px solid var(--riga); background: var(--bg-panel); color: var(--testo); border-radius: 14px; font-size: .74rem; padding: 3px 10px; cursor: pointer; }
.btn-danger { background: transparent; color: var(--rosso); border: 1.5px solid var(--rosso); }
.btn-danger.confirm { background: var(--rosso); color: #fff; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.row-head h3 { margin: 0; }
.cerca-top { position: relative; margin-left: auto; flex: 0 1 300px; }
.cerca-top input { width: 100%; padding: 6px 10px; font-size: .84rem; border-radius: 20px; }
.cerca-ris { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 280px; background: var(--bg-panel); border: 1px solid var(--riga); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 40; max-height: 360px; overflow: auto; }
.cerca-ris button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; cursor: pointer; color: var(--testo); border-bottom: 1px solid var(--riga); }
.cerca-ris button:hover, .cerca-ris button:focus { background: var(--celeste-bg); }
.cerca-ris small { display: block; color: var(--testo-soft); font-size: .74rem; }
.sommario { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; }
.sommario .nome { font-size: 1.1rem; font-weight: 600; color: var(--titolo); }
.sommario .dato { font-size: .82rem; color: var(--testo-soft); }
.sommario .dato b { color: var(--testo); font-weight: 500; }
.es-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 8px 14px; padding: 10px 4px; border-bottom: 1px solid var(--riga); align-items: start; }
.es-row:last-child { border-bottom: none; }
.es-tit b { color: var(--titolo); font-weight: 600; }
.es-tit .cat { font-size: .74rem; color: var(--testo-soft); margin-left: 4px; }
.es-info { font-size: .78rem; color: var(--verde-testo); margin-top: 3px; }
.es-info.neg { color: var(--testo-soft); }
.es-salva { width: 100%; margin-top: 6px; }
.es-sub { grid-column: 1 / -1; background: var(--celeste-bg); border-radius: 8px; padding: 10px 12px; }
.es-sub .grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .es-row { grid-template-columns: 1fr; } .es-sub .grid { grid-template-columns: 1fr; } }
.es-stato { border-left-width: 5px; }
.es-stato.st-proposto { border-left-color: #7A8594; }
.es-stato.st-interessato { border-left-color: #5C86AE; }
.es-stato.st-preventivo { border-left-color: var(--ambra); }
.es-stato.st-sottoscritto { border-left-color: var(--verde); }
.es-stato.st-non_interessato { border-left-color: #9A5B52; }
.cont-item { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--riga); font-size: .84rem; align-items: start; }
.cont-item:last-child { border-bottom: none; }
.cont-item .d { color: var(--testo-soft); }
.cont-item .t { font-weight: 500; }
.cont-item small { display: block; color: var(--testo-soft); font-size: .74rem; }
.cont-item button { border: none; background: none; color: var(--testo-soft); cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 6px; }
.sommario-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sommario-wrap > #sommario { flex: 1 1 420px; }
.status:empty { min-height: 0; margin: 0; }
.blocco { padding: 12px 0; border-top: 1px solid var(--riga); }
.blocco:first-of-type { border-top: none; padding-top: 2px; }
.titoletto { display: block; font-size: .86rem; font-weight: 600; color: var(--testo); margin-bottom: 8px; }
.riga-titoletto { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.riga-titoletto .titoletto { margin: 0; }
.form-contatto { background: var(--celeste-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.evidenzia { animation: evid 1.6s ease-out; border-radius: 8px; }
@keyframes evid { 0% { background: rgba(138,173,199,.45); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .evidenzia { animation: none; } }
.riga-data { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.riga-data input { width: 180px; }
.riga-data .quick { margin-top: 0; }
.grid-contatto { grid-template-columns: 1fr 180px; }
.grid-contatto .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid-contatto { grid-template-columns: 1fr; } .riga-data input { width: 100%; } }
.link-mini { border: none; background: none; color: var(--testo-soft); cursor: pointer; font-size: .72rem; padding: 0 2px; vertical-align: middle; }
.link-mini:hover { color: var(--titolo); text-decoration: underline; }
.link { border: none; background: none; color: var(--titolo); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.avviso-cliente { margin-top: 6px; border: 1px solid var(--ambra); background: rgba(201,134,43,.08); border-radius: 8px; padding: 8px 12px; font-size: .82rem; }
.avviso-cliente .sim { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 4px 0; border-top: 1px dashed var(--riga); }
.avviso-cliente .sim:first-of-type { border-top: none; }
.doppione { color: var(--ambra); }
.lbl-campo { display: block; font-size: .8rem; color: var(--testo-soft); margin-bottom: 6px; }
.lbl-campo em { font-style: normal; opacity: .8; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { border: 1px solid var(--riga); border-radius: 18px; padding: 6px 12px; font-size: .85rem; color: var(--testo); background: var(--bg-panel); transition: background .12s; }
.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--celeste); outline-offset: 2px; }
.filtro-giorni { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.giorno-preciso { display: flex; align-items: center; gap: 8px; }
.giorno-preciso label { margin: 0; white-space: nowrap; font-size: .76rem; }
.giorno-preciso input { width: 140px; font-size: .78rem; padding: 4px 8px; border-radius: 16px; }
.chip span b { font-weight: 600; opacity: .85; margin-left: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.doc-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 10px; }
.doc-head-row .doc-titolo { margin: 0; }
.doc-cliccabile { cursor: pointer; transition: box-shadow .12s; }
.doc-cliccabile:hover { box-shadow: 0 0 0 2px var(--celeste); }
.ed-sit { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.ed-bis { border: 1px solid var(--riga); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.ed-bis .grid { grid-template-columns: 1fr 1fr; }
.ed-bis .riga-fine { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-top: 8px; }
.ed-bis .riga-fine > div { flex: 1 1 140px; }
.ed-canc { border: none; background: none; color: var(--rosso); cursor: pointer; font-size: .8rem; text-decoration: underline; padding: 6px 0; }
@media (max-width: 560px) { .ed-sit { grid-template-columns: 1fr; } .ed-bis .grid { grid-template-columns: 1fr; } }
.doc-titolo { font-size: 1rem; color: var(--titolo); margin: 8px 0 10px; font-weight: 600; }
.stato.in_attesa { background: #7A8594; }
.stato.con_polizza { background: var(--verde); }
.stato.chiusa_senza { background: #9A5B52; }
.stato.senza_risposta { background: #A38A6C; }
.doc-foot { margin-top: 6px; padding-top: 4px; border-top: 1px solid #DBE3EC; text-align: center; font-size: .6rem; color: #5A6472; line-height: 1.4; }
.b-titolo { color: #224676; font-weight: 600; }
.b-cop { display: block; font-size: .7rem; color: #5A6472; margin-top: 2px; line-height: 1.25; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 5px; color: #fff; font-weight: 700; font-size: .68rem; white-space: nowrap; }
.badge.ALTA { background: #B03A2E; }
.badge.MEDIA { background: #C9862B; }

/* ---------- esito ---------- */

/* ---------- grafici ---------- */
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 96px; gap: 10px; align-items: center; font-size: .82rem; margin: 7px 0; }
.bar-track { background: var(--celeste-bg); border-radius: 4px; height: 16px; position: relative; overflow: hidden; }
.bar-b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--navy); }
.bar-row .n { text-align: right; color: var(--testo-soft); }
.bar-row.wide { grid-template-columns: 200px minmax(0, 1fr) 90px; }
.bar-row.mid { grid-template-columns: 150px minmax(0, 1fr) 124px; }
.legend { display: flex; gap: 16px; font-size: .76rem; color: var(--testo-soft); margin-bottom: 6px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
@media (max-width: 560px) { .bar-row, .bar-row.wide { grid-template-columns: 110px minmax(0, 1fr) 92px; } .bar-row.mid { grid-template-columns: 96px minmax(0, 1fr) 118px; } }
.pochi { color: var(--ambra); font-size: .72rem; }
.tbl-wrap { overflow-x: auto; }
h4.sub { font-size: .86rem; font-weight: 600; color: var(--testo); margin: 16px 0 6px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--testo-soft); font-family: var(--font); font-size: 11px; }
svg.chart .grid-line { stroke: var(--riga); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap svg { width: 150px; height: 150px; flex: none; }
.donut-legend { flex: 1; min-width: 160px; font-size: .84rem; }
.donut-legend div { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--riga); }
.donut-legend div:last-child { border-bottom: none; }
.donut-legend i { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.donut-legend span { flex: 1; }
.donut-legend b { font-weight: 600; }
table.heat { border-collapse: separate; border-spacing: 3px; font-size: .8rem; min-width: 420px; width: 100%; }
table.heat th { font-weight: 500; color: var(--testo-soft); font-size: .74rem; padding: 4px; text-align: center; }
table.heat th.rh { text-align: left; }
table.heat td { text-align: center; padding: 7px 4px; border-radius: 4px; }
table.heat td.rh { text-align: left; background: none; font-weight: 500; }
table.heat td small { display: block; font-size: .66rem; opacity: .85; }

pre.regole { white-space: pre-wrap; font-family: var(--font); font-size: .82rem; background: var(--celeste-bg); border-radius: 8px; padding: 14px; max-height: 480px; overflow: auto; margin: 0; }
ul.todo { margin: 0; padding-left: 18px; font-size: .88rem; }
ul.todo li { margin: 4px 0; }

/* ---------- piè di pagina ---------- */
.footer-legal { text-align: center; font-size: .68rem; color: var(--testo-soft); border-top: 1px solid var(--riga); padding-top: 10px; margin-top: 26px; }

/* margine zero sulla pagina: così il browser non ha spazio per scriverci data, titolo e indirizzo,
   e il foglio esce pulito anche con Ctrl+P. Il margine bianco lo mette il documento (05/10/2026). */
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .sit-row, table.bisogni tr, .doc-head, .band { break-inside: avoid; }
  /* i colori si stampano anche senza spuntare «grafica di sfondo» nella finestra di stampa:
     la regola va messa anche sulla radice, certi browser guardano solo quella */
  html, body, .print-target, .print-target * {
    -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact;
  }
  /* quando la tabella passa alla pagina dopo, la cornice non deve allungarsi fino in fondo
     lasciando un riquadro vuoto (05/10/2026) */
  /* sulla carta il foglio è tutta la pagina: niente cornice, niente larghezza massima da schermo */
  .doc { padding: 0; border: none; margin: 0; max-width: none; border-radius: 0; }
  .bisogni-wrap { border: none; border-radius: 0; overflow: visible; }
  table.bisogni thead { display: table-header-group; }
  table.bisogni th:first-child { border-top-left-radius: 8px; }
  table.bisogni th:last-child { border-top-right-radius: 8px; }
  table.bisogni td:first-child { border-left: 1px solid #DBE3EC; }
  table.bisogni td:last-child { border-right: 1px solid #DBE3EC; }
  table.bisogni tr:last-child td { border-bottom: 1px solid #DBE3EC; }
  body * { visibility: hidden; }
  .print-target, .print-target * { visibility: visible; }
  .print-target { position: absolute; top: 0; left: 0; width: 100%; border: none; }
  .no-print { display: none !important; }
  body { margin: 0; }
  /* il margine bianco della carta: 12 mm su tre lati, 14 in basso dove il PDF scrive il numero */
  .print-target { box-sizing: border-box; padding: 12mm 12mm 14mm; }
  /* via per davvero tutto ciò che non si stampa: nascosto non basta, continuerebbe a occupare
     spazio e uscirebbero fogli bianchi in coda (05/10/2026) */
  .topbar, .nav-wrap, .footer-legal, .avvisi, .panel, .screen-head { display: none !important; }
  .shell, .main, .screen { display: block; padding: 0; margin: 0; max-width: none; }
}
@media (max-width: 760px) {
  .topbar h1 { display: none; }
  .profilo { margin-left: auto; }
  .cerca-top { order: 3; flex: 1 1 100%; margin-left: 0; }
}
