/* MillesimaLab · colori, caratteri ed elementi comuni (sito, area riservata, pagina del QR) */

@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-400.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/atkinson-700.woff2) format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/atkinson-400-corsivo.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500 800; font-display: swap; src: url(/fonts/bricolage.woff2) format('woff2'); }
@font-face { font-family: 'Caveat'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/caveat.woff2) format('woff2'); }

:root {
  --ground: #F3F5F2; --ground-2: #E8EDE9; --surface: #FFFFFF; --surface-2: #F7F9F7;
  --ink: #16201D; --ink-2: #3A4642; --muted: #5C6864; --line: #D8DFDA; --line-strong: #BFCAC4;
  --brand: #2C5F58; --brand-ink: #FFFFFF; --brand-soft: #DCEAE5; --brand-strong: #1F4843;
  --zoccolo: #D9E7E0; --zoccolo-line: #2C5F58; --lit: #F2C14E;
  --pen: #2340A0; --pen-red: #B3261E; --paper: #FCFBF6; --paper-line: #C8D5E8; --paper-margin: #E7A9A6;
  --plate: #E9E4D6; --plate-ink: #3B3526; --plate-edge: #CFC6AE;
  --ok: #1D7A46; --ok-soft: #DDF1E4; --warn: #94580A; --warn-soft: #FBEBD0; --bad: #B3261E; --bad-soft: #FBE3E0;
  --phone: #1A1F1E; --scrim: rgba(12, 18, 16, .48);
  --shadow: 0 1px 2px rgba(22, 32, 29, .06), 0 10px 28px rgba(22, 32, 29, .09);
  --focus: #2340A0;
  --f-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --f-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #101614; --ground-2: #18211E; --surface: #1A2320; --surface-2: #1F2926;
    --ink: #E5ECE8; --ink-2: #C3CEC9; --muted: #97A49F; --line: #2C3834; --line-strong: #3B4A45;
    --brand: #7DC1B4; --brand-ink: #0D1714; --brand-soft: #1D3531; --brand-strong: #A9DDD2;
    --zoccolo: #152723; --zoccolo-line: #4E9486; --lit: #E6B548;
    --pen: #A3B6FF; --pen-red: #FF8F86; --paper: #1E2523; --paper-line: #2F3C4C; --paper-margin: #6A3B3A;
    --plate: #39352B; --plate-ink: #EFE7D2; --plate-edge: #4C4638;
    --ok: #62D199; --ok-soft: #173A29; --warn: #F0B45A; --warn-soft: #3B2B12; --bad: #FF8A80; --bad-soft: #44201D;
    --phone: #070A09; --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .4);
    --focus: #A3B6FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #101614; --ground-2: #18211E; --surface: #1A2320; --surface-2: #1F2926;
  --ink: #E5ECE8; --ink-2: #C3CEC9; --muted: #97A49F; --line: #2C3834; --line-strong: #3B4A45;
  --brand: #7DC1B4; --brand-ink: #0D1714; --brand-soft: #1D3531; --brand-strong: #A9DDD2;
  --zoccolo: #152723; --zoccolo-line: #4E9486; --lit: #E6B548;
  --pen: #A3B6FF; --pen-red: #FF8F86; --paper: #1E2523; --paper-line: #2F3C4C; --paper-margin: #6A3B3A;
  --plate: #39352B; --plate-ink: #EFE7D2; --plate-edge: #4C4638;
  --ok: #62D199; --ok-soft: #173A29; --warn: #F0B45A; --warn-soft: #3B2B12; --bad: #FF8A80; --bad-soft: #44201D;
  --phone: #070A09; --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .4);
  --focus: #A3B6FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--f-body); font-size: 17px; line-height: 1.55; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.12; text-wrap: balance; margin: 0; color: var(--ink); }
p, ul, ol { margin: 0; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font-size: 13px; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.num { font-variant-numeric: tabular-nums; }
p .ic, .small .ic { vertical-align: -.22em; margin-right: 5px; }

/* pulsanti */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 18px; border-radius: 11px; font: 700 16px/1.1 var(--f-body); text-decoration: none; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--brand); }
.abtn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 700 14.5px/1.1 var(--f-body); cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 42px; }
.abtn:hover { border-color: var(--brand); }
.abtn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.abtn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.abtn.danger { color: var(--bad); }
.abtn.danger:hover { border-color: var(--bad); }
.abtn.sm { padding: 7px 10px; font-size: 13.5px; min-height: 34px; }
.abtn:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--brand); font: 700 14.5px/1.2 var(--f-body); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.linkbtn:hover { text-decoration: underline; }
.iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; flex: none; }

/* moduli */
.lbl { display: grid; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.lbl .aiuto { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.inp { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: 16px/1.3 var(--f-body); min-height: 44px; }
.inp:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.inp[aria-invalid="true"] { border-color: var(--bad); }
textarea.inp { resize: vertical; min-height: 110px; line-height: 1.45; }
select.inp { padding-right: 32px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid .intera { grid-column: 1 / -1; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; background: var(--surface-2); gap: 2px; }
.seg button { border: 0; background: none; padding: 8px 12px; border-radius: 7px; font: 700 14px/1 var(--f-body); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }

/* etichette di stato */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--ground-2); color: var(--ink-2); line-height: 1.35; }
.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.brand { background: var(--brand-soft); color: var(--brand-strong); }
.chip .ic { width: 13px; height: 13px; stroke-width: 2.6; }

/* riquadri e tabelle */
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; flex-wrap: wrap; }
.panel-h .small { font-weight: 400; }
.panel-b { padding: 14px; }
.stack { display: grid; gap: 16px; align-content: start; }
.stack > * { min-width: 0; } /* una tabella larga scorre dentro il suo riquadro invece di allargare la pagina */
.rule { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.rule .ic { vertical-align: -.22em; margin-right: 6px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 700; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--ink); }
.tbl tr.off td { color: var(--muted); }
.tbl .who { font-weight: 700; white-space: nowrap; }
.tbl .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.bar { height: 7px; border-radius: 99px; background: var(--ground-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .35s ease; }
.vuoto { text-align: center; padding: 28px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }

/* finestra (foglio) e avvisi */
.sheet-bg { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 16px; z-index: 50; }
.sheet { background: var(--surface); color: var(--ink); border-radius: 18px; width: 100%; max-width: 680px; max-height: min(90vh, 860px); overflow: auto; box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.sheet.largo { max-width: 920px; }
.sheet-h { position: sticky; top: 0; z-index: 1; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.sheet-h h3 { font-size: 20px; }
.sheet-b { padding: 18px; display: grid; gap: 14px; }
.sheet-f { position: sticky; bottom: 0; background: var(--surface); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); background: var(--ink); color: var(--ground); padding: 12px 16px; border-radius: 12px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 70; width: max-content; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.errore { background: var(--bad); color: #fff; }
.errore-box { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-weight: 700; font-size: 14.5px; }

/* Caselle di accettazione (invito e documenti aggiornati): testo lungo, casella in alto */
.check.accetta { align-items: flex-start; font-size: 14.5px; line-height: 1.45; }
.check.accetta input { margin-top: 1px; }

/* Verifica anti-robot: di solito invisibile; se Cloudflare chiede una conferma, la casella compare qui, sempre in vista */
.antirobot { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); }
.antirobot[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
