:root {
  --bg: #f6f4f2; --panel: #ffffff; --text: #1d1b1a; --muted: #6d6863; --line: #e4dfda;
  --accent: #7a1f2b; --accent-2: #9c2c3b; --accent-ink: #ffffff; --soft: #f3e7e9;
  --ok: #1f7a4d; --ok-bg: #e3f3ea; --warn: #8a5a00; --warn-bg: #fdf0d5; --bad: #b3261e; --bad-bg: #fbe4e2;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161414; --panel: #211e1e; --text: #ece8e5; --muted: #a39d98; --line: #36312f;
    --accent: #d0586a; --accent-2: #e06c7d; --accent-ink: #1a0c0e; --soft: #3a2328;
    --ok: #6fd3a0; --ok-bg: #173527; --warn: #f1c36b; --warn-bg: #3b2e12; --bad: #ff8a80; --bad-bg: #431c1a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161414; --panel: #211e1e; --text: #ece8e5; --muted: #a39d98; --line: #36312f;
  --accent: #d0586a; --accent-2: #e06c7d; --accent-ink: #1a0c0e; --soft: #3a2328;
  --ok: #6fd3a0; --ok-bg: #173527; --warn: #f1c36b; --warn-bg: #3b2e12; --bad: #ff8a80; --bad-bg: #431c1a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.2rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; margin-top: 1rem; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; min-width: 0; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- layout ---- */
.layout { display: flex; min-height: 100vh; }
#sidebar { width: 236px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 1rem 1rem .75rem; border-bottom: 1px solid var(--line); }
.brand b { display: block; color: var(--accent); }
.brand span { color: var(--muted); font-size: .85rem; }
#sidebar nav { display: flex; flex-direction: column; padding: .5rem; gap: 2px; flex: 1; }
#sidebar nav a { display: flex; gap: .6rem; align-items: center; padding: .5rem .65rem; border-radius: 8px; color: var(--text); }
#sidebar nav a:hover { background: var(--soft); text-decoration: none; }
#sidebar nav a.active { background: var(--accent); color: var(--accent-ink); }
.me { padding: .75rem 1rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem; padding: .65rem 1.25rem; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar h1 { flex: 1; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view { padding: 1.25rem; max-width: 1200px; width: 100%; }
.sync { font-size: .8rem; padding: .2rem .55rem; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.sync.ok { color: var(--ok); background: var(--ok-bg); }
.sync.warn { color: var(--warn); background: var(--warn-bg); }
.sync.bad { color: var(--bad); background: var(--bad-bg); }
.only-mobile { display: none !important; }
#scrim { display: none; }
.splash { min-height: 100vh; display: grid; place-items: center; padding: 16px; width: 100%; }
.splash .card { max-width: 440px; width: 100%; }

/* ---- componenti ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .85rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; white-space: nowrap; color: var(--text); text-decoration: none !important; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: .25rem .55rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 0; padding: .35rem; cursor: pointer; color: var(--text); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; flex-wrap: wrap; }
.card-h h2 { margin: 0; }
.card.hint { border-left: 4px solid var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; display: flex; flex-direction: column; gap: .2rem; color: var(--text); text-decoration: none !important; box-shadow: var(--shadow); }
.stat span { font-size: .8rem; color: var(--muted); }
.stat b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat.warn b { color: var(--warn); }
.stat.ok b { color: var(--ok); }
a.stat[href]:hover { border-color: var(--accent); }
.quick, .actions, .toolbar, .row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.quick, .actions, .toolbar { margin-bottom: 1rem; }
.toolbar input[type="search"] { flex: 1 1 260px; }
.row.end { justify-content: flex-end; margin-top: .75rem; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.pad { padding: .5rem; }
.empty { color: var(--muted); padding: 1rem 0; }
.bad-txt { color: var(--bad); }
.badge { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: var(--soft); color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.muted { color: var(--muted); }
.where { font-size: .82rem; }
.where.out { color: var(--warn); font-weight: 600; }
.where.case { color: var(--accent); }
.inv { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; }
.inv.big { font-size: 1.1rem; color: var(--accent); }
.callout { background: var(--soft); border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; }
.callout.warn { background: var(--warn-bg); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.selbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .5rem; }
.selbar:empty { display: none; }
.selbar:not(:empty) { position: sticky; top: 56px; z-index: 4; background: var(--soft); padding: .5rem; border-radius: 8px; }
details summary { cursor: pointer; margin: .5rem 0; color: var(--accent); }

/* ---- tabelle ---- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: .45rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.hl td { background: var(--soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .w1 { width: 1%; }
.tbl input.qty, .tbl input.rq { width: 4.5rem; }
.tbl.edit input { width: 100%; }

/* ---- scheda articolo ---- */
.item-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.item-qr { width: 96px; height: 96px; flex: none; background: #fff; padding: 4px; border-radius: 8px; border: 1px solid var(--line); }
.item-qr svg { width: 100%; height: 100%; display: block; }
.item-title { font-size: 1.3rem; margin: .1rem 0 .4rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.photo { max-width: 100%; max-height: 320px; border-radius: var(--radius); margin-bottom: 1rem; }

/* ---- moduli ---- */
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 0 0 1rem; padding: .75rem 1rem 1rem; min-width: 0; }
.form legend { font-weight: 600; padding: 0 .35rem; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.fld { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.fld > span { font-size: .8rem; color: var(--muted); }
.fld .row select { flex: 1; }
.span2 { grid-column: 1 / -1; }
.chk { display: flex; align-items: center; gap: .5rem; align-self: end; padding-bottom: .5rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; margin: 0; border-top: 1px solid var(--line); }
.typeahead { position: relative; }
.typeahead input { width: 100%; }
.sug { position: absolute; z-index: 10; left: 0; right: 0; top: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.sug:empty { display: none; }
.sug button { display: block; width: 100%; text-align: left; padding: .55rem .75rem; border: 0; background: none; cursor: pointer; border-bottom: 1px solid var(--line); }
.sug button:hover, .sug button:focus { background: var(--soft); }
.pick-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; margin: .5rem 0; }
.pick { display: flex; gap: .5rem; align-items: center; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }

/* ---- dialoghi e notifiche ---- */
dialog { border: 0; border-radius: 14px; padding: 0; max-width: min(620px, calc(100vw - 32px)); width: 100%; background: var(--panel); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.modal-body { padding: 1.25rem; max-height: 85vh; overflow-y: auto; }
.modal-body .fgrid { margin-top: .5rem; }
.modal-body select, .modal-body > input { width: 100%; }
.qr-reader { width: 100%; min-height: 200px; background: #000; border-radius: 8px; overflow: hidden; }
#qr-manual { margin-top: .75rem; }
#qr-manual input { flex: 1; }
#toasts { position: fixed; z-index: 100; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: .65rem 1rem; border-radius: 10px; box-shadow: var(--shadow); animation: pop .2s ease-out; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.error { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn-bg); color: var(--warn); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---- etichette ---- */
.label-preview { overflow: auto; background: #ddd; border-radius: 8px; padding: 8px; max-height: 70vh; }
.label-preview .scale-wrap { zoom: .55; }
.sheet { position: relative; background: #fff; color: #000; overflow: hidden; margin: 0 auto; }
.lbl { display: flex; gap: 1.5mm; align-items: center; overflow: hidden; font-family: system-ui, Arial, sans-serif; color: #000; outline: .1mm dashed #bbb; }
.lbl-qr { flex: none; }
.lbl-qr svg { width: 100%; height: 100%; display: block; }
.lbl-txt { min-width: 0; display: flex; flex-direction: column; gap: .6mm; }
.lbl-inv { font-weight: 800; font-family: ui-monospace, Consolas, monospace; line-height: 1; }
.lbl-name { line-height: 1.1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lbl-org { color: #444; line-height: 1; }
.casesheet { height: 148.5mm; padding: 10mm 12mm; font-family: system-ui, Arial, sans-serif; color: #000; border-bottom: .2mm dashed #999; }
.cs-head { display: flex; gap: 6mm; align-items: flex-start; margin-bottom: 4mm; }
.cs-head > div:first-child { flex: 1; font-size: 3.4mm; }
.cs-head .pre { white-space: pre-line; }
.cs-qr { width: 26mm; height: 26mm; }
.cs-qr svg { width: 100%; height: 100%; }
.cs-no { display: flex; flex-direction: column; align-items: flex-end; font-size: 3.2mm; }
.cs-no b { font-size: 9mm; line-height: 1; font-family: ui-monospace, Consolas, monospace; }
.casesheet table, .packlist table { width: 100%; border-collapse: collapse; font-size: 3.4mm; }
.casesheet th, .casesheet td, .packlist th, .packlist td { border: .2mm solid #333; padding: 1.2mm 2mm; text-align: left; }
.casesheet tfoot td { font-weight: 700; }
.packlist { font-family: system-ui, Arial, sans-serif; color: #000; }
.packlist h1 { font-size: 16pt; } .packlist h2 { font-size: 13pt; }
.packlist .sign { margin-top: 14mm; }
#print-area { display: none; }

@media print {
  body.printing > :not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  body.printing { background: #fff; }
  .sheet { margin: 0; page-break-after: always; break-after: page; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .lbl { outline: none; }
}

/* ---- telefono ---- */
@media (max-width: 860px) {
  .only-mobile { display: flex !important; }
  .hide-mobile { display: none !important; }
  #sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  body.menu-open #sidebar { transform: none; }
  body.menu-open #scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.4); }
  .topbar { padding: .55rem 16px; }
  #view { padding: 16px 16px 88px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b { font-size: 1.1rem; }
  .toolbar select, .toolbar input { flex: 1 1 45%; }
  .bottomnav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); justify-content: space-around; align-items: center; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a, .bottomnav > button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); background: none; border: 0; padding: 4px 8px; cursor: pointer; }
  .bottomnav a.active { color: var(--accent); }
  .bottomnav .scan-fab { background: var(--accent); color: var(--accent-ink); border-radius: 50%; width: 52px; height: 52px; justify-content: center; margin-top: -22px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
  .bottomnav .scan-fab .ic { width: 26px; height: 26px; }
  /* tabelle come schede */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; padding: .35rem .6rem; background: var(--panel); }
  .tbl td { border: 0; padding: .2rem 0; display: flex; gap: .75rem; justify-content: space-between; text-align: right; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; text-align: left; flex: none; }
  .tbl td[data-label=""]::before { content: none; }
  .tbl td.w1 { width: auto; }
  .tbl .num { text-align: right; }
  .tbl.edit td { flex-direction: column; text-align: left; gap: .15rem; }
  /* elenco inventario: riga compatta */
  .tbl.compact tr { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; padding: .5rem .6rem; }
  .tbl.compact td { display: block; width: auto; padding: 0; text-align: left; }
  .tbl.compact td::before { content: none; }
  .tbl.compact td:nth-child(3) { flex-basis: 100%; order: 3; }
  .tbl.compact td:nth-child(5) { order: 4; }
  .tbl.compact td:nth-child(6) { order: 5; }
  .tbl.compact td:nth-child(4), .tbl.compact td:nth-child(7), .tbl.compact td:nth-child(8) { display: none; }
  .item-qr { width: 72px; height: 72px; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .dl dd { margin-bottom: .45rem; }
  .sticky-actions { bottom: 64px; }
}

/* =================== versione 2: tema, cruscotto, progetti, calendario, documenti =================== */
body { font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif); }
h1, h2, h3, .stat b, .item-title, .cal-title { font-family: var(--font-head, inherit); font-weight: var(--head-weight, 700); }
h2 { font-size: 1.1rem; }
.pre { white-space: pre-line; }
.ok-txt { color: var(--ok); }
.badge.orange { background: var(--orange-bg, #fdeedc); color: var(--orange, #c26a00); }
.fixed { padding: .5rem .6rem; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); }
.fld-label { font-size: .8rem; color: var(--muted); }

/* barra laterale con il logo */
#sidebar { background: var(--side-bg, var(--panel)); color: var(--side-text, var(--text)); border-right-color: transparent; }
#sidebar nav a { color: var(--side-text, var(--text)); }
#sidebar nav a:hover { background: var(--side-hover, var(--soft)); }
#sidebar nav a.active { background: var(--accent); color: var(--accent-ink); }
#sidebar .me { color: var(--side-muted, var(--muted)); border-top-color: rgba(255, 255, 255, .08); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .08); padding: 1.1rem 1rem .9rem; cursor: pointer; color: inherit; font: inherit; }
.brand-logo img { display: block; max-width: 100%; max-height: 64px; }
.brand-logo.tile { background: #fff; border-radius: 8px; padding: 6px 8px; }
.brand-name b { display: block; color: var(--side-text, var(--text)); font-family: var(--font-head, inherit); font-weight: var(--head-weight, 700); }
.brand-name span { color: var(--side-muted, var(--muted)); font-size: .8rem; }
.brand-name u { text-decoration: none; opacity: 0; transition: opacity .15s; }
.brand:hover .brand-name u { opacity: 1; }
.splash-logo { display: block; max-width: 220px; max-height: 90px; margin-bottom: 1rem; }
button.sync { border: 0; font: inherit; font-size: .8rem; }
.logo-edit { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.logo-edit img { max-width: 220px; max-height: 90px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

/* cruscotto: contenuto a sinistra, azioni a destra */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-side { position: sticky; top: 72px; }
.side-actions h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .25rem 0 .5rem; }
.side-actions h2:not(:first-child) { margin-top: 1rem; }
.action { display: flex; flex-direction: column; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; color: var(--text); text-decoration: none !important; }
.action span { font-size: .8rem; color: var(--muted); }
.action:hover { border-color: var(--accent); background: var(--soft); }
.action.out, .action.in { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.action.out span, .action.in span { color: var(--accent-ink); opacity: .85; }
.action.out:hover, .action.in:hover { background: var(--accent-2); }

/* righe in ritardo (progetto finito con materiale fuori) */
.tbl tr.overdue td { background: var(--orange-bg, #fdeedc); }
.tbl tr.overdue td:first-child { box-shadow: inset 4px 0 0 var(--orange, #c26a00); }
.overdue-card { border-left: 4px solid var(--orange, #c26a00); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--soft); }

/* inventario raggruppato */
.tbl tr.grp { cursor: pointer; }
.tbl tr.grp td { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.tbl tr.sub td { background: var(--panel); }
.tbl tr.sub td:nth-child(2) { padding-left: 1.4rem; }
.gtoggle { background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; color: var(--text); }
.caret { color: var(--accent); width: 1em; }
.badge.count { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.chip { font: inherit; font-size: .78rem; font-family: ui-monospace, Consolas, monospace; padding: .1rem .45rem; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--bad); color: var(--bad); }
.pick.disabled { opacity: .5; }
.pick-list.short { max-height: 180px; }
.staff-row { margin-bottom: .4rem; }
.staff-row input { flex: 1; }

/* calendario */
.cal-title { min-width: 10rem; text-align: center; text-transform: capitalize; }
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: .4rem; font-size: .75rem; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 104px; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.empty { background: var(--bg); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day { font-size: .78rem; color: var(--muted); }
.cal-chip { display: block; font-size: .75rem; padding: .15rem .4rem; border-radius: 5px; background: var(--soft); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--accent); text-decoration: none !important; }
p .cal-chip { display: inline-block; }
.cal-chip.warn { border-left-color: var(--bad); background: var(--bad-bg); }
.cal-chip.late { border-left-color: var(--orange, #c26a00); background: var(--orange-bg, #fdeedc); }
.only-mobile-block { display: none; }

/* documenti di uscita e rientro (stampa A4) */
.doc { font-family: var(--font-body, Arial, sans-serif); color: #111; font-size: 10pt; page-break-after: always; break-after: page; display: flex; flex-direction: column; min-height: 270mm; }
.doc:last-child { page-break-after: auto; break-after: auto; }
.doc-head { display: grid; grid-template-columns: auto 1fr auto; gap: 8mm; align-items: start; padding-bottom: 4mm; border-bottom: 1.2pt solid #111; }
.doc-logo { max-width: 52mm; max-height: 24mm; }
.doc-org { font-size: 9pt; line-height: 1.35; }
.doc-org b { font-size: 11pt; }
.doc-title { text-align: right; display: flex; flex-direction: column; gap: 1mm; }
.doc-title span { font-size: 9pt; text-transform: uppercase; letter-spacing: .03em; }
.doc-title b { font-size: 15pt; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; margin: 5mm 0; }
.doc-parties > div { border: .6pt solid #555; border-radius: 2mm; padding: 3mm 4mm; line-height: 1.4; }
.doc-parties h4 { margin: 0 0 1.5mm; font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #555; }
.doc-causale { margin: 0 0 4mm; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.doc-table th { text-align: left; background: #eee; }
.doc-table th, .doc-table td { border: .5pt solid #777; padding: 1.4mm 2mm; vertical-align: top; }
.doc-table .c { text-align: center; }
.doc-table .mono { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.doc-table tfoot td { font-weight: 700; background: #f6f6f6; }
.doc-table small { color: #555; }
.doc-table.small { margin-top: 2mm; font-size: 8.5pt; }
.doc-recap { margin: 4mm 0 1mm; }
.doc-notes, .doc-meta { font-size: 8.5pt; color: #333; margin: 4mm 0 0; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 14mm; margin-top: auto; padding-top: 12mm; }
.doc-sign span { font-size: 9pt; }
.doc-sign .line { border-bottom: .6pt solid #111; height: 16mm; }
.doc-sign small { color: #555; font-size: 7.5pt; }
.doc-copy { margin-top: 5mm; text-align: center; font-size: 8pt; text-transform: uppercase; letter-spacing: .08em; border-top: .5pt dashed #999; padding-top: 2mm; color: #444; }

@media (max-width: 1100px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-side { position: static; order: -1; }
  .side-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; }
  .side-actions h2 { grid-column: 1 / -1; margin: .25rem 0 0 !important; }
  .action { margin: 0; }
}
@media (max-width: 860px) {
  .only-mobile-block { display: block; }
  .stats.three { gap: .5rem; }
  .stats.three .stat span { font-size: .72rem; }
  .tbl.compact tr.grp td:nth-child(5) { display: none; }
  .tbl.compact tr.sub { margin-left: 1rem; }
  .tbl tr.overdue { border-left: 4px solid var(--orange, #c26a00); }
  .brand-logo img { max-height: 48px; }
}

/* =================== versione 0.2: aree di lavoro, marchio Scenedock, amministrazione =================== */
/* menu diviso per aree */
.nav-area { display: flex; flex-direction: column; gap: 2px; margin-bottom: .6rem; }
.nav-area > span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted, var(--muted)); padding: .35rem .65rem .15rem; }
#sidebar .me { display: flex; gap: .6rem; align-items: center; color: var(--side-muted, var(--muted)); text-decoration: none; }
#sidebar .me b { display: block; color: var(--side-text, var(--text)); font-weight: 600; }
#sidebar .me small { display: block; }
#sidebar .me:hover { background: var(--side-hover, var(--soft)); }
/* Scenedock in fondo alla barra laterale e in alto a destra: il nome del software in ogni pagina */
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem 1rem; border-top: 1px solid rgba(255, 255, 255, .08); opacity: .75; text-decoration: none !important; }
.product-foot:hover { opacity: 1; }
.product-foot img { height: 16px; width: auto; }
.product-foot small { color: var(--side-muted, var(--muted)); font-size: .7rem; }
.topbar-product { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .78rem; text-decoration: none !important; padding-left: .5rem; border-left: 1px solid var(--line); }
.topbar-product img { height: 18px; width: 18px; }
/* marchio Scenedock chiaro o scuro secondo il tema */
.on-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .on-dark { display: inline; } :root:not([data-theme="light"]) .on-light { display: none; } }
:root[data-theme="dark"] .on-dark { display: inline; }
:root[data-theme="dark"] .on-light { display: none; }
.topbar-product:hover { color: var(--text); }
.splash-logo { max-width: 260px; }
.splash-foot { margin: 1rem 0 0; font-size: .75rem; color: var(--muted); }
/* schede uscita / rientro */
.tabs { display: inline-flex; gap: 2px; background: var(--soft); border-radius: 10px; padding: 3px; margin-bottom: 1rem; }
.tabs a { padding: .45rem 1rem; border-radius: 8px; color: var(--text); text-decoration: none !important; font-weight: 600; }
.tabs a.on { background: var(--panel); box-shadow: var(--shadow); color: var(--accent); }
/* cruscotto */
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash.no-side { grid-template-columns: minmax(0, 1fr); }
/* crediti e informazioni */
.credits { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.credits-logo { width: 96px; height: 96px; border-radius: 10px; }
.credits h3 { margin: 0 0 .3rem; font-size: 1.1rem; }
.credits p { margin: .15rem 0; }
.product-card .product-logo { display: block; max-width: 320px; width: 100%; margin: .25rem 0 1rem; }
/* amministrazione */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .5rem; }
.svc { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.svc:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.svc small { display: block; color: var(--muted); font-size: .78rem; }
.tbl.matrix select { padding: .3rem .4rem; font-size: .85rem; }
.tbl.matrix th { vertical-align: bottom; }
.tbl tr.area-row td { background: var(--soft); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .3rem .5rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }
.changes { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .82rem; }
.changes s { color: var(--muted); }
.tbl.terms input { width: 100%; }
.tbl.terms td:first-child { max-width: 320px; }
@media (max-width: 860px) {
  .stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbl.matrix thead { display: table-header-group; }
  .tbl.matrix, .tbl.matrix tbody { display: table; width: 100%; }
  .tbl.matrix tr { display: table-row; border: 0; padding: 0; }
  .tbl.matrix td { display: table-cell; width: auto; }
  .tbl.matrix td::before { content: none; }
}
@media (max-width: 860px) {
  .bottomnav a span, .bottomnav > button span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-product { display: none; }
}

/* v0.2 blocco 2: calendari, opzioni, tag, periodi */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 1rem; align-items: start; }
.cal-side { position: sticky; top: 72px; }
.cal-side h2 { font-size: 1rem; margin: 0 0 .5rem; }
.cal-side h3 { font-size: .85rem; margin: 1rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cal-tg { display: flex; align-items: center; gap: .45rem; padding: .25rem 0; cursor: pointer; }
.cal-tg i, .swatch { display: inline-block; width: .85rem; height: .85rem; border-radius: 3px; background: var(--c, var(--accent)); flex: none; }
.cal-tg i.opt { background: repeating-linear-gradient(45deg, var(--c) 0 3px, transparent 3px 6px); border: 1px dashed var(--c); }
.cal-tg .muted { margin-left: auto; }
.cal-chip { border-left-color: var(--c, var(--accent)); }
.cal-chip.opt { border-left-style: dashed; background: repeating-linear-gradient(45deg, var(--soft) 0 6px, var(--panel) 6px 12px); font-style: italic; }
.cal-chip.ext { font: inherit; font-size: .75rem; width: 100%; text-align: left; cursor: pointer; border: 0; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 14%, var(--panel)); }
.badge.opt { background: repeating-linear-gradient(45deg, var(--soft) 0 4px, transparent 4px 8px); border: 1px dashed var(--cal-opt, #7c3aed); color: var(--cal-opt, #7c3aed); }
.badge.tag { background: var(--soft); color: var(--text); border: 1px solid var(--line); }
.tag-pick { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; margin-top: .25rem; }
.tagbox { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .5rem; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-size: .85rem; }
.tagbox:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.range-row { align-items: end; gap: .6rem; margin-bottom: .4rem; }
.range-row .fld { margin: 0; }
@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; order: -1; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; padding: .6rem .9rem; }
  .cal-side h2, .cal-side h3, .cal-side p.muted { display: none; }
  .cal-tg .muted { margin-left: 0; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cal-opt: #a78bfa; --cal-evt: #22d3ee; } }
:root[data-theme="dark"] { --cal-opt: #a78bfa; --cal-evt: #22d3ee; }

/* ---- v0.2 blocco 3: organizzazione, planning, schede tecniche ---- */
:root { --pw-compagnia: color-mix(in srgb, var(--accent) 30%, #fff); --pw-tecnici: #c6e0b4; --pw-attori: #f8cbad; --pw-regia: #d9d2e9; --pw-luogo: #ffff00; }
.recap-prev { white-space: pre-wrap; background: var(--soft); border-radius: 8px; padding: .75rem 1rem; font: inherit; font-size: .9rem; max-height: 22rem; overflow: auto; }
#rcText { width: 100%; font: inherit; }
.checks { margin: 0; padding-left: 1.2rem; }
.checks li { margin: .2rem 0; }
.checks li.bad { color: var(--bad); }
.checks li.warn { color: var(--warn); }
fieldset.hotel { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin: 0 0 .75rem; }
.plan-tbl input:not([type=checkbox]) { width: 100%; min-width: 5rem; }
.plan-tbl td:nth-child(3) input { min-width: 14rem; }
.plan-tbl .pw { text-align: center; width: 2.2rem; }
.plan-tbl .pw.on { background: var(--pw-c); color: #111; }
.pw-compagnia { --pw-c: var(--pw-compagnia); } .pw-tecnici { --pw-c: var(--pw-tecnici); } .pw-attori { --pw-c: var(--pw-attori); }
.pw-regia { --pw-c: var(--pw-regia); } .pw-luogo { --pw-c: var(--pw-luogo); }
.pw-h { vertical-align: bottom; height: 7rem; width: 2.2rem; padding: .25rem !important; }
.pw-h span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; max-height: 6.5rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .pw-h span { writing-mode: horizontal-tb; transform: none; } .pw-h { height: auto; } }

/* stampa del planning: struttura del modello Excel */
.plan-doc { font-family: Arial, sans-serif; color: #111; font-size: 9.5pt; }
.pl-top { display: grid; grid-template-columns: 1fr auto auto; gap: 6mm; align-items: start; border: 1.5pt solid #111; padding: 3mm 4mm; }
.pl-top h1 { font-size: 18pt; margin: 0 0 2mm; } .pl-top h2 { font-size: 11pt; margin: 0; font-weight: normal; }
.pl-top img { max-height: 16mm; max-width: 40mm; } .pl-ver { font-size: 8.5pt; }
.pl-legend { display: flex; gap: 3mm; margin: 2mm 0; } .pl-legend span { padding: 1mm 3mm; border: .5pt solid #888; background: var(--pw-c); }
.pl-tbl { width: 100%; border-collapse: collapse; }
.pl-tbl th, .pl-tbl td { border: .5pt solid #777; padding: 1.2mm 2mm; text-align: left; vertical-align: top; }
.pl-tbl thead th { border-bottom: 1.5pt solid #111; }
.pl-tbl td:not(.pl-d) { background: #e7e6e6; }
.pl-tbl td.pw { width: 6mm; padding: 0; background: #fff; } .pl-tbl td.pw.on { background: var(--pw-c); }
.pl-tbl .pl-d { width: 30mm; font-weight: bold; text-transform: capitalize; } .pl-tbl .pl-t { width: 16mm; font-weight: bold; }
.pl-tbl .pw-h { height: 28mm; width: 6mm; } .pl-tbl .pl-gap td { border: 0; height: 3mm; background: none; padding: 0; }
.ts-doc h3 { margin: 5mm 0 1.5mm; font-size: 11pt; border-bottom: .8pt solid #111; }
.ts-tbl { width: 100%; border-collapse: collapse; } .ts-tbl th { width: 55mm; text-align: left; font-weight: 600; vertical-align: top; padding: 1mm 2mm 1mm 0; } .ts-tbl td { padding: 1mm 0; }
@media print { .plan-doc *, .pl-tbl td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---- v0.3 ---- */
#modal.wide { width: min(900px, 96vw); max-width: 96vw; }
.map-frame { width: 100%; height: min(60vh, 480px); border: 0; border-radius: 8px; background: var(--soft); }
.callout.bad { background: var(--bad-bg); color: var(--bad); }
.tagbox.bad { outline: 2px solid var(--bad); }
tr.internal td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.lead { font-size: 1.05rem; margin-top: -.25rem; }
.small-stats { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.small-stats .stat { flex: 1 1 8rem; }
.flag { width: 1.4em; height: .95em; vertical-align: -.12em; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.lang-btn { gap: .4rem; }
#report { color: var(--muted); }
/* etichette: nuova grafica (testi e logo a sinistra, QR a destra) */
.lbl.lbl2 { padding: 0; gap: 0; align-items: stretch; }
.lbl2 .lbl-left { display: flex; flex-direction: column; justify-content: center; gap: .7mm; min-width: 0; overflow: hidden; box-sizing: border-box; }
.lbl2 .lbl-left.div { border-right: .2mm solid #000; }
.lbl2 .lbl-logo { max-width: 100%; object-fit: contain; object-position: left center; align-self: flex-start; }
.lbl2 .lbl-right { box-sizing: border-box; flex: none; display: flex; }
.lbl2 .lbl-qr { width: 100%; height: 100%; }
.sheet .crop { position: absolute; background: #000; display: block; }
@media print { .lbl.lbl2 { outline: none; } }

/* ===================== v0.4 ===================== */
/* settori e cavi */
.sector-chip { display: inline-block; padding: .15rem .55rem; border-radius: 6px; font-weight: 600; border: 1px solid rgba(0,0,0,.15); }
.cable-code { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.cable-code i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0,0,0,.35); }
.cable-code small { margin-left: 3px; color: var(--muted); }
.cable-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .9rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.fgrid.four { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
/* carta intestata */
.lh-edit { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.lh-prev { position: relative; width: 150px; aspect-ratio: 210 / 297; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; flex: none; }
.lh-prev img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.lh-area { position: absolute; border: 1px dashed #e02424; }
.lh-bg { display: none; }
@media print {
  body.printing .lh-bg { display: block; position: fixed; top: 0; left: 0; width: 210mm; height: 297mm; z-index: -1; }
  .lh-wrap { width: 210mm; border-collapse: collapse; page-break-after: always; break-after: page; }
  .lh-wrap:last-child { page-break-after: auto; break-after: auto; }
  .lh-wrap > * > tr > td { padding: 0; vertical-align: top; }
}
.doc.lh { min-height: 0; page-break-after: auto; break-after: auto; }
.doc-head.lh { border-bottom: 0; padding-bottom: 2mm; }
.doc-table .r { text-align: right; }
/* cruscotto generale */
.next-title { margin: 0 0 .5rem; }
ul.todo { margin: 0; padding-left: 1.1rem; }
.tbl tr.sub td { border-top: 0; }
/* preventivi */
.calc-out { background: var(--soft, #f2efec); border-radius: 8px; padding: .75rem; }
.calc-out .big { font-size: 1.4rem; }
.dl.tot { grid-template-columns: 1fr max-content; max-width: 320px; margin-left: auto; }
.dl.tot dd { text-align: right; margin: 0; }
#qLines input { width: 100%; min-width: 4rem; }
#qLines .lQty { max-width: 5rem; }
/* etichette dei case A5 (modello della compagnia) */
.cl-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.cl-preview { position: sticky; top: 4.5rem; overflow: hidden; }
.cl-scale { width: 210mm; transform-origin: top left; transform: scale(.62); height: calc(148mm * .62); }
@media (max-width: 1200px) { .cl-page { grid-template-columns: minmax(0, 1fr); } .cl-preview { position: static; } }
.clabel { width: 210mm; height: 148mm; padding: 8mm 8mm 4mm; box-sizing: border-box; background: #fff; color: #000; font-family: 'Roboto', Arial, sans-serif; display: flex; flex-direction: column; }
.cl-box { border: .5mm solid #000; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cl-top { display: grid; grid-template-columns: 59% 41%; height: 38mm; border-bottom: .5mm solid #000; }
.cl-logo { display: grid; place-items: center; padding: 4mm 6mm; border-right: .5mm solid #000; }
.cl-logo img { max-width: 100%; max-height: 28mm; object-fit: contain; }
.cl-sector { display: grid; place-items: center; font-weight: 900; font-style: italic; font-size: 34pt; letter-spacing: .01em; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.cl-mid { display: grid; grid-template-columns: 59% 1fr 26mm; height: 25mm; border-bottom: .5mm solid #000; }
.cl-org { padding: 2mm 3mm 2mm 6mm; font-size: 8.5pt; font-style: italic; line-height: 1.3; display: flex; flex-direction: column; gap: .6mm; border-right: .5mm solid #000; }
.cl-org b { font-size: 9.5pt; }
.cl-note { padding: 2mm 3mm; font-size: 8.5pt; border-right: .5mm solid #000; display: flex; flex-direction: column; gap: 1mm; }
.cl-note small, .cl-no small { font-size: 7.5pt; }
.cl-no { padding: 2mm; text-align: center; display: flex; flex-direction: column; gap: 1mm; }
.cl-no b { font-style: italic; font-size: 12.5pt; }
.cl-list { flex: 1; padding: 1.5mm 2mm 1mm 3mm; font-size: 11pt; display: flex; flex-direction: column; min-height: 0; }
.cl-row { display: grid; grid-template-columns: 5mm 48mm 60mm 1fr 24mm; align-items: baseline; line-height: 1.45; }
.cl-row > * { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cl-h { font-style: italic; }
.cl-h .cl-name { grid-column: 1 / 4; padding-left: 3mm; }
.cl-id, .cl-h .cl-id { padding-left: 0; }
.cl-w { text-align: right; padding-right: 4mm; }
.cl-tot { margin-top: auto; display: flex; justify-content: flex-end; gap: 6mm; padding-right: 4mm; }
.cl-tot b { font-style: italic; }
.clabel.dense .cl-list { font-size: 9pt; line-height: 1.25; }
.cl-date { text-align: right; font-size: 7pt; padding-top: .8mm; }
.cl-a4 { width: 210mm; height: 297mm; }
.cl-a5 { width: 210mm; height: 148mm; }

/* ===== v0.5 ===== */
/* righe che portano a una pagina: si illuminano al passaggio e si aprono con un clic ovunque */
.tbl tr.clickable:hover td { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.tbl tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* cruscotto tecnico: carico / scarico in alto */
.dash-moves { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.dash-moves .action { margin: 0; }
/* inserimento a passi */
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0 0 1rem; }
.steps button { font: inherit; font-size: .85rem; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 99px; padding: .3rem .8rem; cursor: pointer; }
.steps button b { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--soft); font-size: .75rem; margin-right: .25rem; }
.steps li.done button { border-color: var(--accent); }
.steps li.on button { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.on button b { background: var(--accent-ink); color: var(--accent); }
.ptabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: .5rem 0 1rem; }
.ptabs button { font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: .3rem .6rem; cursor: pointer; }
.ptabs button.filled { border-color: var(--ok, #2e9d47); }
.ptabs button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ptabs small { opacity: .75; }
/* indirizzi in campi separati */
.fgrid.addr { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.fgrid.addr .span2 { grid-column: span 3; }
@media (max-width: 760px) { .fgrid.addr { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fgrid.addr .span2 { grid-column: span 2; } }
.addr-inline { display: flex; flex-wrap: wrap; gap: .25rem; }
.addr-inline input { width: auto; flex: 1 1 5rem; min-width: 3.5rem; }
.addr-inline .a-street { flex: 3 1 10rem; }
.addr-inline .a-prov, .addr-inline .a-civic { flex: 0 1 3.5rem; }
/* carico: voci già prese in verde, conflitti in rosso */
.tbl tr.done td { background: color-mix(in srgb, var(--ok, #2e9d47) 14%, var(--panel)); }
.chip.bad { border-color: var(--bad); color: var(--bad); }
/* settori: tipi e numerazione */
.subs { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.sub-row { display: inline-flex; gap: .2rem; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: .15rem .3rem; }
.sub-row .subN { width: 3.4rem; }
.sub-row .subName { width: 9rem; }
input[type="color"].secColor { width: 2.2rem; height: 1.8rem; padding: 0; border: 1px solid var(--line); border-radius: 6px; vertical-align: middle; }
/* domanda "salvare prima di uscire?" sopra un'altra finestra */
dialog.ask { max-width: min(460px, calc(100vw - 32px)); }
.callout.small { font-size: .85rem; }
[hidden] { display: none !important; }
/* cruscotto tecnico su schermi stretti: prima carico / scarico e contatori, poi i nuovi inserimenti */
@media (max-width: 1100px) { .dash-side { order: 2; } }
.chip .x { border: 0; background: none; padding: 0 .35rem; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--muted); min-width: 24px; min-height: 24px; }
.gres { max-height: 60vh; overflow-y: auto; margin: .5rem 0; }
.gres h3 { margin: .75rem 0 .25rem; }
.gres-row { display: block; padding: .5rem .6rem; border-radius: 8px; color: var(--text); min-height: 44px; }
.gres-row:hover, .gres-row:focus { background: var(--soft); text-decoration: none; }
#gq { width: 100%; font-size: 16px; }
/* v0.6 (audit grafica): sul telefono campi a 16 px (niente zoom automatico su iPhone) e aree toccabili da 44 px */
@media (max-width: 860px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea { font-size: 16px; }
  .btn, .icon-btn, .sync { min-height: 44px; }
  .icon-btn { min-width: 44px; }
  .sync { display: inline-flex; align-items: center; }
  .btn.small { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* =================== Lotto 3 (v0.6): barra in alto, menu a comparsa, cartelle del menu =================== */
.topbar { gap: .5rem; }
.pop-wrap { position: relative; display: inline-flex; }
.pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.25); }
.pop[hidden] { display: none; }
.notif { position: relative; }
.notif.has::after { content: attr(data-count); position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: var(--panel); font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.notif-panel { width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 560px); display: flex; flex-direction: column; }
.notif-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .85rem; border-bottom: 1px solid var(--line); }
.notif-body { overflow-y: auto; padding: .25rem 0 .5rem; }
.notif-body h3 { margin: .6rem .85rem .25rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.notif-item { display: flex; flex-direction: column; gap: 1px; padding: .5rem .85rem; color: var(--text); border-top: 1px solid var(--line); }
a.notif-item:hover { background: var(--soft); text-decoration: none; }
.pad { padding: .25rem .85rem; }
.user-btn { display: inline-flex; align-items: center; gap: .5rem; background: none; border: 0; padding: .15rem .35rem; border-radius: 99px; cursor: pointer; color: var(--text); text-align: left; }
.user-btn:hover { background: var(--soft); }
.user-name { display: flex; flex-direction: column; line-height: 1.15; font-size: .85rem; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name small { font-weight: 400; color: var(--muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; object-fit: cover; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.user-menu { min-width: 220px; padding: .35rem; display: flex; flex-direction: column; }
.user-menu a, .user-menu button { display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem; border: 0; background: none; border-radius: 8px; color: var(--text); cursor: pointer; text-align: left; text-decoration: none; }
.user-menu a:hover, .user-menu button:hover { background: var(--soft); text-decoration: none; }
.user-menu-head { display: flex; flex-direction: column; padding: .45rem .65rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
.user-menu-head small { color: var(--muted); }
.user-menu .m-only { display: none; }
@media (max-width: 768px) { .user-menu .m-only { display: flex; } }
/* cartelle del menu laterale */
details.nav-area { margin-bottom: .35rem; }
details.nav-area > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted, var(--muted)); padding: .45rem .65rem; border-radius: 8px; min-height: 32px; }
details.nav-area > summary::-webkit-details-marker { display: none; }
details.nav-area > summary::after { content: "▸"; font-size: .8rem; transition: transform .15s; }
details.nav-area[open] > summary::after { transform: rotate(90deg); }
details.nav-area > summary:hover { background: var(--side-hover, var(--soft)); }
details.nav-area[open] { display: flex; flex-direction: column; gap: 2px; }
#sidebar nav a.nav-sub { margin-left: 1.6rem; padding: .3rem .65rem; font-size: .88rem; min-height: 32px; }
#sidebar nav a.nav-sub::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; flex: none; }
@media (max-width: 768px) { #sidebar nav a.nav-sub { min-height: 44px; } details.nav-area > summary { min-height: 44px; } }
/* campi di testo lunghi (es. segnalazione): occupano tutta la larghezza e si allungano in altezza */
dialog textarea, .fgrid textarea, #repText { width: 100%; min-height: 8rem; resize: vertical; }
/* checklist del progetto */
.chk-row { display: flex; gap: .6rem; align-items: baseline; padding: .4rem 0; border-top: 1px solid var(--line); }
.chk-row.done .chk-text { text-decoration: line-through; color: var(--muted); }
.chk-row .grow { flex: 1; }
.chk-row.late .chk-due { color: var(--bad); font-weight: 600; }
.theme-choice { display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 480px) { .topbar { padding: .4rem 12px; gap: .25rem; } .topbar .sync { font-size: .72rem; padding: .15rem .45rem; } }

/* =================== Lotto 5 (v0.7): conteggio, report, kit =================== */
.count-big { font-size: 2rem; font-weight: 700; margin: .25rem 0 .75rem; font-variant-numeric: tabular-nums; }
.count-big b { color: var(--accent); }
.warn-txt { color: var(--warn); }
.kit-bar { margin-bottom: .5rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stats .stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; display: flex; flex-direction: column; gap: .15rem; }
.stats .stat span { color: var(--muted); font-size: .8rem; }
.stats .stat b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: .4rem; align-items: end; height: 160px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; font-size: .72rem; color: var(--muted); }
.bar-stack { display: flex; flex-direction: column-reverse; width: 100%; max-width: 36px; min-height: 2px; border-radius: 4px 4px 0 0; overflow: hidden; }
.bar-stack i { display: block; }
.b-conf { background: var(--ok); } .b-opz { background: var(--warn); } .b-salt { background: var(--bad); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 .25rem 0 .75rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.tok { display:block; word-break:break-all; user-select:all; padding:.4rem; background:var(--soft); border-radius:6px; margin-top:.4rem; }

/* ---- v0.7: notifiche e menù utente sul telefono, scelta multipla del contenuto, stima ingombro ---- */
.cable-len { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: .25rem; }
.scope-boxes { gap: .25rem .9rem; }
.scope-boxes .chk { min-height: 44px; align-items: center; }
.fit-note { margin: .5rem 0; padding: .5rem .75rem; border-radius: var(--radius); background: var(--soft); font-size: .85rem; }
.fit-note.warn { background: var(--warn-bg); color: var(--warn); }
.pick-filter { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: .4rem 0; font-size: .85rem; }
@media (max-width: 600px) {
  /* il pannello si aggancia alla barra in alto e occupa tutta la larghezza: prima usciva a sinistra dallo schermo */
  .pop-wrap { position: static; }
  .pop { left: 12px; right: 12px; top: calc(100% + 4px); width: auto; max-width: none; }
  .notif-panel { width: auto; max-height: 70vh; }
}

/* ---- v0.7: scontrini, recap di fatturazione, cancellazione per sezione, pagina in tour ---- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.btn.big { min-height: 48px; font-size: 1rem; }
.rcpt { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; padding: .75rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; }
.rcpt-amt { text-align: right; font-variant-numeric: tabular-nums; }
.rcpt-act { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; }
.bill-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.bill-row:first-child { border-top: 0; }
.bill-val { font-size: 1.05rem; font-weight: 600; word-break: break-word; }
.wipe-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.tour-card.now { border-color: var(--accent); }
.tour-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.tour-key { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: .5rem 0; }
.tour-key > div { display: flex; flex-direction: column; }
.tour-key b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tour-plan { list-style: none; margin: 0; padding: 0; }
.tour-plan li { display: grid; grid-template-columns: 4.2rem 1fr; gap: .5rem; padding: .5rem .25rem; border-top: 1px solid var(--line); }
.tour-plan li.past { color: var(--muted); }
.tour-plan li.next { background: var(--soft); border-left: 4px solid var(--accent); font-weight: 600; }
.tour-plan .tt { font-variant-numeric: tabular-nums; }
.tour-plan .who { display: block; color: var(--muted); font-weight: 400; }
.tour-people li, .plain-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

/* ---- v0.7: righe con "+" (carte aziendali, CUP) e sottopagine nella tabella dei permessi ---- */
.rep-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.rep-row input[data-k] { min-width: 0; }
.rep-row .grow { flex: 1 1 8rem; }
.rep-year { width: 5.5rem; }
.rep-def, .rep-gap { flex: 0 0 44px; display: flex; justify-content: center; align-items: center; }
.matrix tr.perm-sub td:first-child { padding-left: 1.5rem; }

/* ---- v0.7: inventario, prima schermata ridisegnata (token di spazio e testo; schede sul telefono) ---- */
:root { --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --fs-s: .8125rem; --fs-m: .9375rem; --fs-l: 1.125rem; --tap: 44px; --nav-h: 64px; }
.inv-filters { flex: 1 1 100%; }
.inv-filters > summary { display: none; }
.inv-filters-body { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.inv-count { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin: var(--sp-2) 0; font-size: var(--fs-m); }
.inv-count b { font-size: var(--fs-l); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .inv-bar { gap: var(--sp-2); }
  .inv-bar #q { flex: 1 1 100%; min-height: var(--tap); font-size: 16px; }
  .inv-filters > summary { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); cursor: pointer; list-style: none; font-weight: 600; }
  .inv-filters > summary::-webkit-details-marker { display: none; }
  .inv-filters > summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
  .inv-filters[open] > summary { margin-bottom: var(--sp-2); }
  .inv-filters[open] > summary::after { content: '▴'; }
  .inv-filters-body select { flex: 1 1 calc(50% - var(--sp-2)); min-height: var(--tap); font-size: 16px; }
  .inv-filters-body .btn { min-height: var(--tap); }
  .inv-filters-body #fReset { display: none; } /* su telefono "Azzera filtri" sta accanto al conteggio */
  /* azione principale in basso, raggiungibile col pollice */
  .fab-new { position: fixed; right: var(--sp-4); bottom: calc(var(--nav-h) + var(--sp-3) + env(safe-area-inset-bottom)); z-index: 15; min-height: 52px; padding: 0 var(--sp-5); border-radius: 26px; box-shadow: var(--shadow); display: inline-flex; align-items: center; }
  .has-sel .fab-new { display: none; }
  .selbar:not(:empty) { position: fixed; top: auto; left: var(--sp-3); right: var(--sp-3); bottom: calc(var(--nav-h) + var(--sp-2) + env(safe-area-inset-bottom)); z-index: 16; box-shadow: var(--shadow); border: 1px solid var(--line); }
  .selbar .btn { min-height: var(--tap); }
  #list { padding-bottom: calc(var(--nav-h) + 80px); }
  /* ogni articolo è una scheda: numero e stato in alto, nome, poi dove si trova */
  .tbl.inv-table tr { display: grid; grid-template-columns: var(--tap) 1fr auto; column-gap: var(--sp-2); row-gap: var(--sp-1); align-items: center; min-height: 64px; padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-1); margin-bottom: var(--sp-2); }
  .tbl.inv-table td { display: block; width: auto; padding: 0; text-align: left; }
  .tbl.inv-table td:nth-child(1) { grid-column: 1; grid-row: 1 / span 3; align-self: stretch; display: flex; align-items: center; justify-content: center; }
  .tbl.inv-table td:nth-child(1) input { width: 24px; height: 24px; }
  .tbl.inv-table td:nth-child(2) { grid-column: 2; grid-row: 1; font-size: var(--fs-s); }
  .tbl.inv-table td:nth-child(5) { grid-column: 3; grid-row: 1; justify-self: end; }
  .tbl.inv-table td:nth-child(3) { grid-column: 2 / 4; grid-row: 2; flex-basis: auto; font-size: var(--fs-m); }
  .tbl.inv-table td:nth-child(6) { grid-column: 2 / 4; grid-row: 3; }
  .tbl.inv-table .gtoggle { min-height: var(--tap); }
}

/* ---- v0.7: tabella dei ruoli a pulsanti (un tocco cambia livello), modalità modifica testi ---- */
.lv { min-width: 4.6rem; min-height: 32px; padding: 0 var(--sp-2); border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: var(--fs-s); cursor: pointer; }
.lv-none { color: var(--muted); }
.lv-view { background: var(--soft); }
.lv-edit { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); font-weight: 600; }
.lv-area { min-width: 2.4rem; background: transparent; color: var(--muted); }
.tbl.matrix th { white-space: normal; max-width: 6.5rem; font-size: .75rem; }
.tbl.matrix td:first-child { min-width: 11rem; }
.tbl.matrix td { padding: .25rem .3rem; }
.text-edit .te-hit { outline: 2px dashed var(--accent); outline-offset: 2px; cursor: copy; }
#teBar { position: fixed; left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); z-index: 60; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); border-radius: var(--radius); box-shadow: var(--shadow); font-size: var(--fs-s); }
@media (max-width: 860px) { #teBar { bottom: calc(var(--nav-h) + var(--sp-2)); } }

/* ---- v0.7: grafica coerente su tutte le pagine (PC e telefono) ---- */
:root { --ctl-h: 40px; --fs-xs: .75rem; }
/* controlli: stessa altezza e stesso ritmo in ogni barra di strumenti */
.btn:not(.small), select, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]) { min-height: var(--ctl-h); }
.btn.small { min-height: 30px; }
input[type="color"] { width: 2.6rem; height: var(--ctl-h); padding: 2px; cursor: pointer; }
.toolbar, .quick, .actions { gap: var(--sp-2); }
.toolbar, .quick, .actions { margin-bottom: var(--sp-4); }
/* titoli e testi introduttivi: gli stessi scarti in ogni scheda */
.card > h2:first-child, .card-h { margin-bottom: var(--sp-3); }
.card > p.muted.small:first-of-type, .card-h + p.muted.small { margin-top: 0; }
#view > h2, #view > h3 { margin-top: var(--sp-4); }
#view > .callout, #view > p.muted { max-width: 70ch; }
/* un solo modo di mostrare un'informazione vuota */
.tbl td:empty::after { content: "—"; color: var(--muted); }
.card .tbl-wrap { margin: 0 calc(var(--sp-1) * -1); }
/* sottotipi dei settori e passi del modulo: stessa altezza degli altri controlli */
.sub-row { min-height: var(--ctl-h); }
.sub-row input { min-height: 32px; }
.steps button { min-height: 32px; }
@media (max-width: 860px) {
  :root { --ctl-h: var(--tap); }
  .btn.small { min-height: var(--tap); }
  .steps button, .sub-row input, input[type="color"] { min-height: var(--tap); }
  .sub-row { min-height: var(--tap); }
  input[type="color"] { width: var(--tap); }
  /* schede ricavate dalle tabelle: il primo dato è il titolo, i campi vuoti non compaiono */
  .tbl:not(.compact):not(.edit) tr { box-shadow: var(--shadow); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
  .tbl:not(.compact):not(.edit) td.nil { display: none; }
  .tbl:not(.compact):not(.edit) td:empty { display: none; }
  .tbl:not(.compact):not(.edit) td:first-child:not([data-label=""]) { justify-content: flex-start; text-align: left; font-weight: 600; font-size: var(--fs-l); padding: var(--sp-1) 0 var(--sp-2); margin-bottom: var(--sp-1); border-bottom: 1px solid var(--line); }
  .tbl:not(.compact):not(.edit) td:first-child:not([data-label=""])::before { content: none; }
  .tbl:not(.compact):not(.edit) td { padding: var(--sp-1) 0; align-items: baseline; font-size: var(--fs-m); }
  /* barre di strumenti: i filtri a tutta larghezza, uno per riga, i pulsanti a fianco */
  .toolbar > input[type="search"], .toolbar > input[type="text"] { flex: 1 1 100%; }
  .toolbar > select { flex: 1 1 100%; }
  .toolbar > .btn, .quick > .btn, .actions > .btn { flex: 0 1 auto; }
  /* barra in basso: i nomi lunghi vanno a capo invece di tagliarsi */
  .bottomnav a, .bottomnav > button { flex: 1 1 0; min-width: 0; text-align: center; font-size: var(--fs-xs); line-height: 1.15; }
  .bottomnav a span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .bottomnav .scan-fab { flex: 0 0 52px; }
  /* titoli di pagina nella barra in alto: mai su due righe, ma leggibili */
  .topbar h1 { font-size: var(--fs-l); }
  /* caselle e interruttori con area toccabile */
  .chk { min-height: var(--tap); }
}

/* ---- v0.7: mappa del software (Sistema › Mappa) ---- */
.gd .lead { max-width: 70ch; }
.gd-h { font-size: 1.1rem; margin: var(--sp-5) 0 var(--sp-2); padding-top: var(--sp-2); border-top: 2px solid var(--accent); }
.gd-list { margin: 0; padding-left: 1.1rem; }
.gd-list li { margin-bottom: var(--sp-1); }
.gd-root { display: grid; place-items: center; }
.gd-root div { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: var(--sp-2) var(--sp-5); font-weight: 700; }
.gd-root::after { content: ""; width: 2px; height: 20px; background: var(--line); }
.gd-areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-3); }
.gd-area { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); background: var(--panel); border-top: 4px solid var(--accent); }
.gd-area h3 { margin: 0 0 var(--sp-2); }
.gd-a2 { border-top-color: var(--ok); } .gd-a3 { border-top-color: var(--warn); } .gd-a4 { border-top-color: #7a3f94; } .gd-a5 { border-top-color: var(--muted); }
.gd-pg { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: var(--sp-2); margin-bottom: var(--sp-2); }
.gd-pg b, .gd-pg span { display: block; }
.gd-pg span, .gd-pg small { color: var(--muted); font-size: var(--fs-s); line-height: 1.35; }
.gd-pg ul { list-style: none; margin: var(--sp-1) 0 0; padding: 0; }
.gd-pg li { padding-left: 1rem; position: relative; font-size: var(--fs-s); margin-bottom: 2px; }
.gd-pg li::before { content: "↳"; position: absolute; left: 0; color: var(--muted); }
.gd-flow { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); }
.gd-flow h3 { margin: 0 0 var(--sp-2); }
.gd-steps { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; }
.gd-steps li { flex: 1 1 150px; background: var(--soft); border-radius: 10px; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-s); position: relative; }
.gd-steps li b { display: block; font-size: var(--fs-m); }
.gd-steps li:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: var(--accent); font-weight: 700; z-index: 1; }
.gd-news { margin-bottom: var(--sp-3); }
.gd-news h3 { margin-bottom: var(--sp-1); }
.gd-news ul { margin: 0; padding-left: 1.1rem; }
.gd-news li { margin-bottom: var(--sp-1); }
@media (max-width: 860px) {
  .gd-steps li { flex: 1 1 100%; }
  .gd-steps li:not(:last-child)::after { content: "↓"; right: auto; left: 50%; top: auto; bottom: -15px; transform: translateX(-50%); }
}
.gd-pg li small { display: block; }

/* documenti da leggere (Mappa › docs) */
.gd-docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); margin: var(--sp-3) 0; }
.gd-doc { display: flex; flex-direction: column; gap: var(--sp-1); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-3); color: inherit; text-decoration: none; min-height: var(--tap); }
.gd-doc:hover { border-color: var(--accent); }
.gd-doc span, .gd-doc small { color: var(--muted); font-size: var(--fs-s); }
.md { max-width: 80ch; line-height: 1.55; overflow-wrap: anywhere; }
.md h2 { font-size: 1.35rem; margin: var(--sp-3) 0 var(--sp-2); }
.md h3 { font-size: 1.15rem; margin: var(--sp-4) 0 var(--sp-2); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.md h4, .md h5, .md h6 { margin: var(--sp-3) 0 var(--sp-1); }
.md p, .md ul, .md ol { margin: 0 0 var(--sp-2); }
.md ul, .md ol { padding-left: 1.3rem; }
.md code { background: var(--soft); border-radius: 4px; padding: 0 .3em; font-size: .9em; }
.md pre { background: var(--soft); border-radius: 8px; padding: var(--sp-3); overflow-x: auto; margin: 0 0 var(--sp-3); }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 var(--sp-2); padding: var(--sp-1) var(--sp-3); border-left: 4px solid var(--accent); background: var(--soft); border-radius: 0 8px 8px 0; }
.md-tbl { overflow-x: auto; margin-bottom: var(--sp-3); }
