:root {
  --bg: #f5f7f6; --card: #fff; --ink: #1b2623; --muted: #62706c; --line: #dfe5e2;
  --brand: #00643e; --brand-ink: #fff; --brand-soft: #e1f0e9; --gold: #9a6f13;
  --ok: #17794d; --ok-soft: #e2f4ea; --warn: #8a5a00; --warn-soft: #fdf1d6;
  --bad: #b3261e; --bad-soft: #fbe7e5; --info: #1f5fa8; --info-soft: #e5eefa;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101614; --card: #19211f; --ink: #e8efec; --muted: #9aaaa5; --line: #2b3633;
    --brand: #3fb184; --brand-ink: #04170f; --brand-soft: #143528; --gold: #d9a441;
    --ok: #5fd39a; --ok-soft: #153525; --warn: #f0c35a; --warn-soft: #3a2f10;
    --bad: #ff8b82; --bad-soft: #3d1b19; --info: #7db3f0; --info-soft: #172a41;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 Sailec, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.caricamento { padding: 40px 16px; text-align: center; color: var(--muted); }

/* struttura */
.app { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 20; background: #00643e; color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 12px; }
.top h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 650; }
.top .icona { background: transparent; border: 0; color: inherit; position: relative; padding: 6px; font-size: 20px; cursor: pointer; }
.badge { position: absolute; top: -2px; right: -4px; background: var(--bad); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; font-size: 11px; display: grid; place-items: center; padding: 0 4px; }
main { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; flex: 1; }
.tabbar { position: fixed; inset: auto 0 0 0; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.tabbar .in { display: flex; width: 100%; max-width: 760px; }
.tabbar button { flex: 1; background: none; border: 0; padding: 8px 4px 10px; color: var(--muted); display: grid; gap: 2px; justify-items: center; font-size: 11px; cursor: pointer; position: relative; min-height: 56px; }
.tabbar button .g { font-size: 20px; line-height: 1; }
.tabbar button.on { color: var(--brand); font-weight: 650; }
.tabbar .badge { top: 4px; right: calc(50% - 22px); }

/* componenti */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card.click { cursor: pointer; }
.card.click:active { transform: scale(.995); }
h2 { font-size: 20px; margin: 4px 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.riga { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.stack { display: grid; gap: 4px; }
.muted { color: var(--muted); font-size: 14px; }
.grande { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.grigio { background: var(--line); color: var(--muted); }
.seg { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 8px 10px; border-radius: 10px; margin-top: 6px; }
.seg.avviso { background: var(--warn-soft); color: var(--warn); }
.seg.blocco { background: var(--bad-soft); color: var(--bad); }
.seg.info { background: var(--info-soft); color: var(--info); }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn.primario { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.pericolo { color: var(--bad); border-color: var(--bad); }
.btn.piccolo { padding: 6px 12px; min-height: 36px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.azioni { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.campo { display: grid; gap: 4px; margin-bottom: 12px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--muted); }
.campo input, .campo select, .campo textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); width: 100%; min-height: 44px; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .btn:focus-visible, .tabbar button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.due { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vuoto { text-align: center; color: var(--muted); padding: 28px 8px; }
.errore { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; z-index: 60; box-shadow: var(--shadow); font-size: 14px; max-width: 90vw; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 94dvh; overflow: auto; border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet .testa { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet .testa h2 { margin: 0; }
.foto { display: flex; gap: 10px; align-items: center; border: 2px dashed var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--card); }
.foto img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.foto input { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
td.d, th.d { text-align: right; }
.login { max-width: 460px; margin: 0 auto; padding: 32px 16px; }
.login h1 { margin: 0 0 4px; }
.persona { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; margin-bottom: 8px; }
.demo-banner { background: var(--warn-soft); color: var(--warn); font-size: 13px; text-align: center; padding: 6px 12px; }
.cal-mese { font-weight: 700; margin: 18px 0 8px; text-transform: capitalize; }
.cal-voce { display: flex; gap: 12px; align-items: center; }
.cal-giorno { min-width: 52px; text-align: center; background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 6px 4px; font-weight: 700; line-height: 1.1; }
.cal-giorno small { display: block; font-weight: 500; font-size: 11px; }
.log { font-size: 13px; }
.log code { font-size: 12px; color: var(--muted); }
@media (min-width: 720px) { main { padding: 24px; } }

/* marchio Innova */
.top .marchio { height: 30px; width: auto; display: block; }
.top .sep { opacity: .5; }
.top .nome-app { font-size: 15px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sezione { font-weight: 400; opacity: .85; }
.accesso { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: linear-gradient(160deg, #00643e 0%, #004a2e 100%); }
.accesso .testata { padding: calc(20px + env(safe-area-inset-top)) 24px 0; }
.accesso .testata img { height: 40px; width: auto; display: block; }
.accesso .centro { display: grid; place-items: center; padding: 24px 16px; }
.accesso .scheda { background: var(--card); color: var(--ink); border-radius: 18px; padding: 28px 24px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.accesso h1 { margin: 0 0 4px; font-size: 24px; }
.accesso .sotto { color: var(--muted); margin: 0 0 20px; font-size: 15px; }
.accesso .piede { padding: 0 24px calc(20px + env(safe-area-inset-bottom)); color: rgba(255,255,255,.75); font-size: 13px; text-align: center; }
.accesso .btn.primario { width: 100%; margin-top: 4px; }
.accesso a { color: var(--brand); }
