/* ===== Magazzino — stile applicazione ===== */
:root {
  --ink: #17262b;
  --muted: #627177;
  --line: #dfe5e6;
  --bg: #f3f5f4;
  --card: #ffffff;
  --side: #0F2627;
  --side-ink: #c9d8da;
  --primary: #00787A;
  --primary-ink: #ffffff;
  --accent: #e8a33d;
  --danger: #b4372f;
  --ok: #2f7d4f;
  --warn: #8f5a00;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 40, 45, .06), 0 2px 8px rgba(20, 40, 45, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; margin-bottom: .75rem; }
h3 { font-size: .95rem; margin: .5rem 0; }
code { font-family: var(--mono); background: #eef2f2; padding: 0 .3em; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small, .small-help { font-size: .85rem; }
.small-help { margin: .5rem 0 0; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* ----- Layout ----- */
.app { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.1rem 1rem; font-weight: 700; color: #fff; font-size: 1.02rem; }
.brand .logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--side); }
.brand .logo .ic { width: 20px; height: 20px; }
.brand.big { color: var(--ink); font-size: 1.25rem; padding: 0 0 .5rem; }
.side nav { display: flex; flex-direction: column; padding: .25rem .6rem; gap: 2px; flex: 1; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.side nav a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: 1rem .7rem .3rem; }
.me { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.me a { color: #fff; display: flex; flex-direction: column; min-width: 0; }
.me small { color: var(--side-ink); opacity: .8; }
.me .icon-btn { color: var(--side-ink); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.5rem .25rem; }
.topbar h1 { font-size: 1.35rem; overflow-wrap: anywhere; }
.topbar .menu-btn { display: none; }
.content { padding: 1rem 1.5rem 3rem; max-width: 1100px; width: 100%; }
.content.wide { max-width: 1500px; }
.content > * + * { margin-top: 1rem; }

/* ----- Componenti ----- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card.table-wrap { padding: 0; }
.table-wrap { overflow-x: auto; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; margin: 0; }
details.card > summary::after { content: " ▾"; color: var(--muted); }
details.card[open] > summary { margin-bottom: 1rem; }
details.card > form.card { box-shadow: none; border: 0; padding: 0; margin-bottom: 1rem; }
details.sub { margin-top: .75rem; }
details.sub > summary { cursor: pointer; color: var(--primary); font-weight: 500; }
details.sub > form, details.sub > table { margin-top: .6rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid-2 > .card { margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.section-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.meta-line { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 0 0 1rem; }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; line-height: 1.2; white-space: nowrap; }
.btn:hover { border-color: #b9c6c8; background: #f7f9f9; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: #005F61; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.ghost:hover { background: rgba(0,120,122,.08); }
.btn.danger { color: var(--danger); }
.btn.danger:not(.ghost) { border-color: #e6b8b4; }
.btn.small { padding: .25rem .55rem; font-size: .85rem; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
form.inline { display: inline; }

input, select, textarea { font: inherit; color: inherit; padding: .45rem .6rem; border: 1px solid #cdd6d7; border-radius: 7px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0,120,122,.35); border-color: var(--primary); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
textarea { width: 100%; resize: vertical; }
.w-num { width: 5.5rem; text-align: right; }
.w-price { width: 7rem; text-align: right; }
.w-full { width: 100%; }
.grow { flex: 1; min-width: 10rem; }
.search { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #cdd6d7; border-radius: 8px; padding: 0 .6rem; background: #fff; color: var(--muted); }
.search input { border: 0; padding: .45rem 0; outline: none; min-width: 14rem; color: var(--ink); background: transparent; }
.check { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .9rem; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem 1rem; align-items: start; }
.form-grid.narrow { max-width: 520px; grid-template-columns: minmax(0, 1fr); }
.form-grid h2 { margin: .5rem 0 0; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: .78rem; }
.field.full, .full { grid-column: 1 / -1; }
.field.wide { grid-column: span 2; }
.field.inline { flex-direction: row; align-items: center; gap: .4rem; }
.field.with-link { gap: .2rem; }
.field.with-link .field { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.actions input { min-width: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.inline-form.wrap { margin-top: .75rem; }
.role-help, .small-help { line-height: 1.5; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--line); background: #fafbfb; white-space: nowrap; }
.table td { padding: .55rem .75rem; border-bottom: 1px solid #eef1f1; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfc; }
.table.compact td, .table.compact th { padding: .4rem .5rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.group td { background: #f3f6f6; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: .4rem; padding-bottom: .4rem; }
.table tr.dim td { opacity: .55; }
.table tr.row-short td { background: #fff5f3; }
.table.totals td { padding: .35rem 0; }
.table.totals tr.grand td { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--ink); padding-top: .6rem; }
.w-check { width: 2rem; }
.lines input, .lines select { padding: .3rem .4rem; }
.neg, .neg-text { color: var(--danger); font-weight: 700; }
td.neg { background: #fdecea !important; }
td.zero { color: var(--warn); }
td.part { background: #fff8e8; }
.warn-text { color: var(--warn); font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; background: #eef1f1; color: var(--muted); white-space: nowrap; }
.badge .ic { width: 13px; height: 13px; }
.st-opzione { background: #fde6cf; color: #96470a; }
.st-confermato { background: #d9f0e0; color: #1c6237; }
.st-in_corso { background: #d6ecfa; color: #0d5585; }
.st-rientrato { background: #ebe1fa; color: #5a2f9e; }
.st-chiuso { background: #e9eded; color: #4c5a5e; }
/* badge generici "ok" (rimborsata, in sede, rientro…): verdi, indipendenti dai colori degli stati */
.st-ok { background: #d9f0e0; color: #1c6237; }
.st-annullato { background: #f8e1df; color: #9b2c25; }
.badge.warn { background: #fdecc8; color: #8a5a00; }

.flash { margin: .5rem 1.5rem 0; padding: .7rem 1rem; border-radius: 8px; font-weight: 500; }
.bare .flash { margin: 0; }
.flash-ok { background: #ddf2e4; color: #1d5a35; }
.flash-warn { background: #fdf0d8; color: #7a5000; }
.flash-error { background: #f8e1df; color: #8f2620; }
.alert { display: flex; gap: .75rem; padding: .9rem 1rem; border-radius: var(--radius); background: #fff5f3; border: 1px solid #f0c9c4; color: #6e211b; }
.alert > .ic { color: var(--danger); width: 22px; height: 22px; margin-top: 2px; }
.alert ul { margin: .4rem 0; padding-left: 1.2rem; }

.tabs { display: flex; gap: .25rem; background: #e7ecec; padding: 3px; border-radius: 9px; }
.tabs a { padding: .35rem .8rem; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tabs a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

.stats { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; margin-top: .5rem; }
.stats div { display: flex; flex-direction: column; }
.stats small { color: var(--muted); font-size: .78rem; }
.stats b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.qr-mini svg { display: block; border: 1px solid var(--line); border-radius: 6px; }
.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; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; color: var(--ink); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .2rem; }
.kpi:hover { text-decoration: none; border-color: #b9c6c8; }
.kpi small { color: var(--muted); font-size: .8rem; }
.kpi b { font-size: 1.9rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-bad b { color: var(--danger); }
.kpi-warn b { color: var(--warn); }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid #eef1f1; flex-wrap: wrap; }
.plist li:last-child { border-bottom: 0; }
.plist a { display: flex; flex-direction: column; min-width: 0; }
.plist a small { color: var(--muted); }
.plist-meta { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .88rem; }
.plist.big li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .5rem; }

.progress { position: relative; height: 8px; border-radius: 99px; background: #eef1f1; overflow: hidden; min-width: 90px; }
.progress span { position: absolute; left: 0; top: 0; bottom: 0; background: #8e6ad0; border-radius: 99px; }
.progress span.back { background: #3a9a63; height: 4px; top: 4px; }

/* Disponibilità */
.avail-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 4px; }
.avail-strip .cell { border: 1px solid var(--line); border-radius: 6px; padding: .3rem; text-align: center; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.avail-strip .cell small { color: var(--muted); font-size: .72rem; }
.avail-strip .cell i { font-style: normal; font-size: .68rem; color: var(--warn); }
.avail-strip .cell.part { background: #fff8e8; }
.avail-strip .cell.neg { background: #fdecea; color: var(--danger); border-color: #f0c9c4; }
.avail-table .day { padding-left: .3rem; padding-right: .3rem; min-width: 2rem; font-size: .85rem; }
.avail-table th.day small { display: block; font-weight: 400; }
.avail-table .weekend { background: #f6f7f7; }

/* Ricerca articoli nel progetto */
.add-item { position: relative; margin-bottom: 1rem; }
.add-item .search { width: 100%; }
.add-item .search input { flex: 1; }
.search-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 380px; overflow-y: auto; display: none; }
.search-results.open { display: block; }
.sr-item { display: grid; grid-template-columns: 1fr auto auto auto; gap: .75rem; align-items: center; padding: .55rem .75rem; border-bottom: 1px solid #eef1f1; }
.sr-item:last-child { border-bottom: 0; }
.sr-item small { color: var(--muted); display: block; }
.sr-item .avail { font-variant-numeric: tabular-nums; font-weight: 700; }
.sr-item .avail.neg { color: var(--danger); }
.sr-empty { padding: .8rem; color: var(--muted); }

/* Planning */
.planning { padding: 0; overflow-x: auto; }
.pl-row { display: grid; grid-template-columns: 200px minmax(calc(var(--days) * var(--colw, 28px)), 1fr); border-bottom: 1px solid #eef1f1; min-height: 40px; }
.pl-row:last-child { border-bottom: 0; }
.pl-label { padding: .45rem .75rem; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); position: sticky; left: 0; background: #fff; z-index: 2; min-width: 0; }
.pl-label a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pl-label small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-head .pl-label { font-size: .78rem; text-transform: uppercase; color: var(--muted); font-weight: 600; background: #fafbfb; }
.pl-grid { display: grid; grid-template-columns: repeat(var(--days), minmax(var(--colw, 28px), 1fr)); align-items: center; }
.pl-day { text-align: center; padding: .3rem 0; font-size: .8rem; color: var(--ink); display: flex; flex-direction: column; line-height: 1.1; background: #fafbfb; }
.pl-day small { color: var(--muted); font-size: .68rem; }
a.pl-day:hover { background: #e7f1f2; text-decoration: none; }
.pl-day.weekend, .pl-bg.weekend { background: #f1f4f4; }
.pl-day.today { background: var(--primary); color: #fff; }
.pl-day.today small { color: #fff; }
.pl-bg { grid-row: 1; height: 100%; border-left: 1px solid #f2f4f4; }
.pl-bg.today { background: rgba(0,120,122,.08); }
.pl-bar { grid-row: 1; z-index: 1; margin: 6px 2px; padding: .2rem .5rem; border-radius: 6px; font-size: .78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid rgba(0,0,0,.08); }
.pl-bar:hover { text-decoration: none; filter: brightness(.96); }
.pl-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.pl-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pl-bar.late { background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(180,55,47,.18) 6px 12px); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.month-title { margin: 0 .25rem; min-width: 10rem; text-align: center; }

/* Scansione */
.scan-app { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: .75rem; }
.scan-head { display: flex; flex-direction: column; gap: .6rem; }
.scan-project { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; color: var(--ink); }
.scan-project small { color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #e2e8e8; padding: 4px; border-radius: 12px; }
.seg button { font: inherit; font-weight: 800; font-size: 1.05rem; border: 0; padding: .75rem; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.scan-app[data-mode=out] .seg-out { background: #5a2f9e; color: #fff; }
.scan-app[data-mode=in] .seg-in { background: #22673e; color: #fff; }
.scan-camera { position: relative; background: #0d1a1d; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.scan-camera video { width: 100%; height: 100%; object-fit: cover; display: none; }
.scan-camera.on video { display: block; }
.scan-camera #scan-fallback { position: absolute; inset: 0; }
.scan-camera #scan-fallback:empty { display: none; }
.scan-frame { position: absolute; inset: 18% 22%; border: 3px solid rgba(255,255,255,.75); border-radius: 14px; pointer-events: none; display: none; }
.scan-camera.on .scan-frame { display: block; }
.scan-camera.on .camera-btn { position: absolute; bottom: .6rem; right: .6rem; opacity: .85; }
.scan-camera.flash-ok { box-shadow: 0 0 0 4px #3a9a63; }
.scan-camera.flash-error { box-shadow: 0 0 0 4px var(--danger); }
.scan-manual { display: flex; gap: .5rem; }
.scan-manual input[name=code] { flex: 1; font-size: 1.1rem; font-family: var(--mono); }
.scan-msg { padding: .9rem 1rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-weight: 600; min-height: 3.2rem; }
.scan-msg.ok { background: #ddf2e4; border-color: #b9e0c6; color: #1d5a35; }
.scan-msg.warn { background: #fdf0d8; border-color: #f2d9a6; color: #7a5000; }
.scan-msg.error { background: #f8e1df; border-color: #f0c9c4; color: #8f2620; }
.scan-msg small { display: block; font-weight: 500; margin-top: .2rem; }
.scan-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.scan-row { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; padding: .55rem .9rem; border-bottom: 1px solid #eef1f1; align-items: center; }
.scan-row:last-child { border-bottom: 0; }
.scan-row small { color: var(--muted); font-family: var(--mono); }
.scan-row .count { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.05rem; }
.scan-row.done { background: #f2faf5; }
.scan-row.done .count { color: var(--ok); }
.scan-row.over .count { color: var(--warn); }
.scan-row .progress { grid-column: 1 / -1; }
.scan-log { margin: .5rem 0 0; padding-left: 1.4rem; font-size: .9rem; }
.scan-log li.error { color: var(--danger); }
.scan-log li.warn { color: var(--warn); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: .9rem; }
.login p { margin: 0; }
.error-card { max-width: 520px; }

/* Etichette / stampe */
.print-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .75rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.print-bar .btn.primary { margin-left: auto; }

/* ----- Mobile ----- */
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .topbar .menu-btn { display: grid; }
  .topbar { padding: .75rem 1rem .25rem; position: sticky; top: 0; background: var(--bg); z-index: 10; }
  .topbar h1 { font-size: 1.15rem; }
  .content { padding: .75rem 1rem 3rem; }
  .flash { margin: .5rem 1rem 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .field.wide { grid-column: auto; }
  .search input { min-width: 0; width: 100%; }
  .search { flex: 1; }
  .filters { width: 100%; }
  .pl-row { grid-template-columns: 140px minmax(calc(var(--days) * 30px), 1fr); }
  .sr-item { grid-template-columns: 1fr auto; }
  .sr-item .price { display: none; }
  .table th, .table td { padding: .5rem .5rem; }
}

/* Personale e mezzi nel progetto */
.grid-2.flat { gap: 1.5rem; }
.grid-2.flat h3 { display: flex; align-items: center; gap: .4rem; margin-top: 0; }
.assign-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.assign-form select[multiple] { width: 100%; padding: .25rem; }
.assign-form option { padding: .2rem .4rem; }
.assign-form option.busy { color: var(--warn); }
.assign-form optgroup { font-weight: 700; color: var(--muted); }
.pl-row.pl-conflict .pl-label { box-shadow: inset 3px 0 0 var(--warn); }
.pl-row.pl-conflict .pl-label a { color: var(--warn); }
.table.totals tr.internal td { color: var(--muted); font-size: .9rem; border-top: 1px dashed var(--line); }
.table.totals tr.internal td b { color: var(--ink); }

/* Funzioni a preventivo e assegnazioni */
.ok-text { color: var(--ok); font-weight: 700; }
.add-fn { margin-top: .9rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.add-fn .inline-form.wrap { margin-top: 0; }
.slot { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; margin-bottom: .55rem; }
.slot-missing { border-color: #f2d9a6; background: #fffaf0; }
.slot-ok { background: #f6fbf8; border-color: #cfe8d8; }
.slot-head { display: flex; gap: .6rem; align-items: baseline; }
.slot-head b { flex: 1; }
.slot-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: .5rem; align-items: center; padding: .3rem 0; border-top: 1px solid #eef1f1; }
.slot-form { margin-top: .45rem; }
.slot-form select { flex: 1; min-width: 10rem; }
.slot-form input[type=date] { width: 9.2rem; }

/* ===== Editor preventivo a due pannelli + catalogo ===== */
.editor-grid { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.catalog { position: sticky; top: .75rem; display: flex; flex-direction: column; gap: .5rem; border: 1px solid var(--line); border-radius: 10px; padding: .6rem; background: #fbfcfc; max-height: calc(100vh - 1.5rem); }
.catalog .search { width: 100%; }
.catalog .search input { flex: 1; min-width: 0; }
.cat-tree { overflow-y: auto; flex: 1; min-height: 200px; }
.cat-help { margin: 0; }
.cat-folder { border-bottom: 1px solid #eef1f1; }
.cat-head { display: block; width: 100%; text-align: left; font: inherit; font-weight: 700; font-size: .85rem; padding: .45rem .4rem; background: none; border: 0; cursor: pointer; color: var(--ink); text-transform: uppercase; letter-spacing: .02em; }
div.cat-head { cursor: default; color: var(--muted); }
.cat-head:hover { background: #f0f4f4; }
.cat-head .muted { font-weight: 400; }
.cat-item { display: grid; grid-template-columns: 1fr auto 3.2rem 1.9rem; gap: .35rem; align-items: center; padding: .3rem .4rem .3rem .9rem; border-top: 1px solid #f2f4f4; }
.cat-item:hover { background: #f4f8f8; }
.cat-item.busy { opacity: .5; }
.cat-name { min-width: 0; display: flex; flex-direction: column; }
/* il nome intero su tutta la larghezza (anche su più righe); sotto codice/prezzo, disponibilità, quantità e + */
.cat-name { display: contents; }
.cat-name b { grid-column: 1 / -1; font-weight: 600; font-size: .88rem; line-height: 1.25; white-space: normal; overflow-wrap: break-word; }
.cat-name small { grid-column: 1; min-width: 0; color: var(--muted); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item { row-gap: .15rem; }
.cat-avail { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .85rem; color: var(--ok); text-align: right; }
.cat-avail i { font-style: normal; font-weight: 400; color: var(--muted); font-size: .75rem; }
.cat-avail.low { color: var(--warn); }
.cat-avail.none { color: var(--danger); }
.cat-avail.fn { color: var(--muted); font-weight: 400; font-size: .72rem; }
.cat-qty { width: 100%; padding: .2rem .3rem; text-align: right; font-size: .85rem; }
.cat-add { width: 1.9rem; height: 1.9rem; border-radius: 7px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font-size: 1.1rem; font-weight: 700; cursor: pointer; line-height: 1; }
.cat-add:hover { background: #005F61; }
.editor-main { min-width: 0; }
.editor-bar { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; flex-wrap: wrap; }
.editor-table td { padding-top: .35rem; padding-bottom: .35rem; }
.editor-table .handle { cursor: grab; color: #84939a; width: 1.4rem; text-align: center; user-select: none; font-size: 1rem; }
.editor-table .handle:hover { color: var(--ink); }
.editor-table .target-cell { width: 1.6rem; text-align: center; }
.editor-table tr.grp-head td { background: #eef3f3; border-top: 2px solid #dbe4e5; cursor: pointer; }
.editor-table tbody.is-target tr.grp-head td { background: #dcefee; }
.editor-table tbody.is-target tr.grp-head td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.grp-name { font-weight: 700; border: 1px solid transparent; background: transparent; padding: .2rem .4rem; width: 100%; max-width: 30rem; }
.grp-name:hover, .grp-name:focus { border-color: #cdd6d7; background: #fff; }
.editor-table tr.dragging { opacity: .4; }
.editor-table tr.drop-before td { box-shadow: inset 0 3px 0 var(--primary); }
.editor-table tbody.drop-into tr.grp-head td { background: #cfe9e7; }
.editor-table .fn-ic { width: 15px; height: 15px; color: var(--muted); }
.editor-table input[data-field] { padding: .25rem .35rem; }
.editor-hint { margin: .75rem 0 0; }
@media (max-width: 1100px) {
  .editor-grid { grid-template-columns: 1fr; }
  .catalog { position: static; max-height: 420px; }
}

/* Compositore kit */
.kit-bar { margin: 0 0 .75rem; }
.kit-counters { display: flex; gap: .6rem; flex-wrap: wrap; }
.kit-count { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .7rem; min-width: 7rem; background: #fff; }
.kit-count small { color: var(--muted); font-size: .72rem; }
.kit-count b { font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kit-count.ok b { color: var(--ok); }
.kit-count.bad { border-color: #f0c9c4; background: #fff5f3; }
.kit-count.bad b { color: var(--danger); }
.editor-table td.voce { min-width: 14rem; }
.editor-table .w-num { width: 4.3rem; }
.editor-table .w-price { width: 5.8rem; }
.editor-table th, .editor-table td { padding-left: .45rem; padding-right: .45rem; }

/* Suggeriti */
.suggest { border: 1px solid #f2d9a6; background: #fffaf0; border-radius: 8px; padding: .4rem; }
.suggest-head { display: flex; justify-content: space-between; align-items: center; padding: .1rem .3rem .35rem; }
.suggest .cat-item { padding-left: .4rem; }
[data-suggest].pulse .suggest { animation: pulse 1.2s ease; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(232,163,61,.7); } 100% { box-shadow: 0 0 0 10px rgba(232,163,61,0); } }
.sug-list .cat-item { padding-left: .4rem; }
.sug-dialog { border: 0; border-radius: 12px; padding: 1.2rem 1.3rem; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.sug-dialog::backdrop { background: rgba(15,30,35,.45); }
.sug-dialog h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
.sug-rows { display: flex; flex-direction: column; gap: .35rem; margin: .75rem 0; max-height: 55vh; overflow-y: auto; }
.sug-row { display: grid; grid-template-columns: auto 1fr auto 4.5rem; gap: .6rem; align-items: center; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.sug-row:has(input:checked) { border-color: var(--primary); background: #f1f8f8; }
.sug-row.short { border-color: #f2d9a6; }
.sug-name { display: flex; flex-direction: column; min-width: 0; }
.sug-name small { color: var(--muted); }
.sug-row input[type=number] { width: 100%; text-align: right; }
.logo-preview { max-width: 240px; max-height: 90px; border: 1px solid var(--line); border-radius: 6px; padding: .4rem; background: #fff; }
.range-form { gap: .4rem; }
.range-form input[type=date] { padding: .3rem .4rem; }
.seg-mini { display: inline-flex; background: #e7ecec; border-radius: 8px; padding: 2px; }
.seg-mini a { padding: .3rem .55rem; border-radius: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.seg-mini a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.seg-mini a:hover { text-decoration: none; color: var(--ink); }
.pl-month { display: block; font-style: normal; font-size: .62rem; text-transform: uppercase; color: var(--primary); font-weight: 700; height: .8rem; line-height: .8rem; }
.pl-day.today .pl-month { color: #fff; }
.pl-day.mstart { box-shadow: inset 2px 0 0 #b9c6c8; }
.sched-form input[type=datetime-local] { width: 12.5rem; }
.sched-form input[name=name] { width: 14rem; }
.tpl-grid { grid-template-columns: minmax(320px, 460px) minmax(0, 1fr); align-items: start; }
.tpl-form.narrow { max-width: none; }
.tpl-preview iframe { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 8px; background: #e9edec; }
.checks { display: grid; gap: .35rem; }
@media (max-width: 960px) { .tpl-grid { grid-template-columns: 1fr; } }
.bulk-bar { margin-top: .6rem; }

/* ===== Pagina progetto a schede ===== */
.topbar.no-title { padding: 0; }
@media (max-width: 860px) { .topbar.no-title { padding: .6rem 1rem 0; } }
.pv { position: relative; }
.pv > * + * { margin-top: 1rem; }
.pv-head { position: relative; padding: 1.1rem 1.3rem 1rem; border-top: 4px solid var(--primary); }
.pv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.pv-name { min-width: 0; flex: 1; }
.pv-back { color: var(--muted); }
.pv-name h1 { font-size: 1.5rem; margin: .15rem 0 .45rem; overflow-wrap: anywhere; }
.pv-num { font-family: var(--mono); font-size: .8em; font-weight: 600; color: var(--muted); background: #eef2f2; padding: .1em .45em; border-radius: 6px; vertical-align: .12em; }
.pv-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding-right: 0; }
.pv-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; margin-top: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 9px; background: #fafbfb; color: var(--ink); min-width: 0; }
.kpi:hover { text-decoration: none; border-color: #b9c6c8; background: #f4f8f8; }
.kpi small { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.kpi b { font-size: 1.2rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.warn { border-color: #f0d29b; background: #fff9ec; }
.kpi.warn span { color: var(--warn); font-weight: 600; }

.pv-nav a { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.pv-nav a:hover { text-decoration: none; color: var(--ink); }
.pv-nav a.active { color: var(--primary); }
.pv-nav .cnt { font-style: normal; font-size: .72rem; font-weight: 700; background: #e7ecec; color: var(--muted); border-radius: 999px; padding: .05rem .45rem; }
.pv-nav a.active .cnt { background: var(--primary); color: #fff; }
.pv-nav .cnt.warn, .pv-nav a.active .cnt.warn { background: #f6dfb4; color: #7a4c00; }
.pv-panel > * + * { margin-top: 1rem; }
.pv-panel-title { display: none; }
.pv-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .6rem; }
.pv-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.pv-split .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pv-side > * + * { margin-top: 1rem; }
.pv-side p { margin: 0 0 .5rem; }
ul.plain { list-style: none; padding: 0; margin: .25rem 0 0; }
ul.plain li { padding: .3rem 0; border-top: 1px solid #eef1f1; }
.pv-danger .btn-row { flex-direction: column; align-items: stretch; }
.pv-danger .inline-form { gap: .4rem; }
.pv-tools { justify-content: flex-start; }

/* --- Proposta 1: schede --- */
.pv[data-mode=schede] .pv-nav { position: sticky; top: 0; z-index: 6; display: flex; gap: .25rem; overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--line); margin-top: .5rem; padding-top: .25rem; scrollbar-width: none; }
.pv[data-mode=schede] .pv-nav a { padding: .7rem .6rem .65rem; font-size: .95rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.pv[data-mode=schede] .pv-nav a.active { border-bottom-color: var(--primary); }
.pv[data-mode=schede] .pv-panel { display: none; }
.pv[data-mode=schede] .pv-panel.active { display: block; animation: pvIn .15s ease-out; }
@keyframes pvIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* --- cronologia --- */
.tl { display: flex; flex-direction: column; gap: .35rem; }
.tl-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: .75rem; align-items: center; }
.tl-label { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 26px; border-radius: 6px; background: repeating-linear-gradient(90deg, #f3f6f6 0, #f3f6f6 calc(100% / var(--days) - 1px), #e2e8e8 calc(100% / var(--days) - 1px), #e2e8e8 calc(100% / var(--days))); }
.tl-scale .tl-track { background: none; height: 18px; }
.tl-scale .tl-track span { position: absolute; top: 0; font-size: .72rem; color: var(--muted); padding-left: 3px; border-left: 1px solid var(--line); line-height: 18px; }
.tl-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; background: var(--primary); display: flex; align-items: center; overflow: hidden; min-width: 4px; }
.tl-bar.main { background: repeating-linear-gradient(135deg, #2b7f88 0 8px, #24727a 8px 16px); }
.tl-bar.c0 { background: #e8a33d; } .tl-bar.c1 { background: #5a8f3c; } .tl-bar.c2 { background: #6c5bb3; } .tl-bar.c3 { background: #c0564b; } .tl-bar.c4 { background: #3a7bbf; }
.tl-bar em { font-style: normal; font-size: .7rem; font-weight: 700; color: #fff; padding: 0 .4rem; white-space: nowrap; }

@media (max-width: 1100px) { .pv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) {
  .pv-split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-nav a span { display: none; }
  .pv[data-mode=schede] .pv-nav a.active span { display: inline; }
  .tl-row { grid-template-columns: 100px minmax(0, 1fr); }
  .pv-split .form-grid { grid-template-columns: 1fr; }
}
.pv-panel .card > .btn-row + table { margin-top: .75rem; }
@media (max-width: 640px) { .pv-kpis .kpi:last-child { grid-column: 1 / -1; } }

/* ===== Location e mappa ===== */
.loc-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.loc-grid > .card { margin: 0; }
.loc-grid .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.loc-form + * , .loc-summary + * { margin-top: 1rem; }
.loc-dist { padding: .45rem 0; font-weight: 700; }
.geo-search { display: flex; gap: .4rem; flex-wrap: wrap; }
.geo-search .search input { min-width: 0; flex: 1; }
.geo-results { display: flex; flex-direction: column; gap: 2px; margin: .4rem 0; max-height: 210px; overflow-y: auto; }
.geo-results p { margin: .2rem 0; }
.geo-hit { text-align: left; font: inherit; font-size: .88rem; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: .4rem .6rem; cursor: pointer; }
.geo-hit:hover { border-color: var(--primary); background: #f2f8f8; }
.geo-map { height: 380px; border-radius: 9px; border: 1px solid var(--line); background: #eef2f2; margin-top: .5rem; display: grid; place-items: center; overflow: hidden; z-index: 0; }
.geo-map.leaflet-container { display: block; }
.geo > p { margin: .4rem 0 0; }
.loc-summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.loc-km { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.loc-km span { font-size: 1rem; font-weight: 600; color: var(--muted); margin-left: .6rem; }
.form-sec { grid-column: 1 / -1; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .4rem 0 -.3rem; padding-top: .6rem; border-top: 1px solid #eef1f1; }
.form-sec:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.pv-loc .loc-mini { font-size: 1.3rem; font-weight: 800; }
.pv-loc .loc-mini span { font-size: .85rem; font-weight: 600; color: var(--muted); margin-left: .4rem; }
@media (max-width: 960px) { .loc-grid { grid-template-columns: 1fr; } .loc-grid .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.alert.info { background: #eef6f6; border-color: #c6dfe0; color: #18474d; }
.alert .progress { margin: .4rem 0; max-width: 420px; }
.w-xs { width: 3rem; text-align: right; }
.w-km { width: 4.4rem; text-align: right; }
.km-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; font-size: .85rem; }
.km-cell > span { display: inline-flex; align-items: center; gap: .3rem; }
.warn-input { border-color: var(--warn) !important; background: #fff8e8 !important; }
.fn-van { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: flex-end; }
.fn-van label { display: flex; flex-direction: column; gap: .15rem; font-size: .72rem; color: var(--muted); font-weight: 600; }
.fn-van .fn-name { min-width: 11rem; flex: 1; }
.fn-van:has(select[name=unit] option[value=km]:checked) .fn-giorno { display: none; }
.fn-van:has(select[name=unit] option[value=giorno]:checked) .fn-km { display: none; }
.km-out { padding: .5rem .7rem; background: #f3f8f8; border-radius: 8px; border: 1px solid #d9e8e8; }

/* ===== Contabilità ===== */
.pv-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.acc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.acc-kpis .kpi { background: var(--card); box-shadow: var(--shadow); }
.acc-kpis .kpi b { font-size: 1.35rem; }
.kpi b.neg-text, .kpi b.ok-text { font-weight: 800; }
.acc-table td { vertical-align: top; }
.dim-row td { background: #fafbfb; }
.table tfoot td { border-top: 2px solid var(--line); padding: .55rem .5rem; }
.exp-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-top: .6rem; }
.exp-form .field.grow { flex: 1; min-width: 14rem; }
.exp-form input[type=file] { max-width: 15rem; }
.acc-list td { vertical-align: top; }
@media (max-width: 640px) { .exp-form > * { flex: 1 1 100%; } .exp-form .w-price { width: 100%; } }

/* ===== Prezzi e fattori ===== */
.fx-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.fx-main > * + * { margin-top: 1rem; }
.fx-side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.ftab-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.ftab-name { font-weight: 800; font-size: 1.05rem; text-transform: uppercase; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: .3rem 0; min-width: 14rem; }
.ftab-name:focus { outline: 0; border-bottom-color: var(--primary); }
.ftab-rows input { width: 100%; max-width: 9rem; }
.ftab-rows th { font-size: .75rem; }
.ftab-foot { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .6rem; }
.ftab-extra { color: var(--muted); font-size: .9rem; display: inline-flex; align-items: center; gap: .35rem; }
.ftab-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid #eef1f1; }
.fx-out { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.fx-out div { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; padding: .45rem .6rem; background: #f3f8f8; border-radius: 8px; }
.fx-out b { font-size: 1.1rem; }
.fx-out small { grid-column: 1 / -1; color: var(--muted); }
@media (max-width: 960px) { .fx-layout { grid-template-columns: minmax(0, 1fr); } .fx-side { position: static; } }

/* ===== Fasi: chi e cosa, fase per fase ===== */
.phase-matrix th.ph-col { text-align: center; text-transform: none; letter-spacing: 0; min-width: 7.5rem; border-bottom: 3px solid var(--phc, #ccc); }
.phase-matrix th.ph-col b { display: block; color: var(--ink); font-size: .85rem; }
.phase-matrix th.ph-col small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.c0 { --phc: #e8a33d; } .c1 { --phc: #5a8f3c; } .c2 { --phc: #6c5bb3; } .c3 { --phc: #c0564b; } .c4 { --phc: #3a7bbf; }
.phase-matrix td.pm-cell { text-align: center; position: relative; }
.pm-chk { display: inline-grid; place-items: center; cursor: pointer; }
.pm-chk input { position: absolute; opacity: 0; pointer-events: none; }
.pm-chk span { width: 30px; height: 22px; border-radius: 6px; border: 2px dashed #cfd8d9; display: block; transition: background .1s; }
.pm-chk input:checked + span { background: var(--phc); border: 2px solid var(--phc); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.pm-chk input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.pm-chk input:disabled + span { cursor: default; }
.pm-chk:hover input:not(:checked):not(:disabled) + span { border-color: var(--phc); }
.pm-mat-bar { position: absolute; left: 0; right: 0; top: 50%; height: 14px; margin-top: -7px; background: repeating-linear-gradient(135deg, #2b7f88 0 8px, #24727a 8px 16px); }
.pm-mat-bar.first { left: 50%; border-radius: 7px 0 0 7px; margin-left: -15px; }
.pm-mat-bar.last { right: 50%; border-radius: 0 7px 7px 0; margin-right: -15px; }
.pm-mat-bar.first.last { left: 50%; right: auto; width: 30px; border-radius: 7px; }
.pm-sel { display: flex; flex-wrap: wrap; gap: .3rem .6rem; margin-top: .3rem; font-size: .8rem; color: var(--muted); }
.pm-sel select { padding: .2rem .35rem; font-size: .82rem; }
.pm-sub td:first-child { padding-left: 1.4rem; color: #3b4b50; }
.pm-sub .pm-chk span { width: 24px; height: 16px; }
.pm-actions { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.pm-actions .muted { flex: 1; min-width: 16rem; }
.pm-empty { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.pm-empty p { margin: 0; }
.tl-sep { height: 1px; background: var(--line); margin: .3rem 0; }
.tl-sub .tl-label { padding-left: .8rem; font-size: .82rem; color: var(--muted); }
.tl-sub .tl-track { height: 18px; }
.tl-sub .tl-bar { top: 2px; bottom: 2px; opacity: .75; }
.tl-none { font-size: .75rem; color: var(--muted); padding-left: .5rem; line-height: 26px; }
.from-ph { display: inline-block; padding: .15rem .45rem; border-radius: 6px; background: #eef4f4; border: 1px dashed #b8cfd0; font-size: .85rem; white-space: nowrap; cursor: help; }

/* Assegnazione per fasi o per date */
.ph-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: middle; margin-left: .3rem; }
.ph-chip { font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 5px; background: color-mix(in srgb, var(--phc) 18%, #fff); color: color-mix(in srgb, var(--phc) 70%, #000); border: 1px solid color-mix(in srgb, var(--phc) 45%, #fff); }
.slot-head .ph-chips { margin-left: 0; }
.by-switch { display: inline-flex; background: #e7ecec; border-radius: 8px; padding: 2px; }
.by-switch label { cursor: pointer; }
.by-switch input { position: absolute; opacity: 0; pointer-events: none; }
.by-switch span { display: block; padding: .3rem .6rem; border-radius: 6px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.by-switch input:checked + span { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.by-switch input:focus-visible + span { outline: 2px solid var(--primary); }
.by-fasi { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ph-pick { cursor: pointer; }
.ph-pick input { position: absolute; opacity: 0; pointer-events: none; }
.ph-pick span { display: block; padding: .3rem .55rem; border-radius: 7px; font-size: .8rem; font-weight: 600; border: 1.5px dashed color-mix(in srgb, var(--phc) 60%, #fff); color: var(--muted); background: #fff; }
.ph-pick input:checked + span { background: var(--phc); border: 1.5px solid var(--phc); color: #fff; }
.ph-pick input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.by-date { display: inline-flex; gap: .4rem; }
.slot-form:has(input[name=by][value=fasi]:checked) .by-date { display: none; }
.slot-form:has(input[name=by][value=date]:checked) .by-fasi { display: none; }
.pl-bar.inv-pending, .inv-pending { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 6px, transparent 6px 12px) !important; outline: 1px dashed rgba(0,0,0,.25); }

/* ===== Inviti ===== */
.badge.inv-todo { background: #eef1f1; color: #4a5a5f; }
.badge.inv-wait { background: #fdf0d8; color: #7a5000; }
.badge.inv-ok { background: #ddf2e4; color: #1d5a35; }
.badge.inv-no { background: #f8e1df; color: #8f2620; }
.inv-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .2rem; }
.inv-btn { font: inherit; font-size: .72rem; font-weight: 700; padding: .12rem .45rem; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--primary); cursor: pointer; text-decoration: none !important; }
.inv-btn.wa { color: #128c4b; border-color: #bfe3cf; }
.inv-set { font-size: .72rem; padding: .1rem .25rem; border-radius: 6px; color: var(--muted); }
.inv-note { font-size: .78rem; color: var(--muted); font-style: italic; }
.struck { text-decoration: line-through; opacity: .6; }
.inv-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; }
.inv-stats .kpi { background: var(--card); }
.inv-stats .kpi.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.inv-stats .kpi.inv-ok b { color: var(--ok); } .inv-stats .kpi.inv-no b { color: var(--danger); } .inv-stats .kpi.inv-wait b { color: var(--warn); }
.inv-table td { vertical-align: top; }
.inv-actions { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; }
@media (max-width: 760px) { .inv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
ol.howto { margin: 0; padding-left: 1.2rem; line-height: 1.6; }
.slot-row { grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto auto auto; }
.slot-row > .nowrap.small.muted { white-space: normal; text-align: right; max-width: 15rem; }
.slot-row .ph-chips { margin: 0 0 .15rem; justify-content: flex-end; }
/* conferma eliminazione a due passi */
.btn.confirm-armed, .btn.ghost.confirm-armed { background: var(--danger) !important; border-color: var(--danger) !important; color: #fff !important; animation: armPulse .9s ease-in-out infinite alternate; white-space: nowrap; }
@keyframes armPulse { from { box-shadow: 0 0 0 0 rgba(180,55,47,.45); } to { box-shadow: 0 0 0 5px rgba(180,55,47,0); } }

/* Importazione da Rentman */
.rm-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.rm-head h2 { margin: 0 0 .3rem; }
.rm-head p { margin: 0; }
.rm-kpis { margin: 1rem 0; }
.rm-new { background: #dceafb; color: #1d4f8c; }
.rm-chg { background: #fdf0d8; color: #8a5a00; }
.rm-same { background: #ddf2e4; color: #22673e; }
.rm-problem { color: var(--danger); }
.rm-blocked td { background: #fff8f7; }
.rm-table details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.rm-diff { margin-top: .4rem; font-size: .85rem; }
.rm-diff tr.rm-add td { background: #eef9f1; }
.rm-diff tr.rm-del td { background: #fdeeec; text-decoration: line-through; color: var(--muted); }
.rm-diff tr.rm-chg td { background: #fff7e6; }
.rm-diff tr.rm-chg, .rm-diff tr.rm-add, .rm-diff tr.rm-del { color: inherit; }
.rm-same-list { margin-top: .6rem; }
.rm-same-list > summary { cursor: pointer; color: var(--muted); }
.rm-actions { position: sticky; bottom: 0; background: var(--bg, #f4f6f6); padding: .75rem 0; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; z-index: 2; }
.rm-detail > td { background: #fafbfb; padding-top: 0; }
.rm-table [data-rm-toggle] { padding: .25rem .6rem; font-size: .82rem; }
.rm-kpis .kpi span { white-space: normal; }
.rm-tabs { margin: 1rem 0; width: fit-content; max-width: 100%; overflow-x: auto; }
.rm-opts { display: flex; gap: 1.5rem 2.5rem; flex-wrap: wrap; }
.rm-fields { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .35rem 0; }
.rm-opts small { display: block; max-width: 520px; }
.rm-ch { font-size: .88rem; line-height: 1.45; }
.rm-ch > span { display: inline-block; min-width: 6.5rem; color: var(--muted); font-size: .8rem; }
.rm-ch s { color: var(--muted); }
.rm-ch b { white-space: nowrap; }
.rm-status-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem 1rem; margin: .5rem 0; }
.rm-table td.nowrap { white-space: nowrap; }

/* Preventivo compatto: gruppi come cartelle comprimibili, righe più basse */
.editor-table td { padding-top: .2rem; padding-bottom: .2rem; }
.editor-table tr.line td { font-size: .9rem; }
.editor-table tr.line input:not([type=radio]), .editor-table tr.line select { padding: .18rem .4rem; min-height: 0; height: 1.85rem; font-size: .88rem; }
.editor-table tr.grp-head td { padding-top: .35rem; padding-bottom: .35rem; }
.grp-title { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.grp-toggle { border: 0; background: transparent; color: var(--muted); font-size: .95rem; width: 1.4rem; height: 1.4rem; line-height: 1; cursor: pointer; border-radius: 5px; padding: 0; flex: none; }
.grp-toggle:hover { background: #dfe7e8; color: var(--ink); }
.grp-ic { flex: none; }
.grp-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.grp-text .grp-name, .grp-label { text-transform: uppercase; letter-spacing: .02em; font-weight: 700; font-size: .92rem; }
.grp-text .grp-name { padding: .05rem .3rem; margin-left: -.3rem; height: auto; }
.grp-when { color: var(--muted); font-size: .76rem; line-height: 1.2; }
.editor-table tbody.folded tr.line, .editor-table tbody.folded tr.empty-row { display: none; }
.editor-table tbody.folded tr.grp-head td { border-bottom: 1px solid #dbe4e5; }

/* Catalogo: i suggeriti hanno una loro barra di scorrimento e non escono mai dal riquadro */
.catalog { overflow: hidden; }
.catalog > .search, .catalog > .cat-help { flex: none; }
.cat-tree { min-height: 140px; }
.catalog [data-suggest] { flex: 0 1 auto; min-height: 0; max-height: 38vh; overflow-y: auto; border-radius: 8px; }
.catalog [data-suggest]:empty { display: none; }
.suggest-head { position: sticky; top: -.4rem; z-index: 1; background: #fffaf0; margin: -.4rem -.4rem 0; padding: .45rem .7rem .35rem; border-bottom: 1px solid #f2d9a6; }
.pv[data-mode=schede] .catalog { top: 3.4rem; max-height: calc(100vh - 4.4rem); }

/* Sottoprogetti */
.editor-table tbody.sp-block tr.sp-head td { background: #23393d; color: #fff; padding: .45rem .7rem; border-top: 10px solid var(--card, #fff); }
.sp-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sp-bar .badge { background: rgba(255,255,255,.14); color: #fff; }
.sp-bar .badge.st-confermato { background: #2f8a55; } .sp-bar .badge.st-opzione { background: #c4620f; } .sp-bar .badge.st-annullato { background: #a33; }
.sp-bar .muted { color: #b8c6c8; }
.sp-bar .struck { text-decoration: line-through; }
.grp-sp { margin-left: auto; font-size: .78rem; padding: .1rem .3rem; height: auto; max-width: 11rem; border-color: #d3dcdd; background: #fff; }
.sp-card .sp-table td { padding: .2rem .25rem; }
.sp-form { display: grid; grid-template-columns: 7.2rem 1fr 3rem 3rem; gap: .35rem; align-items: center; }
.sp-form input[name=name] { min-width: 0; padding: .2rem .4rem; }
.sp-form select { padding: .2rem .3rem; font-size: .8rem; }
.sp-chk { display: flex; justify-content: center; }
.sp-table th:nth-child(3), .sp-table th:nth-child(4) { text-align: center; }
.tl-sp, .ph-sp { display: block; font-size: .68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.sched-table tr.sched-sp td { background: #eef3f3; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: #33494d; }
.sched-sp-sel { max-width: 10rem; }
.sp-card { margin-top: 1rem; }
.sp-form { grid-template-columns: 8rem minmax(0, 1fr) 6.5rem 6.5rem; }
.sp-form-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.sp-form-head span:nth-child(n+3) { text-align: center; }
.sp-table thead th { padding-bottom: .1rem; }
.sp-table { table-layout: fixed; width: 100%; }
.sp-table th:last-child, .sp-table td:last-child { width: 2.6rem; }
.sp-form input[name=name] { width: 100%; }

/* Sottoprogetti come cartelle */
.sp-switch { display: flex; gap: .35rem; flex-wrap: wrap; margin: .9rem 0 .2rem; }
.sp-switch a { display: inline-flex; align-items: center; gap: .4rem; padding: .38rem .75rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card, #fff); color: var(--ink); font-weight: 600; font-size: .88rem; }
.sp-switch a svg { color: #9aa7ab; }
.sp-switch a:hover { text-decoration: none; border-color: #b9c6c8; }
.sp-switch a.active { background: #23393d; color: #fff; border-color: #23393d; }
.sp-switch a.active svg { color: #f2c94c; }
.sp-switch a.nofin { font-style: italic; }
.sp-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #9aa7ab; }
.sp-dot.st-confermato { background: #2f8a55; } .sp-dot.st-opzione { background: #e07b1a; } .sp-dot.st-in_corso { background: #2b8fd1; } .sp-dot.st-annullato { background: #c53030; } .sp-dot.st-chiuso { background: #718096; }
.sp-sum { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: baseline; padding: .7rem .9rem; margin-bottom: .8rem; border-radius: 10px; background: #fdf7e3; border: 1px solid #f0dfa6; }
.sp-sum > b { font-size: 1.1rem; }
.gen-quote { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.gen-quote select { max-width: 16rem; }
.model-pick label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; }
.model-pick select { max-width: 18rem; }
.qm-card { margin-top: 1rem; }
.qm-table td { vertical-align: top; }
.qm-table input[name^=name_] { min-width: 14rem; }
.qm-table select { max-width: 19rem; }
.qm-checks { display: flex; flex-direction: column; gap: .1rem; font-size: .82rem; }
.qm-checks .check { font-size: .82rem; }
.qm-table .center { text-align: center; }

/* Impostazioni con menu laterale */
.set-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.set-nav { position: sticky; top: 1rem; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; padding: .5rem; display: flex; flex-direction: column; gap: .35rem; }
.set-group { display: flex; flex-direction: column; gap: .1rem; }
.set-group + .set-group { border-top: 1px solid var(--line); padding-top: .35rem; }
.set-group > small { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .35rem .6rem .15rem; }
.set-nav a { display: flex; align-items: center; gap: .55rem; padding: .45rem .6rem; border-radius: 8px; color: var(--ink); font-weight: 500; font-size: .92rem; }
.set-nav a .ic { width: 17px; height: 17px; color: var(--muted); }
.set-nav a:hover { background: #f0f4f4; text-decoration: none; }
.set-nav a.active { background: #e2eeee; color: #12474d; font-weight: 700; }
.set-nav a.active .ic { color: var(--primary); }
.set-main { min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.set-main > .card, .set-main > form.card { margin: 0; }
.set-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.set-card { display: flex; flex-direction: column; gap: .25rem; color: var(--ink); padding: .9rem 1rem; }
.set-card:hover { text-decoration: none; border-color: #b9c6c8; }
.set-card .ic { color: var(--primary); }
.set-card span { font-size: .85rem; }
@media (max-width: 900px) {
  .set-wrap { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; }
  .set-group { flex-direction: row; align-items: center; }
  .set-group > small { display: none; }
  .set-group + .set-group { border-top: 0; padding-top: 0; border-left: 1px solid var(--line); padding-left: .35rem; }
  .set-nav a { white-space: nowrap; }
}

/* Ruoli e permessi */
.perm-table th { vertical-align: bottom; min-width: 9.5rem; }
.perm-table th small { display: block; font-weight: 400; }
.perm-table td:first-child { font-weight: 500; }
.perm-table .role-name { width: 100%; font-weight: 600; font-size: .95rem; text-transform: none; letter-spacing: 0; padding: .3rem .45rem; border: 1px solid var(--line, #d5dde0); border-radius: 6px; }
.perm-table select.lvl-sel { width: 100%; padding: .3rem .4rem; border-radius: 6px; border: 1px solid var(--line, #d5dde0); font-weight: 500; }
.lvl-sel.lvl-edit, .lvl.lvl-edit { background: #e5f4ea; color: #1d6b3a; }
.lvl-sel.lvl-view, .lvl.lvl-view { background: #e8f0fb; color: #24548f; }
.lvl-sel.lvl-none, .lvl.lvl-none { background: #f3f4f5; color: #8a9499; }
.lvl { display: inline-block; padding: .2rem .55rem; border-radius: 6px; font-size: .9em; font-weight: 500; }
.perm-prices td { background: #fffaf0; }
.role-help div { margin: .15rem 0; }

/* Backup */
pre.code { font-family: var(--mono); background: #0F2627; color: #e8f1f2; padding: .7rem .9rem; border-radius: 8px; overflow-x: auto; }
.bk-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.bk-head h2 { margin: 0; }
.bk-status.bk-off { border-left: 4px solid #d9a12b; }
.bk-status.bk-bad { border-left: 4px solid var(--danger, #c0392b); }
.bk-status.bk-ok { border-left: 4px solid #3a9a63; }
.bk-status.bk-run { border-left: 4px solid #2f6db3; }

/* Registro attività */
.act-table td { vertical-align: top; }
.act-table td:last-child { min-width: 15rem; }
.act-ch { list-style: none; margin: 0; padding: 0; }
.act-ch li { margin: .1rem 0; word-break: break-word; }
.act-filters { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-end; }
.act-filters .field { min-width: 10rem; flex: 1 1 10rem; }
.act-card > summary { cursor: pointer; list-style: none; }
.act-card > summary h2 { display: inline; }
.field.need input { border-color: #d9a12b; background: #fffaf0; }

/* Preparazione materiale */
.prep-app { max-width: 820px; margin: 0 auto; display: grid; gap: .8rem; }
.prep-head h1 { margin: .2rem 0 .3rem; font-size: 1.35rem; }
.prep-progress { margin: .7rem 0 .4rem; }
.progress.big { height: 12px; }
.progress.big span { background: #3a9a63; }
.prep-sum { margin-top: .45rem; display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; }
.prep-chip { white-space: nowrap; }
.prep-chip.prep-da_preparare { background: #f3f4f5; color: #56616a; }
.prep-chip.prep-caricato { background: #dce9f8; color: #24548f; }
a.prep-chip { text-decoration: none; }
.prep-scan { display: grid; gap: .6rem; }
.prep-cam { aspect-ratio: 16 / 9; }
.prep-tools { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; }
.prep-tools input[type=search] { flex: 1 1 10rem; min-width: 8rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; }
.prep-sec { padding: .4rem 0; }
.prep-sec-h { font-size: .95rem; margin: .5rem 1rem .3rem; letter-spacing: .02em; }
.prep-row { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; padding: .6rem 1rem; border-top: 1px solid var(--line); }
.prep-row.child { padding-left: calc(1rem + var(--d, 1) * 1.6rem); background: #fafbfb; }
.prep-row.child .prep-check { width: 2.1rem; height: 2.1rem; }
.prep-check { width: 2.7rem; height: 2.7rem; border-radius: 50%; border: 2px solid #b8c3c6; background: #fff; color: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.prep-check svg { width: 62%; height: 62%; }
.prep-row.part .prep-check { border-color: #d9a12b; background: #fff6e3; }
.prep-row.done .prep-check { border-color: #3a9a63; background: #3a9a63; color: #fff; }
.prep-check:disabled { cursor: default; }
.prep-name { min-width: 0; }
.prep-name b { display: block; overflow-wrap: anywhere; }
.prep-name small { color: var(--muted, #6b767b); }
.prep-loc { color: #24548f; font-weight: 600; white-space: nowrap; }
.prep-loc .ic { width: 13px; height: 13px; vertical-align: -2px; }
.prep-row.done .prep-name b { color: #6b8f78; text-decoration: line-through; text-decoration-thickness: 1px; }
.prep-kit-btn { margin-top: .2rem; background: none; border: 0; padding: 0; color: #24548f; font-size: .85rem; cursor: pointer; }
.prep-qty { display: flex; align-items: center; gap: .3rem; }
.prep-count { min-width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; }
.prep-count b { font-size: 1.15rem; }
.prep-step { width: 2.2rem; height: 2.2rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.prep-row.flash { animation: prepflash 1.2s ease; }
@keyframes prepflash { 0% { background: #c9ecd5; } 100% { background: transparent; } }
@media (max-width: 560px) {
  .prep-row { padding: .55rem .7rem; gap: .5rem; }
  .prep-step { width: 2rem; height: 2rem; }
  .prep-count { min-width: 2.8rem; }
}
[hidden] { display: none !important; }
.prep-app > * { min-width: 0; }
.prep-scan .scan-manual input[name=code] { min-width: 0; font-size: 1rem; }

/* Guasti e manutenzione */
.tabs-mini { display: flex; flex-wrap: wrap; gap: .3rem; }
.tabs-mini a { padding: .45rem .8rem; border-radius: 8px; text-decoration: none; color: var(--ink, #1d2b30); background: #eef2f2; font-weight: 500; }
.tabs-mini a.active { background: var(--primary); color: #fff; }
.tabs-mini .count { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; border-radius: 99px; background: rgba(0,0,0,.12); font-size: .8rem; text-align: center; }
.tabs-mini .count.warn { background: #f3c9c4; color: #8f2620; }
.tabs-mini a.active .count { background: rgba(255,255,255,.25); color: #fff; }
.badge.due-scaduta { background: #f8e1df; color: #8f2620; }
.badge.due-mai { background: #fdf0d8; color: #7a5000; }
.badge.due-in_scadenza { background: #fff3cf; color: #7a5000; }
.badge.due-ok { background: #ddf2e4; color: #1d5a35; }
.check-form { flex-wrap: wrap; gap: .3rem; }
.check-form input[type=date] { width: 9.5rem; }
.check-form input[name=notes] { min-width: 7rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .5rem 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.repair-photos { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; }
.repair-photos img { width: 140px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.scan-fault { margin-left: auto; }
@media (max-width: 560px) { dl.kv { grid-template-columns: 1fr; } dl.kv dt { margin-top: .4rem; } }

/* Calendari in abbonamento */
.cal-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: start; }
.cal-main { display: grid; gap: .7rem; min-width: 0; }
.cal-link { display: flex; gap: .4rem; }
.cal-link input { flex: 1; min-width: 0; font-family: var(--mono); font-size: .85rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #f7f9f9; }
.cal-qr { display: grid; justify-items: center; gap: .2rem; }
.cal-qr svg { width: 150px; height: 150px; }
.cal-how ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.cal-how li { margin: .25rem 0; }
@media (max-width: 640px) { .cal-grid { grid-template-columns: minmax(0, 1fr); } .cal-qr { display: none; } }
.cat-badge { background: #e6eef7; color: #24548f; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .7rem 1rem; margin-bottom: .7rem; }
.bulk-bar select { padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 8px; margin-left: .3rem; }
[data-bulk-cat].has-sel .bulk-bar { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,120,122,.15); }
.cat-quick { padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); max-width: 11rem; }
.cat-quick.set { background: #e6eef7; color: #24548f; border-color: #c9d9ee; font-weight: 600; }
.cat-quick.saved { box-shadow: 0 0 0 3px #b9e0c6; }
.bulk-grp { display: inline-flex; align-items: center; gap: .4rem; }

/* Allegati */
.files-table .file-name a { font-weight: 600; word-break: break-word; }
.files-table select { padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.files-table select.vis-staff { background: #e5f4ea; color: #1d6b3a; border-color: #bfe3cb; }
.files-table select.vis-office { background: #f3f4f5; color: #56616a; }
.files-table select.saved { box-shadow: 0 0 0 3px #b9e0c6; }
.file-drop { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .8rem; padding: .9rem; border: 2px dashed var(--line); border-radius: 10px; }
.file-drop.over { border-color: var(--primary); background: #eef7f7; }
.file-drop select { padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 7px; margin-left: auto; }
.file-progress { width: 100%; color: var(--primary); }
.file-progress:empty { display: none; }
.field.inline.off input { opacity: .45; text-decoration: line-through; }
.agreed-field input { border-color: #3a9a63 !important; font-weight: 600; }
.table.totals tr.agreed td { color: #1d6b3a; }
.table.totals tr.agreed-tax td { background: #eef8f1; }

/* Spese aziendali */
.cexp-bars { display: grid; gap: .3rem; margin: .5rem 0 .8rem; }
.cexp-bar { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) auto; align-items: center; gap: .6rem; color: inherit; text-decoration: none; padding: .15rem .25rem; border-radius: 6px; }
.cexp-bar:hover { background: var(--bg-soft, rgba(0,0,0,.04)); }
.cexp-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cexp-bar i { display: block; height: .7rem; border-radius: 4px; background: var(--accent, #2563eb); opacity: .75; }
.cexp-bar b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cexp-h { margin: 0 0 .5rem; }
.cexp-receipt { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.dim-field { opacity: .45; }
.acc-company { margin: 1rem 0; }
.acc-result tfoot td { border-top: 2px solid #8a96a3; }
@media (max-width: 640px) { .cexp-bar { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) auto; } }
.cexp-pdf { width: 100%; height: 70vh; border: 1px solid #d5dbe1; border-radius: 8px; }

/* Preventivi: modelli, editor, condizioni */
.qm-tabs { display: inline-flex; margin-bottom: 1rem; }
.qm-editor { grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); }
.qm-editor .tpl-preview { position: sticky; top: 1rem; }
.qm-editor .tpl-preview iframe { height: calc(100vh - 9rem); }
.qm-editor form > .field { margin-bottom: .8rem; }
.qm-fs { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem .7rem; margin: 0 0 .8rem; }
.qm-fs legend, .qm-fs > summary { font-weight: 700; font-size: .9rem; padding: 0 .3rem; }
.qm-fs > summary { cursor: pointer; padding: .2rem 0; }
.qm-fs .form-grid { padding: .6rem 0 0; box-shadow: none; border: 0; }
.qm-checks.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .15rem .8rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card, #fff); padding: .7rem 0; margin-bottom: -.5rem; border-top: 1px solid var(--line); z-index: 2; flex-wrap: wrap; }
.qm-cond { border-top: 1px solid var(--line); padding: .8rem 0; }
.qm-cond-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.qm-cond-head input[name=name] { font-weight: 700; min-width: 14rem; }
.qm-cond textarea { width: 100%; font-size: .88rem; line-height: 1.45; }
.qm-pay .wide-in { width: 100%; min-width: 16rem; }
.qm-pay input[name=name], .qm-pay input[name=new_name] { min-width: 12rem; }
.gen-quote select { max-width: 16rem; }
@media (max-width: 960px) { .qm-editor .tpl-preview { position: static; } .qm-editor .tpl-preview iframe { height: 75vh; } }
.qm-pay td:last-child { white-space: nowrap; } .qm-pay .wide-in { min-width: 12rem; } .qm-pay input[name=name], .qm-pay input[name=new_name] { min-width: 9rem; }

/* Preventivo: materiale temporaneo, selezione righe, menu del tasto destro */
.editor-table tr.line { user-select: none; -webkit-user-select: none; }
.editor-table tr.line input { user-select: text; -webkit-user-select: text; }
.editor-table tr.line.selected > td { background: #dbeafe; }
.editor-table tr.line.selected > td:first-child { box-shadow: inset 3px 0 0 #2563eb; }
.temp-badge { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b55; font-size: .68rem; letter-spacing: .03em; }
.row-temp .temp-desc { margin-top: .2rem; }
.temp-sub { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; align-items: center; font-size: .8rem; color: var(--muted); }
.temp-sub input { font-size: .8rem; padding: .2rem .4rem; min-width: 0; }
.temp-sub input[data-field=supplier] { flex: 1 1 6rem; width: 6rem; }
.temp-sub .w-code { width: 4.8rem; flex: 0 0 auto; }
.temp-sub label { display: inline-flex; align-items: center; gap: .3rem; }
.sel-bar { display: inline-flex; align-items: center; gap: .25rem; background: #dbeafe; border-radius: 8px; padding: .15rem .25rem .15rem .6rem; font-size: .85rem; }
.ctx-menu { position: fixed; z-index: 1000; min-width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: .3rem; }
.ctx-menu button { display: flex; width: 100%; justify-content: space-between; gap: 1.5rem; align-items: center; border: 0; background: none; font: inherit; font-size: .9rem; text-align: left; padding: .45rem .7rem; border-radius: 6px; cursor: pointer; color: var(--ink); }
.ctx-menu button:hover, .ctx-menu button:focus { background: #eef3f3; outline: none; }
.ctx-menu button.danger { color: #b42318; }
.ctx-menu kbd { font: .75rem ui-monospace, monospace; color: var(--muted); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.ctx-head { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .35rem .7rem .2rem; }
.temp-dialog { max-width: 560px; }
.temp-dialog .form-grid { box-shadow: none; border: 0; padding: 0; }
.ml-temp-h { font-size: 11pt; margin: 6mm 0 2mm; }
.ml-temp-h small { font-weight: 400; color: #555; }
.sp-filter-note { background: #fff7e6; border: 1px solid #f5c26b; border-radius: 10px; padding: .55rem .9rem; margin: 0 0 .8rem; font-size: .9rem; }
.prep-head .sp-filter-note { margin: .4rem 0; }

/* Preventivo su telefono e tablet: tieni premuto = menu, tocca = seleziona, barra azioni in basso */
.editor-table tr.line { -webkit-touch-callout: none; }
@media (pointer: coarse) {
  .ctx-menu kbd { display: none; }
  .ctx-menu button { padding: .75rem .8rem; font-size: 1rem; }
  .ctx-menu { min-width: 230px; max-width: calc(100vw - 16px); }
}
@media (max-width: 760px) {
  .sel-bar:not([hidden]) { position: fixed; left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 900; justify-content: space-between; flex-wrap: wrap;
    padding: .45rem .5rem .45rem .8rem; box-shadow: 0 8px 24px rgba(0,0,0,.2); border: 1px solid #93c5fd; }
  .sel-bar .btn { padding: .45rem .6rem; }
  .editor-bar [data-paste]:not([hidden]) { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 900; box-shadow: 0 8px 24px rgba(0,0,0,.2); background: #fff; padding: .6rem .9rem; }
}

/* ======================================================================
   Aspetto 2026 (proposta 1): barra laterale scura con logo, verde CIPIESSE,
   carattere Figtree, schede arrotondate, dashboard a riquadri
   ====================================================================== */
:root {
  --ink: #12201F; --muted: #5B6B69; --line: #E1E6E4; --bg: #F3F5F4; --card: #fff;
  --side: #0F2627; --side-ink: #C9D6D4; --primary: #00787A; --primary-ink: #fff; --accent: #2CC4BE;
  --radius: 16px; --shadow: 0 1px 2px rgba(16, 38, 39, .04);
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
body { font-size: 15px; }
h2 { font-size: 1.1rem; font-weight: 800; letter-spacing: -.005em; }
.card { border-radius: 18px; padding: 1.2rem 1.35rem; }
.btn { border-radius: 11px; padding: .6rem 1rem; border-color: #D5DDDB; }
.btn.small { border-radius: 9px; padding: .3rem .6rem; }
.btn.primary:hover { background: #005F61; border-color: #005F61; }
input, select, textarea { border-radius: 10px; border-color: #D5DDDB; }
.table th { background: transparent; font-size: .74rem; letter-spacing: .06em; }
.table td { border-bottom-color: #EEF1F0; }
.badge { padding: .18rem .6rem; }
.flash { border-radius: 12px; }
.alert { border-radius: 14px; }

/* barra laterale */
.side { width: 248px; padding: 18px 12px 0; gap: 14px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 12px 14px 9px; background: #fff; border-radius: 14px; color: var(--ink); text-decoration: none !important; }
.brand img { display: block; width: 150px; max-width: 100%; height: auto; }
.brand b { font-size: 1.05rem; color: var(--ink); }
.brand small { font-size: 12px; font-weight: 600; color: #4A5957; letter-spacing: .02em; }
.side-search { display: flex; align-items: center; gap: 8px; background: #183536; border-radius: 10px; padding: 0 12px; color: #8FA7A5; }
.side-search input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; padding: .6rem 0; font-size: 13.5px; }
.side-search input::placeholder { color: #8FA7A5; }
.side-search input:focus { outline: none; }
.side-search:focus-within { box-shadow: 0 0 0 2px #2CC4BE55; }
.side nav { padding: 0; }
.side nav a { padding: .62rem .75rem; border-radius: 10px; font-weight: 600; font-size: 14.5px; gap: .75rem; }
.side nav a.active { background: #1D4042; box-shadow: inset 3px 0 0 #2CC4BE; }
.side nav a .nav-cnt { margin-left: auto; font-size: 11.5px; font-weight: 700; background: #24484A; color: #DDF3F1; border-radius: 20px; padding: 1px 8px; }
.nav-sep { padding: 1rem .75rem .3rem; }
.me { padding: 12px 6px; border-top-color: #1E3C3D; }
.me a { flex-direction: row; align-items: center; gap: 10px; }
.me .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: #2B4A4B; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.me .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.me .who small { color: #8FA7A5; font-size: 12px; }
.topbar { padding: 1.5rem 2rem .25rem; }
.topbar h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.015em; }
.content { padding: 1rem 2rem 3rem; }
.flash { margin: .6rem 2rem 0; }

/* indicatori */
.kpis { gap: 14px; }
.kpi { border-radius: 16px; }
.pv-kpis .kpi { border-radius: 14px; background: #F6F8F7; border-color: transparent; }
.pv-kpis .kpi.warn { background: #FFF4E5; border-color: #F3D9AE; }

/* progetto */
.pv-head { border-top: 0; border-radius: 20px; padding: 1.4rem 1.6rem 1.2rem; }
.pv-name h1 { font-size: 1.85rem; font-weight: 800; letter-spacing: -.015em; }
.pv-num { font-size: .7em; background: #F0F3F2; color: #3B4A48; border-radius: 8px; padding: .2em .55em; }
.sp-switch a { border-radius: 30px; padding: .45rem 1rem; border-color: #D5DDDB; }
.sp-switch a.active { background: var(--ink); border-color: var(--ink); }
.sp-switch a.active svg { color: #2CC4BE; }
.pv[data-mode=schede] .pv-nav { border-bottom-color: #DCE3E1; }
.pv[data-mode=schede] .pv-nav a { padding: .8rem .8rem .7rem; }
.editor-table tr.grp-head > td { background: #F6F8F7; }
.sp-filter-note { border-radius: 14px; }

/* ricerca generale */
.search-res h2 { display: flex; align-items: center; gap: .5rem; }
.search-res ul { list-style: none; margin: 0; padding: 0; }
.search-res li a { display: flex; gap: .75rem; align-items: baseline; padding: .55rem 0; border-bottom: 1px solid #EEF1F0; color: var(--ink); }
.search-res li a:hover { color: var(--primary); text-decoration: none; }
.search-res li small { color: var(--muted); }

/* dashboard a riquadri */
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.dash-head .hello { flex: 1 1 320px; }
.dash-head .hello small { display: block; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.dash-head .hello h1 { margin: 4px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -.015em; }
.dash-head .btn { min-height: 44px; }
.dash-add { background: #EAF5F4; border: 1px dashed #8CC9C6; border-radius: 16px; padding: 16px 18px; }
.dash-add .btn-row { margin-top: 10px; }
.dash-add .btn { min-height: 44px; background: #fff; }
.dash-add .btn small { color: var(--muted); font-weight: 500; }
.dash-grid { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.wdg { background: #fff; border: 1px solid #E1E6E4; border-radius: 18px; min-width: 0; box-sizing: border-box; }
.wdg.s-full { flex: 1 1 100%; } .wdg.s-wide { flex: 999 1 560px; } .wdg.s-narrow { flex: 1 1 300px; }
.wdg.editing { border-color: #9FD0CD; box-shadow: 0 0 0 3px #E3F3F1; }
.wdg-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; background: #F1F7F6; border-bottom: 1px solid #E1E6E4; border-radius: 18px 18px 0 0; }
.wdg-bar b { margin-right: auto; font-size: 13px; color: #3B4A48; }
.wdg-bar form { display: inline; }
.wdg-bar button { min-width: 36px; height: 36px; border-radius: 9px; border: 1px solid #D5DDDB; background: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.wdg-bar button.x { color: #B42318; border-color: #F2C9C4; }
.wdg-body { padding: 16px 20px 18px; }
.wdg-body > h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wdg-body > h2 a { margin-left: auto; font-size: 14px; font-weight: 600; }
.wdg-body > h2 small { font-size: 13px; font-weight: 500; color: var(--muted); }
.wdg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 14px; }
.wdg-kpis a { display: flex; flex-direction: column; gap: 4px; border-radius: 14px; padding: 14px 16px; background: #F3F5F4; color: var(--ink); }
.wdg-kpis a:hover { text-decoration: none; background: #EBF1EF; }
.wdg-kpis small { font-size: 13px; color: #4A5957; font-weight: 600; }
.wdg-kpis b { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.wdg-kpis span { font-size: 13px; color: #4A5957; }
.wdg-kpis a.warn { background: #FFF4E6; } .wdg-kpis a.warn span { color: #9A3412; font-weight: 700; }
.wdg-kpis a.bad { background: #FDECEA; } .wdg-kpis a.bad span { color: #A1221A; font-weight: 700; }
.up-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 150px; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid #EEF1F0; color: var(--ink); }
.up-row:hover { text-decoration: none; background: #FAFCFB; }
.up-day { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 54px; border-radius: 12px; background: #F0F3F2; }
.up-day.today { background: var(--primary); color: #fff; }
.up-day.in { background: #E8F0FF; color: #1E40AF; }
.up-day small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.up-day b { font-size: 21px; font-weight: 800; line-height: 1; }
.up-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.up-main b { font-size: 15px; }
.up-main small { font-size: 13px; color: var(--muted); }
.up-num { font-family: var(--mono); font-size: 12px; color: #4A5957; background: #F0F3F2; border-radius: 6px; padding: 2px 6px; margin-right: 6px; }
.up-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; font-size: 12px; color: var(--muted); }
.bar { width: 100%; max-width: 130px; height: 6px; border-radius: 6px; background: #E6ECEA; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--primary); }
.bar.big { max-width: none; height: 8px; }
.todo-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 12px; border-radius: 12px; background: #F3F5F4; color: var(--ink); margin-top: 8px; }
.todo-item:hover { text-decoration: none; background: #EBF1EF; }
.todo-item.warn { background: #FFF4E6; }
.todo-item.bad { background: #FDECEA; }
.todo-item .ti { flex: none; width: 30px; height: 30px; border-radius: 9px; background: #fff; display: grid; place-items: center; color: var(--primary); }
.todo-item.warn .ti { color: #9A3412; } .todo-item.bad .ti { color: #A1221A; }
.todo-item span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.todo-item span small { color: #4A5957; font-size: 13px; }
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini-grid a, .mini-grid div { display: flex; flex-direction: column; background: #F3F5F4; border-radius: 12px; padding: 10px 12px; color: var(--ink); }
.mini-grid a:hover { text-decoration: none; background: #EBF1EF; }
.mini-grid b { font-size: 24px; font-weight: 800; }
.mini-grid small { font-size: 12.5px; color: #4A5957; }
.prep-line { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; color: var(--ink); }
.prep-line:hover { text-decoration: none; }
.prep-line > span { display: flex; justify-content: space-between; font-size: 14px; }
.crew-line { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 0; }
.crew-line .ini { width: 30px; height: 30px; border-radius: 50%; background: #E3F1F0; color: #00605F; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.crew-line > span { flex: 1; min-width: 0; }
.exp-line { display: grid; grid-template-columns: 130px minmax(0, 1fr) 84px; gap: 10px; align-items: center; font-size: 13.5px; margin-top: 8px; }
.exp-line .bar { max-width: none; height: 8px; } .exp-line .bar > i { background: #E3A23B; }
.exp-line b { text-align: right; }
@media (max-width: 760px) {
  .side { width: 248px; padding-top: 14px; }
  .topbar { padding: 1rem 1rem .25rem; }
  .content { padding: 1rem 1rem 3rem; }
  .flash { margin: .5rem 1rem 0; }
  .up-row { grid-template-columns: 52px minmax(0, 1fr); }
  .up-side { grid-column: 2; align-items: flex-start; }
  .dash-head .hello h1 { font-size: 24px; }
}
/* editor del preventivo più compatto: si vede anche la colonna Totale */
@media (min-width: 761px) { .editor-grid { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); } }
.catalog { border-radius: 14px; }
.editor-table td, .editor-table th { padding-left: .4rem; padding-right: .4rem; }
.editor-table .w-num { width: 3.6rem; }
.editor-table .w-price { width: 5rem; }
.editor-table select[data-field=apply_factor] { padding-left: .35rem; padding-right: .2rem; }
@media (max-width: 760px) {
  .wdg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .wdg-kpis a { padding: 10px 12px; }
  .wdg-kpis b { font-size: 26px; }
  .wdg-kpis small { font-size: 12px; }
  .wdg-body { padding: 14px 14px 16px; }
}

/* riquadro "La settimana" e "Prossima uscita" (tutti gli aspetti) */
.wk { display: grid; grid-template-columns: minmax(160px, 220px) repeat(7, minmax(70px, 1fr)); row-gap: 6px; min-width: 760px; }
.wk-day { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 12px; color: #3E4148; }
.wk-day small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.wk-day b { font-size: 20px; line-height: 1; }
.wk-day.today { background: var(--ink); color: #fff; }
.wk-name { grid-column: 1; display: flex; flex-direction: column; justify-content: center; padding-right: 10px; color: var(--ink); min-width: 0; }
.wk-name:hover { text-decoration: none; color: var(--primary); }
.wk-name small { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.wk-name b { font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-bar { display: flex; align-items: center; gap: 8px; margin: 3px; padding: 0 12px; min-height: 42px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; overflow: hidden; white-space: nowrap; }
.wk-bar:hover { text-decoration: none; filter: brightness(1.08); }
.wk-bar span { overflow: hidden; text-overflow: ellipsis; }
.wk-bar em { margin-left: auto; font-style: normal; font-weight: 500; font-size: 12px; opacity: .85; }
.wk-bar.wk-confermato { background: #22703f; }
.wk-bar.wk-opzione { background: repeating-linear-gradient(-45deg, #F0953A 0 8px, #FFD9B3 8px 16px); color: #16181B; }
.wk-bar.wk-in_corso { background: #0f6aa6; }
.wk-bar.wk-rientrato { background: #5A2F9E; }
.wk-bar.wk-chiuso { background: #5f6b6f; }
.nextcase { background: #FFC93C; border-radius: inherit; display: flex; flex-direction: column; gap: 12px; color: #16181B; }
.nc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.nc-tag { font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: .14em; background: #16181B; color: #FFC93C; padding: 4px 8px; border-radius: 4px; align-self: flex-start; }
.nc-when { font-family: var(--mono); font-size: 12.5px; }
.nc-name { font-weight: 800; font-size: 26px; line-height: 1.05; letter-spacing: -.02em; color: #16181B; }
.nc-name:hover { color: #16181B; }
.nc-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; border-top: 2px solid #16181B; padding-top: 10px; }
.nc-facts small { display: block; font-size: 12px; color: #4A4630; }
.nc-facts b { font-size: 21px; }
.nc-code { height: 30px; background: repeating-linear-gradient(90deg, #16181B 0 2px, transparent 2px 5px, #16181B 5px 6px, transparent 6px 9px, #16181B 9px 12px, transparent 12px 14px); }
.nc-btn.btn { background: #16181B; color: #fff; border-color: #16181B; border-radius: 30px; justify-content: center; min-height: 46px; }
.nc-btn.btn:hover { background: #2A2D33; }

/* scelta dell'aspetto nel profilo */
.theme-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.theme-opt { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.theme-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,120,122,.15); }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt small { color: var(--muted); }
.theme-prev { display: grid; grid-template-columns: 26% 1fr; grid-template-rows: 1fr 1fr; gap: 4px; height: 70px; border-radius: 8px; overflow: hidden; margin-bottom: 6px; background: #F3F5F4; padding: 4px; }
.theme-prev i { border-radius: 4px; background: #fff; }
.th-classico .theme-prev i:first-child { grid-row: 1 / 3; background: #0F2627; }
.th-flight .theme-prev { grid-template-columns: 1fr 1fr; grid-template-rows: 14px 1fr; background: #ECEAE4; }
.th-flight .theme-prev i:first-child { grid-column: 1 / 3; background: #16181B; box-shadow: inset 0 -3px 0 #FFC93C; }
.th-flight .theme-prev i:last-child { background: #FFC93C; }

/* ======================================================================
   Aspetto «Flight case» (proposta 2): barra in alto nera e gialla, etichette da baule
   ====================================================================== */
body.theme-flight {
  --ink: #16181B; --muted: #5E6168; --line: #DDD9CF; --bg: #ECEAE4; --card: #fff;
  --side: #16181B; --side-ink: #B9BDC3; --primary: #006B67; --accent: #FFC93C;
  --radius: 22px; --shadow: 0 1px 0 #D9D6CE;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  background: var(--bg);
}
.theme-flight h1, .theme-flight h2, .theme-flight .pv-name h1, .theme-flight .dash-head h1, .theme-flight .nc-name, .theme-flight .kpi b, .theme-flight .wdg-kpis b, .theme-flight .wk-day b {
  font-family: "Bricolage Grotesque", var(--font); }
.theme-flight .topbar h1 { font-size: 2.1rem; letter-spacing: -.025em; }
.theme-flight .dash-head h1 { font-size: 40px; letter-spacing: -.025em; }
.theme-flight .dash-head .hello small { font-family: var(--mono); letter-spacing: .1em; }
.theme-flight .card, .theme-flight .wdg { border: 0; border-radius: 22px; box-shadow: var(--shadow); }
.theme-flight .btn { border-radius: 30px; border: 2px solid var(--ink); background: transparent; }
.theme-flight .btn:hover { background: #fff; }
.theme-flight .btn.primary { background: #FFC93C; border-color: #FFC93C; color: #16181B; }
.theme-flight .btn.primary:hover { background: #F5B921; border-color: #F5B921; }
.theme-flight .btn.ghost { border-color: transparent; color: var(--ink); }
.theme-flight .btn.small { border-width: 1px; }
.theme-flight .btn.danger:not(.ghost) { border-color: #E2A097; }
.theme-flight input, .theme-flight select, .theme-flight textarea { border-radius: 12px; border-color: #CFCABE; }
.theme-flight .table th { font-family: var(--mono); font-weight: 600; font-size: .72rem; letter-spacing: .1em; }
.theme-flight .kpi, .theme-flight .wdg-kpis a, .theme-flight .pv-kpis .kpi { background: #F3F1EA; border-color: transparent; }
.theme-flight .wdg-kpis a:hover { background: #ECE8DC; }
.theme-flight .wdg-kpis a.warn, .theme-flight .pv-kpis .kpi.warn { background: #FFE9B0; }
.theme-flight .todo-item { background: #F3F1EA; border-radius: 4px; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.theme-flight .todo-item:nth-child(odd) { transform: rotate(-.4deg); } .theme-flight .todo-item:nth-child(even) { transform: rotate(.3deg); }
.theme-flight .todo-item.warn { background: #FFE08A; }
.theme-flight .todo-item.bad { background: #FFD3C7; }
.theme-flight .up-day { background: #F3F1EA; }
.theme-flight .up-day.today { background: var(--ink); color: #FFC93C; }
.theme-flight .up-num, .theme-flight .pv-num { background: var(--ink); color: #FFC93C; border-radius: 4px; letter-spacing: .08em; }
.theme-flight .wk-day.today { background: var(--ink); color: #FFC93C; }
.theme-flight .wdg-bar { background: #F6F4EE; border-color: var(--line); border-radius: 22px 22px 0 0; }
.theme-flight .wdg.editing { outline: 2px dashed var(--ink); outline-offset: 4px; box-shadow: none; }
.theme-flight .dash-add { background: #F6F4EE; border: 2px dashed var(--ink); }
.theme-flight .pv-head { border-radius: 22px; }
.theme-flight .pv-name h1 { font-size: 2.4rem; letter-spacing: -.025em; }
.theme-flight .sp-switch a { border: 0; background: #fff; border-radius: 30px; }
.theme-flight .sp-switch a.active { background: #FFC93C; color: #16181B; }
.theme-flight .sp-switch a.active svg { color: #16181B; }
.theme-flight .pv[data-mode=schede] .pv-nav { background: #fff; border: 0; border-radius: 30px; padding: 5px; gap: 4px; margin-top: .8rem; box-shadow: var(--shadow); }
.theme-flight .pv[data-mode=schede] .pv-nav a { border: 0; border-radius: 30px; padding: .55rem 1rem; margin: 0; }
.theme-flight .pv[data-mode=schede] .pv-nav a.active { background: var(--ink); color: #fff; }
.theme-flight .pv[data-mode=schede] .pv-nav a.active .cnt { background: #FFC93C; color: #16181B; }
.theme-flight .editor-table tr.grp-head > td { background: #F6F4EE; }
.theme-flight .editor-table .grp-name, .theme-flight .grp-label { font-family: var(--mono); font-weight: 600; letter-spacing: .08em; }
.theme-flight .badge { border-radius: 6px; }
.theme-flight .flash-ok { background: #FFE9B0; color: #16181B; }
.theme-flight .side-search { background: #26292E; border-radius: 30px; }
.theme-flight .brand { border-radius: 10px; }
.theme-flight .side nav a.active { background: transparent; color: #fff; box-shadow: inset 0 -3px 0 #FFC93C; border-radius: 0; }
.theme-flight .side nav a .nav-cnt { background: #FFC93C; color: #16181B; font-family: var(--mono); border-radius: 4px; }
.theme-flight .me .avatar { background: var(--primary); }
/* su schermi grandi la barra laterale diventa una barra in alto */
@media (min-width: 761px) {
  .theme-flight .app { flex-direction: column; }
  .theme-flight .side { position: sticky; top: 0; z-index: 40; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 28px 16px; }
  .theme-flight .side::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: repeating-linear-gradient(-45deg, #FFC93C 0 14px, #16181B 14px 28px); }
  .theme-flight .brand { flex-direction: row; align-items: center; padding: 6px 12px; }
  .theme-flight .brand img { width: auto; height: 26px; }
  .theme-flight .brand small { display: none; }
  .theme-flight .side nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 520px; overflow: visible; gap: 0; order: 2; }
  .theme-flight .side nav a { padding: .55rem .7rem; font-size: 14.5px; }
  .theme-flight .side nav a .ic { display: none; }
  .theme-flight .nav-sep { display: none; }
  .theme-flight .side-search { order: 3; flex: 0 1 240px; }
  .theme-flight .me { order: 4; border: 0; padding: 0; }
  .theme-flight .me .who { display: none; }
  .theme-flight .main { width: 100%; max-width: 1500px; margin: 0 auto; }
  .theme-flight .topbar .menu-btn { display: none; }
}
.theme-flight .nextcase .nc-btn, .nextcase .nc-btn { background: #16181B; color: #fff; border-color: #16181B; }
.theme-flight .nextcase .nc-btn:hover { background: #2A2D33; color: #fff; }
.wdg:has(.nextcase) { background: #FFC93C; border-color: #F0B92C; }
.theme-flight .mini-grid a, .theme-flight .mini-grid div { background: #F3F1EA; }

/* ---- Verifica usabilità 2026-10: telefono e contrasto ---- */
.scan-manual input { min-width: 0; }
.dash-add form { max-width: 100%; }
.dash-add .btn { white-space: normal; text-align: left; max-width: 100%; height: auto; min-height: 40px; }
@media (max-width: 760px) {
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  a.small[href^="/"], .pv-back { display: inline-flex; align-items: center; min-height: 36px; }
  .tabs a { min-height: 38px; display: inline-flex; align-items: center; }
  .grp-toggle { min-width: 36px; min-height: 36px; }
}
.prep-scan > * { min-width: 0; }
.ftab-rows { table-layout: fixed; width: 100%; }
.ftab-rows input { width: 100%; min-width: 0; box-sizing: border-box; }
.ftab-rows th:last-child, .ftab-rows td:last-child { width: 3rem; }
@media (max-width: 760px) { .ftab-rows th { white-space: normal; font-size: .75rem; } }
@media (max-width: 760px) { .ftab-name { min-width: 0; width: 100%; } }
.pv-top > .pv-name { flex: 1 1 24rem; }
/* Preventivo su schermi 1280-1500 px: colonne più strette, così il Totale resta visibile */
@media (min-width: 761px) and (max-width: 1500px) {
  .editor-grid { grid-template-columns: minmax(210px, 240px) minmax(0, 1fr); }
  .editor-table td.voce { min-width: 11rem; }
  .editor-table .w-num { width: 3.6rem; }
  .editor-table .w-price { width: 5rem; }
  .editor-table tr.line select { max-width: 4.4rem; }
  .editor-table input[data-field=discount] { width: 3.1rem; }
  .editor-table input[data-field=price] { width: 4.6rem; }
  .editor-table td, .editor-table th { padding-left: .3rem; padding-right: .3rem; }
}
.pv-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.editor-table td.voce input.w-full { width: 100%; min-width: 0; }
.vf-meta { display: inline-flex; gap: .35rem; align-items: center; }
.vf-meta select, .vf-meta input[type=date] { padding: .2rem .4rem; font-size: .85rem; min-height: 0; height: 2rem; }
.file-drop [data-file-kind] { max-width: 14rem; }
@media (max-width: 760px) { .files-table td.nowrap { white-space: normal; } .vf-meta { flex-wrap: wrap; } }
/* ---- Contabilità: schede, fatture, compensi, andamento, clienti, noleggiatori ---- */
.fin-tabs { margin-bottom: 1rem; flex-wrap: wrap; }
.fin-month { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.fin-month-title { margin: 0; min-width: 9rem; text-align: center; text-transform: capitalize; }
.acc-kpis a.kpi { text-decoration: none; }
.acc-kpis a.kpi:hover { border-color: var(--primary); }
.inv-pay { display: inline-flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.inv-pay input { padding: .2rem .4rem; height: 2rem; min-height: 0; font-size: .85rem; }
.inv-pay input[type=date] { width: 9.2rem; }
.inv-list tr.row-short td { background: #fff4f2; }
.pay-chip { display: inline-block; margin: .2rem .4rem 0 0; }
.linklike { background: none; border: 0; padding: 0 .2rem; color: var(--danger, #b42318); cursor: pointer; font: inherit; }
.fin-chart-wrap { overflow-x: auto; }
.fin-chart { width: 100%; min-width: 640px; height: auto; display: block; }
.fin-chart .g { stroke: var(--line); stroke-width: 1; }
.fin-chart .ax { fill: var(--muted); font-size: 12px; font-family: inherit; }
.fin-chart .rev { fill: var(--primary); }
.fin-chart .cost { fill: #e0a458; }
.fin-chart .prev { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 5; opacity: .7; }
.fin-legend { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; color: var(--muted); }
.fin-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-left: .5rem; }
.fin-legend i.rev { background: var(--primary); }
.fin-legend i.cost { background: #e0a458; }
.fin-legend i.prev { height: 0; border-top: 2px dashed var(--ink); border-radius: 0; opacity: .7; }
.fin-table tr.dim td { color: var(--muted); }
.cli-bar { min-width: 12rem; }
.cli-bar span { display: block; height: 6px; background: var(--line); border-radius: 4px; margin-bottom: .25rem; }
.cli-bar i { display: block; height: 6px; background: var(--primary); border-radius: 4px; }
.cli-bar b { margin-right: .4rem; }
.sup-card summary { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; cursor: pointer; }
.sup-card summary h2 { margin: 0; }
.inv-form .field small { display: block; margin-top: .2rem; }
.theme-flight .fin-chart .cost { fill: #d38b2c; }
.pay-cell { min-width: 12.5rem; }
.pay-cell .inv-pay { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem; max-width: 15rem; }
.pay-cell .inv-pay input.w-price { width: 100%; }
.pay-cell .inv-pay input[type=date] { width: 100%; grid-column: 1; }
.pay-cell .inv-pay button { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; height: auto; }
.pay-jobs { min-width: 17rem; }
.pay-list .pay-cell { min-width: 9.5rem; }
.pay-list .pay-cell .inv-pay { grid-template-columns: minmax(0, 1fr); max-width: 10rem; }
.pay-list .pay-cell .inv-pay button { grid-column: 1; grid-row: auto; }
.pay-list .pay-jobs { min-width: 14rem; }
/* ---- Notifiche ---- */
.bell { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: inherit; text-decoration: none; flex: none; }
.bell .ic { width: 21px; height: 21px; }
.bell:hover, .bell.active { background: rgba(127, 127, 127, .15); }
.bell-n { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #c2410c; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--side, #0F2627); }
.me .bell { color: #fff; margin-left: auto; }
.topbar .bell-top { display: none; margin-left: auto; color: var(--ink); }
.topbar .bell-top .bell-n { box-shadow: 0 0 0 2px var(--bg); }
@media (max-width: 760px) { .topbar .bell-top { display: inline-grid; } }
.notif-list { padding: 0; overflow: hidden; }
.notif-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: rgba(127, 127, 127, .07); }
.notif-item .notif-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.notif-item .notif-text b { font-weight: 500; }
.notif-item .notif-text small { color: var(--muted); }
.notif-item.unread { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.notif-item.unread .notif-text b { font-weight: 700; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; }
.notif-item.unread .notif-dot { background: var(--primary); }
.notif-prefs input[type=checkbox] { width: 20px; height: 20px; }
.push-box { padding: .2rem 0 .6rem; }
.push-state { font-weight: 600; margin: 0 0 .6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-flight .me .bell { color: #fff; }
@media (min-width: 761px) { .theme-flight .me .bell { margin-left: 0; } }
.profile-link { display: flex; align-items: center; gap: .9rem; text-decoration: none; color: var(--ink); } .profile-link span:nth-child(2) { display: flex; flex-direction: column; flex: 1; } .profile-link .ic { width: 22px; height: 22px; color: var(--primary); }
.me > a { flex: 1 1 auto; min-width: 0; }
.me .who { min-width: 0; }
.me .who strong, .me .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .bell { margin-left: 0; }
.notif-item:hover, .notif-item:hover * { text-decoration: none; }
.num-card .section-head { align-items: baseline; }
.num-preview b { font-family: var(--mono); font-size: 1.05rem; color: var(--primary); }
.num-tokens { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.num-tokens .btn { font-family: var(--mono); font-size: .8rem; }
.num-yearly { display: flex; align-items: center; gap: .5rem; }
/* ---- Appuntamenti ---- */
.pl-bar.appt, .badge.appt { background: #fde4e1; color: #9b1c13; border: 1px solid #f2b3aa; }
.pl-bar.appt { border-left: 3px solid #d63a2b; }
.pl-appts .pl-label a { color: #b42318; font-weight: 700; }
.pl-bg-link { display: block; }
.pl-bg-link:hover { background: color-mix(in srgb, #d63a2b 10%, transparent); outline: 1px dashed #d63a2b; outline-offset: -2px; }
.day-menu { position: absolute; z-index: 60; display: flex; flex-direction: column; min-width: 200px; padding: .4rem; border-radius: 12px; background: var(--card, #fff); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.day-menu b { font-size: .8rem; color: var(--muted); padding: .3rem .6rem .4rem; text-transform: uppercase; letter-spacing: .05em; }
.day-menu a { padding: .65rem .7rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.day-menu a:hover, .day-menu a:focus { background: rgba(127,127,127,.12); outline: none; }
.appt-form .appt-times .appt-time-row { display: flex; align-items: center; gap: .5rem; }
.appt-form .appt-times input { width: 8rem; }
.appt-staff { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.appt-staff legend { font-weight: 600; padding: 0 .3rem; }
.appt-staff-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.appt-staff-tools input { flex: 1 1 14rem; }
.appt-staff-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem 1.4rem; max-height: 360px; overflow: auto; }
.appt-group { display: flex; flex-direction: column; gap: .15rem; }
.appt-group > b { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .2rem; }
.appt-person { display: flex; gap: .5rem; align-items: flex-start; padding: .3rem .2rem; border-radius: 6px; cursor: pointer; }
.appt-person:hover { background: rgba(127,127,127,.08); }
.appt-person input { margin-top: .2rem; width: 18px; height: 18px; flex: none; }
.appt-busy { display: block; font-style: normal; font-size: .78rem; color: var(--warn); }
.appt-list { padding: 0; overflow: hidden; }
.appt-item { display: flex; gap: 1rem; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.appt-item:last-child { border-bottom: 0; }
.appt-item:hover { background: rgba(127,127,127,.06); }
.appt-date { flex: none; width: 52px; height: 52px; border-radius: 12px; background: #fde4e1; color: #9b1c13; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.appt-date b { font-size: 1.3rem; }
.appt-date small { font-size: .72rem; text-transform: uppercase; font-weight: 700; margin-top: .15rem; }
.appt-date.big { width: 68px; height: 68px; }
.appt-date.big b { font-size: 1.7rem; }
.appt-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.appt-main small { color: var(--muted); }
.appt-view-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.appt-view-head h2 { margin: 0; }
.appt-when { margin: .2rem 0 0; font-weight: 600; text-transform: capitalize; }
.appt-notify-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .8rem; }
.appt-notify-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.appt-notify-row b { min-width: 11rem; }
.theme-flight .pl-bar.appt { color: #8a1910; }
/* il titolo di un appuntamento di un giorno resta leggibile anche se la colonna è stretta */
/* appuntamenti: il testo va a capo dentro la barra (massimo 2 righe, poi «…»); tutto il testo nel tooltip */
.pl-bar.appt { white-space: normal; overflow: hidden; z-index: 1; }
.pl-bar.appt > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: break-word; line-height: 1.25; }
/* barra troppo stretta per leggere (planning di un mese): solo il blocco rosso, il testo nel tooltip */
.pl-bar.appt.tiny { font-size: 0; padding: 0; min-height: 22px; }
.appt-form .appt-allday { display: flex; align-items: center; gap: .5rem; align-self: end; min-height: 42px; }
.appt-form label.appt-allday { flex-direction: row; justify-content: flex-start; padding-top: 1.4rem; } .appt-form label.appt-allday input { width: 20px; height: 20px; margin: 0; }
.tv-link-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.2rem; align-items: start; margin-bottom: .8rem; }
.tv-how { margin: .8rem 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .3rem; }
@media (max-width: 700px) { .tv-link-grid { grid-template-columns: 1fr; } }

/* ======================================================================
   Schermi larghi (monitor 24"–34", 1920px e oltre): le pagine con tabelle,
   planning e dashboard usano tutta la larghezza disponibile
   ====================================================================== */
@media (min-width: 1700px) {
  .content { max-width: 1280px; padding-left: 2rem; padding-right: 2rem; }
  .content.wide { max-width: 2100px; }
  .content.wide.settings { max-width: 1600px; }
  .theme-flight .main { max-width: 2100px; }
}
@media (min-width: 2300px) {
  .content.wide { max-width: 2400px; }
  .theme-flight .main { max-width: 2400px; }
}

/* ======================================================================
   Telefono: «Oggi in magazzino» e barra in basso
   ====================================================================== */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(16, 38, 39, .06); }
  .tabbar a, .tabbar button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px;
    border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 12px; cursor: pointer; text-decoration: none; }
  .tabbar .ic { width: 24px; height: 24px; }
  .tabbar a.on { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
  .main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .editor-bar [data-paste]:not([hidden]) { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media print { .tabbar { display: none !important; } }

.m-home { display: flex; flex-direction: column; gap: 18px; max-width: 640px; }
.m-hello small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.m-hello h1 { margin: 2px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.m-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-act { display: flex; flex-direction: column; gap: 2px; padding: 14px 14px 12px; min-height: 96px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.m-act .ic { width: 28px; height: 28px; color: var(--primary); margin-bottom: auto; }
.m-act b { font-size: 16.5px; margin-top: 8px; }
.m-act small { color: var(--muted); font-size: 12.5px; }
.m-act-main { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; min-height: 84px; background: var(--primary); border-color: var(--primary); color: var(--primary-ink, #fff); }
.m-act-main .ic { color: inherit; width: 36px; height: 36px; margin: 0; }
.m-act-main b { margin: 0; font-size: 20px; }
.m-act-main small { color: inherit; opacity: .85; margin-left: auto; }
.m-act-warn .ic { color: var(--danger); }
.m-sec { display: flex; flex-direction: column; gap: 10px; }
.m-sec > h2 { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 0; font-size: 19px; font-weight: 800; }
.m-sec > h2 small { font-size: 13px; font-weight: 600; color: var(--muted); }
.m-sec > h2 a { margin-left: auto; font-size: 14px; font-weight: 600; }
.m-empty { margin: 0; padding: 14px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.m-job { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--primary); border-radius: 16px; overflow: hidden; }
.m-job.m-in { border-left-color: #3B6FD8; }
.m-job.m-late { border-left-color: var(--danger); }
.m-job-main { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; color: var(--ink); text-decoration: none !important; }
.m-job-main b { font-size: 17px; line-height: 1.25; }
.m-job-main small { color: var(--muted); font-size: 13px; }
.m-job-top { display: flex; align-items: center; gap: 8px; }
.m-tag { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.m-in .m-tag { color: #3B6FD8; } .m-late .m-tag { color: var(--danger); }
.m-time { margin-left: auto; font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--ink); }
.m-prog { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.m-prog .bar { flex: 1; max-width: none; }
.m-in .m-prog .bar > i { background: #3B6FD8; }
.m-job-actions { display: flex; gap: 8px; padding: 0 12px 12px; }
.m-job-actions .btn { flex: 1; justify-content: center; min-height: 48px; font-size: 15px; border-radius: 12px; }
.m-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.m-list a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: var(--ink); border-top: 1px solid var(--line); text-decoration: none !important; }
.m-list a:first-child { border-top: 0; }
.m-list a > span:first-child { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.m-list small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-full { text-align: center; margin: 4px 0 0; font-size: 14px; }
.m-back { display: inline-block; margin-bottom: 8px; font-weight: 600; }
.m-in .m-job-actions .btn.primary, .m-late .m-job-actions .btn.primary { background: #3B6FD8; border-color: #3B6FD8; color: #fff; }

/* Progetti aperti: linguette in alto per tornare al progetto che stavi usando */
.open-tabs { display: flex; gap: 6px; padding: 10px 1.5rem 0; overflow-x: auto; scrollbar-width: none; }
.open-tabs::-webkit-scrollbar { display: none; }
.open-tabs[hidden] { display: none; }
.open-tab { display: inline-flex; align-items: center; flex: none; max-width: 260px; border: 1px solid var(--line); background: var(--card); border-radius: 9px; box-shadow: var(--shadow); border-left: 3px solid var(--primary); }
.open-tab.ot-opzione { border-left-color: #E8892B; } .open-tab.ot-confermato { border-left-color: #2F9E5A; } .open-tab.ot-in_corso { border-left-color: #3B9BD8; } .open-tab.ot-chiuso, .open-tab.ot-annullato { border-left-color: #9AA5A3; }
.open-tab a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 4px 6px 10px; font-size: 13px; font-weight: 600; color: var(--primary); text-decoration: none; }
.open-tab a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-tab .ic { width: 16px; height: 16px; flex: none; }
.open-tab-x { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; border-radius: 7px; cursor: pointer; }
.open-tab-x:hover { color: var(--ink); background: rgba(127, 127, 127, .12); }
@media (min-width: 1700px) { .open-tabs { padding-left: 2rem; padding-right: 2rem; } }
@media (max-width: 760px) { .open-tabs { padding: 8px 1rem 0; } .open-tab { max-width: 200px; } }
@media print { .open-tabs { display: none !important; } }

/* Editor del preventivo: i numeri (quantità, prezzo, km, sconto) si leggono interi.
   Niente frecce su/giù nei campi (rubano spazio alle cifre); campi più larghi dove c'è posto */
.editor-table input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.editor-table input[type=number]::-webkit-outer-spin-button, .editor-table input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.editor-table .w-num { width: 4.4rem; }
.editor-table .w-price { width: 6.4rem; }
.editor-table input[data-field=discount] { width: 3.6rem; }
@media (min-width: 1500px) { .editor-table .w-num { width: 5rem; } .editor-table .w-price { width: 7rem; } }
@media (min-width: 761px) and (max-width: 1100px) { .editor-table .w-num { width: 3.9rem; } .editor-table .w-price { width: 5.8rem; } }
/* riquadri numerici del progetto: le righe sotto il numero vanno a capo invece di finire con «…» */
.kpi span { white-space: normal; overflow: visible; }
.kpi b { white-space: normal; overflow-wrap: anywhere; }
/* testi interi invece di «…»: nomi nel planning (fino a 2 righe), suggeriti del catalogo, voci delle spese */
.pl-label a { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.25; }
.pl-label small { white-space: normal; line-height: 1.2; }
.cat-name small { white-space: normal; overflow: visible; }
.exp-line > span { white-space: normal; overflow: visible; line-height: 1.2; }
.cexp-bar span { white-space: normal; overflow: visible; line-height: 1.2; }
@media (min-width: 761px) { .pv[data-mode=schede] .pv-nav { flex-wrap: wrap; overflow-x: visible; } } /* schede del progetto: vanno a capo invece di sparire a destra */
.rm-badge { background: #EDE7F6; color: #5B2BA6; font-size: .7rem; }
.fn-merge { margin-top: .8rem; }
.fn-merge-form { display: flex; flex-direction: column; gap: .6rem; margin-top: .6rem; }
.fn-merge-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .2rem 1rem; max-height: 320px; overflow: auto; padding: .4rem; border: 1px solid var(--line); border-radius: 10px; }
.fn-merge-form .field.inline { align-self: flex-start; }
.fn-merge-form > .btn { align-self: flex-start; }
.fn-merge-tools { display: flex; flex-wrap: wrap; gap: .3rem; }
.fn-merge-join { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; padding-top: .6rem; border-top: 1px solid var(--line); }
.fn-merge-list label.dim { opacity: .6; }
.fn-bulk { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .55rem .7rem; margin: .4rem 0 .6rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft, rgba(127,127,127,.05)); position: sticky; top: 0; z-index: 3; }
.fn-bulk > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.fn-bulk select { max-width: 16rem; }
td.fn-sel { width: 2rem; text-align: center; vertical-align: middle; }
td.fn-sel input { width: 18px; height: 18px; }
/* personale e trasporti: il nome nel preventivo si scrive direttamente sulla riga */
.fn-desc-wrap { display: flex; align-items: center; gap: .35rem; }
.editor-table tr.line input.fn-desc { flex: 1; min-width: 8rem; font-weight: 700; border-color: transparent; background: transparent; padding-left: .3rem; }
.editor-table tr.line input.fn-desc::placeholder { color: var(--ink); opacity: 1; }
.editor-table tr.line input.fn-desc:hover, .editor-table tr.line input.fn-desc:focus { border-color: var(--line); background: var(--card); }
.editor-table tr.line input.fn-desc:focus::placeholder { color: var(--muted); }
.fn-of { padding-left: 1.6rem; }

/* Suggerimenti imparati dallo storico */
.suggest.learned { border-color: #c9dcf5; background: #f4f8fe; margin-top: .5rem; }
.suggest.learned .suggest-head b { color: #2b5ea7; }
.learn-hint { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .82rem; color: #2b5ea7; background: #eef4fd; border-radius: 8px; padding: .25rem .5rem; }
.learn-alert { margin-bottom: .8rem; }
.m-watch { font-size: 12.5px; font-weight: 600; color: #2b5ea7; margin-top: 4px; }
.suggest.learned .suggest-head { background: #f4f8fe; border-bottom-color: #c9dcf5; }
/* «non serve» sui suggerimenti dello storico */
.suggest-item.has-hide { position: relative; }
.suggest-item.has-hide .cat-name b { padding-right: 1.4rem; }
.learn-hide { position: absolute; top: .2rem; right: .2rem; width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.learn-hide:hover { background: rgba(127,127,127,.15); color: var(--danger); }
.learn-page .card h2 small { font-weight: 500; }
.learn-pairs td:first-child, .learn-pairs td:nth-child(2) { min-width: 12rem; }
.pv-kpis[hidden] { display: none !important; }

/* ======================================================================
   Aspetto «Territorio» (proposta 4): chiaro e fresco, barra bianca in alto con
   voci a pillola, carattere Outfit, schede molto arrotondate, accento corallo
   ====================================================================== */
body.theme-territorio {
  --ink: #102A43; --muted: #52677A; --line: #DCE6EC; --bg: #F2F6F8; --card: #fff; --bg-soft: #F2F6F8;
  --side: #fff; --side-ink: #334E68; --primary: #0B6E6B; --primary-ink: #fff; --accent: #E5533D;
  --danger: #B4321F; --warn: #8A5200; --ok: #1F7A4D;
  --radius: 22px; --shadow: 0 1px 2px rgba(16,42,67,.06), 0 8px 30px rgba(16,42,67,.05);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;
  background: var(--bg);
}
.theme-territorio h1, .theme-territorio .pv-name h1, .theme-territorio .dash-head h1 { font-weight: 800; letter-spacing: -.02em; }
.theme-territorio .topbar h1 { font-size: 2rem; }
.theme-territorio .card, .theme-territorio .wdg { border: 0; border-radius: 24px; box-shadow: var(--shadow); }
.theme-territorio .pv-head { border-radius: 26px; }
.theme-territorio .btn { border-radius: 30px; border-color: #C9D8E1; }
.theme-territorio .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.theme-territorio .btn.primary:hover { background: #08504E; border-color: #08504E; }
.theme-territorio input, .theme-territorio select, .theme-territorio textarea { border-radius: 14px; border-color: #C9D8E1; }
.theme-territorio .badge { border-radius: 20px; }
.theme-territorio .kpi, .theme-territorio .wdg-kpis a, .theme-territorio .pv-kpis .kpi { background: #F2F6F8; border-color: transparent; border-radius: 18px; }
.theme-territorio .kpi.warn, .theme-territorio .wdg-kpis a.warn, .theme-territorio .pv-kpis .kpi.warn { background: #FFF1EC; }
.theme-territorio .wdg-bar { background: #F7FAFB; border-radius: 24px 24px 0 0; }
.theme-territorio .table th { color: var(--muted); }
.theme-territorio .up-day { background: #F2F6F8; border-radius: 14px; }
.theme-territorio .up-day.today { background: var(--primary); color: #fff; }
.theme-territorio .pv[data-mode=schede] .pv-nav a.active { color: var(--primary); border-bottom-color: var(--accent); }
.theme-territorio .tabs a.active, .theme-territorio .seg-mini a.active { color: var(--primary); }
.theme-territorio .flash-ok { background: #E1F2F1; color: #0B4F4D; }
.theme-territorio .open-tab { border-radius: 30px; }
.theme-territorio .m-act { border-radius: 22px; }
/* barra laterale (telefono) e barra in alto (computer): bianche */
.theme-territorio .side { background: #fff; color: var(--side-ink); border-right: 1px solid var(--line); }
.theme-territorio .brand { color: var(--ink); }
.theme-territorio .side nav a { color: #334E68; border-radius: 30px; }
.theme-territorio .side nav a:hover { background: #F2F6F8; color: var(--ink); }
.theme-territorio .side nav a.active { background: #E1F2F1; color: var(--primary); box-shadow: none; }
.theme-territorio .side nav a .nav-cnt { background: var(--accent); color: #fff; }
.theme-territorio .nav-sep { color: var(--muted); }
.theme-territorio .side-search { background: #F2F6F8; border-radius: 30px; color: var(--muted); }
.theme-territorio .side-search input { color: var(--ink); }
.theme-territorio .me { border-top-color: var(--line); }
.theme-territorio .me a, .theme-territorio .me .bell { color: var(--ink); }
.theme-territorio .me small, .theme-territorio .me .icon-btn { color: var(--muted); }
.theme-territorio .me .avatar { background: #FFE3DC; color: #A3341E; }
@media (min-width: 761px) {
  .theme-territorio .app { flex-direction: column; }
  .theme-territorio .side { position: sticky; top: 0; z-index: 40; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .theme-territorio .brand { flex-direction: row; align-items: center; padding: 4px 8px; background: transparent; }
  .theme-territorio .brand img { width: auto; height: 28px; }
  .theme-territorio .brand small { display: none; }
  .theme-territorio .side nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 520px; overflow: visible; gap: 2px; order: 2; padding: 0; }
  .theme-territorio .side nav a { padding: .5rem .85rem; font-size: 15px; font-weight: 600; }
  .theme-territorio .side nav a .ic { display: none; }
  .theme-territorio .nav-sep { display: none; }
  .theme-territorio .side-search { order: 3; flex: 0 1 240px; margin: 0; }
  .theme-territorio .me { order: 4; border: 0; padding: 0; }
  .theme-territorio .me .who { display: none; }
  .theme-territorio .main { width: 100%; max-width: 1500px; margin: 0 auto; }
  .theme-territorio .topbar .menu-btn { display: none; }
}
@media (min-width: 1700px) { .theme-territorio .main { max-width: 2100px; } }
@media (min-width: 2300px) { .theme-territorio .main { max-width: 2400px; } }
/* anteprima nella scelta dell'aspetto */
.th-territorio .theme-prev { grid-template-columns: 1fr 1fr; grid-template-rows: 14px 1fr; background: #F2F6F8; }
.th-territorio .theme-prev i { border-radius: 10px; }
.th-territorio .theme-prev i:first-child { grid-column: 1 / 3; background: #fff; box-shadow: inset 0 -2px 0 #DCE6EC; border-radius: 4px; }
.th-territorio .theme-prev i:nth-child(2) { background: #E1F2F1; }
.th-territorio .theme-prev i:last-child { background: #fff; box-shadow: inset 4px 0 0 #E5533D; }
.theme-territorio .side-search input::placeholder { color: var(--muted); }
/* intestazioni ordinabili */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
th.sortable::after { content: "↕"; margin-left: .35em; opacity: .35; font-size: .9em; }
th.sortable[aria-sort=ascending]::after { content: "↑"; opacity: .9; color: var(--primary); }
th.sortable[aria-sort=descending]::after { content: "↓"; opacity: .9; color: var(--primary); }
.wk-phase { color: var(--primary); } .wk-long { margin: .6rem 0 0; }
/* riquadro «Oggi in magazzino» sulla dashboard (come sul telefono) */
.wdg-oggi .oggi-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.wdg-oggi h3 { margin: 0 0 8px; font-size: 15px; }
.wdg-oggi .oggi-cols > div { display: flex; flex-direction: column; gap: 10px; }
/* Impostazioni → App del telefono */
.phone-prev { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.phone-side { display: flex; flex-direction: column; gap: 8px; width: 220px; }
.phone-side .btn { justify-content: flex-start; }
.phone-frame { width: 390px; height: 800px; max-width: 100%; border: 12px solid #111; border-radius: 44px; overflow: hidden; background: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.phone-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Scansione: uscita / rientro manuale con selezione dall'elenco */
.scan-listhead { display: flex; align-items: center; gap: .6rem; justify-content: space-between; margin-top: .25rem; }
.scan-picktools { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.scan-picktools [data-pick-hint] { flex: 1 1 12rem; }
.scan-row.pickrow { grid-template-columns: auto minmax(0, 1fr) auto auto; cursor: pointer; }
.scan-row.pickrow .progress { grid-column: 2 / -1; }
.scan-row.pickrow.on { background: color-mix(in srgb, var(--primary) 9%, var(--card)); }
.scan-row .pick-name { min-width: 0; overflow-wrap: anywhere; }
.pick-check { display: grid; place-items: center; width: 2rem; height: 2rem; margin: -.25rem 0; }
.pick-check input { width: 1.35rem; height: 1.35rem; accent-color: var(--primary); }
.pick-qty { width: 4.2rem; text-align: right; font-variant-numeric: tabular-nums; font-size: 1rem; padding: .35rem .45rem; }
.scan-pickbar { position: sticky; bottom: .5rem; z-index: 30; display: flex; align-items: center; gap: .75rem; justify-content: space-between;
  padding: .6rem .7rem .6rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(16, 38, 39, .14); font-weight: 600; }
.scan-pickbar[hidden], .scan-picktools[hidden] { display: none; }
.scan-pickbar .btn { min-height: 46px; padding-inline: 1.1rem; font-weight: 700; }
.scan-pickbar .btn.pick-out { background: #5a2f9e; border-color: #5a2f9e; color: #fff; }
.scan-pickbar .btn.pick-in { background: #22673e; border-color: #22673e; color: #fff; }
.scan-pickbar .btn:disabled { opacity: .45; }
@media (max-width: 760px) { .scan-pickbar { bottom: calc(70px + env(safe-area-inset-bottom)); } }

/* Fotocamera: posteriore in diretta oppure foto scattata con l'app del telefono */
.camera-acts { display: flex; flex-direction: column; align-items: center; gap: .55rem; padding: 1rem; position: relative; z-index: 2; }
.camera-acts .btn { min-height: 46px; }
.camera-acts .camera-photo { cursor: pointer; }
.scan-camera.on .camera-acts { position: absolute; left: .6rem; right: .6rem; bottom: .6rem; padding: 0; flex-direction: row; justify-content: flex-end; flex-wrap: wrap; }
.scan-camera.on .camera-acts .camera-btn { position: static; opacity: .9; }
.scan-camera.on .camera-acts .camera-photo { display: none; }
.camera-switch[hidden] { display: none; }
.prep-cam { position: relative; }
.prep-cam .camera-switch { position: absolute; right: .5rem; bottom: .5rem; z-index: 2; background: rgba(255,255,255,.9); }
.prep-scan label.btn { cursor: pointer; }

/* Popup di scelta dei sottoprogetti per preventivi e DDT */
.sp-pick { border: 0; border-radius: 14px; padding: 1.2rem 1.3rem; max-width: min(92vw, 380px); background: var(--card, #fff); color: inherit; box-shadow: 0 20px 50px rgba(10, 20, 30, .25); }
.sp-pick::backdrop { background: rgba(10, 20, 30, .45); }
.sp-pick h3 { margin: 0 0 .3rem; }
.sp-pick-row { display: flex; gap: .5rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.sp-pick-acts { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

/* Copia di prova (AMBIENTE=prova): banda sempre visibile per non confonderla con il software vero */
.prova-banner { position: sticky; top: 0; z-index: 1000; background: repeating-linear-gradient(-45deg, #FFD43B 0 14px, #FFC107 14px 28px); color: #1a1a1a; font-weight: 700; text-align: center; padding: .35rem .8rem; font-size: .85rem; letter-spacing: .02em; }
@media print { .prova-banner { display: none; } }
