/* Layout: un foglio di lavoro della pratica. In alto il verdetto e i controlli da fare; sotto, il percorso dai documenti
   alle ultime disdette, poi le sezioni della pratica come fogli successivi. Tutto allineato a sinistra.
   Colore: carta da lucido fredda, inchiostro, blu timbro. Tipo: Bodoni (tipografia italiana, solo titoli e numeri) + Figtree. */
:root{
  --paper:#eef1f5; --sheet:#ffffff; --ink:#1b1f2e; --muted:#5a6175; --rule:#d2d7e2;
  --stamp:#2b44a3; --stamp-ink:#ffffff; --stamp-soft:#e4e8f7;
  --red:#b02a20; --red-soft:#f8e4e1; --amber:#875700; --amber-soft:#f7eed9; --green:#22704a; --green-soft:#e0f0e6;
  --f-display:"Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --f-body:"Figtree", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){
  --paper:#12141c; --sheet:#1a1d28; --ink:#e6e8ef; --muted:#9aa1b5; --rule:#2c3142;
  --stamp:#9aabf2; --stamp-ink:#12141c; --stamp-soft:#232a45;
  --red:#f08a80; --red-soft:#3a1f1d; --amber:#e2b354; --amber-soft:#33291a; --green:#7cc79f; --green-soft:#172d21;
  color-scheme:dark }}
:root[data-theme="dark"]{
  --paper:#12141c; --sheet:#1a1d28; --ink:#e6e8ef; --muted:#9aa1b5; --rule:#2c3142;
  --stamp:#9aabf2; --stamp-ink:#12141c; --stamp-soft:#232a45;
  --red:#f08a80; --red-soft:#3a1f1d; --amber:#e2b354; --amber-soft:#33291a; --green:#7cc79f; --green-soft:#172d21;
  color-scheme:dark }

*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0}
body{background:var(--paper);color:var(--ink);font-family:var(--f-body);font-size:16px;line-height:1.55;font-variant-numeric:tabular-nums;
  padding-left:max(16px, env(safe-area-inset-left, 0px));padding-right:max(16px, env(safe-area-inset-right, 0px));padding-block:20px 56px}
.wrap{max-width:1080px;margin:0 auto;display:flex;flex-direction:column;gap:28px}
h1,h2,h3{margin:0;text-wrap:balance}
h2{font-family:var(--f-display);font-weight:600;font-size:2rem;line-height:1.1;letter-spacing:-.005em}
h3{font-size:1.05rem;font-weight:700;line-height:1.3}
p{margin:0}
.muted{color:var(--muted)}
.small{font-size:.875rem}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--stamp);outline-offset:2px;border-radius:3px}
a{color:var(--stamp)}

/* Barra superiore */
.top{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:14px}
.brand{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
.brand b{font-family:var(--f-display);font-size:1.7rem;font-weight:700;letter-spacing:-.01em}
.brand span{color:var(--muted);font-size:.92rem}
.seg{display:flex;background:var(--sheet);border:1px solid var(--rule);border-radius:8px;padding:3px}
.seg button{border:0;background:transparent;padding:6px 14px;border-radius:6px;cursor:pointer;font-weight:600;font-size:.9rem;color:var(--muted)}
.seg button[aria-pressed="true"]{background:var(--ink);color:var(--paper)}

/* Avviso di prototipo */
.proto{background:var(--stamp-soft);border-radius:6px;padding:10px 14px;font-size:.9rem;max-width:100%}

/* Hero: verdetto + controlli */
.hero{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:44px;align-items:start}
.verdict{display:flex;flex-direction:column;gap:18px;padding-top:6px;min-width:0}
.prop{color:var(--muted);font-size:.95rem}
.prop strong{color:var(--ink);font-weight:600}
.headline{font-family:var(--f-display);font-weight:600;font-size:clamp(2.4rem, 5.4vw, 4.2rem);line-height:1.02;letter-spacing:-.015em}
.state{display:inline-flex;align-items:center;gap:8px;font-weight:700;font-size:.92rem;padding:5px 12px 5px 10px;border-radius:999px;align-self:flex-start}
.state i{width:10px;height:10px;border-radius:50%;background:currentColor}
.state.r{color:var(--red);background:var(--red-soft)} .state.y{color:var(--amber);background:var(--amber-soft)} .state.g{color:var(--green);background:var(--green-soft)}
.flags{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.flags li{display:grid;grid-template-columns:26px 1fr;gap:12px;padding:12px 0;border-top:1px solid var(--rule)}
.flags li:first-child{border-top:0;padding-top:6px}
.flags li p{min-width:0}
.mk{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;font-size:.75rem;font-weight:700;margin-top:1px}
.mk.d::before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor}
.mk.r{color:var(--red)} .mk.y{color:var(--amber)} .mk.g{color:var(--green)}
.flags strong{font-weight:600}
.note{font-size:.82rem;color:var(--muted)}

/* Percorso: i passaggi della pratica in ordine, con il preliminare come spartiacque */
.path{display:flex;flex-direction:column;gap:10px}
.route{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(100px,1fr))}
.stop a{display:flex;flex-direction:column;gap:3px;height:100%;padding:10px 12px 4px 0;border-top:3px solid var(--rule);text-decoration:none;color:var(--ink)}
.stop b{font-family:var(--f-display);font-size:1.7rem;font-weight:600;line-height:1;color:var(--stamp)}
.stop strong{font-size:.88rem;font-weight:600;line-height:1.25}
.stop span{font-size:.8rem;color:var(--muted)}
.stop a:hover strong{color:var(--stamp);text-decoration:underline}
.stop.full a{border-top-color:var(--stamp)}
.stop.hot a{border-top-color:var(--red)}
.stop.hot b{color:var(--red)}
.stop.gate a{border-left:1px solid var(--ink);padding-left:12px}

