/* Catalogo Amati — "cantiere": testata scura col rosso Amati, banco di lavoro a tutta larghezza,
   albero delle categorie a sinistra, scheda prodotto a destra. Ogni stato ha il suo colore. */
:root {
  /* marchio: rosso Amati solo come accento */
  --amati: #920d10; --amati-dark: #6c0a0c; --amati-soft: #f2f4f7;
  --pece: #14161a; --pece-2: #22262c; --pece-ink: #f3f4f6; --pece-muted: #9aa1ab;
  /* superfici neutre fredde */
  --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f8f9fb; --ink: #15181d; --muted: #5f6672; --line: #e2e5e9; --line-2: #eef0f3;
  /* stati */
  --ok: #157a3f; --ok-soft: #ecf8f0;
  --brass: #a8550a; --brass-soft: #fff7ec;
  --sea: #1e5aa8; --sea-soft: #eef4fc;
  --miss: #c42b2b; --miss-soft: #fef3f3;
  --out: #7b818a; --out-soft: #f1f2f4;
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-code: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--sea); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: -.015em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amati); outline-offset: 2px; }
[hidden] { display: none !important; }
.code { font-family: var(--f-code); font-size: 12.5px; letter-spacing: -.01em; }
.mini { font-size: 12.5px; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- testata */
header.top { position: sticky; top: 0; z-index: 20; background: var(--pece); color: var(--pece-ink); border-bottom: 3px solid var(--amati); padding: 0 24px; display: flex; flex-wrap: wrap; gap: 6px 26px; align-items: center; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.brand img { width: 38px; height: 38px; border-radius: 6px; display: block; }
.brand h1 { font-size: 19px; color: #fff; line-height: 1.1; }
.brand span { font-size: 11.5px; color: var(--pece-muted); letter-spacing: .02em; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; align-self: stretch; }
.tab { text-decoration: none; color: var(--pece-muted); padding: 0 14px; display: flex; align-items: center; gap: 7px; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -3px; min-height: 60px; }
.tab:hover { color: #fff; background: var(--pece-2); }
.tab[aria-current="page"] { color: #fff; border-bottom-color: #fff; background: var(--pece-2); }
.tab .cnt { font-family: var(--f-code); font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--pece-ink); }
.tab .cnt:empty { display: none; }
.me { margin-left: auto; display: flex; gap: 16px; align-items: center; font-size: 12.5px; color: var(--pece-muted); }
.me a { color: var(--pece-ink); }
.save { display: inline-flex; gap: 7px; align-items: center; color: var(--pece-ink); }
.save i { width: 9px; height: 9px; border-radius: 50%; background: #4cc38a; box-shadow: 0 0 0 3px rgba(76,195,138,.18); }
.save[data-s="busy"] i { background: #e6b04a; box-shadow: 0 0 0 3px rgba(230,176,74,.2); }
.save[data-s="err"] i { background: #ff6b5a; box-shadow: 0 0 0 3px rgba(255,107,90,.2); }

.wrap { padding: 20px 24px 80px; width: 100%; }
.banner { background: var(--miss-soft); color: var(--miss); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
.ok-box { background: var(--ok-soft); color: var(--ok); border-radius: 8px; padding: 10px 14px; }

/* ---------------------------------------------------------------- controlli */
input[type="text"], input[type="number"], input[type="email"], input[type="search"], select, textarea { background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; min-width: 0; transition: border-color .12s; }
input:hover, select:hover, textarea:hover { border-color: #c9ced5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sea); box-shadow: 0 0 0 3px var(--sea-soft); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 7px 14px; cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.pri { background: var(--pece); border-color: var(--pece); color: #fff; }
.btn.pri:hover:not(:disabled) { background: var(--amati); border-color: var(--amati); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover:not(:disabled) { background: #116234; border-color: #116234; }
.btn.bad { color: var(--miss); border-color: #f3c2c2; }
.btn.bad:hover:not(:disabled) { background: var(--miss-soft); border-color: var(--miss); }
a.btn { text-decoration: none; display: inline-flex; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 11px 22px; font-size: 15.5px; font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--sea); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--out-soft); color: var(--muted); white-space: nowrap; border: 0; }
.chip.ok { background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.chip.acc { background: var(--brass-soft); color: var(--brass); font-weight: 500; }
.chip.bad { background: var(--miss-soft); color: var(--miss); font-weight: 500; }
.chip.navy { background: var(--sea-soft); color: var(--sea); }
.chip button { background: none; border: 0; padding: 0 0 0 2px; cursor: pointer; color: inherit; opacity: .7; }
.chip button:hover { opacity: 1; }
button.chip { cursor: pointer; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 13px; cursor: pointer; font-weight: 500; border-radius: 6px; color: var(--muted); }
.seg button:hover { color: var(--ink); background: var(--panel-2); }
.seg button[aria-pressed="true"] { background: var(--pece); color: #fff; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.card h3 { font-size: 18px; margin-bottom: 8px; }
.sect-title { font-family: var(--f-ui); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- albero + lavoro */
.work { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.side { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.side input[type="search"] { width: 100%; margin-bottom: 8px; background: var(--panel-2); }
.results button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.results button:hover { background: var(--panel-2); }
.results small { display: block; color: var(--muted); }
.tree { font-size: 14px; }
.tree ul { list-style: none; margin: 0; padding-left: 12px; }
.tree > ul { padding-left: 0; }
.tree > ul > li { border-top: 1px solid var(--line-2); padding-top: 4px; margin-top: 4px; }
.tree > ul > li:first-child { border-top: 0; margin-top: 0; }
.tnode { width: 100%; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left; background: none; border: 0; border-left: 3px solid transparent; padding: 5px 7px; border-radius: 0 6px 6px 0; cursor: pointer; }
.tnode:hover { background: var(--panel-2); }
.tnode[aria-current="true"] { background: var(--amati-soft); border-left-color: var(--amati); color: var(--ink); font-weight: 600; }
.tnode.grp { font-weight: 600; }
.tnode .n { font-family: var(--f-code); font-size: 11px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid #b8bec6; display: inline-block; }
.dot[data-s="ok"] { background: var(--ok); border-color: var(--ok); }
.dot[data-s="part"] { background: linear-gradient(90deg, var(--brass) 50%, transparent 50%); border-color: var(--brass); }
.dot[data-s="none"] { visibility: hidden; }

/* testata della categoria */
.chead { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.crumbs { font-size: 12.5px; color: var(--muted); letter-spacing: .01em; }
.chead h2 { font-size: 30px; line-height: 1.1; }
.progress-mini { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.progress-mini .bar { width: 120px; }
.presence { background: var(--sea-soft); color: var(--sea); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.catbox { display: grid; gap: 10px; margin-bottom: 16px; background: var(--panel-2); }
.catbox summary { list-style: none; }
.catbox summary::-webkit-details-marker { display: none; }
.catbox summary::before { content: "▸"; color: var(--muted); transition: transform .15s; display: inline-block; }
.catbox[open] summary::before { transform: rotate(90deg); }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fchip { border: 1px solid var(--line); border-radius: 7px; padding: 5px 11px; background: var(--panel); cursor: pointer; display: inline-flex; gap: 7px; align-items: baseline; color: var(--muted); }
.fchip:hover { border-color: var(--ink); color: var(--ink); }
.fchip small { font-family: var(--f-code); font-size: 11px; color: inherit; opacity: .75; }
.fchip[aria-pressed="true"] { background: var(--ok-soft); border-color: #a9d8ba; color: var(--ok); font-weight: 500; }
.fchip[aria-pressed="true"]::before { content: "✓"; }
.fchip.pr[aria-pressed="true"] { border-style: dashed; }

/* ---------------------------------------------------------------- scheda prodotto */
.guide { display: grid; grid-template-columns: minmax(300px, 440px) minmax(0, 1fr); gap: 24px; align-items: start; }
.guide > div:first-child { position: sticky; top: 150px; }
.gal-main { aspect-ratio: 1; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--r); display: grid; place-items: center; overflow: hidden; }
.gal-main img { width: 100%; height: 100%; object-fit: contain; }
.gal-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gal-strip button { width: 56px; height: 56px; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; cursor: pointer; opacity: .75; transition: opacity .12s; }
.gal-strip button:hover { opacity: 1; }
.gal-strip button[aria-pressed="true"] { outline: 2px solid var(--amati); outline-offset: 1px; opacity: 1; }
.gal-strip img { width: 100%; height: 100%; object-fit: contain; }
.noimg { color: var(--muted); font-size: 13px; padding: 20px; text-align: center; }
.ptitle { display: grid; gap: 6px; padding: 2px 2px 4px; }
.ptitle .code { display: inline-block; background: var(--pece); color: #fff; border-radius: 5px; padding: 2px 8px; font-size: 12.5px; justify-self: start; }
.ptitle h2 { font-size: 26px; line-height: 1.15; }
.pform { display: grid; gap: 14px; }
.psec { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r); padding: 14px 18px; display: grid; gap: 10px; }
.psec.s-prod { border-left-color: var(--pece); }
.psec.s-dove { border-left-color: var(--sea); }
.psec.s-car { border-left-color: var(--brass); }
.psec.s-vend { border-left-color: var(--ok); }
.psec.s-desc { border-left-color: #64748b; }
.psec.s-coll { border-left-color: #64748b; }
.fld { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 4px 14px; align-items: center; }
.fld > label, .fld > .lbl { font-size: 13.5px; color: var(--muted); }
.fld.top { align-items: start; }
.fld.top > .lbl, .fld.top > label { padding-top: 6px; }
.fld .help { grid-column: 2; font-size: 12px; color: var(--muted); }
.fld input[type="text"], .fld input[type="number"], .fld select { width: 100%; }
.fld.miss > label, .fld.miss > .lbl { color: var(--miss); font-weight: 600; }
.fld.miss > label::after, .fld.miss > .lbl::after { content: " · manca"; font-weight: 400; }
.isprop { border-style: dashed !important; border-color: var(--brass) !important; background: var(--brass-soft) !important; color: var(--brass) !important; font-style: italic; }
.modtag { font-size: 11px; color: var(--brass); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.restore { font-size: 12px; }
.vals { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.vals .chip { background: var(--sea-soft); color: var(--sea); font-weight: 500; }
.vals select { max-width: 240px; }
.editor-bar { display: flex; gap: 4px; margin-bottom: 4px; }
.editor-bar button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 5px; padding: 2px 9px; cursor: pointer; font-size: 13px; }
.editor-bar button:hover { border-color: var(--ink); }
.editor { border: 1px solid var(--line); border-radius: 7px; padding: 9px 12px; min-height: 90px; background: #fff; max-height: 440px; overflow: auto; line-height: 1.55; }
.editor.long { min-height: 220px; }
.editor:focus { outline: none; border-color: var(--sea); box-shadow: 0 0 0 3px var(--sea-soft); }
.editor:empty::before { content: "Scrivete qui…"; color: #9aa1ab; }
.editor p { margin: 0 0 8px; }
.editor table { border-collapse: collapse; }
.editor td, .editor th { border: 1px solid var(--line); padding: 3px 6px; }
details.adv summary { cursor: pointer; color: var(--sea); font-size: 13.5px; font-weight: 500; }
.gfoot { position: sticky; top: 72px; z-index: 10; background: var(--pece); color: var(--pece-ink); border-radius: var(--r); box-shadow: 0 8px 24px rgba(23,19,15,.18); margin: 0 0 16px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gfoot .btn:not(.ok):not(.bad) { background: var(--pece-2); border-color: #343a42; color: var(--pece-ink); }
.gfoot .btn:not(.ok):not(.bad):hover:not(:disabled) { border-color: var(--pece-ink); }
.gfoot .btn.bad { background: transparent; color: #fca5a5; border-color: #6b2a2a; }
.gfoot .btn.bad:hover:not(:disabled) { background: #3a1f22; border-color: #fca5a5; }
.gfoot .btn.ok { background: #178a48; border-color: #178a48; }
.gfoot .btn.ok:hover:not(:disabled) { background: #1c9b52; border-color: #1c9b52; }
.gfoot .grow { flex: 1; }
.gfoot .mini, .gfoot label { color: var(--pece-muted); }
.gstate { font-size: 13.5px; }
.gstate b { color: #fff; }
.gstate .bar { display: inline-block; width: 110px; vertical-align: middle; margin-left: 8px; background: #2c3138; }

/* ---------------------------------------------------------------- elenco */
.listbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.bulk { position: sticky; top: 72px; z-index: 9; background: var(--pece); color: #fff; border-radius: var(--r); padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 12px; box-shadow: 0 8px 24px rgba(23,19,15,.18); }
.bulk b { color: #fff; }
.bulk select, .bulk input { background: #fff; color: var(--ink); border-color: transparent; }
.bulk .btn { background: var(--pece-2); color: var(--pece-ink); border-color: #343a42; }
.bulk .btn:hover { border-color: var(--pece-ink); }
.bulk .btn[data-b="ok"] { background: #178a48; border-color: #178a48; color: #fff; }
.bulk .btn[data-b="togli"] { color: #fca5a5; border-color: #6b2a2a; background: transparent; }
.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
table.list { border-collapse: collapse; width: 100%; min-width: 1100px; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; text-align: left; }
table.list th { position: sticky; top: 0; background: var(--panel-2); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
table.list tbody tr:hover td { background: #fafbfc; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tr.fam td { background: var(--panel-2); border-top: 1px solid var(--line); }
table.list tr.fam b { font-family: var(--f-head); }
table.list tr.isok td { background: #f5fbf7; }
table.list tr.isok td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
table.list tr.isout td { opacity: .5; }
table.list tr.isout .pname { text-decoration: line-through; }
table.list tr.isout td.st { opacity: 1; }
table.list tr.flash td { animation: flash 1.6s ease; }
@keyframes flash { from { background: var(--brass-soft); } }
.thumb { width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 0; overflow: hidden; cursor: pointer; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pname { font-weight: 600; }
.pmeta { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.cv { font-size: 12px; border-radius: 5px; padding: 1px 7px; background: var(--sea-soft); color: var(--sea); display: inline-block; margin: 0 3px 3px 0; }
.cv i { font-style: normal; opacity: .7; }
.cv.miss { background: var(--miss-soft); color: var(--miss); font-weight: 500; }
td input.small { width: 88px; text-align: right; }
.ordbtn { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.ordbtn button { border: 1px solid var(--line); background: var(--panel); border-radius: 4px; padding: 0 6px; cursor: pointer; font-size: 11px; line-height: 18px; color: var(--muted); }
.ordbtn button:hover { border-color: var(--ink); color: var(--ink); }
.sub { font-size: 11.5px; color: var(--muted); }

/* pannello laterale */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(1100px, 100vw); z-index: 30; background: var(--bg); border-left: 3px solid var(--amati); box-shadow: -14px 0 50px rgba(23,19,15,.25); overflow: auto; padding: 16px 24px 80px; }
.drawer .dhead { position: sticky; top: -16px; z-index: 5; background: var(--pece); color: var(--pece-ink); margin: -16px -24px 16px; padding: 12px 24px; }
.drawer .dhead .btn:not(.ok):not(.bad) { background: var(--pece-2); border-color: #343a42; color: var(--pece-ink); }
.drawer .dhead .btn.bad { background: transparent; color: #fca5a5; border-color: #6b2a2a; }
.drawer .dhead .btn.ok { background: #178a48; border-color: #178a48; }
.drawer .dhead .mini { color: var(--pece-muted); }
.drawer .guide > div:first-child { top: 70px; }

/* ---------------------------------------------------------------- categorie, filtri, marche */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 22px; align-items: start; }
.split > div:last-child { position: sticky; top: 80px; }
.ctree ul { list-style: none; margin: 0; padding-left: 20px; border-left: 1px dashed var(--line); }
.ctree > ul { padding-left: 0; border-left: 0; }
.crow { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; }
.crow:hover { background: var(--panel-2); }
.crow.sel { background: var(--amati-soft); box-shadow: inset 3px 0 0 var(--amati); }
.crow .name { flex: 1; cursor: pointer; }
.crow .acts { display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.crow:hover .acts, .crow.sel .acts { opacity: 1; }
.crow .acts button { border: 1px solid var(--line); background: var(--panel); border-radius: 5px; padding: 1px 8px; cursor: pointer; font-size: 12.5px; }
.crow .acts button:hover { border-color: var(--ink); }
table.simple { border-collapse: collapse; width: 100%; }
table.simple td, table.simple th { padding: 7px 8px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
table.simple th { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
table.simple tr.alias td { color: var(--out); font-style: italic; }
table.simple tr.sel td { background: var(--amati-soft); }
table.simple tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--amati); }
table.simple input[type="text"] { width: 100%; }
table.simple select { width: 100%; max-width: 260px; }
.card > .sect-title, .card h3.sect-title { font-family: var(--f-ui); font-size: 11.5px; margin-top: 6px; }
table.simple td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--f-code); font-size: 12.5px; }

/* ---------------------------------------------------------------- famiglie */
.fam-list { display: grid; gap: 14px; }
.fam-card { border-left: 4px solid var(--line); display: grid; gap: 8px; }
.fam-card.deciso { border-left-color: var(--ok); }
.fam-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.fam-code { background: var(--pece); color: #fff; border-radius: 5px; padding: 3px 9px; font-size: 13px; }
.fam-tab td { padding: 5px 8px; }
.fam-tab .w1 { width: 1%; white-space: nowrap; }
.fam-tab td:nth-last-child(1) input { width: 100%; }
.thumb.sm { width: 40px; height: 40px; cursor: default; }
.thumb.sm img { width: 100%; height: 100%; object-fit: contain; }

/* ---------------------------------------------------------------- decisioni, avanzamento */
.dec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 16px; }
.dec { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; gap: 10px; align-content: start; }
.dec[data-done="1"] { border-top-color: var(--ok); }
.prop { background: var(--brass-soft); border-radius: 8px; padding: 10px 12px; }
.prop b { color: var(--brass); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; display: block; margin-bottom: 2px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; background: var(--panel); cursor: pointer; }
.opt:hover { border-color: var(--ink); }
.opt[aria-pressed="true"] { background: var(--ok); color: #fff; border-color: var(--ok); }
.opt[aria-pressed="true"]::before { content: "✓ "; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi:first-child { background: var(--pece); color: #fff; border-color: var(--pece); }
.kpi:first-child span { color: var(--pece-muted); }
.kpi b { font-family: var(--f-head); font-size: 30px; display: block; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.bar { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.prog-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 90px; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.prog-row:last-child { border-bottom: 0; }
.check { border-left: 4px solid var(--line); padding: 9px 12px; background: var(--panel-2); border-radius: 0 8px 8px 0; margin-bottom: 8px; }
.check.bad { border-left-color: var(--miss); background: var(--miss-soft); }
.check.warn { border-left-color: var(--brass); background: var(--brass-soft); }
.check.ok { border-left-color: var(--ok); }

/* ---------------------------------------------------------------- modale, avvisi */
.modal-bg { position: fixed; inset: 0; background: rgba(23, 19, 15, .5); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; border-top: 4px solid var(--amati); padding: 20px 24px; width: min(600px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h3 { font-size: 20px; }
.modal form { display: grid; gap: 12px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--pece); color: #fff; padding: 11px 18px; border-radius: 9px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.err { background: var(--miss); }

/* ---------------------------------------------------------------- accesso */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: var(--pece); }
.login-box { background: var(--panel); border-radius: 14px; border-top: 5px solid var(--amati); padding: 30px; width: min(440px, 100%); display: grid; gap: 14px; }
.login-box img { width: 56px; height: 56px; border-radius: 8px; }
.login-box h1 { font-size: 28px; }
.login-box form { display: grid; gap: 10px; }
.login-box input { width: 100%; padding: 11px; }

@media (max-width: 1100px) {
  .work, .guide, .split { grid-template-columns: minmax(0, 1fr); }
  .side, .guide > div:first-child, .split > div:last-child { position: static; max-height: none; }
  .side { max-height: 320px; }
  .me { margin-left: 0; }
  .dec-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  header.top, .wrap { padding-left: 16px; padding-right: 16px; }
  .fld { grid-template-columns: minmax(0, 1fr); }
  .fld .help { grid-column: 1; }
  .prog-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .prog-row .bar { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================================================================ componenti comuni (restyling completo) */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.btn, .tab, .linkico, .pill, .seg button { display: inline-flex; align-items: center; gap: 7px; }
.btn { min-height: 38px; }
.btn.sm { min-height: 32px; }
.btn.big { min-height: 46px; }
.btn.sm .ico, .pill .ico, .linkico .ico { width: 15px; height: 15px; }
.btn.danger { background: var(--miss); border-color: var(--miss); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #a32121; border-color: #a32121; }
.linkico { text-decoration: none; color: var(--sea); }
.linkico:hover { text-decoration: underline; }
.ibtn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; color: var(--muted); }
.ibtn:hover { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
.tab .ico { width: 17px; height: 17px; opacity: .85; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 16px; }
#main:focus { outline: none; }
.flabel { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }

/* intestazione di sezione */
.phead { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between; margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.phead-t { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.phead-ico { width: 44px; height: 44px; border-radius: 10px; background: var(--pece); color: #fff; display: grid; place-items: center; flex: none; box-shadow: inset 0 -3px 0 var(--amati); }
.phead-ico .ico { width: 22px; height: 22px; }
.phead-ico.sm { width: 32px; height: 32px; border-radius: 8px; }
.phead-ico.sm .ico { width: 17px; height: 17px; }
.phead h2 { font-size: 30px; line-height: 1.1; }
.pdesc { margin: 6px 0 0; color: var(--muted); max-width: 90ch; font-size: 14px; }
.phead-a { align-items: center; }
.progress-mini b { color: var(--ink); }

/* caricamento e stati vuoti */
.skel { display: grid; gap: 12px; }
.skel i, .skel-row i { display: block; height: 16px; border-radius: 8px; background: linear-gradient(90deg, var(--line-2) 0%, #f5f6f8 50%, var(--line-2) 100%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; }
.skel-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.skel-row i { height: 90px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 34px 20px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r); }
.empty > .ico { width: 34px; height: 34px; color: var(--muted); opacity: .7; }
.empty b { color: var(--ink); font-size: 15.5px; }

/* pillole di stato: icona + testo, mai solo colore */
.pill { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; background: var(--out-soft); color: var(--muted); white-space: nowrap; }
.pill.sm { font-size: 11.5px; padding: 2px 8px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cb; }
.pill.todo { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.pill.out { background: var(--out-soft); color: var(--out); }
button.pill { cursor: pointer; }
button.pill:hover { border-color: currentColor; }
td.st { display: grid; gap: 4px; justify-items: start; }
.badge { font-family: var(--f-code); font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); border-radius: 999px; padding: 1px 8px; min-width: 32px; text-align: center; }

/* ricerca con icona */
.search-box { position: relative; display: flex; align-items: center; }
.search-box .ico { position: absolute; left: 10px; color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.search-box input { width: 100%; padding-left: 34px !important; }
.search-box.sm input { width: 220px; }
.side .search-box { margin-bottom: 8px; }
.side-t { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 6px 4px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.side-t .mini { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11px; }

/* albero richiudibile */
.trow { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; }
.tog { width: 22px; height: 26px; border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; place-items: center; border-radius: 4px; padding: 0; }
.tog:hover { background: var(--panel-2); color: var(--ink); }
.tog .ico { width: 14px; height: 14px; }
.tog-sp { width: 22px; }
.tree ul ul { padding-left: 14px; }
.tree > ul > li { border-top: 1px solid var(--line-2); padding-top: 3px; margin-top: 3px; }

/* elenchi selezionabili (filtri) */
.lhead { display: grid; grid-template-columns: minmax(0, 1fr) 70px 80px; gap: 8px; padding: 0 10px 8px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.llist { display: grid; }
.lrow { display: grid; grid-template-columns: minmax(0, 1fr) 70px 80px; gap: 8px; align-items: center; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line-2); border-left: 3px solid transparent; padding: 10px; cursor: pointer; min-height: 44px; }
.lrow:hover { background: var(--panel-2); }
.lrow.sel { background: var(--amati-soft); border-left-color: var(--amati); font-weight: 600; color: var(--ink); }
.lrow .badge { justify-self: start; }

/* schede di dettaglio e zona pericolosa */
.card.detail { display: grid; gap: 12px; }
.card.detail > h3 { font-size: 22px; margin: 0; }
.danger-zone { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; border: 1px solid #f5cccc; background: #ffffff; border-radius: 8px; padding: 12px 14px; margin-top: 4px; }
.danger-zone > div { display: grid; gap: 2px; }
.crow .name { background: none; border: 0; padding: 4px 0; text-align: left; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crow { min-height: 40px; }
.crow .acts button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; }
.crow .acts .ico { width: 15px; height: 15px; }
.crow .badge { margin-right: 4px; }

/* barra di modifica in blocco a gruppi */
.bulk { display: grid; gap: 8px; }
.bulk-h { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.bulk-g { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding-top: 8px; border-top: 1px solid #2c3138; }
.bulk-l { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--pece-muted); font-weight: 600; min-width: 110px; }
.bulk .btn .ico { width: 15px; height: 15px; }
.ordbtn button { display: grid; place-items: center; width: 30px; height: 24px; padding: 0; }
.ordbtn .ico { width: 14px; height: 14px; }

/* finestre di dialogo */
.mhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 4px; }
.mfoot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.modal select, .modal input[type="text"] { width: 100%; }
.noimg { display: grid; justify-items: center; gap: 8px; }
.noimg .ico { width: 34px; height: 34px; opacity: .6; }

/* avanzamento */
.kpi { display: grid; gap: 2px; position: relative; }
.kpi-i { width: 34px; height: 34px; border-radius: 8px; background: var(--panel-2); display: grid; place-items: center; color: var(--muted); margin-bottom: 6px; }
.kpi.main .kpi-i { background: var(--pece-2); color: #fff; }
.kpi:first-child { background: var(--panel); color: var(--ink); border-color: var(--line); }
.kpi:first-child span { color: var(--muted); }
.kpi.main { background: var(--pece) !important; color: #fff !important; border-color: var(--pece) !important; }
.kpi.main span { color: var(--pece-muted) !important; }
.check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; }
.check-i { width: 18px; height: 18px; margin-top: 2px; }
.check.bad .check-i { color: var(--miss); }
.check.warn .check-i { color: var(--brass); }
.check.ok .check-i { color: var(--ok); }
.uform { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 12px; margin-top: 14px; align-items: end; }
.uform input, .uform select { width: 100%; }

/* accesso */
body.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); padding: 0; place-items: stretch; background: var(--bg); }
.login-brand { background: var(--pece); color: var(--pece-ink); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; border-right: 4px solid var(--amati); }
.login-brand img { width: 64px; height: 64px; border-radius: 10px; }
.login-brand h1 { color: #fff; font-size: 40px; margin: 22px 0 10px; line-height: 1.05; }
.login-brand p { color: var(--pece-muted); max-width: 46ch; font-size: 15.5px; }
.login-brand ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.login-brand li { display: flex; gap: 12px; align-items: flex-start; color: var(--pece-ink); }
.login-brand li svg { width: 20px; height: 20px; flex: none; stroke: #f87171; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.login-brand small { color: var(--pece-muted); }
.login-side { display: grid; place-items: center; padding: 32px 20px; }
.login-box { border-top: 0; box-shadow: 0 20px 60px rgba(23,19,15,.08); }
.login-box h2 { font-size: 26px; }
.login-box label { font-size: 13.5px; font-weight: 500; }
.login-box .btn { justify-content: center; min-height: 46px; font-size: 15px; }
@media (max-width: 860px) { body.login { grid-template-columns: minmax(0, 1fr); } .login-brand { padding: 28px 22px; border-right: 0; border-bottom: 4px solid var(--amati); } .login-brand h1 { font-size: 30px; } }
@media (prefers-reduced-motion: reduce) { .skel i, .skel-row i { animation: none; } }
@media (max-width: 760px) {
  header.top { position: static; padding-top: 8px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .tab { min-height: 46px; white-space: nowrap; }
  .gfoot, .bulk, .drawer .dhead { top: 0; }
  .phead h2 { font-size: 24px; }
  .phead-ico { width: 36px; height: 36px; }
}

/* ================================================================ aspetto contemporaneo */
.card, .psec, .kpi, .tablewrap, .side, .dec, .fam-card, .login-box { box-shadow: var(--shadow); border-color: var(--line); }
.psec { border-left-width: 1px; }
.psec .sect-title::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--line); display: inline-block; }
.psec.s-prod .sect-title::before { background: var(--pece); }
.psec.s-dove .sect-title::before { background: var(--sea); }
.psec.s-car .sect-title::before { background: var(--brass); }
.psec.s-vend .sect-title::before { background: var(--ok); }
.psec.s-desc .sect-title::before { background: #64748b; }
.psec.s-coll .sect-title::before { background: #94a3b8; }
.phead h2, .chead h2 { font-size: 28px; font-weight: 600; }
.ptitle h2 { font-size: 24px; }
.kpi b { font-family: var(--f-ui); font-weight: 600; letter-spacing: -.02em; }
.catbox { background: var(--panel); }
.check { background: var(--panel-2); }
.check.bad { background: var(--miss-soft); }
.danger-zone { background: #fff; border-color: #f5cccc; }
tr.isok td, table.list tr.isok td { background: #f7fbf8; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr.fam { cursor: default; }
table.list tbody tr:hover td { background: #f6f8fb; }
.fchip[aria-pressed="true"] { background: var(--ok-soft); border-color: #a9d8ba; }
.vals .chip, .cv { background: var(--sea-soft); color: var(--sea); }
.tab[aria-current="page"] { background: transparent; border-bottom-color: var(--amati); }
header.top { border-bottom-width: 2px; }
.phead-ico { background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.kpi.main .kpi-i { background: rgba(255,255,255,.1); }
.apri { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
td input.small { width: 100px; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.isprop { background: #fffaf2 !important; border-color: #e8b877 !important; }

/* ================================================================ micro-interazioni (150–250 ms, solo transform e opacity) */
.btn, .chip, .pill, .fchip, .opt, .seg button, .tnode, .lrow, .tab, .ibtn, .tog, .ordbtn button, .gal-strip button, .thumb { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease, opacity .15s ease; }
.btn:active:not(:disabled), .opt:active, .fchip:active, .pill:active, .ordbtn button:active { transform: scale(.97); }
.btn.ok:hover:not(:disabled), .btn.pri:hover:not(:disabled) { box-shadow: 0 4px 12px rgba(16, 24, 40, .12); }
.thumb:hover { transform: scale(1.04); box-shadow: var(--shadow); }
.fam-card, .dec, .kpi { transition: box-shadow .2s ease, transform .2s ease; }
.fam-card:hover, .dec:hover { box-shadow: 0 6px 20px rgba(16, 24, 40, .07); }

/* entrate: pannello laterale, finestre, avvisi, foto */
.drawer:not([hidden]) { animation: entraDestra .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes entraDestra { from { transform: translateX(28px); opacity: 0; } }
.modal-bg:not([hidden]) { animation: dissolvenza .18s ease-out; }
.modal-bg:not([hidden]) .modal { animation: entraModale .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes dissolvenza { from { opacity: 0; } }
@keyframes entraModale { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toast:not([hidden]) { animation: entraBasso .2s cubic-bezier(.2, .8, .2, 1); display: flex; align-items: center; gap: 8px; }
@keyframes entraBasso { from { transform: translate(-50%, 10px); opacity: 0; } }
.toast.ok { background: var(--ok); }
.toast .ico { width: 16px; height: 16px; }
.gal-main img { animation: dissolvenza .18s ease-out; }

/* conferma visiva della convalida */
table.list tr.flash-ok td { animation: lampoOk 1.2s ease-out; }
@keyframes lampoOk { from { background: #d7f0df; } }
.pill.ok .ico { animation: spunta .25s ease-out; }
@keyframes spunta { from { transform: scale(.4); opacity: 0; } }
.save[data-s="busy"] i { animation: pulsa 1s ease-in-out infinite; }
@keyframes pulsa { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .drawer, .modal-bg, .modal, .toast, .gal-main img, .pill.ok .ico, table.list tr.flash-ok td, .save i { animation: none !important; } .btn:active, .opt:active { transform: none; } }

/* ================================================================ scheda: scelte con ricerca, valori cliccabili, riepilogo */
.pick { position: relative; min-width: 0; }
.fld > .pick, .fld .row > .pick { width: 100%; }
.fld .row > .pick { flex: 1; }
.pick-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; cursor: pointer; text-align: left; color: var(--ink); font: inherit; }
.pick-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-btn .ico { color: var(--muted); width: 16px; height: 16px; }
.pick-btn:hover { border-color: var(--ink); }
.pick-btn[aria-expanded="true"] { border-color: var(--sea); box-shadow: 0 0 0 3px var(--sea-soft); }
.vals .pick-btn { min-width: 160px; color: var(--muted); }
.pick-pop { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; width: max(100%, 300px); max-width: min(460px, 86vw); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 6px; animation: entraModale .15s cubic-bezier(.2, .8, .2, 1); }
.pick-q { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: var(--panel-2); color: var(--muted); }
.pick-q:focus-within { border-color: var(--sea); box-shadow: 0 0 0 3px var(--sea-soft); }
.pick-q input[type="text"] { border: 0; background: transparent; flex: 1; width: auto; padding: 8px 2px; box-shadow: none; }
.pick-list { max-height: 300px; overflow: auto; margin-top: 4px; }
.pick-o { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 10px; cursor: pointer; color: var(--ink); font: inherit; }
.pick-o .pick-t { flex: 1; min-width: 0; }
.pick-o small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.pick-o[aria-selected="true"] { background: var(--sea-soft); color: var(--sea); }
.pick-o .pick-cur { color: var(--ok); width: 16px; height: 16px; }
.pick-o.crea { color: var(--sea); font-weight: 500; }
.pick-o.crea .ico { width: 16px; height: 16px; }
.pick-vuoto { margin: 6px 10px; color: var(--muted); font-size: 13px; }
.vchip { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); }
.vchip .ico { width: 14px; height: 14px; display: none; }
.vchip:hover { border-color: var(--ink); }
.vchip[aria-pressed="true"] { background: var(--sea-soft); border-color: var(--sea); color: var(--sea); font-weight: 500; }
.vchip[aria-pressed="true"] .ico { display: inline; }
.sugg-l { font-size: 12px; color: var(--muted); margin-left: 4px; }
.sugg { min-height: 28px; border: 1px dashed var(--brass); background: var(--brass-soft); color: var(--brass); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12.5px; cursor: pointer; }
.sugg:hover { border-style: solid; }
.manca { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--miss); font-weight: 500; }
.vchip, .sugg, .pick-btn, .pick-o { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
@media (prefers-reduced-motion: reduce) { .pick-pop { animation: none !important; } }
.fld .row > input { flex: 1; width: auto; min-width: 120px; }
.psec > .chip { justify-self: start; }
.pick-pop.su { top: auto; bottom: calc(100% + 4px); }

/* pannello laterale in primo piano: velo sulla pagina dietro, che non scorre */
.drawer-bg { position: fixed; inset: 0; z-index: 29; background: rgba(20, 22, 26, .55); cursor: pointer; }
.drawer-bg:not([hidden]) { animation: dissolvenza .2s ease-out; }
body.con-drawer { overflow: hidden; }
.drawer { box-shadow: -24px 0 60px rgba(0, 0, 0, .35); }
@media (prefers-reduced-motion: reduce) { .drawer-bg { animation: none !important; } }

/* ================================================================ scheda a passi: lettura più grande, stato di ogni passo, blocco del modello */
.pform { font-size: 15.5px; gap: 16px; }
.pform .fld > label, .pform .fld > .lbl { font-size: 15px; color: #3d434c; }
.pform .fld { grid-template-columns: 190px minmax(0, 1fr); }
.pform input[type="text"], .pform input[type="number"], .pform textarea, .pform .pick-btn { min-height: 40px; font-size: 15px; }
.pform .help, .pform .mini { font-size: 13.5px; }
.pform p.help { margin: 6px 0 0; }
.pform .psec { padding: 18px 20px; gap: 14px; }
.ptitle { gap: 10px; }
.ptitle h2 { font-size: 26px; }
.step { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.step-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--pece); color: #fff; font-size: 14px; font-family: var(--f-code); flex: none; }
.step-t { flex: 1; min-width: 0; }
.step-st { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; padding: 3px 10px; border-radius: 999px; }
.step-st .ico { width: 15px; height: 15px; }
.step-st.ok { background: var(--ok-soft); color: var(--ok); }
.step-st.miss { background: var(--miss-soft); color: var(--miss); }
.step-d { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.manca, .completa { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 500; }
.manca { background: var(--miss-soft); color: var(--miss); }
.manca .chip.bad { background: #fff; border: 1px solid #f0b8b8; font-size: 14px; padding: 4px 11px; }
.manca .chip.bad:hover { border-color: var(--miss); }
.completa { background: var(--ok-soft); color: var(--ok); }
.livelli { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.livello { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; font: inherit; font-weight: 600; color: var(--ink); transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.livello:hover { border-color: var(--ink); }
.livello[aria-pressed="true"] { background: var(--pece); border-color: var(--pece); color: #fff; }
.tacche { width: 18px; height: 16px; flex: none; }
.tacche rect { fill: var(--line); }
.tacche rect.on { fill: var(--amati); }
.livello[aria-pressed="true"] .tacche rect { fill: rgba(255, 255, 255, .3); }
.livello[aria-pressed="true"] .tacche rect.on { fill: #fff; }
.pform input.anno { flex: 0 1 260px; min-width: 160px; width: auto; }
.secolo { font-weight: 600; color: var(--sea); background: var(--sea-soft); padding: 5px 11px; border-radius: 999px; font-size: 14px; }
.tempi { display: grid; grid-template-columns: max-content max-content; gap: 8px 12px; align-items: center; }
.tempi label { color: #3d434c; }
.ore { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.pform .ore input[type="number"] { width: 110px; text-align: right; }
@media (max-width: 640px) { .livelli { grid-template-columns: minmax(0, 1fr); } .pform .fld { grid-template-columns: minmax(0, 1fr); } }
.pform .fld { grid-template-columns: 160px minmax(0, 1fr); }
.livelli { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.livello { justify-content: flex-start; gap: 8px; padding: 8px 12px; min-height: 48px; font-size: 15px; white-space: nowrap; }
.livelli { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.livello { flex-direction: column; justify-content: center; gap: 6px; min-height: 64px; padding: 8px 6px; white-space: normal; text-align: center; }
.livello .tacche { width: 22px; height: 18px; }
@media (max-width: 640px) { .pform .fld { grid-template-columns: minmax(0, 1fr); } }
