:root {
  --bg: #f3f5f8; --panel: #ffffff; --ink: #18212f; --ink2: #4a5568; --ink3: #7b8698; --line: #e1e6ee; --line2: #eef1f5;
  --navy: #1f3b63; --navy2: #2b4f80; --accent: #e0592a; --ok: #1f9d55; --warn: #d98a00; --bad: #d23c3c; --info: #2f6fde;
  --r: 10px; --sh: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08); --sh2: 0 12px 32px rgba(16,24,40,.18);
  --side: 232px; font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Segoe UI", Roboto, system-ui, -apple-system, Arial, sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.12rem; } h3 { font-size: .98rem; }
.muted { color: var(--ink3); } .small { font-size: .84rem; } .tiny { font-size: .76rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #dfe7f3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 20px 18px 16px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: .9rem; letter-spacing: -.03em; }
.brand b { display: block; color: #fff; font-size: 1rem; } .brand span { font-size: .75rem; opacity: .7; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #c9d5e6; text-decoration: none; font-weight: 500; }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: rgba(255,255,255,.13); color: #fff; }
.nav a .cnt { margin-left: auto; background: var(--accent); color: #fff; border-radius: 10px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }
.who { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; gap: 10px; align-items: center; }
.who .n { flex: 1; min-width: 0; } .who b { display: block; color: #fff; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who button { background: none; border: 0; color: #c9d5e6; cursor: pointer; padding: 6px; border-radius: 6px; }
.who button:hover { background: rgba(255,255,255,.1); }
.main { min-width: 0; padding: 22px 28px 60px; }
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.top h1 { margin-right: auto; }
.mobilebar, .bottomnav { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c6cfdc; background: #fafbfc; }
.btn.pri { background: var(--navy); border-color: var(--navy); color: #fff; } .btn.pri:hover { background: var(--navy2); }
.btn.acc { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); } .btn.danger:hover { background: #fff3f3; border-color: #f0c4c4; }
.btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--line2); }
.btn.sm { padding: 5px 10px; font-size: .82rem; } .btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; outline: none; min-height: 38px; }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--info); box-shadow: 0 0 0 3px rgba(47,111,222,.15); }
label.f { display: block; font-size: .8rem; font-weight: 600; color: var(--ink2); margin-bottom: 12px; }
label.f > input, label.f > select, label.f > textarea, label.f > .inp { margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: .88rem; cursor: pointer; user-select: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--ink2); }
.seg button.on { background: var(--navy); color: #fff; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.card > .hd { padding: 14px 16px; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; }
.card > .hd h2, .card > .hd h3 { margin-right: auto; }
.card > .bd { padding: 14px 16px; }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.empty { padding: 26px 16px; text-align: center; color: var(--ink3); font-size: .9rem; }

/* ---------- people ---------- */
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: .72rem; flex: none; letter-spacing: -.02em; }
.av.lg { width: 36px; height: 36px; font-size: .85rem; }
.av.sm { width: 20px; height: 20px; font-size: .6rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.who-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: .74rem; font-weight: 700; background: var(--line2); color: var(--ink2); white-space: nowrap; }
.chip.da_fare { background: #eef1f6; color: #4a5568; }
.chip.in_corso { background: #e6effd; color: #2257b8; }
.chip.in_attesa { background: #fff4de; color: #9a6400; }
.chip.completata, .chip.svolto, .chip.accettato, .chip.riparato { background: #e3f6eb; color: #17773f; }
.chip.annullato, .chip.rifiutato { background: #fde8e8; color: #b42318; }
.chip.bozza { background: #eef1f6; color: #4a5568; } .chip.inviato { background: #e6effd; color: #2257b8; }
.chip.programmato { background: #f1ecfd; color: #6a3fc4; }
.prio { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.prio.urgente { color: #fff; background: var(--bad); padding: 1px 6px; border-radius: 4px; }
.prio.alta { color: #c2410c; } .prio.media { color: var(--ink3); } .prio.bassa { color: #94a3b8; }
.late { color: var(--bad) !important; font-weight: 700; }

/* ---------- tasks ---------- */
.quickadd { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.quickadd textarea { min-height: 44px; height: 44px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #e9edf3; border-radius: var(--r); padding: 10px; min-height: 140px; }
.col.drop { outline: 2px dashed var(--info); outline-offset: -2px; background: #e3ecfb; }
.col > .ch { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 700; font-size: .9rem; }
.col > .ch .n { margin-left: auto; font-size: .78rem; color: var(--ink3); font-weight: 600; }
.col.backlog { background: #fbf3ee; } .col.backlog > .ch { color: #a0410f; }
.tcard { background: #fff; border-radius: 8px; padding: 10px 11px 9px 13px; margin-bottom: 8px; box-shadow: var(--sh); cursor: pointer; border-left: 4px solid #cbd3df; position: relative; }
.tcard:hover { box-shadow: 0 2px 8px rgba(16,24,40,.12); }
.tcard.done { opacity: .62; } .tcard.done .tt { text-decoration: line-through; }
.tcard .tt { font-weight: 600; font-size: .92rem; line-height: 1.3; margin-bottom: 5px; padding-right: 18px; }
.tcard .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .78rem; color: var(--ink3); }
.tcard .by { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line2); font-size: .72rem; color: var(--ink3); display: flex; align-items: center; gap: 5px; }
.tcard .desc { font-size: .8rem; color: var(--ink2); margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .sel { position: absolute; top: 9px; right: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; position: sticky; top: 0; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #f7f9fc; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; }
.bulkbar { position: sticky; bottom: 14px; margin-top: 14px; background: var(--navy); color: #fff; border-radius: 10px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; box-shadow: var(--sh2); flex-wrap: wrap; }
.bulkbar select { width: auto; min-width: 180px; }

/* ---------- agenda ---------- */
.week { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.week .h { background: #fafbfc; font-size: .78rem; font-weight: 700; color: var(--ink2); padding: 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line2); text-transform: capitalize; }
.week .h.today { color: var(--accent); background: #fff6f2; }
.week .tec { padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line2); display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: .86rem; background: #fcfcfd; }
.week .cell { border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); padding: 5px; min-height: 84px; position: relative; cursor: copy; }
.week .cell.today { background: #fffaf7; } .week .cell.we { background: #fafafa; }
.week .cell:hover .plus { opacity: 1; }
.week .plus { position: absolute; right: 4px; bottom: 3px; opacity: 0; font-size: 1.1rem; color: var(--ink3); }
.ev { border-radius: 6px; padding: 5px 7px; margin-bottom: 4px; font-size: .76rem; line-height: 1.25; cursor: pointer; color: #fff; overflow: hidden; }
.ev b { display: block; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .t { opacity: .9; font-weight: 600; }
.ev.svolto { opacity: .55; } .ev.annullato { opacity: .45; text-decoration: line-through; }
.tkchip { font-size: .72rem; padding: 3px 6px; border-radius: 5px; background: #f2f4f8; border: 1px dashed #c9d1dd; margin-bottom: 4px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daylist .day { margin-bottom: 16px; }
.daylist .day > h3 { font-size: .85rem; text-transform: capitalize; color: var(--ink2); margin: 0 0 8px; }
.daylist .day.today > h3 { color: var(--accent); }
.evrow { display: flex; gap: 10px; background: #fff; border: 1px solid var(--line); border-left: 5px solid; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.evrow .tm { font-weight: 700; font-size: .82rem; width: 74px; flex: none; color: var(--ink2); }

/* ---------- preventivo ---------- */
.prev-head { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 14px; }
.righe td { padding: 5px 6px; } .righe input { min-height: 34px; padding: 6px 8px; }
.righe .q { width: 74px; } .righe .pz { width: 130px; } .righe .sc { width: 90px; } .righe .cod { width: 170px; }
.search-wrap { position: relative; }
.results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh2); max-height: 360px; overflow: auto; }
.results .r { padding: 9px 12px; border-bottom: 1px solid var(--line2); cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.results .r:hover, .results .r.act { background: #f1f6ff; }
.results .r .c { font-weight: 700; font-size: .86rem; } .results .r .d { font-size: .84rem; color: var(--ink2); grid-column: 1; }
.results .r .l { font-size: .72rem; color: var(--ink3); grid-column: 1; } .results .r .p { grid-row: 1 / span 3; grid-column: 2; text-align: right; font-weight: 700; font-size: .88rem; align-self: center; }
.results .r .p small { display: block; font-weight: 500; color: var(--ink3); font-size: .72rem; }
.totals { display: grid; grid-template-columns: auto auto; gap: 6px 22px; justify-content: end; font-variant-numeric: tabular-nums; }
.totals .big { font-size: 1.35rem; font-weight: 800; color: var(--navy); }

/* ---------- note ---------- */
.note { background: #fff; border: 1px solid var(--line); border-left: 5px solid; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--sh); }
.note.pin { background: #fffbea; border-color: #f1df9c; }
.note .nh { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: .82rem; }
.note .tx { white-space: pre-wrap; line-height: 1.5; font-size: .94rem; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--sh); }
.kpi .v { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .8rem; color: var(--ink3); font-weight: 600; margin-top: 2px; }
.kpi.bad .v { color: var(--bad); } .kpi.acc .v { color: var(--accent); }
.bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line2); }
.bar > span { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--ink2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.prog { font-variant-numeric: tabular-nums; }

/* ---------- storico ---------- */
.log .dayh { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink3); margin: 16px 0 6px; }
.log .it { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line2); font-size: .9rem; }
.log .it .tm { width: 44px; flex: none; color: var(--ink3); font-size: .8rem; padding-top: 4px; font-variant-numeric: tabular-nums; }
.log .it .tx { flex: 1; line-height: 1.4; } .log .it .tx b { font-weight: 600; }
.log .it .tag { font-size: .7rem; color: var(--ink3); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 720px; box-shadow: var(--sh2); }
.modal.wide { max-width: 980px; }
.modal > .hd { padding: 16px 20px; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; }
.modal > .hd h2 { margin-right: auto; }
.modal > .bd { padding: 18px 20px; }
.modal > .ft { padding: 14px 20px; border-top: 1px solid var(--line2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink3); padding: 2px 8px; border-radius: 6px; }
.x:hover { background: var(--line2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 12px; }
.tabs button { border: 0; background: none; padding: 8px 12px; font-weight: 600; color: var(--ink3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--navy); border-color: var(--navy); }
.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment .b { background: #f5f7fa; border-radius: 10px; padding: 8px 12px; flex: 1; }
.comment .b .h { font-size: .78rem; color: var(--ink3); margin-bottom: 2px; } .comment .b .t { white-space: pre-wrap; font-size: .9rem; }
.stamp { font-size: .76rem; color: var(--ink3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.statusbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.statusbtns button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 12px; font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--ink2); }
.statusbtns button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.colorpick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.colorpick button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.colorpick button.on { box-shadow: 0 0 0 2px var(--ink); }
.copybox { display: flex; gap: 8px; } .copybox input { font-family: Consolas, monospace; font-size: .8rem; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: #1d2939; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--sh2); font-size: .9rem; animation: tin .2s ease; }
#toast div.err { background: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #1f3b63 0%, #14263f 100%); padding: 20px; }
.login .box { background: #fff; border-radius: 16px; padding: 30px 28px; width: 100%; max-width: 380px; box-shadow: 0 30px 60px rgba(0,0,0,.3); }
.login .brand { padding: 0 0 20px; border: 0; } .login .brand b { color: var(--ink); font-size: 1.15rem; } .login .brand span { color: var(--ink3); opacity: 1; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 14px 90px; }
  .mobilebar { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 20; }
  .mobilebar b { flex: 1; } .mobilebar button { background: none; border: 0; color: #fff; padding: 6px; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: .68rem; color: var(--ink3); text-decoration: none; font-weight: 600; position: relative; }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.on { color: var(--navy); }
  .bottomnav a .cnt { position: absolute; top: 3px; left: 55%; background: var(--accent); color: #fff; border-radius: 9px; font-size: .62rem; padding: 0 5px; }
  .cards2, .grid2, .grid3, .prev-head { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; }
  .top h1 { font-size: 1.25rem; width: 100%; }
  .modal-bg { padding: 0; } .modal { border-radius: 0; min-height: 100vh; }
  .righe .cod { width: 110px; }
  .hide-m { display: none !important; }
  .kpi .v { font-size: 1.5rem; }
}
@media (min-width: 901px) { .hide-d { display: none !important; } }
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.45); }
.sheet .nav { background: var(--navy); width: 270px; height: 100%; padding-top: 16px; }

@media print {
  .side, .mobilebar, .bottomnav, .top .btn, .noprint { display: none !important; }
  .app { display: block; } .main { padding: 0; } body { background: #fff; }
}
label.f > input, label.f > select, label.f > textarea, label.f .inp input { font-size: .94rem; font-weight: 400; color: var(--ink); }
label.f .colorpick { font-weight: 400; }
.mobilebar svg { width: 24px; height: 24px; display: block; }
@media (max-width: 900px) { .quickadd { grid-template-columns: 1fr; } .quickadd textarea { height: 70px; } .quickadd .row select { flex: 1; } }

/* foto ricambi */
.results { display: grid; grid-template-columns: 1fr; }
.results:has(.rprev) { grid-template-columns: 1fr 260px; }
.results .rlist { max-height: 380px; overflow: auto; }
.results .r { grid-template-columns: 56px 1fr auto; }
.results .r .th { grid-row: 1 / span 3; grid-column: 1; }
.results .r .c, .results .r .d, .results .r .l { grid-column: 2; }
.results .r .p { grid-column: 3; }
.th { width: 52px; height: 52px; object-fit: contain; background: #fff; border: 1px solid var(--line2); border-radius: 6px; align-self: center; }
.th.sm { width: 38px; height: 38px; cursor: zoom-in; flex: none; }
.nofoto { display: grid; place-items: center; text-align: center; font-size: .6rem; color: var(--ink3); background: #f6f7f9; line-height: 1.1; }
.rprev { border-left: 1px solid var(--line2); padding: 12px; background: #fbfcfd; font-size: .86rem; }
.rprev img { width: 100%; height: 190px; object-fit: contain; background: #fff; border: 1px solid var(--line2); border-radius: 8px; margin-bottom: 8px; }
.rprev .nofoto.big { height: 190px; border-radius: 8px; margin-bottom: 8px; font-size: .8rem; }
@media (max-width: 900px) { .results:has(.rprev) { grid-template-columns: 1fr; } }

/* rapportini: firma */
.firma-wrap { position: relative; border: 2px dashed #c3ccd9; border-radius: 10px; background: #fff; height: 190px; }
.firma-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: 10px; }
.firma-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink3); pointer-events: none; font-size: .9rem; }
.righe select.modo { min-height: 34px; padding: 5px 6px; font-size: .82rem; width: 118px; }
.righe select.modo.garanzia { background: #e3f6eb; color: #17773f; border-color: #bfe5cc; }
.righe select.modo.nc { background: #fff4de; color: #9a6400; border-color: #f1d9a6; }
.righe .md { width: 124px; }
/* documentazione */
.docgrid { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.dside { position: sticky; top: 14px; max-height: calc(100vh - 40px); overflow: auto; }
.dtree { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; color: var(--ink2); text-decoration: none; font-size: .88rem; font-weight: 500; }
.dtree svg { width: 16px; height: 16px; flex: none; color: #d4a106; }
.dtree span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtree .n { font-size: .72rem; color: var(--ink3); }
.dtree:hover { background: var(--line2); } .dtree.on { background: #e6effd; color: #1d4fa8; font-weight: 600; }
.crumbs { font-weight: 600; font-size: .95rem; } .crumbs a { color: var(--ink); text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.drow { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-bottom: 1px solid var(--line2); border-radius: 6px; cursor: pointer; }
.drow:hover { background: #f7f9fc; }
.drow .dlink { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.drow .dn { flex: 1; min-width: 0; } .drow .dn b { font-weight: 600; word-break: break-word; }
.dico { width: 40px; height: 46px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: .68rem; font-weight: 800; flex: none; letter-spacing: .02em; }
.dico.cart { background: #fdf3d3; color: #d4a106; } .dico.cart svg { width: 24px; height: 24px; }
#darea.drop { outline: 2px dashed var(--info); outline-offset: -4px; background: #f3f8ff; }
@media (max-width: 900px) { .docgrid { grid-template-columns: 1fr; } .dside { position: static; max-height: 240px; } }

/* righe ricambi su telefono: una scheda per riga invece della tabella larga */
@media (max-width: 900px) {
  .righe thead { display: none; }
  .righe tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .righe td { padding: 0 !important; border: 0 !important; }
  .righe td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .righe td:nth-child(2) { grid-column: 2 / 3; grid-row: 1; }
  .righe td:nth-child(8) { grid-column: 3; grid-row: 1; text-align: right; }
  .righe td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  .righe td:nth-child(4) { grid-column: 1; grid-row: 3; }
  .righe td:nth-child(5) { grid-column: 2; grid-row: 3; }
  .righe td:nth-child(6) { grid-column: 3; grid-row: 3; }
  .righe td:nth-child(7) { grid-column: 1 / -1; grid-row: 4; text-align: right; font-weight: 700; }
  .righe .q, .righe .cod, .righe .pz, .righe .sc, .righe .md { width: auto; }
  .righe select.modo { width: 100%; }
  .righe td.empty { grid-column: 1 / -1; }
  .righe td:nth-child(1)::before { content: 'Q.tà'; } .righe td:nth-child(2)::before { content: 'Codice'; }
  .righe td:nth-child(4)::before { content: 'Addebito'; } .righe td:nth-child(5)::before { content: 'Prezzo €'; } .righe td:nth-child(6)::before { content: 'Sconto %'; }
  .righe td:nth-child(-n+6)::before { display: block; font-size: .68rem; font-weight: 700; color: var(--ink3); text-transform: uppercase; margin-bottom: 2px; }
  .righe td:nth-child(3)::before { content: none; }
}
.righe td.empty::before { content: none !important; }
