/* Gestione Mezzi — foglio di stile */
:root {
  --bg: #f3f4f6; --card: #fff; --ink: #1c2128; --ink2: #5b6470; --line: #e2e5ea; --line2: #eef0f3;
  --side: #15181d; --side2: #22272e; --side-ink: #c8ced6;
  --acc: #f2b705; --acc-ink: #1a1400; --acc-soft: #fff6d6;
  --red-bg: #ffe0e0; --red: #b42318; --red-line: #f5b3ae;
  --yel-bg: #fff4a8; --yel: #6b5600; --yel-line: #f0dc6a;
  --grn-bg: #e4f4d6; --grn: #2f6d14; --grn-line: #bfe2a3;
  --blu-row: #e6f2fc; --gri-row: #eceef1;
  --r: 10px; --sh: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --f: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--f); color: var(--ink); background: var(--bg); }
a { color: #0b5cad; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--line2); padding: 1px 5px; border-radius: 4px; }
.muted { color: #9aa3ae; }
small { color: var(--ink2); }

/* struttura */
.app { display: flex; min-height: 100vh; }
.side { width: 236px; flex: 0 0 236px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.brand-mark { width: 38px; height: 38px; border-radius: 9px; background: var(--acc); color: var(--acc-ink); font-weight: 800; display: grid; place-items: center; letter-spacing: -.5px; }
.brand-t { font-weight: 700; color: #fff; font-size: 15px; }
.brand-s { font-size: 11.5px; color: #8b95a1; }
.side nav { padding: 6px 8px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-ink); font-size: 13.5px; margin-bottom: 1px; }
.side nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: .8; flex: 0 0 18px; }
.side nav a:hover { background: var(--side2); color: #fff; text-decoration: none; }
.side nav a.on { background: var(--acc); color: var(--acc-ink); font-weight: 600; }
.side nav a.on svg { opacity: 1; }
.side nav a.sub { padding-left: 38px; font-size: 13px; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f7883; padding: 16px 10px 6px; }
.side-user { border-top: 1px solid #2b3139; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-user b { display: block; color: #fff; font-size: 13px; }
.side-user span { font-size: 11.5px; color: #8b95a1; }
.side-user .btn-ghost { color: var(--side-ink); border-color: #39414b; background: transparent; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 19px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.oggi { color: var(--ink2); font-size: 13px; }
.hamb { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; }
.content { padding: 18px 24px 40px; }

/* bottoni */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 7px; border: 1px solid #cfd4db; background: #fff; color: var(--ink); font: 600 13px var(--f); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f6f7f9; text-decoration: none; }
.btn-pri { background: var(--acc); border-color: #d9a400; color: var(--acc-ink); }
.btn-pri:hover { background: #ffc61a; }
.btn-dan { color: var(--red); border-color: var(--red-line); }
.btn-dan:hover { background: var(--red-bg); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-big { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 8px; }

/* messaggi */
.flash { margin: 12px 24px 0; padding: 10px 14px; border-radius: 8px; font-weight: 500; }
.flash-ok { background: var(--grn-bg); color: var(--grn); border: 1px solid var(--grn-line); }
.flash-err { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-line); }
.login .flash { margin: 0 0 12px; }
.avviso { background: var(--acc-soft); border: 1px solid #f1d98a; color: #6b5300; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.vuoto { padding: 26px; text-align: center; color: var(--ink2); background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); }
.nota-pie { color: var(--ink2); font-size: 12.5px; }

/* filtri */
.filtri { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 12px; }
.filtri label { display: flex; flex-direction: column; font-size: 11.5px; color: var(--ink2); gap: 3px; font-weight: 600; }
.filtri label.chk { flex-direction: row; align-items: center; font-weight: 500; font-size: 13px; color: var(--ink); padding-bottom: 6px; }
.filtri select, .filtri input { font: 13.5px var(--f); padding: 6px 8px; border: 1px solid #cfd4db; border-radius: 7px; background: #fff; max-width: 260px; }
.filtri .cerca { width: 300px; max-width: 100%; padding: 7px 10px; }
.conta { margin-left: auto; color: var(--ink2); font-size: 13px; padding-bottom: 7px; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink2); margin-bottom: 10px; align-items: center; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { font-style: normal; }
.lg { width: 16px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid #c9d3dd; }
.lg-azz { background: var(--blu-row); } .lg-gri { background: var(--gri-row); }

/* tabelle */
.tbl-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; box-shadow: var(--sh); max-height: calc(100vh - 210px); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: #f8f9fb; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink2); padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.tbl.ordinabile th { cursor: pointer; user-select: none; }
.tbl.ordinabile th:hover { color: var(--ink); }
.tbl th.asc::after { content: " ▲"; font-size: 9px; } .tbl th.desc::after { content: " ▼"; font-size: 9px; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl tbody tr:hover td { background: #fbf7e6; }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .ctr { text-align: center; }
.tbl .note { color: var(--ink2); max-width: 280px; font-size: 12.5px; }
.tbl .azr { text-align: right; white-space: nowrap; }
.tbl.compatta td, .tbl.compatta th { padding: 6px 7px; font-size: 12px; }
.tbl.compatta th { white-space: normal; min-width: 70px; vertical-align: bottom; }
.card .tbl th { position: static; }
tr.riga-dismessa td { background: var(--gri-row); color: #7d858f; }
tr.riga-azzurra td { background: var(--blu-row); }
tr.riga-fatta td { color: #8a929c; }
tr.riga-fatta td b { color: #8a929c; }
.mz { color: var(--ink); } .mz b { color: #0b5cad; }
.targa { display: inline-block; font: 600 11.5px/1 ui-monospace, Consolas, monospace; border: 1px solid #b9c2cc; border-left: 4px solid #2a5db0; border-right: 4px solid #2a5db0; padding: 3px 5px; border-radius: 3px; background: #fff; color: #1d2733; letter-spacing: .04em; white-space: nowrap; }
.az { display: inline-block; min-width: 20px; padding: 1px 5px; border-radius: 4px; font-weight: 700; font-size: 11.5px; background: #e8ebef; }
.az-l { background: #fff1c2; color: #6b5300; } .az-r { background: #dde9ff; color: #1d4c9c; }
.cnt-scad { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--red); color: #fff; font-weight: 700; font-size: 12px; }
.txt-scad { color: var(--red); } .txt-ok { color: var(--grn); }
h2.grp { font-size: 15px; margin: 18px 0 8px; } h2.grp span { color: var(--ink2); font-weight: 500; }
.totali { margin-top: 10px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
pre.diff { margin: 0; white-space: pre-wrap; font: 12px/1.35 ui-monospace, Consolas, monospace; color: var(--ink2); max-width: 640px; }

/* etichette di stato */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; font-style: normal; }
.pill-scaduto { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.pill-vicino { background: var(--yel-bg); color: var(--yel); border-color: var(--yel-line); }
.pill-ok { background: var(--grn-bg); color: var(--grn); border-color: var(--grn-line); }
.pill-nota { background: #eef0f3; color: #4c5561; }
.pill-mancante { background: #fff; color: #8a5a00; border: 1px dashed #d9a400; }
.pill-fatto { background: #eef0f3; color: #5b6470; }
.prio { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; }
.prio-alta { background: var(--red); color: #fff; } .prio-media { background: #f7c948; color: #4a3900; } .prio-bassa { background: #d9e2ec; color: #334e68; }
.st { font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: #eef0f3; white-space: nowrap; }
.st-incorso { background: #dde9ff; color: #1d4c9c; } .st-dafare { background: var(--acc-soft); color: #6b5300; } .st-completato { background: var(--grn-bg); color: var(--grn); }
.regola { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; display: inline-block; }
.r-si { background: var(--grn-bg); color: var(--grn); } .r-na { background: #f0f1f3; color: #8a929c; } .r-alt { background: var(--acc-soft); color: #6b5300; }
.kpi-mini { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

/* schede */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px 18px; margin-bottom: 14px; }
.card h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink2); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; }
.card h2 a { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.griglia { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; }
.griglia.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld.w2 { grid-column: span 2; } .fld.w3 { grid-column: span 3; } .fld.w4 { grid-column: 1 / -1; }
.fld > label { font-size: 12px; font-weight: 600; color: var(--ink2); }
.fld > label i { color: var(--red); font-style: normal; }
.fld input, .fld select, .fld textarea { font: 14px var(--f); padding: 7px 9px; border: 1px solid #cfd4db; border-radius: 7px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .filtri input:focus, .filtri select:focus { outline: 2px solid #f6d365; border-color: #d9a400; }
.fld input:disabled, .fld select:disabled, .fld textarea:disabled { background: #f6f7f9; color: var(--ink); }
.fld small { font-size: 11.5px; }
.fld small.prev b { color: var(--ink); }
.fld-bool { justify-content: flex-end; }
.fld-btn { justify-content: flex-end; }
.chk { display: inline-flex !important; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500 !important; color: var(--ink) !important; }
.chk input { width: 17px; height: 17px; accent-color: #d9a400; }
.money { display: flex; align-items: center; border: 1px solid #cfd4db; border-radius: 7px; background: #fff; }
.money span { padding: 0 0 0 9px; color: var(--ink2); }
.money input { border: 0 !important; outline: none !important; }
.calc { padding: 7px 0; min-height: 34px; }
.barra-az { display: flex; gap: 8px; align-items: center; position: sticky; bottom: 0; background: rgba(243,244,246,.95); padding: 12px 0; border-top: 1px solid var(--line); z-index: 4; }
.spazio { flex: 1; }
.cerca-wrap { display: flex; flex-direction: column; gap: 4px; }
.cerca-wrap input.cerca-in { font-size: 12.5px; padding: 5px 8px; border-style: dashed; }
.quick h2 { margin-bottom: 10px; }

/* riepilogo scheda mezzo */
.riepilogo-mezzo { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px 18px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 14px; border-top: 4px solid var(--acc); }
.riepilogo-mezzo.dismesso { border-top-color: #9aa3ae; background: #f7f8f9; }
.rm-id { display: flex; gap: 14px; align-items: center; }
.rm-cod { font: 800 22px/1 var(--f); background: var(--side); color: var(--acc); padding: 12px 14px; border-radius: 9px; min-width: 64px; text-align: center; }
.rm-tit { font-size: 18px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rm-sub { color: var(--ink2); font-size: 13px; margin-top: 2px; }
.rm-scad { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; flex-direction: column; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line); min-width: 130px; }
.chip span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; opacity: .85; }
.chip b { font-size: 14px; }
.chip-scaduto { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.chip-vicino { background: var(--yel-bg); color: var(--yel); border-color: var(--yel-line); }
.chip-ok { background: var(--grn-bg); color: var(--grn); border-color: var(--grn-line); }
.chip-mancante { background: #fff; color: #8a5a00; border: 1px dashed #d9a400; }

/* schede a tab */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button, .tabs a { border: 0; background: none; padding: 8px 12px; font: 600 13px var(--f); color: var(--ink2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .on { color: var(--ink); border-bottom-color: var(--acc); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tab { display: none; } .tab.on { display: block; }
.tab > .btn { margin-bottom: 10px; }

/* riepilogo */
.kpi { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.k { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh); color: var(--ink); display: flex; flex-direction: column; }
.k:hover { text-decoration: none; border-color: #d9a400; }
.k span { font-size: 12px; color: var(--ink2); font-weight: 600; }
.k b { font-size: 28px; line-height: 1.15; }
.k small { font-size: 11.5px; }
.k-scad { border-left: 4px solid var(--red); } .k-scad b { color: var(--red); }
.k-vic { border-left: 4px solid #e0b800; } .k-vic b { color: #8a6d00; }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash .card { margin: 0; }

/* accesso */
.login-body { display: grid; place-items: center; min-height: 100vh; background: var(--side); padding: 16px; }
.login { background: #fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.login .brand { padding: 0 0 6px; } .login .brand-t { color: var(--ink); } .login .brand-s { color: var(--ink2); }

/* schermi piccoli */
@media (max-width: 1100px) { .kpi { grid-template-columns: repeat(3, 1fr); } .dash { grid-template-columns: 1fr; } .griglia.g6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) {
  .side { position: fixed; left: -250px; z-index: 20; transition: left .2s; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .side.open { left: 0; }
  .hamb { display: block; }
  .top { padding: 10px 14px; flex-wrap: wrap; } .content { padding: 14px 14px 40px; } .flash { margin: 10px 14px 0; }
  .griglia { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fld.w3, .fld.w2 { grid-column: 1 / -1; }
  .griglia.g6 { grid-template-columns: repeat(2, 1fr); }
  .kpi { grid-template-columns: repeat(2, 1fr); }
  .tbl-wrap { max-height: none; }
}

/* stampa */
@media print {
  .side, .filtri, .top-act, .barra-az, .hamb, .tabs-link, .quick, .azr, .tab > .btn, .flash { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .content { padding: 0; } .top { position: static; padding: 0 0 8px; border: 0; }
  .tbl-wrap { max-height: none; overflow: visible; box-shadow: none; border: 0; }
  .tbl th { position: static; } .tbl td, .tbl th { padding: 4px 5px; }
  .card { box-shadow: none; break-inside: avoid; }
  .tab { display: block !important; }
  .pill, .chip, .prio, tr.riga-dismessa td, tr.riga-azzurra td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4 landscape; margin: 10mm; }
}