/* Bodoni piccolo: taglio ottico robusto, i filetti sottili sparirebbero */
.brand b,.stop b,.phase .no,.ph-top h3,.day b,.meter b,.steps li::before{font-optical-sizing:none}

/* Sezioni */
nav.tabs{display:flex;gap:26px;overflow-x:auto;border-bottom:1px solid var(--rule);scrollbar-width:none}
nav.tabs a{padding:10px 0 12px;text-decoration:none;color:var(--muted);font-weight:600;white-space:nowrap;border-bottom:2px solid transparent;margin-bottom:-1px}
nav.tabs a:hover{color:var(--ink)}
nav.tabs a[aria-current="page"]{color:var(--ink);border-bottom-color:var(--stamp)}
section.view{display:flex;flex-direction:column;gap:22px}
.intro{display:flex;flex-direction:column;gap:8px;max-width:64ch}
.intro p{color:var(--muted)}
.sheet{background:var(--sheet);border:1px solid var(--rule);border-radius:4px;padding:20px 22px}

/* Profilo */
.qgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));column-gap:40px}
.q{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:13px 0;border-bottom:1px solid var(--rule)}
.q label{flex:1;min-width:0;cursor:pointer;font-weight:500}
.q small{display:block;color:var(--muted);font-size:.83rem;font-weight:400}
.sw{appearance:none;width:44px;height:26px;border-radius:999px;background:var(--rule);position:relative;cursor:pointer;flex:none;transition:background .15s}
.sw::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:var(--sheet);box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .18s}
.sw:checked{background:var(--stamp)}
.sw:checked::after{transform:translateX(18px)}
.row-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.btn{border:1px solid var(--rule);background:var(--sheet);border-radius:6px;padding:8px 14px;cursor:pointer;font-weight:600;font-size:.9rem;text-decoration:none;color:var(--ink)}
.btn:hover{border-color:var(--ink)}
.btn.pri{background:var(--stamp);border-color:var(--stamp);color:var(--stamp-ink)}

