/* Moto Bizzotto · App interna — stile minimal scuro */
:root {
  --bg: #000000; --s1: #141416; --s2: #1C1D20; --line: #1F2023; --line2: #2A2B2E;
  --tx: #F5F5F7; --tx2: #A1A1A6; --tx3: #8A8A90; --red: #E30613; --link: #8AB4F8;
  --ok: #86EFAC; --okbg: rgba(74,222,128,.12); --warn: #FDBA74; --warnbg: rgba(251,146,60,.12);
  --bad: #FCA5A5; --badbg: rgba(248,113,113,.12); --info: #C9DCFF; --infobg: rgba(138,180,248,.12);
  --pur: #E9D5FF; --purbg: rgba(192,132,252,.12); --grey: #D1D1D6; --greybg: rgba(255,255,255,.08);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* "hidden" vince sempre (es. voci oltre le prime 10 negli elenchi): senza, display:flex di alcune righe lo annullava */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--tx); font: 400 16px/1.4 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); }
::-webkit-scrollbar { width: 0; height: 0; }
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--tx2); }
/* Attesa: emblema Yamaha che gira */
.spin { width: 56px; height: 56px; background: url(/icons/yamaha-ruota.png) center / contain no-repeat; animation: gira 1.1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@keyframes compari { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

/* Struttura */
/* La barra in alto (casetta, campanello, esci) resta sempre visibile scorrendo. Lo spazio della barra di stato del telefono
   (ora, batteria) è dentro la barra stessa: prima era fuori, e scorrendo la barra finiva sotto la barra di stato, nascosta. */
.screen { max-width: 640px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.top { position: -webkit-sticky; position: sticky; top: 0; z-index: 20; background: var(--bg); padding: calc(12px + var(--safe-t)) 16px 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.top .logo { width: 104px; height: auto; display: block; }
.top .title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.top .title b { font-size: 17px; font-weight: 600; }
.top .title span { font-size: 13px; color: var(--tx2); }
.spacer { flex: 1; }
.body { flex: 1; padding: 16px 16px calc(110px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.foot { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 12px 16px calc(14px + var(--safe-b)); display: flex; gap: 10px; }

/* Elementi */
.ib { width: 40px; height: 40px; border: 0; border-radius: 20px; background: var(--s2); display: inline-flex; align-items: center; justify-content: center; position: relative; flex: 0 0 40px; }
.ib svg { width: 18px; height: 18px; stroke: var(--tx); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.card { background: var(--s1); border: 1px solid #232427; border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tx2); }
.cap { font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--tx2); }
.muted { font-size: 13px; color: var(--tx2); }
.small { font-size: 12px; color: var(--tx3); }
.lbl { display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--tx2); }
.in { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 12px; background: var(--s2); color: var(--tx); font-size: 16px; text-transform: none; letter-spacing: 0; }
.in:focus { outline: none; border-color: var(--tx3); }
.in::placeholder { color: var(--tx3); }
textarea.in { resize: vertical; }
.bp { min-height: 54px; border: 0; border-radius: 14px; background: var(--tx); color: #0B0B0C; font-weight: 600; font-size: 16px; padding: 0 18px; }
.bp:disabled { opacity: .5; }
.bs { min-height: 50px; border: 1px solid var(--line2); border-radius: 14px; background: var(--s2); color: var(--tx); font-weight: 600; font-size: 15px; padding: 0 16px; }
.bs.danger { color: #F87171; border-color: rgba(248,113,113,.4); }
.bs.blue { color: var(--link); }
.bl { min-height: 44px; border: 0; background: transparent; color: var(--link); font-weight: 600; font-size: 15px; }
.full { width: 100%; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.pill { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line2); background: transparent; color: var(--grey); font-size: 13px; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.pill.on { background: var(--tx); color: #0B0B0C; border-color: var(--tx); }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.c-da { background: var(--warnbg); color: var(--warn); } .c-rim { background: rgba(251,146,60,.18); color: var(--warn); border: 1px solid rgba(251,146,60,.4); }
.c-val { background: var(--okbg); color: var(--ok); } .c-scad { background: var(--badbg); color: var(--bad); }
.c-rit { background: var(--infobg); color: var(--info); } .c-rif, .c-ann, .c-grey { background: var(--greybg); color: var(--grey); }
.c-pur { background: var(--purbg); color: var(--pur); border: 1px solid rgba(192,132,252,.45); }
.c-rip { background: rgba(255,255,255,.06); color: var(--tx); border: 1px solid #3A3B40; }
.note { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 14px; font-size: 14px; }
.n-info { background: rgba(138,180,248,.08); border: 1px solid rgba(138,180,248,.3); color: var(--info); }
.n-warn { background: var(--warnbg); border: 1px solid rgba(251,146,60,.35); color: #FED7AA; }
.n-bad { background: var(--badbg); border: 1px solid rgba(248,113,113,.4); color: #FECACA; }
.n-ok { background: var(--okbg); border: 1px solid rgba(74,222,128,.35); color: #BBF7D0; }
.n-pur { background: var(--purbg); border: 1px solid rgba(192,132,252,.45); color: var(--pur); }
.n-grey { background: var(--greybg); border: 1px solid #3A3B40; color: var(--grey); }
.err { margin: 0; color: #F87171; font-size: 14px; font-weight: 500; white-space: pre-line; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--tx2); flex: 0 0 auto; }
.kv span:last-child { font-weight: 500; text-align: right; white-space: pre-line; }
.pre { white-space: pre-line; }

/* Elenco */
.search { display: flex; align-items: center; gap: 8px; background: var(--s2); border: 1px solid var(--line2); border-radius: 12px; padding: 0 12px; }
.search input { flex: 1; border: 0; outline: none; background: transparent; min-height: 46px; font-size: 16px; }
.item { text-align: left; width: 100%; background: var(--s1); border: 1px solid #232427; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--tx); }
.item.dim { opacity: .72; }
.item .r1 { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.item .r1 b { font-size: 16px; font-weight: 600; display: block; }
.item .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid #222326; padding-top: 10px; font-size: 12px; color: var(--tx2); }
.price { font-size: 16px; font-weight: 700; color: #4ADE80; white-space: nowrap; }
.price.old { color: var(--tx2); text-decoration: line-through; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fab { position: fixed; right: max(16px, calc(50% - 304px)); bottom: calc(24px + var(--safe-b)); min-height: 52px; padding: 0 20px; border: 0; border-radius: 26px; background: var(--tx); color: #0B0B0C; font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.6); z-index: 6; }
.empty { text-align: center; color: var(--tx2); padding: 32px 0; }

/* Home */
.home { background: #000; }
.big { display: flex; align-items: baseline; gap: 12px; }
.big b { font-size: 88px; font-weight: 200; line-height: .9; letter-spacing: -.04em; }
.big span { font-size: 17px; color: var(--tx2); white-space: pre-line; }
.bar { height: 3px; border-radius: 2px; background: var(--s2); overflow: hidden; }
.bar i { display: block; height: 3px; background: var(--red); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats b { display: block; font-size: 22px; font-weight: 300; }
.stats span { font-size: 12px; color: var(--tx2); }
.mods { border-top: 1px solid var(--line); }
.mod { text-align: left; width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--tx); }
.mod.off { color: var(--tx3); cursor: default; }
.mod .ic { width: 44px; height: 44px; border-radius: 22px; background: var(--s1); display: flex; align-items: center; justify-content: center; flex: 0 0 44px; }
.mod .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mod .tx { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.mod .tx b { font-size: 17px; font-weight: 500; }
.mod .tx span { font-size: 13px; color: var(--tx2); }

/* Login */
.login { min-height: 100vh; background: #000; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 20px 32px; gap: 16px; }
.login .hero { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-bottom: 8px; }

/* Wizard */
.steps { height: 4px; border-radius: 2px; background: var(--s2); overflow: hidden; margin: 0 16px 0; }
.steps i { display: block; height: 4px; background: var(--red); }
.yn { display: flex; gap: 6px; }
.yn button { min-width: 84px; padding: 0 10px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--grey); font-weight: 600; }
.yn button.on { background: var(--tx); color: #0B0B0C; border-color: var(--tx); }
.yn button.da-fare.on { background: var(--warn); border-color: var(--warn); color: #1a0f00; }
.yn button.a-posto.on { background: var(--ok); border-color: var(--ok); color: #052e12; }
.ynrow { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ynrow .h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; font-weight: 500; }
.choice { display: flex; gap: 8px; }
.choice button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line2); background: transparent; color: var(--grey); font-weight: 600; }
.choice button.on { background: var(--tx); color: #0B0B0C; border-color: var(--tx); }

/* Foto */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ph { position: relative; aspect-ratio: 1/1; border-radius: 12px; overflow: hidden; background: var(--s2); border: 0; padding: 0; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .x { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 16px; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; }
.ph .x svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; fill: none; }
.add { aspect-ratio: 1/1; border: 1px dashed #3A3B40; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--tx); font-size: 13px; font-weight: 500; position: relative; background: var(--s1); cursor: pointer; }
.add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.add svg { width: 26px; height: 26px; stroke: var(--tx); fill: none; stroke-width: 1.6; }

/* Overlay: dialoghi e foto grandi */
#overlay:empty { display: none; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal .box { background: var(--s1); border: 1px solid var(--line2); border-radius: 18px; padding: 20px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.lightbox { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.lightbox .lt { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 8px 16px; }
.lightbox .img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }
.lightbox .img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .lb { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px calc(24px + var(--safe-b)); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--tx); color: #0B0B0C; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; z-index: 90; width: max-content; max-width: min(92vw, 440px); display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: entra .2s ease; transition: opacity .35s, transform .35s; }
.toast.via { opacity: 0; transform: translate(-50%, -10px); }
.toast.t-ok { background: #15803D; color: #fff; }
.toast.t-err { background: #B91C1C; color: #fff; }
.toast .t-ic { width: 22px; height: 22px; border-radius: 11px; background: rgba(255,255,255,.2); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 auto; }
.toast .t-ic svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; }
@keyframes entra { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* stati di salvataggio */
.salvato { animation: verde 1.8s ease; }
@keyframes verde { 0%, 35% { box-shadow: 0 0 0 2px #22C55E, 0 0 24px rgba(34,197,94,.35); border-color: #22C55E; } 100% { box-shadow: none; } }
.ok-badge { display: inline-flex; align-items: center; gap: 6px; color: #4ADE80; font-size: 13px; font-weight: 600; }
.ok-badge svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; }
.stato-mod { align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: rgba(138,180,248,.16); color: #8AB4F8; }
.stato-mod.sporco { background: rgba(251,146,60,.18); color: #FDBA74; }
.in-modifica { border-color: rgba(138,180,248,.55) !important; }
.bp:disabled, .bs:disabled { opacity: .45; }
.salvato-il { display: flex; align-items: center; gap: 6px; color: var(--tx2); font-size: 13px; }
.salvato-il svg { width: 14px; height: 14px; fill: none; stroke: #4ADE80; stroke-width: 3; }
.busy { position: fixed; inset: 0; background: rgba(0,0,0,.45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); z-index: 80; display: flex; align-items: center; justify-content: center; opacity: 0; animation: compari .2s ease .15s forwards; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Ferie: calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { text-align: center; font-size: 11px; color: var(--tx3); font-weight: 600; letter-spacing: .04em; padding-bottom: 2px; }
.cal-d { position: relative; aspect-ratio: 1 / 1; min-height: 40px; border: 1px solid transparent; border-radius: 10px; background: var(--s2); color: var(--tx); font-size: 15px; font-weight: 500; display: flex; align-items: center; justify-content: center; padding: 0; }
.cal-d.chiuso { background: transparent; color: var(--tx3); }
.cal-d.oggi { border-color: var(--tx2); }
.cal-d.ok { background: rgba(74,222,128,.22); color: #BBF7D0; }
.cal-d.att { background: rgba(250,204,21,.16); color: #FDE68A; border-style: dashed; border-color: rgba(250,204,21,.6); }
.cal-d.perm::after { content: ''; position: absolute; bottom: 5px; width: 6px; height: 6px; border-radius: 3px; background: #8AB4F8; }
.cal-d.mezza { background-image: linear-gradient(135deg, transparent 50%, rgba(0,0,0,.35) 50%); }
.cal-d.pieno::before, .cal-d.rosso::before { content: ''; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 4px; background: #F87171; }
.cal-d.attenz::before, .cal-d.arancio::before { content: ''; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 4px; background: #FB923C; }
.cal-d.critico { box-shadow: inset 0 -3px 0 #FB923C; }
.cal-d.rosso { background: rgba(248,113,113,.18); }
.cal-d.sel { background: #8AB4F8; color: #0B0B0C; font-weight: 700; }
.cal-d em { position: absolute; bottom: 3px; right: 5px; font-style: normal; font-size: 10px; font-weight: 700; color: var(--tx2); }
.leg { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--tx2); }
.leg span { display: inline-flex; align-items: center; gap: 5px; }
.leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.l-ok { background: rgba(74,222,128,.6); } .l-att { background: rgba(250,204,21,.6); } .l-perm { background: #8AB4F8; border-radius: 5px !important; }
.l-pieno { background: #F87171; border-radius: 5px !important; } .l-crit { background: #FB923C; height: 3px !important; } .l-chiuso { background: var(--s2); border: 1px solid var(--line2); }
.l-n { font-style: normal; font-size: 10px; font-weight: 700; color: var(--tx2); }
/* ---------- Ferie: impostazioni ---------- */
details.sez > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
details.sez > summary::-webkit-details-marker { display: none; }
details.sez > summary > span { display: flex; flex-direction: column; gap: 2px; }
details.sez > summary::after { content: '›'; font-size: 22px; color: var(--tx3); transition: transform .15s; }
details.sez[open] > summary::after { transform: rotate(90deg); }
.riga { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.tab-cop { display: grid; grid-template-columns: minmax(90px, 1.6fr) repeat(7, minmax(0, 1fr)); gap: 4px; align-items: center; text-align: center; }
.in.mini { min-height: 38px; padding: 6px 2px; text-align: center; font-size: 15px; }

/* barra "modifiche non salvate" */
#barra-salva { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 60; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px;
  background: #1F2937; border: 1px solid rgba(251,146,60,.55); border-radius: 16px; box-shadow: 0 12px 34px rgba(0,0,0,.55); animation: sale .18s ease; max-width: 560px; margin: 0 auto; }
#barra-salva > span { flex: 1; display: flex; flex-direction: column; line-height: 1.2; color: #FDBA74; }
#barra-salva .bs, #barra-salva .bp { min-height: 44px; padding: 0 16px; flex: 0 0 auto; }
body.con-barra .body { padding-bottom: 110px; }
body.con-barra .fab { display: none; }
@keyframes sale { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.cambiato { box-shadow: 0 0 0 2px rgba(251,146,60,.75) !important; }
.da-togliere { opacity: .5; text-decoration: line-through; }
.chip.c-nuovo { background: rgba(251,146,60,.18); color: #FDBA74; }

/* Home ad app */
.apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 12px; padding: 4px 0 8px; }
.app { background: transparent; border: 0; color: var(--tx); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; transition: transform .12s; }
.app:active { transform: scale(.93); }
.app.off { cursor: default; }
.app.off .app-ic { filter: grayscale(1) brightness(.55); }
.app.off .app-tx { color: var(--tx3); }
.app-ic { position: relative; width: 72px; height: 72px; border-radius: 20px; display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 82%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 70%, #000) 100%);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 30%, transparent), inset 0 1px 0 rgba(255,255,255,.25); }
.app-ic svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-ic.sm { width: 44px; height: 44px; border-radius: 12px; flex: 0 0 44px; box-shadow: none; }
.app-ic.sm svg { width: 24px; height: 24px; }
.app-n { position: absolute; top: -7px; right: -7px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--red); color: #fff; font: 700 13px/24px inherit; font-style: normal; text-align: center; border: 2px solid #000; }
.app-tx { font-size: 13px; line-height: 1.25; text-align: center; max-width: 100px; }
.app-presto { font-size: 11px; color: var(--tx3); margin-top: -5px; }
.todo { display: flex; flex-direction: column; gap: 8px; }
.td, .voce { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px; border: 1px solid var(--line2); border-radius: 16px; background: var(--s1); color: var(--tx); transition: transform .12s; }
.td:active, .voce:active { transform: scale(.98); }
.td > svg, .voce > svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: var(--tx3); stroke-width: 2; }
.td-n { flex: 0 0 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; color: #fff; background: var(--c); }
.td .tx, .voce .tx { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.td .tx b, .voce .tx b { font-size: 16px; font-weight: 600; }
.td .tx span, .voce .tx span { font-size: 13px; color: var(--tx2); }
.todo-ok { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; background: var(--okbg); color: var(--ok); font-size: 15px; }
.todo-ok svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.voci { display: flex; flex-direction: column; gap: 10px; }

/* Giorni di apertura a mezze giornate */
.ap-tab { display: flex; flex-direction: column; gap: 10px; }
.ap-riga { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 14px; }
.ap-riga.cambiato { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.ap-riga b { font-size: 15px; font-weight: 600; }
.seg { display: grid; grid-template-columns: .85fr 1fr 1.2fr 1fr; gap: 4px; background: var(--s2); border-radius: 10px; padding: 3px; }
.seg button { min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--tx2); font-size: 12.5px; font-weight: 600; padding: 0 2px; line-height: 1.1; }
.seg button.on { background: var(--tx); color: #0B0B0C; }
.cal-d { position: relative; }
.cal-mz { position: absolute; top: 2px; right: 3px; font-size: 9px; font-weight: 700; font-style: normal; color: var(--warn); }

/* Altri assenti nella richiesta da approvare */
.assenti { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--infobg); }
.as-r { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.as-r.as-att { opacity: .75; }
.as-r i { color: var(--warn); font-style: normal; }
/* Notifica arrivata con l'app aperta */
.push-in { position: fixed; left: 12px; right: 12px; top: calc(10px + var(--safe-t)); z-index: 60; max-width: 560px; margin: 0 auto; display: flex; gap: 12px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 18px; border: 1px solid var(--line2); background: rgba(40,41,45,.96); color: var(--tx); box-shadow: 0 12px 40px rgba(0,0,0,.6);
  animation: scendi .25s ease-out; transition: opacity .4s, transform .4s; }
.push-in.via { opacity: 0; transform: translateY(-20px); }
.push-in img { width: 38px; height: 38px; border-radius: 9px; flex: 0 0 38px; }
.push-in > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.push-in b { font-size: 15px; }
.push-in > span > span { font-size: 14px; color: var(--tx2); }
@keyframes scendi { from { opacity: 0; transform: translateY(-24px); } to { opacity: 1; transform: none; } }

/* Tira giù per aggiornare */
html, body { overscroll-behavior-y: contain; }
.ptr { position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translate(-50%, -60px); width: 40px; height: 40px; border-radius: 20px; background: var(--s2); border: 1px solid var(--line2);
  display: flex; align-items: center; justify-content: center; z-index: 70; opacity: 0; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.ptr .spin { width: 24px; height: 24px; animation: none; }
.ptr.pronto { border-color: var(--red); }
.ptr.gira { opacity: 1 !important; transform: translate(-50%, 40px) !important; }
.ptr.gira .spin { animation: gira 0.9s linear infinite; }

/* ---------- KPI vendite ---------- */
.seg.seg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg.seg3 button { min-height: 38px; font-size: 13px; }
.kpi-filtri { gap: 10px; }
.pills.wrap { flex-wrap: wrap; overflow: visible; }
.kpi-tit { display: flex; flex-direction: column; gap: 2px; padding: 4px 2px; }
.kpi-tit b { font-size: 34px; font-weight: 300; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi-grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-box { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px; border-radius: 16px; background: var(--s1); border: 1px solid var(--line2); color: var(--tx); }
.kpi-box .lbl { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--tx2); }
.kpi-box b { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }
.kpi-box.cl { cursor: pointer; } .kpi-box.cl b { text-decoration: underline dotted var(--tx3); text-underline-offset: 4px; }
.kpi-box .pos, .tab .pos { color: var(--ok); } .kpi-box .neg, .tab .neg, .kpi-cattot .neg { color: var(--bad); }
.kpi-cattot { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.kpi-cattot b { font-size: 22px; font-weight: 600; }
.tab-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.tab { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tab th { text-align: left; color: var(--tx2); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 6px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tab td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tab .n { text-align: right; white-space: nowrap; }
.tab td.n { font-weight: 600; }
.tab .cod { display: block; color: var(--tx3); font-size: 10.5px; margin-top: 2px; }
.tab .dim, .tab i.dim { color: var(--tx3); font-weight: 400; }
.tab tr.tot td { font-weight: 700; border-top: 1px solid var(--line2); background: rgba(255,255,255,.03); }
.kpi-dd > summary b { font-size: 15px; }
.hbar { display: flex; flex-direction: column; gap: 10px; }
.hb-r { display: grid; grid-template-columns: 70px 1fr; gap: 4px 10px; align-items: center; }
.hb-l { font-size: 13px; color: var(--tx2); }
.hb-t { height: 18px; background: var(--s2); border-radius: 6px; overflow: hidden; }
.hb-t i { display: block; height: 100%; border-radius: 6px; }
.hb-v { grid-column: 2; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.graf { width: 100%; height: auto; display: block; }
.graf text { fill: var(--tx3); font-size: 9.5px; }
.kpi-ric { text-align: center; padding: 6px 0 12px; }
.card.stima { border: 1px dashed #F4A82C; }
.small.warn { color: #F4A82C; }
.kc-m { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kc-m.dim { opacity: .6; }
.kc-m .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kc-conf { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--warn); }
.busy .busy-txt { position: absolute; top: calc(50% + 44px); left: 0; right: 0; text-align: center; color: var(--tx); font-size: 14px; }
.tab.compact { font-size: 12.5px; }
.tab.compact td, .tab.compact th { padding-left: 4px; padding-right: 4px; }
.tab .pc { display: block; font-size: 11px; font-weight: 600; }

/* KPI: navigazione, clic, ricerca */
.kpi-tabs { position: sticky; top: calc(64px + var(--safe-t)); z-index: 4; box-shadow: 0 8px 16px rgba(0,0,0,.6); }
.seg.seg4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg.seg4 button { min-height: 38px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.seg.seg4 button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.tab tr.cl { cursor: pointer; }
.tab tr.cl:active td { background: rgba(255,255,255,.06); }
.tab .vai { color: var(--tx3); margin-left: 6px; font-weight: 400; }
.hb-r.cl { cursor: pointer; }
.cerca-box { position: relative; }
.cerca-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--tx3); stroke-width: 2; }
.cerca-box .in { padding-left: 42px; }
.graf rect[data-mi] { cursor: pointer; }
/* torta cliccabile KPI */
.torta{display:flex;flex-direction:column;gap:10px}
.torta-svg{width:100%;max-width:240px;margin:4px auto 0;display:block}
.torta-svg path{cursor:pointer;stroke:var(--bg2,#fff);stroke-width:1;transition:opacity .15s}
.torta-svg path:hover,.torta-svg path:active{opacity:.75}
.torta-svg .t1{font-size:18px;font-weight:700;fill:var(--tx,#111)}
.torta-svg .t2{font-size:11px;fill:var(--tx3,#888)}
.torta-leg{display:flex;flex-direction:column}
.tl-r{display:flex;align-items:center;gap:8px;padding:9px 2px;border:0;border-bottom:1px solid var(--line,#eee);background:none;text-align:left;font:inherit;color:inherit;cursor:pointer}
.tl-r i{width:12px;height:12px;border-radius:3px;flex:none}
.tl-n{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tl-v{white-space:nowrap;font-variant-numeric:tabular-nums}
.tl-v.neg{color:#c0392b}
.tl-r .vai,.tab .vai{color:var(--tx3,#999);margin-left:4px}
.kb-del{border:0;background:none;color:#e15a4a;font:inherit;font-size:13px;margin-left:10px;cursor:pointer;padding:4px}
#k-budget .kv>span:first-child{display:flex;flex-direction:column}
.esp-r td{padding:6px 0 2px!important;border:0!important}
.esp{border:1px solid var(--line,#333);background:none;color:inherit;font:inherit;font-size:13px;font-weight:600;border-radius:999px;padding:7px 14px;cursor:pointer;margin-top:4px}
.torta-leg .esp{align-self:flex-start;margin-top:8px}

/* Ambiente di TEST: etichetta arancione nella barra in alto e bordo arancione, per non confonderla con l'app vera */
.amb-tag { display: inline-block; vertical-align: 2px; margin-right: 8px; padding: 2px 8px; border-radius: 6px; background: #F59E0B; color: #000; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
html.amb-prova .top { border-bottom: 2px solid #F59E0B; }
.amb-login { align-self: center; padding: 6px 14px; border-radius: 999px; background: #F59E0B; color: #000; font-size: 13px; font-weight: 800; letter-spacing: .06em; }
