/* TopFire v2 – interfaccia pensata per tablet in mano (touch, luce esterna) */
:root {
  --brand: #c62828; --brand-d: #8e1b1b; --brand-l: #fdecea;
  --ink: #1b1f24; --ink-2: #4a525c; --ink-3: #78818c;
  --bg: #f2f3f5; --card: #fff; --line: #dde0e5; --line-2: #c7ccd3;
  --ok: #1e7b34; --ok-l: #e3f4e6; --warn: #b85c00; --warn-l: #fff1dd; --err: #b3261e; --err-l: #fde7e5;
  --info: #1d5fa8; --info-l: #e5f0fb;
  --r: 14px; --r-sm: 10px; --tap: 52px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 17px; }
@media (min-width: 900px) { html { font-size: 18px; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.4; -webkit-text-size-adjust: 100%; }
a { color: var(--info); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--ink-3); } .small { font-size: .82rem; } .center { text-align: center; }
[hidden] { display: none !important; }

/* app bar */
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.appbar-btn { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; border-radius: 12px; background: transparent; color: #fff; cursor: pointer; }
.appbar-btn:active { background: rgba(255,255,255,.18); }
.appbar-btn svg { width: 28px; height: 28px; }
.appbar-logo { display: flex; align-items: center; height: 48px; padding: 0 6px; background: #fff; border-radius: 10px; }
.appbar-logo img { height: 36px; }
.appbar-title { flex: 1; min-width: 0; }
.appbar-title .t1 { font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title .t2 { font-size: .8rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
.net.off { background: #fff; color: var(--err); }
.net.pending { background: #fff; color: var(--warn); }

/* menu laterale */
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.35); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 85vw); background: #fff; padding: 12px 0; overflow-y: auto; box-shadow: -4px 0 20px rgba(0,0,0,.2); }
.drawer-panel a { display: flex; align-items: center; min-height: var(--tap); padding: 0 22px; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.drawer-panel a:active { background: var(--bg); }
.drawer-user { padding: 10px 22px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.drawer-user span { color: var(--ink-3); font-size: .85rem; }
.drawer-sep { margin: 8px 22px 4px; padding-top: 8px; border-top: 1px solid var(--line); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }

/* pagina */
.page { max-width: 1100px; margin: 0 auto; padding: 16px 16px 40px; }
.has-tabbar .page { padding-bottom: calc(110px + var(--safe-b)); }
.section { font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: 26px 2px 10px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--line); color: var(--ink-2); border-radius: 99px; padding: 1px 9px; font-size: .8rem; }
.section-details > summary { list-style: none; cursor: pointer; }
.section-details > summary::-webkit-details-marker { display: none; }
.section-details > summary h2::after { content: "▾"; margin-left: 4px; }
.empty { text-align: center; padding: 60px 20px; } .empty h2 { margin-bottom: 20px; }
.empty-sm { padding: 18px; text-align: center; color: var(--ink-3); background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r); }

/* bottoni */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; user-select: none; touch-action: manipulation; }
.btn:active { transform: scale(.98); background: var(--bg); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:active { background: var(--brand-d); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { color: var(--err); border-color: #efb3ae; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--info); }
.btn-lg { min-height: 58px; font-size: 1.08rem; padding: 0 24px; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: .9rem; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

/* form */
.stack > * + * { margin-top: 14px; }
.pad { padding: 16px; }
.field { display: block; }
.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin: 0 0 6px 2px; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; font: inherit; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(29,95,168,.25); border-color: var(--info); }
input[type=checkbox] { width: 26px; height: 26px; min-height: 0; accent-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .row2, .row3 { grid-template-columns: 1fr; } }
.pw { position: relative; } .pw input { padding-right: 90px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; bottom: 4px; border: 0; background: var(--bg); border-radius: 8px; padding: 0 12px; font: inherit; font-size: .85rem; }

/* card */
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.card-link:active { background: #fafafa; }
.card-row { display: flex; gap: 12px; align-items: flex-start; }
.card-main { flex: 1; min-width: 0; }
.card-title { font-weight: 700; font-size: 1.08rem; }
.card-sub { color: var(--ink-3); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.grid-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 400px) { .grid-cards { grid-template-columns: 1fr; } }
.progress { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 12px 0 4px; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.b-open { background: var(--info-l); color: var(--info); } .b-signed { background: var(--warn-l); color: var(--warn); } .b-sent { background: var(--ok-l); color: var(--ok); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; }
.search { padding-left: 44px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378818c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center / 22px; }

/* lista scelta cliente */
.list { display: flex; flex-direction: column; gap: 8px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 10px 16px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--r); font: inherit; color: inherit; cursor: pointer; }
.pick:active { background: var(--bg); border-color: var(--brand); }
.pick-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pick-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.pick-side { text-align: right; }
.new-client { margin-top: 12px; padding: 4px; }
.new-client summary { list-style: none; } .new-client summary::-webkit-details-marker { display: none; }

/* login */
.is-login { background: linear-gradient(160deg, #fff 0%, #f6e9e9 100%); min-height: 100vh; }
.login { max-width: 420px; margin: 0 auto; padding: 8vh 20px 40px; }
.login-logo { display: block; width: 180px; margin: 0 auto 10px; }
.login h1 { text-align: center; margin-bottom: 26px; color: var(--ink-2); font-weight: 600; }

/* avvisi */
.alert { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 14px; font-weight: 500; }
.alert-ok { background: var(--ok-l); color: var(--ok); } .alert-err { background: var(--err-l); color: var(--err); }
.alert-warn { background: var(--warn-l); color: var(--warn); } .alert-info { background: var(--info-l); color: var(--info); }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; z-index: 90; max-width: min(560px, 92vw); padding: 14px 20px; border-radius: 12px; background: #23272d; color: #fff; font-weight: 600; transition: .2s; pointer-events: none; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }
.lockbar { background: var(--warn-l); color: var(--warn); padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 12px; font-weight: 600; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* barra schede in basso (raggiungibile col pollice) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.tabbar button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 68px; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.tabbar button svg { width: 28px; height: 28px; }
.tabbar button.active { color: var(--brand); }
.tabbar button.active::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; background: var(--brand); border-radius: 0 0 3px 3px; }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--ink-3); color: #fff; font-style: normal; font-size: .72rem; line-height: 20px; }
.tab-badge:empty { display: none; }
.tab-badge.done { background: var(--ok); }

/* presidi */
.ptop { position: sticky; top: 60px; z-index: 20; background: var(--bg); padding: 10px 0 8px; margin: -16px 0 6px; }
.pstats { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pstats-in { flex: 1; display: flex; align-items: center; gap: 12px; }
.pstats .progress { flex: 1; margin: 0; height: 12px; }
.pstats .btn svg { width: 22px; height: 22px; stroke-width: 2.6; }
.pstats b { font-size: 1.05rem; white-space: nowrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { flex: none; min-height: 42px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 99px; background: #fff; font: inherit; font-weight: 600; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { opacity: .7; margin-left: 4px; }
.group-h { margin: 18px 4px 8px; font-weight: 700; color: var(--ink-2); font-size: .92rem; display: flex; gap: 8px; align-items: baseline; }
.group-h .muted { font-weight: 500; }
.pres { display: flex; align-items: stretch; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--line-2); border-radius: var(--r); margin-bottom: 8px; box-shadow: var(--shadow); overflow: hidden; }
.pres.e-V { border-left-color: var(--ok); } .pres.e-R { border-left-color: var(--warn); } .pres.e-X { border-left-color: var(--err); }
.pres-body { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; }
.pres-body:active { background: #fafafa; }
.pres-num { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; line-height: 1; }
.pres-num small { font-size: .62rem; font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.pres-info { min-width: 0; flex: 1; }
.pres-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres-s { font-size: .85rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: var(--bg); color: var(--ink-2); }
.tag.late { background: var(--err-l); color: var(--err); } .tag.due { background: var(--warn-l); color: var(--warn); } .tag.done { background: var(--ok-l); color: var(--ok); }
.esiti { flex: none; display: flex; gap: 6px; padding: 8px 10px 8px 4px; align-items: center; }
.esito { width: 60px; height: 60px; border-radius: 12px; border: 2px solid var(--line-2); background: #fff; font: inherit; font-weight: 800; font-size: 1.3rem; color: var(--ink-3); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; touch-action: manipulation; }
.esito small { font-size: .55rem; font-weight: 700; margin-top: 3px; letter-spacing: .02em; }
.esito:active { transform: scale(.94); }
.esito.on.V { background: var(--ok); border-color: var(--ok); color: #fff; }
.esito.on.R { background: var(--warn); border-color: var(--warn); color: #fff; }
.esito.on.X { background: var(--err); border-color: var(--err); color: #fff; }
@media (max-width: 560px) {
  .pres { flex-wrap: wrap; }
  .pres-body { flex-basis: 100%; padding-bottom: 4px; }
  .esiti { flex-basis: 100%; padding: 4px 10px 10px; }
  .esito { flex: 1; width: auto; height: 50px; flex-direction: row; gap: 6px; font-size: 1.15rem; }
  .esito small { margin-top: 0; font-size: .7rem; }
  .pres-num { width: 44px; height: 46px; }
}
.fab { position: fixed; right: 18px; bottom: calc(86px + var(--safe-b)); z-index: 35; height: 60px; padding: 0 24px; border-radius: 30px; border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 700; font-size: 1.05rem; box-shadow: 0 6px 18px rgba(198,40,40,.4); display: flex; align-items: center; gap: 8px; cursor: pointer; }
.fab:active { transform: scale(.97); }
.fab svg { width: 26px; height: 26px; stroke-width: 2.5; }

/* attività: tessere */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.tile { position: relative; min-height: 76px; padding: 12px 14px 12px 50px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: var(--r); font: inherit; cursor: pointer; color: var(--ink); }
.tile b { display: block; } .tile small { color: var(--ink-3); }
.tile::before { content: ""; position: absolute; left: 14px; top: 50%; width: 26px; height: 26px; margin-top: -13px; border: 2px solid var(--line-2); border-radius: 8px; background: #fff; }
.tile.on { border-color: var(--brand); background: var(--brand-l); }
.tile.on::before { background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/18px no-repeat; border-color: var(--brand); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.quick button { min-height: 40px; padding: 0 14px; border: 1px dashed var(--line-2); border-radius: 99px; background: #fff; font: inherit; font-size: .88rem; color: var(--info); cursor: pointer; }
.saved { font-size: .8rem; color: var(--ok); margin-left: 8px; font-weight: 600; transition: opacity .4s; }

/* righe ore/materiali */
.lines { display: flex; flex-direction: column; gap: 8px; }
.line { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; }
.line-main { flex: 1; min-width: 0; } .line-main b { display: block; }
.line-big { font-size: 1.25rem; font-weight: 800; white-space: nowrap; }
.timepick { display: flex; gap: 8px; } .timepick input { flex: 1; } .timepick .btn { flex: none; }
.stepper { display: flex; align-items: stretch; } .stepper input { text-align: center; border-radius: 0; font-weight: 700; font-size: 1.1rem; }
.stepper button { width: 58px; flex: none; border: 1px solid var(--line-2); background: var(--bg); font-size: 1.5rem; font-weight: 700; cursor: pointer; }
.stepper button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; } .stepper button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.seg button { flex: 1; min-height: var(--tap); border: 0; border-right: 1px solid var(--line-2); background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: #fff; }
.seg button.on.V { background: var(--ok); } .seg button.on.R { background: var(--warn); } .seg button.on.X { background: var(--err); }
.kgchips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kgchips button { min-width: 50px; min-height: 42px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 6px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; cursor: pointer; }
.switch input { width: 28px; height: 28px; }

/* foglio inferiore */
.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 820px; max-height: 94vh; background: var(--bg); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .18s ease-out; }
@media (min-width: 900px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; max-height: 90vh; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 18px 18px 0 0; }
.sheet-title { text-align: center; font-weight: 700; }
.sheet-body { overflow-y: auto; padding: 16px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn-danger { flex: 0 0 auto; }

/* firma */
.sigbox { position: relative; height: 200px; border: 2px dashed var(--line-2); border-radius: var(--r); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.sigbox img { max-width: 100%; max-height: 100%; }
.sigbox .ph { color: var(--ink-3); font-weight: 600; font-size: 1.1rem; text-align: center; }
.sigfull { position: fixed; inset: 0; z-index: 95; background: #fff; display: flex; flex-direction: column; }
.sigfull-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); font-weight: 700; border-bottom: 1px solid var(--line); }
.sigfull canvas { flex: 1 1 0; min-height: 0; display: block; width: 100%; touch-action: none; background: #fff; }   /* min-height 0: senza, sul PC la tela cresce con lo zoom dello schermo e spinge giù "Salva" */
.sigfull-line { position: absolute; left: 8%; right: 8%; bottom: calc(150px + var(--safe-b)); border-top: 2px solid var(--line-2); text-align: center; color: var(--ink-3); font-size: .85rem; padding-top: 4px; pointer-events: none; }
.sigfull-foot { display: flex; gap: 12px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); }
.sigfull-foot .btn { flex: 1; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.summary div { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-align: center; }
.summary b { display: block; font-size: 1.6rem; }
.warnlist { margin: 0; padding: 0; list-style: none; } .warnlist li { padding: 10px 14px; background: var(--warn-l); color: var(--warn); border-radius: var(--r-sm); margin-bottom: 6px; font-weight: 600; }

/* ufficio */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-decoration: none; color: inherit; display: block; }
.kpi b { display: block; font-size: 2rem; } .kpi span { color: var(--ink-2); font-weight: 600; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tr.clickable { cursor: pointer; } .t tr.clickable:hover td { background: #fafbfc; }
.t .actions { white-space: nowrap; text-align: right; }
.t .actions .btn { min-height: 40px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; margin-bottom: 14px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 14px; align-items: center; }
.formcard { max-width: 760px; margin-left: auto; margin-right: auto; }
.sigpad-inline { height: 180px; border: 2px dashed var(--line-2); border-radius: var(--r); background: #fff; touch-action: none; width: 100%; display: block; }

/* niente frecce nei campi numerici: rubano spazio e sul tablet non servono */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* tipi di presidio: una scheda per tipo, tutto visibile senza scorrere di lato */
.tipo-card { padding: 12px 14px; }
.tipo-top { display: grid; grid-template-columns: 34px 1.4fr 1fr; gap: 10px; align-items: end; }
.tipo-num { font-weight: 800; color: var(--ink-3); padding-bottom: 14px; }
.tipo-num-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin-top: 10px; padding-left: 44px; }
.tipo-num-grid .field > span { font-size: .74rem; min-height: 2.4em; display: flex; align-items: flex-end; }
.tipo-num-grid input { text-align: center; font-weight: 700; }
.tipo-azioni { display: flex; gap: 8px; }
@media (max-width: 900px) {
  .tipo-top { grid-template-columns: 30px 1fr; }
  .tipo-top .field:last-child { grid-column: 2; }
  .tipo-num-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-left: 0; }
  .tipo-azioni { grid-column: 1 / -1; }
}

/* ---------- finestra (dialog) ---------- */
.dlg { border: 0; border-radius: var(--r); padding: 18px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dlg::backdrop { background: rgba(0,0,0,.4); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; font-size: 1.15rem; }
.dlg-cliente { font-weight: 700; color: var(--brand, var(--ink)); }
.dlg .btn-row { justify-content: flex-end; flex-wrap: wrap; }
.dlg .btn-row .btn-danger { margin-right: auto; }

/* ---------- scadenzario visite ---------- */
.vis-date { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.vis-date div { background: var(--bg); border-radius: var(--r-sm); padding: 8px 10px; min-width: 0; }
.vis-date span { display: block; font-size: .75rem; color: var(--ink-2); font-weight: 600; }
.vis-date b { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- calendario ---------- */
.cal-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; }
.cal-nav h2 { margin: 0 8px; font-size: 1.3rem; min-width: 170px; text-align: center; }
.cal-filtro select { min-width: 190px; }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-h { background: #fff; text-align: center; font-weight: 700; font-size: .8rem; color: var(--ink-2); padding: 6px 0; }
.cal-d { background: #fff; min-height: 104px; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-d.we { background: #fafafa; }
.cal-d.fuori { background: #f3f4f6; } .cal-d.fuori .cal-n { opacity: .45; }
.cal-d.oggi .cal-n { background: var(--brand, #c62828); color: #fff; border-radius: 99px; }
.cal-d.su { outline: 3px dashed var(--brand, #c62828); outline-offset: -3px; }
.cal-n { align-self: flex-start; font-size: .8rem; font-weight: 700; min-width: 24px; height: 24px; display: grid; place-items: center; }
.ev { display: block; font-size: .78rem; line-height: 1.25; padding: 3px 6px; border-radius: 6px; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 12%, #fff);
  color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ev.fatto { background: #eef0f2; color: var(--ink-2); font-weight: 400; }
.ev.corso { background: color-mix(in srgb, var(--c) 28%, #fff); }
.ev[draggable=true] { cursor: grab; }
.cal-agenda { display: none; }
.ag-g { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.ag-g.oggi { border-color: var(--brand, #c62828); }
.ag-g .ev { font-size: .95rem; padding: 8px 10px; white-space: normal; }
.cal-legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.cal-legenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cal-side { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.df { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; padding: 9px 10px; margin-bottom: 6px; font: inherit; cursor: pointer; }
.df:hover { border-color: var(--line-2); background: var(--bg); }
.df b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.df > span { font-size: .8rem; color: var(--ink-2); }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } .cal-side { position: static; max-height: none; } }
@media (max-width: 760px) {
  .cal-grid { display: none; } .cal-agenda { display: block; }
  .solo-pc { display: none; }
  .cal-nav h2 { min-width: 0; font-size: 1.1rem; }
}
@media (hover: none) { .solo-pc { display: none; } }
.avv { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.avv summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.avv-testo { white-space: pre-wrap; font: inherit; font-size: .88rem; background: var(--bg); padding: 10px; border-radius: var(--r-sm); margin: 8px 0 0; }
.avv-log { display: flex; flex-direction: column; }
.avv-riga { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.avv-riga:last-child { border-bottom: 0; }

.drawer-ver { margin-top: auto; padding: 14px 18px; font-size: .8rem; color: var(--ink-2); }
.login-ver { text-align: center; font-size: .8rem; color: var(--ink-2); margin-top: 18px; }

/* ---------- guida ---------- */
.g-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.g-top .search { flex: 1 1 320px; }
.g-wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.g-indice { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.g-indice a { padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 600; }
.g-indice a:hover { background: #fff; color: var(--ink); }
.g-testo { max-width: 860px; }
.g-h1 { font-size: 1.5rem; margin: 0 0 8px; }
.g-sez { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px 22px; margin: 14px 0; scroll-margin-top: 76px; line-height: 1.6; }
.g-sez h2 { margin: 0 0 8px; font-size: 1.2rem; }
.g-sez h3 { margin: 18px 0 6px; font-size: 1.02rem; }
.g-sez ol, .g-sez ul { padding-left: 22px; margin: 8px 0; }
.g-sez li { margin: 4px 0; }
.g-fig { margin: 14px 0; }
.g-fig img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.g-fig figcaption { font-size: .82rem; color: var(--ink-2); margin-top: 6px; text-align: center; }
.g-nota, .g-ok { border-radius: var(--r-sm); padding: 10px 14px; margin: 12px 0; font-size: .95rem; }
.g-nota { background: var(--warn-l); border-left: 4px solid var(--warn); }
.g-ok { background: var(--ok-l); border-left: 4px solid var(--ok); }
.g-t { margin: 8px 0; }
.g-vuoto { text-align: center; padding: 30px 0; }
@media (max-width: 900px) { .g-wrap { grid-template-columns: 1fr; } .g-indice { display: none; } .g-sez { padding: 14px 16px; } }
@media print {
  .appbar, .drawer, .g-top, .g-indice, .toast, #net { display: none !important; }
  .g-wrap { display: block; } .g-sez { break-inside: avoid-page; border: 0; padding: 0; margin: 0 0 18px; }
  .g-fig img { max-width: 70%; box-shadow: none; }
  .g-man[hidden] { display: none !important; }
}

/* ---------- report ---------- */
.rep-tit { font-size: 1.15rem; margin: 18px 0 4px; }
.rep-kpi .kpi b { font-size: 1.7rem; }
.rep-su { color: var(--ok); font-weight: 700; } .rep-giu { color: var(--err); font-weight: 700; }
.rep-t td.n, .rep-t th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rep-tot td { font-weight: 700; border-top: 2px solid var(--line-2); }
.rep-barcol { width: 34%; min-width: 120px; }
.rep-bar { display: flex; gap: 2px; height: 12px; }
.rep-bar i, .gm-legenda i { display: block; height: 100%; border-radius: 3px; }
.bv { background: var(--ok); } .br { background: var(--warn); } .bx { background: var(--err); }
.gm-legenda { display: flex; gap: 16px; margin: 14px 0 6px; color: var(--ink-2); }
.gm-legenda span { display: flex; align-items: center; gap: 6px; }
.gm-legenda i { width: 12px; height: 12px; display: inline-block; }
.gm-legenda i.gm-cur { background: #2a78d6; } .gm-legenda i.gm-prev { background: #eb6834; }
.gm-grid4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gm { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 6px; }
.gm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gm-tot { font-weight: 700; font-size: 1.1rem; } .gm-tot small { font-weight: 400; color: var(--ink-2); font-size: .8rem; }
.gm-svg { width: 100%; height: auto; display: block; margin-top: 6px; }
.gm-grid { stroke: #eceef1; stroke-width: 1; } .gm-base { stroke: #c9cdd3; stroke-width: 1; }
.gm-ax { font-size: 14px; fill: #6b7280; }
path.gm-cur { fill: #2a78d6; } path.gm-prev { fill: #eb6834; }
.gm-svg path:hover { opacity: .8; }
.gm-tip { position: absolute; z-index: 90; background: #1f2937; color: #fff; font-size: .82rem; font-weight: 600; padding: 5px 9px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
@media (max-width: 760px) { .gm-grid4 { grid-template-columns: 1fr; } }
@media print {
  .no-print, .appbar, .drawer, .toast, #net, .gm-tip { display: none !important; }
  .gm-grid4 { grid-template-columns: 1fr 1fr; } .gm, .card, .kpi { break-inside: avoid; }
  .page { max-width: none; padding: 0; }
}

/* ---------- storico presidio ---------- */
.st-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.st-head div { background: var(--bg); border-radius: var(--r-sm); padding: 8px 10px; }
.st-head span { display: block; font-size: .75rem; color: var(--ink-2); font-weight: 600; }
.st-tl { position: relative; margin: 16px 0 0; padding-left: 22px; }
.st-tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line-2); }
.st-ev { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.st-ev::before { content: ""; position: absolute; left: -21px; top: 16px; width: 12px; height: 12px; border-radius: 99px; background: #9ca3af; border: 2px solid var(--bg); }
.st-ev.e-V::before { background: var(--ok); } .st-ev.e-R::before { background: var(--warn); } .st-ev.e-X::before { background: var(--err); }
.st-ev-top { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.st-cambio { color: var(--brand, #c62828); font-weight: 700; }
.filters .btn-row .btn { white-space: nowrap; }

/* ---------- etichette QR ---------- */
.et-fogli { margin-top: 14px; }
.et-foglio { background: #fff; width: 210mm; max-width: 100%; display: grid; margin: 0 auto 14px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.et-3x8 .et-foglio { grid-template-columns: repeat(3, 70mm); grid-auto-rows: 37mm; padding: 0; }
.et-2x5 .et-foglio { grid-template-columns: repeat(2, 105mm); grid-auto-rows: 57mm; }
.et { display: flex; gap: 2.5mm; align-items: center; padding: 3mm; overflow: hidden; border: 1px dashed #ddd; color: #000; }
.et-3x8 .et-qr { width: 24mm; height: 24mm; flex: none; } .et-2x5 .et-qr { width: 46mm; height: 46mm; flex: none; }
.et-qr svg { width: 100%; height: 100%; display: block; }
.et-txt { min-width: 0; font-size: 7.5pt; line-height: 1.25; }
.et-2x5 .et-txt { font-size: 10pt; }
.et-az { font-weight: 700; font-size: 7pt; text-transform: uppercase; margin-bottom: 1mm; }
.et-2x5 .et-az { font-size: 9pt; }
.et-r1 { font-weight: 700; } .et-r2 { color: #333; }
.et-cod { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .5px; margin-top: 1mm; }
/* testo delle etichette su una riga sola (niente a capo che fa sbordare) */
.et-txt { flex: 1; }
.et-az, .et-r1, .et-r2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.et-matr { font-family: inherit; font-weight: 400; letter-spacing: 0; color: #333; }
/* rotolo 60×20 mm per stampante termica (300 dpi): margine di sicurezza 2 mm sopra/sotto, 3 mm ai lati */
.et-60x20 .et-foglio { width: 60mm; height: 20mm; grid-template-columns: 60mm; grid-auto-rows: 20mm; overflow: hidden; }
.et-60x20 .et { padding: 2mm 3mm; gap: 2mm; border: 1px dashed #ccc; }
.et-60x20 .et-qr { width: 16mm; height: 16mm; flex: none; }
.et-60x20 .et-txt { font-size: 6.6pt; line-height: 1.22; }
.et-60x20 .et-az { font-size: 7pt; margin-bottom: .4mm; }
.et-60x20 .et-r1 { font-size: 7pt; }
.et-60x20 .et-cod { font-size: 6.4pt; margin-top: .4mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media print {
  @page { size: A4; margin: 0; }
  body:has(.et-fogli) { background: #fff; }
  .et-foglio { box-shadow: none; margin: 0; break-after: page; width: 210mm; }
  .et-3x8 .et-foglio { padding-top: 0; }
  .et { border-color: transparent; }
  .et-fogli { margin: 0; }
  .et-foglio:last-child { break-after: auto; }
  main:has(.et-fogli), .page:has(.et-fogli) { margin: 0 !important; padding: 0 !important; }
  .et-60x20 .et-foglio { width: 60mm; height: 20mm; margin: 0; break-inside: avoid; }
  .et-60x20 .et { border-color: transparent; }
}

/* ---------- foto e QR (tablet) ---------- */
.fotoset { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.ft { position: relative; width: 92px; height: 92px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; padding: 0; overflow: hidden; cursor: pointer; }
.ft img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ft.attesa img { opacity: .75; }
.ft i { position: absolute; right: 3px; bottom: 3px; font-style: normal; font-size: .8rem; background: #fff; border-radius: 99px; padding: 0 3px; }
.ft-add { display: grid; place-items: center; text-align: center; font-weight: 700; font-size: .85rem; color: var(--ink-2); border-style: dashed; }
.ft-add span { line-height: 1.3; }
.fviewer { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.fviewer img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 6px; }
.fviewer-bar { display: flex; gap: 10px; margin-top: 14px; }
.qr-box { margin: 4px 0; }
.qr-on { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--bg); border-radius: var(--r-sm); padding: 8px 10px; }
.qr-on b { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; }
.qrscan { position: fixed; inset: 0; z-index: 120; background: #000; display: flex; flex-direction: column; }
.qrscan video { flex: 1; width: 100%; min-height: 0; object-fit: cover; }
.qrscan-mirino { position: absolute; left: 50%; top: 45%; width: min(60vw, 60vh); aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.qrscan-bar { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; padding: 14px 16px calc(14px + var(--safe-b, 0px)); background: #111; color: #fff; }
.qrscan-bar span { flex: 1 1 100%; text-align: center; font-weight: 600; }

/* ---------- giro del giorno ---------- */
.giro-kpi .kpi b { font-size: 1.5rem; }
.giro-consiglio { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 14px 0; border-color: var(--ok); background: var(--ok-l); }
.giro-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 14px; }
.giro-mappa-box { position: sticky; top: 76px; }
.giro-mappa { height: min(70vh, 620px); border-radius: var(--r); border: 1px solid var(--line); background: #e8ecef; }
.giro-lista { list-style: none; margin: 0; padding: 0; }
.giro-tappa, .giro-sede { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
.giro-sede { background: var(--bg); }
.giro-sede > div:not(.giro-tratta) { display: flex; gap: 10px; align-items: center; }
.giro-tappa.fatto { opacity: .7; }
.giro-tratta { font-size: .8rem; color: var(--ink-2); margin: -2px 0 6px 2px; }
.giro-riga { display: flex; gap: 10px; align-items: flex-start; }
.giro-n { flex: none; width: 30px; height: 30px; border-radius: 99px; background: #2a78d6; color: #fff; display: grid; place-items: center; font-weight: 800; }
.giro-sede .giro-n { background: transparent; }
.giro-main { flex: 1; min-width: 0; }
.giro-az { display: flex; flex-direction: column; gap: 4px; }
.giro-az .btn { min-height: 30px; padding: 0 10px; }
.giro-btn { margin-top: 8px; justify-content: flex-start; }
.giro-pin { background: #2a78d6; color: #fff; border: 2px solid #fff; border-radius: 99px; display: grid !important; place-items: center; font-weight: 800; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.giro-pin.sede { background: #fff; font-size: 16px; }
@media (max-width: 900px) { .giro-wrap { grid-template-columns: 1fr; } .giro-mappa-box { position: static; order: -1; } .giro-mappa { height: 320px; } }
@media print { .giro-az, .giro-btn, .giro-consiglio .btn-row { display: none !important; } .giro-wrap { grid-template-columns: 1fr; } }
.cli-mappa { height: 260px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #e8ecef; margin-bottom: 4px; }
.cal-d { position: relative; }
.cal-giro { position: absolute; top: 3px; right: 4px; text-decoration: none; font-size: .9rem; opacity: .75; }
.cal-giro:hover { opacity: 1; }
.giro-card { margin-bottom: 6px; border-color: #2a78d6; }
.giro-btn .btn { white-space: nowrap; }
.leaflet-container svg { width: auto; height: auto; stroke: initial; stroke-width: initial; }

/* ---------- import ---------- */
.imp-file.imp-no { opacity: .75; }
.imp-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 14px; background: var(--bg); border-radius: var(--r-sm); padding: 8px 10px; }
.imp-info span { display: block; font-size: .72rem; color: var(--ink-2); font-weight: 700; text-transform: uppercase; }
.imp-tab { max-height: 360px; overflow: auto; margin-top: 8px; }
.imp-mappa { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr; gap: 10px; align-items: center; }
@media (max-width: 600px) { .imp-mappa { grid-template-columns: 1fr; } }
.badge.b-excel { background: #ede9fe; color: #5b21b6; }
.tipo-int button { font-size: .9rem; padding: 0 8px; }
.tipo-tag { display: inline-block; font-size: .72rem; font-weight: 700; color: #5b21b6; background: #ede9fe; border-radius: 6px; padding: 1px 7px; margin-top: 2px; }

/* check list stazione di pompaggio */
.esito.on.OK, .seg button.on.OK { background: var(--ok); border-color: var(--ok); color: #fff; }
.esito.on.NP, .seg button.on.NP { background: var(--ink-3); border-color: var(--ink-3); color: #fff; }
.esito.on.NE, .seg button.on.NE { background: var(--warn); border-color: var(--warn); color: #fff; }
.pres.e-OK { border-left-color: var(--ok); } .pres.e-NP { border-left-color: var(--ink-3); } .pres.e-NE { border-left-color: var(--warn); }
.clv .esito { width: 56px; height: 52px; font-size: 1.05rem; }
.cl-body { flex: 1; min-width: 0; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; }
.cl-body:active { background: #fafafa; }
.cl-t { font-weight: 700; font-size: .95rem; }
.cl-val { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 4px; }
.cl-val input { width: 88px; min-height: 48px; text-align: center; font-weight: 700; }
.cl-val span { font-size: .8rem; color: var(--ink-3); min-width: 26px; }
.cl-sez { justify-content: space-between; align-items: center; }
.cl-vista { flex: none; }
.cl-vista button { padding: 0 14px; min-height: 44px; white-space: nowrap; }
.cl-comp { margin-bottom: 10px; }
.cl-comp-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cl-comp-h b { flex: 1; }
.cl-campi { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.cl-campi .field { margin: 0; }
@media (max-width: 560px) {
  .cl-val { flex-basis: 100%; padding: 0 10px; }
  .cl-val input { flex: 1; }
  .clv .esito { height: 46px; }
  .pstats { flex-wrap: wrap; }
}
.cl-sez-b { display: flex; gap: 6px; align-items: center; }
.cl-x { border: 0; background: none; color: var(--ink-3); font-size: .8rem; padding: 0 4px; cursor: pointer; }
.cl-campo-add { align-self: end; min-height: 44px; }
.cl-pers summary { cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .9rem; }
/* squadra */
.sq-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sq-chip { display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 99px; background: #fff; cursor: pointer; font-weight: 600; font-size: .9rem; }
.sq-chip input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.sq-chip:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag.chi { background: #e8eefc; color: #2c4a9a; }
.zona-sel { max-width: 260px; min-height: 42px; }
.zona-sel { display: block; width: 100%; max-width: none; margin: 0 0 8px; font-weight: 600; }

/* marchio FireDesk */
.login-marchio { text-align: center; margin: 4px 0 24px; }
.login-marchio img { height: 46px; width: auto; max-width: 80%; }
.drawer-marchio { height: 22px; width: auto; margin-bottom: 4px; opacity: .9; }

/* ===== 3.4: leggibilità, accessibilità, conferme, inizio/fine lavoro, tablet orizzontale ===== */
:root { --ink-3: #5f6873; --warn-t: #8a4a00; }
.alert-warn, .b-signed, .tag.due, .warnlist li { color: var(--warn-t); }
code { color: inherit; }
.card-title { overflow-wrap: break-word; }
.card-quando { font-size: .88rem; font-weight: 600; color: var(--ink-2); margin: 2px 0; }
.progress { background: var(--line); }
/* focus visibile da tastiera su tutto ciò che si tocca */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible, .chip:focus-visible, .tile:focus-visible {
  outline: 3px solid var(--info); outline-offset: 2px; border-radius: 10px;
}
tr[data-href]:focus-visible { outline: 3px solid var(--info); outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
/* selezione (attività svolte): blu, il rosso resta per marchio e azione principale */
.tile.on { border-color: var(--info); background: var(--info-l); }
.tile.on::before { background-color: var(--info); border-color: var(--info); }
/* nota della demo: una riga sottile invece di una fascia */
.demo-nota { margin: -6px 0 12px; padding: 4px 12px; border-radius: 99px; background: var(--warn-l); color: var(--warn-t); font-size: .78rem; text-align: center; }
.demo-nota b { letter-spacing: .06em; margin-right: 6px; }
/* pulsanti */
.btn-xl { min-height: 72px; font-size: 1.2rem; font-weight: 700; border-radius: 16px; }
.btn-pericolo { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger { color: #a3241c; }
/* conferma nello stile dell'app (TF.conferma) */
.conf { position: fixed; inset: 0; z-index: 130; background: rgba(20, 24, 28, .45); display: flex; align-items: center; justify-content: center; padding: 20px; animation: conf-in .12s ease-out; }
.conf-box { width: 100%; max-width: 520px; background: #fff; border-radius: 18px; padding: 22px 22px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.conf-t { font-weight: 700; font-size: 1.15rem; margin-bottom: 8px; }
.conf-b p { margin: 4px 0; color: var(--ink-2); }
.conf-az { display: flex; gap: 10px; margin-top: 18px; }
.conf-az .btn { flex: 1; }
@keyframes conf-in { from { opacity: 0; } to { opacity: 1; } }
/* menu "⋯" nelle righe */
.altre-az { position: relative; display: inline-block; }
.altre-az summary { list-style: none; min-width: 40px; }
.altre-az summary::-webkit-details-marker { display: none; }
.altre-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; text-align: left; }
.altre-menu a, .altre-menu button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: none; font: inherit; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.altre-menu a:hover, .altre-menu button:hover { background: var(--bg); }
.altre-menu .pericolo { color: var(--err); }
.altre-menu form { margin: 0; }
/* caricamento file in italiano */
.file-btn { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.file-btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-btn input[type=file]:focus-visible + .btn { outline: 3px solid var(--info); outline-offset: 2px; }
/* firma: cose da completare, ognuna porta alla sua scheda */
.todo { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.todo-h { padding: 10px 14px; font-weight: 700; color: var(--ink-2); font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.todo-i { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--warn-l); color: var(--warn-t); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.todo-i:last-child { border-bottom: 0; }
.todo-i.info { background: var(--info-l); color: var(--info); cursor: default; }
.todo-vai { flex: none; padding: 4px 12px; border-radius: 99px; background: #fff; border: 1px solid currentColor; font-size: .85rem; }
.fine-lavoro { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--ok-l); border: 1px solid #b9dfc1; border-radius: var(--r); }
/* inizio lavoro (si apre entrando nell'intervento) */
.inizio { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 8px; }
.inizio-cli b { display: block; font-size: 1.1rem; }
.inizio-cli .muted { font-size: .9rem; }
.inizio-altro summary { cursor: pointer; color: var(--info); font-weight: 600; padding: 6px 0; }
/* presidi: zona e ricerca sulla stessa riga quando c'è spazio */
.pcerca-row { margin-bottom: 4px; }
.group-h { margin-top: 14px; }
@media (min-width: 900px) {
  .page { max-width: 1200px; }
  .pcerca-row { display: flex; gap: 10px; align-items: center; }
  .pcerca-row .zona-sel { flex: 0 0 300px; margin: 0; }
  .pcerca-row .search { flex: 1; margin: 0; }
  .ptop { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .ptop .pstats { flex: 1 1 420px; margin: 0; }
  .ptop .chips { flex: 0 1 auto; }
}
.cal-d.fuori .cal-n { opacity: 1; color: var(--ink-3); font-weight: 500; }
.chip .n { opacity: 1; color: var(--ink-3); } .chip.on .n { color: #fff; opacity: .8; }
.leaflet-container .leaflet-control-attribution a { text-decoration: underline; }

/* ===== 3.5: barra laterale dell'ufficio e menu a gruppi ===== */
.drawer-gruppo { margin: 14px 22px 2px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.drawer-panel a.attiva { color: var(--brand-d); font-weight: 700; background: var(--brand-l); }
.sidebar { display: none; }
@media (min-width: 1100px) {
  body.con-sidebar .appbar [data-menu] { display: none; }
  body.con-sidebar .sidebar { display: flex; flex-direction: column; position: fixed; z-index: 25; top: 60px; left: 0; bottom: 0; width: 248px; padding: 14px 10px 12px; overflow-y: auto; background: #fff; border-right: 1px solid var(--line); }
  body.con-sidebar main.page { margin-left: calc(248px + max(0px, (100vw - 248px - 1200px) / 2)); margin-right: auto; }
  body.con-sidebar .toast { left: calc(50% + 124px); }
}
.sidebar-nuovo { margin: 0 4px 10px; }
.sidebar-gruppo { margin-bottom: 8px; }
.sidebar-h { padding: 8px 12px 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.sidebar-gruppo a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.sidebar-gruppo a:hover { background: var(--bg); }
.sidebar-gruppo a.attiva { background: var(--brand-l); color: var(--brand-d); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar-piede { margin-top: auto; padding: 12px 12px 0; border-top: 1px solid var(--line); font-size: .85rem; color: var(--ink-2); }
.sidebar-piede a { color: var(--info); }
.sidebar-utente { margin-bottom: 4px; }
@media print { .sidebar { display: none !important; } body.con-sidebar main.page { margin-left: auto !important; } }
@media (min-width: 1100px) { body.con-sidebar .doppione-sidebar { display: none; } }

/* ===== 3.5: scheda cliente con intestazione e schede ===== */
.cli-testa { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.cli-testa-main { flex: 1 1 420px; min-width: 0; }
.cli-nome { font-size: 1.45rem; margin: 0 0 6px; overflow-wrap: break-word; }
.cli-info { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-2); font-size: .95rem; }
.cli-info a { color: var(--info); }
.cli-visita { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.cli-azioni { display: flex; flex-direction: column; gap: 8px; flex: 0 1 320px; }
.cli-nuovo { display: flex; flex-direction: column; gap: 8px; }
.cli-nuovo select { width: 100%; }
.cli-azioni > .btn { width: 100%; }
.cli-schede { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 6px 0 14px; overflow-x: auto; scrollbar-width: none; }
.cli-schede button { flex: none; min-height: 46px; padding: 0 16px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.cli-schede button.on { color: var(--ink); border-bottom-color: var(--brand); }
.cli-schede .count { font-size: .8rem; background: var(--bg); padding: 1px 8px; border-radius: 99px; margin-left: 4px; }
.cli-strumenti { margin-bottom: 12px; }
.cli-sez .formcard { margin-left: 0; }
@media (max-width: 700px) { .cli-azioni { flex-basis: 100%; } }
/* scheda presidio */
.kgchips { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
.kgchips button { flex: none; }
.testo-pericolo { color: var(--err) !important; }
input.errore { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-l); }
#blk-kg[hidden] + .field { grid-column: 1 / -1; }

/* ===== 3.6: calendario leggibile ===== */
.cal-grid.we-stretti { grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .55fr)); }   /* sabato e domenica stretti se nel mese non ci sono visite */
.ev { white-space: normal; padding: 3px 6px 4px; }
.ev-r1 { display: block; font-size: .72rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-r2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: break-word; font-weight: 600; }
.ev.fatto .ev-r2 { font-weight: 400; }
.cal-d .ev.extra { display: none; }
.cal-d.aperto .ev.extra { display: block; }
.ev-altre { align-self: stretch; border: 1px dashed var(--line-2); border-radius: 6px; background: #fff; font: inherit; font-size: .75rem; font-weight: 700; color: var(--info); padding: 3px; cursor: pointer; }
.cal-main > .cal-legenda { margin: 0 0 8px; }
.ag-g .ev-r1 { font-size: .85rem; }
.ag-g .ev-r2 { -webkit-line-clamp: unset; }
.df { position: relative; }
@media (hover: hover) { .df[draggable=true]::after { content: "⠿"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 1.1rem; } .df b { padding-right: 20px; } }

/* ===== 3.6: opzioni con indice e salvataggio per sezione ===== */
.opz-indice { position: sticky; top: 60px; z-index: 15; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 760px; margin: 0 auto 12px; padding: 10px 0; background: var(--bg); }
.opz-indice a { flex: none; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 99px; background: #fff; color: var(--ink-2); font-weight: 600; font-size: .88rem; text-decoration: none; }
.opz-indice a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.opz-sez { scroll-margin-top: 130px; }
.opz-salva { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.opz-barra { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--safe-b)); display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; background: #23272d; color: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 600; }
@media (min-width: 1100px) { body.con-sidebar .opz-barra { left: calc(50% + 124px); } }
/* vista mese / settimana */
.cal-vista { display: inline-flex; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; }
.cal-vista a { padding: 0 16px; min-height: 46px; display: flex; align-items: center; color: var(--ink-2); font-weight: 600; text-decoration: none; }
.cal-vista a.on { background: var(--ink); color: #fff; }
.cal-sett .cal-h { padding: 8px 0; }
.cal-sett .cal-h b { font-size: 1.05rem; color: var(--ink); margin-left: 4px; }
.cal-sett .cal-h.oggi { background: var(--brand-l); } .cal-sett .cal-h.oggi b { color: var(--brand-d); }
.cal-sett .cal-d { min-height: 420px; padding: 6px; gap: 6px; }
.cal-sett .cal-d.oggi { background: #fffafa; }
.cal-sett .ev { font-size: .85rem; padding: 6px 8px; }
.cal-sett .ev-r2 { -webkit-line-clamp: 3; }
.ev-r3 { display: block; font-size: .75rem; font-weight: 400; color: var(--ink-2); margin-top: 2px; overflow-wrap: break-word; }
.cal-sett .cal-giro { align-self: flex-end; font-size: .78rem; text-decoration: none; color: var(--info); font-weight: 600; }
.cal-vuoto { margin: auto; color: var(--ink-3); font-size: .85rem; opacity: 0; transition: opacity .15s; }
.cal-sett .cal-d:hover .cal-vuoto { opacity: 1; }
@media (max-width: 760px) { .cal-vista { order: -1; } }
.cal-wrap-sett { grid-template-columns: 1fr; }   /* settimana: tutta la larghezza ai giorni, "da pianificare" sotto */
.cal-wrap-sett .cal-side { position: static; max-height: none; }
.cal-wrap-sett .df { display: inline-block; width: auto; max-width: 320px; margin-right: 6px; vertical-align: top; }
.cal-sett .cal-giro { position: static; opacity: 1; }

/* ===== 3.6: riepilogo "Da fare adesso" ===== */
.todo-uff { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.todo-uff-i { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; padding: 10px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; border: 1px solid transparent; }
.todo-uff-i.err { background: var(--err-l); color: #a3241c; border-color: #f3c3be; }
.todo-uff-i.warn { background: var(--warn-l); color: var(--warn-t); border-color: #f2d6ae; }
.todo-uff-i.info { background: var(--info-l); color: var(--info); border-color: #c7dcf3; }
.todo-uff-i:hover { filter: brightness(.98); }
.kpi.zero { background: transparent; box-shadow: none; padding: 10px 16px; }
.kpi.zero b { font-size: 1.3rem; color: var(--ink-3); } .kpi.zero span { color: var(--ink-3); font-weight: 500; }
#da-inviare { scroll-margin-top: 80px; }

/* ===== 3.6: presidi compatti sul telefono ===== */
@media (max-width: 560px) {
  .pstats { flex-wrap: wrap; row-gap: 6px; }
  .pstats-in { order: 3; flex-basis: 100%; }
  .pres-body { padding: 8px 10px 2px; gap: 10px; }
  .pres-num { width: 38px; height: 40px; font-size: 1rem; }
  .pres-num small { display: none; }
  .pres-tags { flex-wrap: nowrap; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .esiti { padding: 4px 8px 8px; gap: 6px; }
  .esito { height: 44px; }
  .group-h { margin: 10px 4px 6px; }
  .chips { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 24px; }
}
@media (max-width: 560px) { .pres-tags .tag { flex: none; white-space: nowrap; } }
/* giro: logo della ditta sulla sede */
.giro-logo { width: 30px; height: 30px; object-fit: contain; border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.giro-pin.sede { overflow: hidden; padding: 0; }
.giro-pin.sede img { width: 26px; height: 26px; object-fit: contain; display: block; }
.giro-sede .giro-riga { align-items: center; }