/* Checklist */
.cl-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:16px}
.meter{display:flex;flex-direction:column;gap:6px;min-width:220px}
.meter b{font-family:var(--f-display);font-size:1.6rem;font-weight:600;line-height:1}
.bar{height:4px;background:var(--rule);border-radius:2px;overflow:hidden}
.bar i{display:block;height:100%;background:var(--stamp);transition:width .25s}
.legend{display:flex;flex-wrap:wrap;gap:6px 18px;font-size:.85rem;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.lv{width:8px;height:8px;border-radius:50%;display:inline-block;flex:none}
.lv.r{background:var(--red)} .lv.y{background:var(--amber)} .lv.g{background:var(--green)}
.phase{display:grid;grid-template-columns:64px minmax(0,1fr);gap:0 18px;padding:18px 0;border-top:1px solid var(--rule)}
.phase .no{font-family:var(--f-display);font-size:2.6rem;font-weight:500;line-height:.9;color:var(--stamp)}
.ph-top{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap;cursor:pointer;background:none;border:0;padding:0;text-align:left;width:100%}
.ph-top h3{font-family:var(--f-display);font-size:1.45rem;font-weight:600}
.ph-top .cnt{color:var(--muted);font-size:.9rem}
.ph-top .chev{display:inline-block;transition:transform .2s;margin-left:6px;color:var(--muted)}
.phase.open .chev{transform:rotate(90deg)}
.items{list-style:none;margin:10px 0 0;padding:0}
.item{display:grid;grid-template-columns:24px minmax(0,1fr);gap:12px;padding:11px 0;border-top:1px dashed var(--rule)}
.item:first-child{border-top:0}
.ck{appearance:none;width:20px;height:20px;border:1.5px solid var(--muted);border-radius:4px;margin:2px 0 0;cursor:pointer;display:grid;place-items:center;background:var(--sheet)}
.ck:checked{background:var(--stamp);border-color:var(--stamp)}
.ck:checked::after{content:"";width:10px;height:5px;border-left:2px solid var(--stamp-ink);border-bottom:2px solid var(--stamp-ink);transform:rotate(-45deg) translate(1px,-1px)}
.item label{cursor:pointer;font-weight:500}
.item.done label{color:var(--muted);text-decoration:line-through;text-decoration-color:var(--rule)}
.meta{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:.82rem;color:var(--muted);margin-top:3px;align-items:center}
.meta .t{display:inline-flex;align-items:center;gap:6px}
.ver{border-bottom:1px dotted var(--muted)}
.hint{font-size:.9rem;color:var(--muted);margin-top:2px}

/* Scadenze */
.dates{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px}
.field{display:flex;flex-direction:column;gap:5px;min-width:0}
.field label{font-size:.86rem;font-weight:600}
.field input,.field select{padding:9px 11px;border:1px solid var(--rule);border-radius:6px;background:var(--paper);width:100%}
.tl{list-style:none;margin:0;padding:0}
.tl li{display:grid;grid-template-columns:76px minmax(0,1fr) auto;gap:18px;padding:14px 0;border-top:1px solid var(--rule);align-items:start}
.tl li:first-child{border-top:0}
.day{display:flex;flex-direction:column;line-height:1}
.day b{font-family:var(--f-display);font-size:2rem;font-weight:600}
.day span{font-size:.8rem;color:var(--muted);margin-top:4px}
.tl .w{font-weight:600}
.tl .rel{font-size:.85rem;color:var(--muted);white-space:nowrap;padding-top:6px}
.tl li.key .day b{color:var(--stamp)}
.tl li.past{opacity:.6}
.tl li.soon .rel{color:var(--amber);font-weight:600}
.tl li.late .rel,.tl li.late .day b{color:var(--red);font-weight:600}
@media (max-width:560px){ .tl li{grid-template-columns:60px minmax(0,1fr)} .tl .rel{grid-column:2;padding-top:0} }

/* Calcoli */
.calcs{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:18px}
.calcs>*{min-width:0}
.calc{display:flex;flex-direction:column;gap:14px}
.calc .fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px}
.res{display:flex;flex-direction:column;gap:6px;padding-top:12px;border-top:1px solid var(--rule)}
.res .r{display:flex;justify-content:space-between;gap:12px;font-size:.93rem}
.res .r span:first-child{color:var(--muted)}
.res .tot{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding-top:8px;margin-top:4px;border-top:1px solid var(--ink)}
.res .tot b{font-family:var(--f-display);font-size:1.7rem;font-weight:600}

/* Come funziona */
.steps{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:18px;counter-reset:s}
.steps li{display:flex;flex-direction:column;gap:4px;min-width:0}
.steps li::before{counter-increment:s;content:counter(s);font-family:var(--f-display);font-size:2rem;font-weight:500;color:var(--stamp);line-height:1}
.plans{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:18px}
.plan{background:var(--sheet);border:1px solid var(--rule);border-radius:4px;padding:20px;display:flex;flex-direction:column;gap:10px}
.plan.feat{border-color:var(--stamp);box-shadow:inset 0 0 0 1px var(--stamp)}
.plan .pr{font-family:var(--f-display);font-size:2rem;font-weight:600;line-height:1}
.plan ul{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:5px;font-size:.93rem}
.rules{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:12px 36px}
.rules li{display:grid;grid-template-columns:30px 1fr;gap:10px;font-size:.95rem}
.rules li p{min-width:0}
.yes{color:var(--green);font-weight:700} .no{color:var(--red);font-weight:700}

.foot a{color:inherit}
.foot-links{display:flex;flex-wrap:wrap;gap:6px 18px}

.mb{margin-bottom:14px}
.foot{font-size:.84rem;color:var(--muted);max-width:78ch;border-top:1px solid var(--rule);padding-top:16px;display:flex;flex-direction:column;gap:6px}

@media (max-width:820px){ .hero{grid-template-columns:1fr;gap:24px} }
@media (max-width:480px){ .phase{grid-template-columns:40px minmax(0,1fr);gap:0 12px} .phase .no{font-size:2rem} .sheet{padding:16px} }
@media (prefers-reduced-motion:reduce){ *{transition:none!important} }
