/* =============================================================================
   Nuova amministrazione (admin/): grafica comune. Nata dall'anteprima docs/anteprime/nuova_grafica_admin.html.
   Menu laterale fisso sul computer; sul telefono (sotto 760 px) barra in alto, navigazione in basso, tabelle a schede.
   Tema chiaro/scuro: segue il sistema, oppure data-theme su <html> scelto con il pulsante del menu (js/tema.js).
   Caratteri salvati sul sito (la CSP di /admin/ non ammette file esterni): assets/vendor/fonts/.
   ============================================================================= */
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/vendor/fonts/barlow-semi-condensed/5.3.0/barlow-semi-condensed-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/vendor/fonts/barlow-semi-condensed/5.3.0/barlow-semi-condensed-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/vendor/fonts/barlow-semi-condensed/5.3.0/barlow-semi-condensed-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/vendor/fonts/barlow-semi-condensed/5.3.0/barlow-semi-condensed-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/vendor/fonts/barlow-semi-condensed/5.3.0/barlow-semi-condensed-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/vendor/fonts/barlow-semi-condensed/5.3.0/barlow-semi-condensed-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/vendor/fonts/ibm-plex-sans/5.3.0/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/vendor/fonts/ibm-plex-sans/5.3.0/ibm-plex-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/vendor/fonts/ibm-plex-sans/5.3.0/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/vendor/fonts/ibm-plex-sans/5.3.0/ibm-plex-sans-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/vendor/fonts/ibm-plex-sans/5.3.0/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/vendor/fonts/ibm-plex-sans/5.3.0/ibm-plex-sans-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --bg: #f2f6f6; --surface: #ffffff; --surface-2: #f6f9f9; --sunken: #e9efef; --line: #dbe4e4; --line-2: #c7d3d3;
  --ink: #142a2c; --muted: #52686a; --faint: #7d9091;
  --accent: #01a4a6; --accent-ink: #00787a; --accent-soft: #ddf2f2; --on-accent: #ffffff;
  --ok: #2b8753; --ok-soft: #e2f2e8; --warn: #a06a00; --warn-soft: #faefd4; --err: #c0403a; --err-soft: #fae5e3;
  --info: #37709f; --info-soft: #e4edf7; --extra: #7a52b3; --extra-2: #c2478f;
  --side: #0e2e30; --side-2: #143b3d; --side-ink: #d6e7e7; --side-muted: #86a3a4; --side-line: #1f4a4c;
  --side-attivo: rgba(43, 191, 193, .16); --side-attivo-ic: #43d3d5;   /* voce del menu della pagina aperta */
  --shadow: 0 1px 2px rgba(16, 45, 47, .06), 0 8px 24px rgba(16, 45, 47, .08);
  --shadow-lg: 0 18px 50px rgba(10, 30, 32, .22);
  --display: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --logo-bg: transparent;   /* il logo ha la scritta scura: nel tema scuro gli si mette un fondo chiaro */
  /* liste di scelta con la ricerca (/assets/css/scelta.css) */
  --sc-fondo: var(--surface); --sc-testo: var(--ink); --sc-linea: var(--line); --sc-tenue: var(--sunken); --sc-tenue-testo: var(--muted);
  --sc-accento: var(--accent); --sc-accento-testo: var(--accent-ink); --sc-segno: var(--accent-soft); --sc-font: var(--body);
  --lato: 240px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1516; --surface: #122022; --surface-2: #162628; --sunken: #0f1c1d; --line: #223537; --line-2: #2d4446;
    --ink: #e1ecec; --muted: #97acae; --faint: #6f8586;
    --accent: #2bbfc1; --accent-ink: #72d9db; --accent-soft: #123a3b; --on-accent: #052224;
    --ok: #5cc48a; --ok-soft: #14301f; --warn: #e2b24d; --warn-soft: #362b12; --err: #ef7f77; --err-soft: #3a1b19;
    --info: #86b4e6; --info-soft: #172739; --extra: #b596ea; --extra-2: #f08cc4;
    --side: #081516; --side-2: #10292a; --side-ink: #d6e7e7; --side-muted: #7c9798; --side-line: #173536;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
    --logo-bg: #eef4f4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1516; --surface: #122022; --surface-2: #162628; --sunken: #0f1c1d; --line: #223537; --line-2: #2d4446;
  --ink: #e1ecec; --muted: #97acae; --faint: #6f8586;
  --accent: #2bbfc1; --accent-ink: #72d9db; --accent-soft: #123a3b; --on-accent: #052224;
  --ok: #5cc48a; --ok-soft: #14301f; --warn: #e2b24d; --warn-soft: #362b12; --err: #ef7f77; --err-soft: #3a1b19;
  --info: #86b4e6; --info-soft: #172739; --extra: #b596ea; --extra-2: #f08cc4;
  --side: #081516; --side-2: #10292a; --side-ink: #d6e7e7; --side-muted: #7c9798; --side-line: #173536;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  --logo-bg: #eef4f4;
}

/* ---------- Temi di colore (generato: colori e contrasto scelti in Aspetto, attributi data-colore e data-contrasto su <html>) ---------- */
@media screen {
  :root[data-colore="blu"] { --bg: #f2f5f9; --surface: #ffffff; --surface-2: #f6f8fb; --sunken: #e8eef5; --line: #d9e2ec; --line-2: #c4d0de; --ink: #15223a; --muted: #52617a; --faint: #7d8aa0; --accent: #2563b8; --accent-ink: #1d4f94; --accent-soft: #e0eaf7; --on-accent: #ffffff; --side: #13243d; --side-2: #1a2f4f; --side-ink: #d8e3f1; --side-muted: #8ea3bf; --side-line: #24395a; --side-attivo: rgba(91, 155, 239, .18); --side-attivo-ic: #8ab8f5; }
  @media (prefers-color-scheme: dark) { :root[data-colore="blu"]:not([data-theme="light"]) { --bg: #0b111a; --surface: #121b27; --surface-2: #16202e; --sunken: #0e1621; --line: #223044; --line-2: #2d3e56; --ink: #e1e8f2; --muted: #97a6ba; --faint: #6f7e93; --accent: #5b9bef; --accent-ink: #93bff6; --accent-soft: #132640; --on-accent: #06162b; --side: #080e17; --side-2: #0f1a2a; --side-ink: #d8e3f1; --side-muted: #7d92ae; --side-line: #17253a; --side-attivo: rgba(91, 155, 239, .18); --side-attivo-ic: #8ab8f5; } }
  :root[data-colore="blu"][data-theme="dark"] { --bg: #0b111a; --surface: #121b27; --surface-2: #16202e; --sunken: #0e1621; --line: #223044; --line-2: #2d3e56; --ink: #e1e8f2; --muted: #97a6ba; --faint: #6f7e93; --accent: #5b9bef; --accent-ink: #93bff6; --accent-soft: #132640; --on-accent: #06162b; --side: #080e17; --side-2: #0f1a2a; --side-ink: #d8e3f1; --side-muted: #7d92ae; --side-line: #17253a; --side-attivo: rgba(91, 155, 239, .18); --side-attivo-ic: #8ab8f5; }
  :root[data-colore="verde"] { --bg: #f3f6f2; --surface: #ffffff; --surface-2: #f7f9f6; --sunken: #e9efe7; --line: #dbe4d8; --line-2: #c6d3c2; --ink: #172a1d; --muted: #536a59; --faint: #7f9384; --accent: #2f7d4a; --accent-ink: #22603a; --accent-soft: #e1f0e5; --on-accent: #ffffff; --side: #15301f; --side-2: #1c3d28; --side-ink: #d9e8dd; --side-muted: #8ba694; --side-line: #264b33; --side-attivo: rgba(92, 191, 127, .18); --side-attivo-ic: #86d6a3; }
  @media (prefers-color-scheme: dark) { :root[data-colore="verde"]:not([data-theme="light"]) { --bg: #0c140f; --surface: #131f17; --surface-2: #17251b; --sunken: #0f1912; --line: #23352a; --line-2: #2e4536; --ink: #e1ece4; --muted: #98ad9e; --faint: #708676; --accent: #5cbf7f; --accent-ink: #93dbac; --accent-soft: #143321; --on-accent: #04200f; --side: #08110b; --side-2: #102317; --side-ink: #d9e8dd; --side-muted: #7a9784; --side-line: #173524; --side-attivo: rgba(92, 191, 127, .18); --side-attivo-ic: #86d6a3; } }
  :root[data-colore="verde"][data-theme="dark"] { --bg: #0c140f; --surface: #131f17; --surface-2: #17251b; --sunken: #0f1912; --line: #23352a; --line-2: #2e4536; --ink: #e1ece4; --muted: #98ad9e; --faint: #708676; --accent: #5cbf7f; --accent-ink: #93dbac; --accent-soft: #143321; --on-accent: #04200f; --side: #08110b; --side-2: #102317; --side-ink: #d9e8dd; --side-muted: #7a9784; --side-line: #173524; --side-attivo: rgba(92, 191, 127, .18); --side-attivo-ic: #86d6a3; }
  :root[data-colore="grafite"] { --bg: #f4f4f5; --surface: #ffffff; --surface-2: #f8f8f9; --sunken: #ebebed; --line: #dcdde0; --line-2: #c8cacf; --ink: #1c1f24; --muted: #5a5f68; --faint: #868b94; --accent: #3f4652; --accent-ink: #2b313a; --accent-soft: #e6e8eb; --on-accent: #ffffff; --side: #1e2126; --side-2: #272b31; --side-ink: #e2e4e8; --side-muted: #979ca5; --side-line: #33373e; --side-attivo: rgba(255, 255, 255, .12); --side-attivo-ic: #e2e4e8; }
  @media (prefers-color-scheme: dark) { :root[data-colore="grafite"]:not([data-theme="light"]) { --bg: #111214; --surface: #1a1b1e; --surface-2: #1f2024; --sunken: #151619; --line: #2c2e33; --line-2: #383b41; --ink: #e6e7ea; --muted: #a0a4ab; --faint: #74787f; --accent: #b8bec8; --accent-ink: #d9dde3; --accent-soft: #2a2d33; --on-accent: #111214; --side: #0c0d0f; --side-2: #18191c; --side-ink: #e2e4e8; --side-muted: #8a8f98; --side-line: #25272b; --side-attivo: rgba(255, 255, 255, .12); --side-attivo-ic: #e2e4e8; } }
  :root[data-colore="grafite"][data-theme="dark"] { --bg: #111214; --surface: #1a1b1e; --surface-2: #1f2024; --sunken: #151619; --line: #2c2e33; --line-2: #383b41; --ink: #e6e7ea; --muted: #a0a4ab; --faint: #74787f; --accent: #b8bec8; --accent-ink: #d9dde3; --accent-soft: #2a2d33; --on-accent: #111214; --side: #0c0d0f; --side-2: #18191c; --side-ink: #e2e4e8; --side-muted: #8a8f98; --side-line: #25272b; --side-attivo: rgba(255, 255, 255, .12); --side-attivo-ic: #e2e4e8; }
  :root[data-colore="arancio"] { --bg: #f7f4f1; --surface: #ffffff; --surface-2: #faf8f6; --sunken: #efe9e4; --line: #e5ddd5; --line-2: #d3c8bd; --ink: #2a1d14; --muted: #6b5a4e; --faint: #93837a; --accent: #c9561a; --accent-ink: #9e4213; --accent-soft: #f8e6da; --on-accent: #ffffff; --side: #2e1d12; --side-2: #3b2618; --side-ink: #f0e2d6; --side-muted: #b09a88; --side-line: #4a3222; --side-attivo: rgba(240, 138, 75, .2); --side-attivo-ic: #f6a877; }
  @media (prefers-color-scheme: dark) { :root[data-colore="arancio"]:not([data-theme="light"]) { --bg: #15100c; --surface: #1f1812; --surface-2: #241c15; --sunken: #1a140f; --line: #382b21; --line-2: #47372a; --ink: #f0e6de; --muted: #bba99b; --faint: #8f7e72; --accent: #f08a4b; --accent-ink: #f6b186; --accent-soft: #3a2213; --on-accent: #2a1204; --side: #0f0b08; --side-2: #1f1710; --side-ink: #f0e2d6; --side-muted: #a08b7a; --side-line: #33251a; --side-attivo: rgba(240, 138, 75, .2); --side-attivo-ic: #f6a877; } }
  :root[data-colore="arancio"][data-theme="dark"] { --bg: #15100c; --surface: #1f1812; --surface-2: #241c15; --sunken: #1a140f; --line: #382b21; --line-2: #47372a; --ink: #f0e6de; --muted: #bba99b; --faint: #8f7e72; --accent: #f08a4b; --accent-ink: #f6b186; --accent-soft: #3a2213; --on-accent: #2a1204; --side: #0f0b08; --side-2: #1f1710; --side-ink: #f0e2d6; --side-muted: #a08b7a; --side-line: #33251a; --side-attivo: rgba(240, 138, 75, .2); --side-attivo-ic: #f6a877; }
  @media not all and (prefers-color-scheme: dark) { :root[data-contrasto="alto"]:not([data-theme="dark"]) { --ink: #000000; --muted: #23292b; --faint: #3a4143; --line: #8e999b; --line-2: #6c777a; } }
  :root[data-contrasto="alto"][data-theme="light"] { --ink: #000000; --muted: #23292b; --faint: #3a4143; --line: #8e999b; --line-2: #6c777a; }
  @media (prefers-color-scheme: dark) { :root[data-contrasto="alto"]:not([data-theme="light"]) { --ink: #ffffff; --muted: #e3e9ea; --faint: #c5cdce; --line: #5c6c6f; --line-2: #7d8c8f; --bg: #000000; --surface: #0e1112; } }
  :root[data-contrasto="alto"][data-theme="dark"] { --ink: #ffffff; --muted: #e3e9ea; --faint: #c5cdce; --line: #5c6c6f; --line-2: #7d8c8f; --bg: #000000; --surface: #0e1112; }
}
/* ---------- fine dei colori generati ---------- */

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: .005em; text-wrap: balance; line-height: 1.15; }
a { color: var(--accent-ink); }
.num { font-variant-numeric: tabular-nums; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 15px; height: 15px; }
.vuoto { color: var(--faint); }
.piccola { font-size: 12px; color: var(--muted); }
.caricando { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* ---------- struttura: menu laterale + contenuto ---------- */
.guscio { display: grid; grid-template-columns: var(--lato) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.lato { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 14px; }
.marchio { display: grid; gap: 8px; padding: 0 6px; }
/* il logo resta in alto mentre si scorre il menu: fascia fissa con il colore del menu, sopra le voci che scorrono */
.lato > .marchio { position: sticky; top: -18px; z-index: 2; margin: -18px -14px -6px; padding: 18px 20px 12px; background: var(--side);
  border-bottom: 1px solid transparent; transition: border-color .15s; }
.lato.scorso > .marchio { border-bottom-color: var(--side-line); }
.marchio img { height: 36px; width: auto; max-width: 100%; background: #fff; border-radius: 7px; padding: 3px 6px; display: block; }
.marchio .in-prova { justify-self: start; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; white-space: nowrap;
  color: #f0c46a; border: 1px solid rgba(240, 196, 106, .35); border-radius: 20px; padding: 1px 8px; }
.nav { display: grid; gap: 2px; }
.nav .titolo { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); padding: 12px 10px 4px; font-weight: 600; }
.nav .voce { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-weight: 500; }
.nav .voce:hover { background: var(--side-2); }
.nav .voce[aria-current="page"] { background: var(--side-attivo); color: #fff; }
.nav .voce[aria-current="page"] .ic { color: var(--side-attivo-ic); }
.nav .testo { flex: 1; min-width: 0; }
.conta { font-size: 11.5px; font-weight: 600; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 10px; background: var(--side-2); color: var(--side-ink); }
.conta.warn { background: #6b4d10; color: #ffe3a6; }
.fumetto-conta { position: fixed; z-index: 1000; max-width: min(320px, calc(100% - 16px)); padding: 8px 11px; border-radius: 8px;
  background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.4; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); pointer-events: none; }
.conta.err { background: #6b2320; color: #ffd0cc; }
.piede-lato { margin-top: auto; display: grid; gap: 10px; border-top: 1px solid var(--side-line); padding-top: 12px; }
.chi { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
.chi .nome { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.chi .ruolo { font-size: 12px; color: var(--side-muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; flex: none;
  background: var(--accent); color: var(--on-accent); }
.comandi { display: flex; gap: 6px; }
.comandi button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--side-line);
  background: none; color: var(--side-ink); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; }
.comandi button:hover { background: var(--side-2); }
.su-tel, .giu-tel, .velo-menu { display: none; }
.principale { min-width: 0; padding: 22px 28px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }

/* ---------- testata della pagina ---------- */
.testata { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.testata .dove { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.testata h1 { font-size: 30px; font-weight: 700; }
.testata .sotto { color: var(--muted); margin-top: 2px; }
.testata .destra { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- componenti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); padding: 7px 12px; border-radius: 8px; font-weight: 500; font-size: 13.5px; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.pieno { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.pieno:hover { filter: brightness(1.06); }
.btn.rosso { color: var(--err); }
.btn.rosso.pieno { background: var(--err); border-color: var(--err); color: #fff; }
.btn.piccolo { padding: 5px 10px; font-size: 12.5px; }
.btn.icona { padding: 7px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); } .tag.info { background: var(--info-soft); color: var(--info); }
.tag.neutro { background: var(--sunken); color: var(--muted); }
.tag.link { cursor: pointer; }
.riquadro { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.riquadro > header { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 14px 16px 10px; }
.riquadro > header h2 { font-size: 18px; font-weight: 600; }
.riquadro > header .leg { font-size: 12.5px; color: var(--muted); }
.riquadro > header .link { margin-left: auto; font-size: 13px; text-decoration: none; font-weight: 500; display: inline-flex; gap: 4px; align-items: center; }
.mese { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; }
.mese button { border: 0; background: none; padding: 6px 10px; color: var(--muted); font-size: 18px; line-height: 1; }
.mese button:hover { color: var(--ink); }
.mese span { min-width: 124px; text-align: center; font-weight: 600; }
.schede { display: inline-flex; flex-wrap: wrap; gap: 2px; background: var(--sunken); border-radius: 10px; padding: 3px; }
.schede button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.schede button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.bolla { min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.nota { font-size: 13px; padding: 8px 10px; border-radius: 8px; }
.nota.info { background: var(--info-soft); color: var(--info); }
.nota.err { background: var(--err-soft); color: var(--err); }
.nota.warn { background: var(--warn-soft); color: var(--warn); }
.azioni { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex !important; gap: 8px; align-items: center; color: var(--ink) !important; font-size: 14px !important; font-weight: 400 !important; }
.check input { width: auto; accent-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow-lg); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Home: cruscotto ---------- */
#cruscotto { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.dafare { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; align-content: start;
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .riga1 { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; font-size: 13px; }
.card .riga1 .ic { padding: 5px; width: 28px; height: 28px; border-radius: 8px; background: var(--sunken); }
.card.warn .riga1 .ic { background: var(--warn-soft); color: var(--warn); }
.card.err .riga1 .ic { background: var(--err-soft); color: var(--err); }
.card.ok .riga1 .ic { background: var(--ok-soft); color: var(--ok); }
.card.info .riga1 .ic { background: var(--info-soft); color: var(--info); }
.card .grande { font-family: var(--display); font-size: 40px; font-weight: 600; line-height: 1; }
.card.warn .grande { color: var(--warn); } .card.err .grande { color: var(--err); }
.card.zero .grande { color: var(--ok); }
.card .piccolo { font-size: 12.5px; color: var(--muted); }
.card .vai { font-size: 12.5px; color: var(--accent-ink); font-weight: 500; }
.due { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
/* Home: Richieste di assenza in attesa e Settimana in azienda alte uguali (il grafico resta in basso) */
.due.pari { align-items: stretch; }
.due.pari > .riquadro { display: flex; flex-direction: column; }
.due.pari .settimana { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.due.pari .barre { flex: 1; }
.lista { list-style: none; margin: 0; padding: 0 8px 8px; }
.lista li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lista li:first-child { border-top: 0; }
.lista li.passata { box-shadow: inset 3px 0 0 var(--err); background: var(--err-soft); border-radius: 6px; }
.lista li.passata .tag.err { background: var(--err); color: var(--bg); }
.card .piccolo .passate { color: var(--err); font-weight: 600; }
.lista .chi-riga { flex: 1 1 220px; min-width: 0; display: flex; gap: 10px; align-items: center; }
.lista .avatar { width: 32px; height: 32px; font-size: 12px; background: var(--sunken); color: var(--ink); }
.lista .nome { font-weight: 600; }
.lista .dett { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; }
.lista .azioni { margin-left: auto; gap: 6px; }
.lista-vuota { padding: 4px 16px 16px; color: var(--muted); margin: 0; }
.settimana { padding: 4px 16px 16px; display: grid; gap: 10px; }
.barre { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; min-height: 150px; }
.barra { display: grid; gap: 4px; justify-items: center; align-content: end; height: 100%; }
/* Home: le colonne riempiono l'altezza del riquadro, la più alta arriva in cima e le altre in proporzione
   (flex-grow messo da home.js: .aria è lo spazio vuoto sopra il numero) */
.barre .barra { display: flex; flex-direction: column; align-items: center; gap: 0; height: auto; min-height: 0; }
/* due pile per giorno: quella grande (ordinarie, viaggio, permessi) e, stretta a fianco, gli straordinari */
.barra .coppia { flex: 1 1 0; min-height: 0; width: 100%; display: flex; justify-content: center; gap: 3px; }
.barra .pila { flex: 1 1 0; min-width: 0; max-width: 42px; display: flex; flex-direction: column; align-items: center; }
.barra .pila.stra { flex: 0 0 22%; max-width: 14px; align-items: flex-start; }
.barra .pila.stra .prev { font-weight: 600; color: var(--extra); }
.barra .pila.stra .col { background: var(--extra); border-radius: 4px 4px 2px 2px; }
.barra .col.vuota { background: var(--sunken); }
.barra .aria { flex: 0 1 0; }
.barra .col { flex: 0 1 0; min-height: 3px; width: 100%; max-width: 42px; border-radius: 6px 6px 3px 3px; background: var(--accent); position: relative; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.barra .col.futuro { background: var(--sunken); }
/* colonna impilata: sotto le ore ordinarie, poi le ore di viaggio, sopra i permessi approvati */
.barra .col i { display: block; flex: 0 1 0; }
.barra .col .lav { background: var(--accent); }
.barra .col .perm { background: var(--warn); }
.barra .col .via { background: var(--extra-2); }
.barra small { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.barra b { font-size: 12px; font-weight: 600; }
/* un giorno passato (o oggi) è un collegamento alle sue Timbrature del giorno */
a.barra { color: inherit; text-decoration: none; border-radius: 8px; padding: 2px 0; }
a.barra:hover { background: var(--sunken); }
a.barra:hover small { color: var(--ink); text-decoration: underline; }
/* ore previste del giorno, sotto il totale: «su 688» */
.barra .prev { font-size: 11px; line-height: 1.2; color: var(--muted); white-space: nowrap; margin-bottom: 4px; }
.leg { font-size: 12px; color: var(--muted); }

/* ---------- Registro presenze ---------- */
.pagina { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.rail { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: sticky; top: 16px; }
.rail .cerca { position: relative; padding: 10px; border-bottom: 1px solid var(--line); }
.rail .cerca .ic { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.rail input { width: 100%; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 7px 10px 7px 34px; }
.rail ul { list-style: none; margin: 0; padding: 6px; display: grid; gap: 1px; max-height: calc(100dvh - 190px); overflow: auto; }
.rail li button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 7px 8px; border-radius: 8px; text-align: left; }
.rail li button:hover { background: var(--surface-2); }
.rail li button[aria-current="true"] { background: var(--accent-soft); }
.rail .avatar { width: 28px; height: 28px; font-size: 11px; background: var(--sunken); color: var(--ink); }
.rail li button[aria-current="true"] .avatar { background: var(--accent); color: var(--on-accent); }
.rail .nome { flex: 1; font-weight: 500; min-width: 0; }
.segno { font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.segno.err { background: var(--err-soft); color: var(--err); } .segno.warn { background: var(--warn-soft); color: var(--warn); }
.scegli-mobile { display: none; }
.dip-scelto { display: flex; align-items: center; gap: 12px; }
.dip-scelto .avatar { width: 44px; height: 44px; font-size: 15px; }
.dip-scelto h2 { font-size: 24px; font-weight: 600; }
.dip-scelto small { display: block; color: var(--muted); font-size: 13px; }
.colonna { display: grid; gap: 14px; min-width: 0; }
#contenuto { display: grid; gap: 14px; min-width: 0; }
.esporta { display: flex; gap: 6px; }
.riepilogo { display: grid; grid-template-columns: 1.5fr repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.riepilogo > div { padding: 12px 14px; border-left: 1px solid var(--line); display: grid; gap: 2px; align-content: start; }
.riepilogo > div:first-child { border-left: 0; }
.riepilogo small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; line-height: 1.3; }
.riepilogo b { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.1; }
.riepilogo .barra { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; margin-top: 6px; }
.riepilogo .barra i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.riepilogo .warn b { color: var(--warn); } .riepilogo .err b { color: var(--err); }
.controlli { display: grid; gap: 6px; background: var(--err-soft); border-radius: 12px; padding: 12px 14px; }
.controlli h3 { font-family: var(--body); font-size: 14px; font-weight: 600; color: var(--err); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.controlli h3 small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.controlli ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.controlli li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.controlli li span { flex: 1 1 260px; }
.controlli .altri { justify-self: start; }
.tabella { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 820px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; white-space: nowrap; }
tr.giorno { cursor: pointer; }
tr.giorno:hover td { background: var(--surface-2); }
tr.festa td { color: var(--faint); background: var(--surface-2); }
tr.anomalia td.data b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--err); margin-left: 5px; vertical-align: middle; }
tr.oggi td.data b { color: var(--accent-ink); }
td.data { white-space: nowrap; width: 92px; }
#contenuto td[data-l] { width: 1%; }   /* colonne delle ore strette: lo spazio va ai turni */
#contenuto td.c-turni { min-width: 240px; }
#contenuto td.assenze { min-width: 110px; }
td.data b { font-family: var(--display); font-size: 19px; font-weight: 600; margin-right: 5px; }
td.data small { color: var(--muted); text-transform: lowercase; }
.turni { display: grid; gap: 4px; justify-items: start; }
.turno { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.turno .ore { font-weight: 600; }
.turno .dove { color: var(--muted); font-size: 12.5px; }
/* pulsante della regola della mezz'ora sulla riga del turno fuori regola */
.turno .mezzora { padding: 2px 8px; font-size: 12px; align-self: center; }
/* riga sopra la tabella del mese: quanti turni sono fuori regola e il pulsante che li sistema tutti */
.mezzora-mese { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
/* pulsante che sta lavorando: rotellina davanti alla scritta */
.btn.in-corso { opacity: 1; cursor: progress; }
.btn.in-corso::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px; vertical-align: -1px; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.in-corso::before { animation-duration: 2.5s; } }
.piu { color: var(--ok); font-weight: 500; } .meno { color: var(--err); font-weight: 500; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); align-items: center; }
.solo-stampa { display: none; }
.stampa-titolo { display: none; }

/* richieste di assenza */
.filtri { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filtri button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 4px 12px; font-size: 13px; }
.filtri button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filtri button.ordine { margin-left: 8px; font-variant-numeric: tabular-nums; }
.filtri input:not([type=checkbox]) { margin-left: auto; border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 5px 12px; min-width: 220px; }
.richieste { display: grid; gap: 10px; }
.richiesta { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: grid;
  grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; }
.richiesta h3 { font-size: 18px; font-weight: 600; }
.richiesta .dati { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; margin-top: 2px; }
.richiesta .dati b { color: var(--ink); font-weight: 500; }
.richiesta .conflitto { grid-column: 1 / -1; }
.richiesta .azioni { justify-content: flex-end; }

/* pannello del giorno */
.velo { position: fixed; inset: 0; background: rgba(8, 24, 25, .38); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.velo.on { opacity: 1; pointer-events: auto; }
.pannello { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 41;
  transform: translateX(104%); transition: transform .24s ease; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.pannello.on { transform: none; }
.pannello header { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.pannello header h2 { font-size: 24px; }
.pannello header p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pannello header .chiudi { margin-left: auto; border: 1px solid var(--line-2); background: var(--surface); width: 34px; height: 34px; border-radius: 8px; font-size: 20px; line-height: 1; }
.pannello .corpo { padding: 16px 18px; overflow: auto; display: grid; gap: 14px; flex: 1; align-content: start; }
.pannello footer { padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.pannello footer .btn { flex: 1; }
.scheda { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.scheda .riga { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scheda label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.scheda input, .scheda select, .scheda textarea { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%; color: var(--ink); }
.scheda input:focus, .scheda select:focus, .scheda textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.scheda select:disabled { opacity: .6; }
.scheda .testa { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.scheda .testa b { font-family: var(--display); font-size: 17px; font-weight: 600; }
.scheda .c-avvisi ul { margin: 4px 0 0; padding-left: 18px; }
/* caselle di spunta nelle schede: piccole accanto al testo (non larghe come i campi) */
.scheda .check input[type="checkbox"] { width: 20px; height: 20px; padding: 0; flex: none; margin: 0; }
.scheda .riga > *, .scheda label { min-width: 0; }
.scheda input, .scheda select { min-width: 0; max-width: 100%; }
/* ora e data sul telefono (Safari): a sinistra e alte come gli altri campi, senza allargare il riquadro */
.scheda input[type="time"], .scheda input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-height: 38px; text-align: left; }
.scheda input[type="time"]::-webkit-date-and-time-value, .scheda input[type="date"]::-webkit-date-and-time-value { text-align: left; }
/* pannello e finestre aperti: la pagina sotto resta ferma; dentro si scorre solo in verticale, senza trascinare la pagina */
@media (pointer: coarse), (max-width: 760px) { html:has(.pannello.on), html:has(dialog[open]) { overflow: hidden; } }
.pannello { height: 100dvh; overscroll-behavior: contain; }
.pannello .corpo { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; min-height: 0; }
dialog.finestra, dialog.finestra .modulo-imp { overscroll-behavior: contain; }

/* ---------- pagine a sezioni (Accessi, Impostazioni) ---------- */
.blocco-sezione { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.blocco-sezione h2 { font-size: 21px; font-weight: 600; }
.nota-sezione { color: var(--muted); margin: 0; max-width: 75ch; }
.nota-sezione a { color: var(--accent-ink); }
table.compatta { min-width: 640px; }
table.compatta td { vertical-align: middle; }
tr.in-modifica td { background: var(--accent-soft); }
.campo-num { width: 84px; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); }
.blocco-modo { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.blocco-modo select { padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); }
.blocco-modo .minuti { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.azioni-riga { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.c-permessi .tag { margin: 1px 0; }
.modulo-imp { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; max-width: 760px; box-shadow: var(--shadow); }
.modulo-imp h3 { font-size: 18px; font-weight: 600; color: var(--accent-ink); }
.modulo-imp label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.modulo-imp input:not([type=checkbox]):not([type=radio]) { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); width: 100%; }
.modulo-imp input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
/* campo di sola lettura (es. Totale fatture nella commessa): grigetto, senza bordo di fuoco */
.modulo-imp input:not([type=checkbox]):not([type=radio])[readonly] { background: var(--sunken); color: var(--muted); border-style: dashed; cursor: default; }
.modulo-imp input[readonly]:focus { outline: none; border-color: var(--line-2); }
.modulo-imp .campi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.modulo-imp .campi .largo { grid-column: span 2; }
.modulo-imp fieldset { border: 0; margin: 0; padding: 0; }
.modulo-imp legend { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 6px; padding: 0; }
.giorni { display: flex; flex-wrap: wrap; gap: 6px; }
.giorni legend { width: 100%; }
.chip { display: inline-flex !important; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 16px; padding: 6px 12px; font-size: 13.5px; color: var(--ink); cursor: pointer; min-width: 48px; text-align: center; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.permessi-testa { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.permessi { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; }
.permessi fieldset { display: grid; gap: 6px; align-content: start; padding: 10px 12px !important; border: 1px solid var(--line) !important; border-radius: 10px; background: var(--surface-2); }
.permessi legend { float: left; width: 100%; margin-bottom: 4px; color: var(--accent-ink); font-weight: 600; }
.anno-festivi { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.anno-festivi .btn { white-space: normal; text-align: left; }

/* ---------- pagina di accesso ---------- */
.pagina-login { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 26px 22px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; }
.login-logo { height: 44px; justify-self: start; background: var(--logo-bg); border-radius: 6px; padding: 2px 4px; }
.login h1 { font-size: 30px; font-weight: 700; }
.login-prova { margin: -10px 0 0; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--warn); }
.login form { display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.login input { font-size: 15px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); }
.login input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.login .btn { font-size: 15px; padding: 11px 12px; }
.login-errore { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--err-soft); color: var(--err); }
.login-avviso { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); }
.login-altro { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ---------- telefono e tablet stretto ---------- */
/* timbrature del giorno (giornata.php) */
.blocco-sezione.largo { max-width: none; }
.giorno-scelta input { border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; padding: 5px 2px; min-width: 0; }
.riepilogo-giorno { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.riepilogo .ok b { color: var(--ok); }
#g-cerca { min-width: 300px; }
.chi-cella { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.chi-cella .avatar { width: 30px; height: 30px; font-size: 11.5px; background: var(--sunken); color: var(--ink); }
table.giornata tr.in-turno td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
table.giornata td:first-child { min-width: 200px; }

/* sicurezza (sicurezza.php) */
.segnalazioni { display: grid; gap: 10px; }
.segnalazione { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; display: grid; gap: 8px; }
.segnalazione header { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.segnalazione header .quando { margin-left: auto; color: var(--muted); font-size: 13px; }
.segnalazione .dati { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; }
.segnalazione .dati b { color: var(--ink); font-weight: 600; }
.segnalazione .regola { font-weight: 600; }
.blocco-testo b { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 500; }
.blocco-testo p { margin: 2px 0 0; max-width: 90ch; overflow-wrap: anywhere; }
.blocco-testo.evidenza { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; }
.segnalazione .azioni { justify-content: flex-end; }
.modulo-nota { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.modulo-nota label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.modulo-nota textarea { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 14px; color: var(--ink); resize: vertical; }
.modulo-nota textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.riga-nota { display: flex; gap: 12px; align-items: center; }
.contatore.poco { color: var(--warn); }
.errore-nota { color: var(--err); font-size: 13px; }
.btn.altri { justify-self: center; }
#s-filtri button[aria-pressed="true"] .piccola { color: inherit; opacity: .75; }
#s-cerca { min-width: 300px; }
#s-filtri select { border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 4px 10px; font-size: 13px; }
#s-statistiche > h2 { margin-top: 6px; }
.card .barretta { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.card .barretta i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.card.err .barretta i { background: var(--err); } .card.warn .barretta i { background: var(--warn); } .card.ok .barretta i { background: var(--ok); }
.grafico { position: relative; height: 260px; padding: 0 16px 16px; }
.grafico.piccolo-g { height: 220px; }

/* finestra sopra la pagina (<dialog>, per esempio Nuovo mezzo e Modifica) */
dialog.finestra { border: 0; padding: 0; background: transparent; max-width: min(760px, calc(100vw - 32px)); width: 100%; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); color: var(--ink); }
dialog.finestra::backdrop { background: rgba(8, 24, 25, .45); }
dialog.finestra .modulo-imp { max-width: none; box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overflow-x: hidden; }
.testa-finestra { display: flex; align-items: center; gap: 12px; }
.testa-finestra h3 { flex: 1; }
.testa-finestra .chiudi { border: 0; background: var(--sunken); color: var(--muted); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; line-height: 1; }
.testa-finestra .chiudi:hover { color: var(--ink); }

/* attrezzi e dotazioni (magazzino.php) */
.riga-schede { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.schede.piccole button { padding: 4px 12px; font-size: 13px; }
table.magazzino td { white-space: normal; }
#d-filtri select { border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 4px 10px; font-size: 13px; max-width: 220px; }
#d-cerca { min-width: 300px; }
dialog.finestra .modulo-imp select { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); width: 100%; color: var(--ink); }

/* mezzi (mezzi.php) e notifiche (notifiche.php) */
table.mezzi tr.spento td, table.anagrafica tr.spento td, table.clienti tr.spento td { color: var(--muted); }
table.mezzi td { white-space: normal; }
.maiuscolo { text-transform: uppercase; }
.modulo-imp .spunte { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.modulo-imp .check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink); font-weight: 400; }
.modulo-imp textarea { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); width: 100%; font-size: 14px; color: var(--ink); resize: vertical; }
.modulo-imp textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
#m-filtri select, #m-utilizzo select, #a-filtri select, #r-filtri select { border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 4px 10px; font-size: 13px; }
#m-cerca, #a-cerca, #r-cerca { min-width: 260px; }
/* Report ai referenti: un riquadro per referente, dentro le sue commesse */
#rf-filtri select { border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 4px 10px; font-size: 13px; max-width: 260px; }
#rf-cerca { min-width: 300px; }
#rf-elenco { display: grid; gap: 14px; }
.referente > header .chi { display: grid; gap: 2px; min-width: 0; }
.referente > header .chi .leg { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; overflow-wrap: anywhere; }
.referente > header .totale { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.referente.escluso { border-style: dashed; }
.commessa-ref { border-top: 1px solid var(--line); padding: 10px 16px 14px; display: grid; gap: 8px; }
.commessa-ref h3 { font-size: 14.5px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.commessa-ref h3 .numero { color: var(--accent-ink); }
.commessa-ref h3 .piccola { margin-left: auto; color: var(--muted); font-weight: 400; }
.commessa-ref table { table-layout: fixed; }
.commessa-ref th:nth-child(2), .commessa-ref th:nth-child(3) { width: 110px; }
.commessa-ref th:nth-child(4) { width: 80px; }
.commessa-ref th:nth-child(5) { width: 90px; }
.commessa-ref th:nth-child(6) { width: 80px; }
table.materiale td.testo-lungo { max-width: 46ch; white-space: pre-line; overflow-wrap: anywhere; }
#m-utilizzo h2 { font-size: 21px; font-weight: 600; }
.notifica header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notifica header h2 { margin-right: 4px; font-size: 22px; }
.notifica .interruttore { font-weight: 600; }
/* Notifiche: elenco per area a sinistra, la notifica scelta a destra (sul telefono una cosa alla volta) */
.notifiche-due { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 14px; }
.n-elenco { display: grid; gap: 14px; position: sticky; top: 12px; }
.n-gruppo { display: grid; gap: 2px; }
.n-gruppo .titolo { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 0 10px 4px; }
.n-voce { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid transparent; background: none; border-radius: 10px; padding: 9px 10px; color: var(--ink); }
.n-voce:hover { background: var(--sunken); }
.n-voce[aria-current="true"] { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.n-voce .tx { flex: 1; min-width: 0; display: grid; gap: 1px; }
.n-voce .tx b { font-weight: 600; font-size: 14px; }
.n-voce .tx small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n-voce .punto { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line-2); }
.n-voce .punto.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.n-dettaglio .notifica { max-width: 760px; }
.campo-dest { display: grid; gap: 6px; }
.campo-dest .eti { font-size: 13px; font-weight: 600; color: var(--muted); }
.etichette { display: flex; flex-wrap: wrap; gap: 6px; }
.destinatario { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: 13px; max-width: 100%; }
.destinatario.esterno { background: var(--sunken); }
.destinatario .piccola { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.destinatario .togli { border: 0; background: none; color: var(--muted); width: 22px; height: 22px; border-radius: 50%; font-size: 15px; line-height: 1; padding: 0; flex: none; }
.destinatario .togli:hover { background: var(--surface); color: var(--err); }
.aggiungi-dest { position: relative; }
.aggiungi-dest input { width: 100%; }
.proposte { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px; display: grid; max-height: 280px; overflow-y: auto; }
.proposte button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; color: var(--ink); }
.proposte button:hover, .proposte button.prima { background: var(--sunken); }
.proposte .vuoto { padding: 8px 10px; margin: 0; }
.solo-tel { display: none; }
@media (max-width: 760px) {
  .notifiche-due { grid-template-columns: 1fr; }
  .n-elenco { position: static; }
  .notifiche-due.con-dettaglio .n-elenco, .notifiche-due:not(.con-dettaglio) .n-dettaglio { display: none; }
  .solo-tel { display: inline-block; justify-self: start; }
}

/* ---------- Commesse (admin/commesse.php) ---------- */
.vista { display: inline-flex; background: var(--sunken); border-radius: 9px; padding: 3px; }
.vista button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: 13px; color: var(--muted); font-weight: 500; }
.vista button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.colbox { position: relative; }
.colmenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 10px 12px; display: grid; gap: 6px; min-width: 220px; }
.colmenu .eti { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.colmenu .btn { justify-self: end; margin-top: 4px; }
.soldi-commesse { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Buste paga (buste.php) */
dialog.finestra.larga { max-width: min(1040px, calc(100vw - 32px)); }
/* Anagrafica: giudizi di idoneità nella finestra del dipendente (js/dipendenti.js) */
.blocco-visite { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.blocco-visite h4 { font-size: 15px; }
.blocco-visite td.azione { white-space: nowrap; }
.blocco-visite td.azione .btn + .btn, .blocco-visite td.azione .btn + label.btn, .blocco-visite td.azione label.btn + .btn { margin-left: 4px; }
.zona-file { position: relative; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 22px 16px; border: 2px dashed var(--line-2);
             border-radius: 12px; background: var(--surface-2); cursor: pointer; color: var(--ink); }
.zona-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.zona-file b { color: var(--accent-ink); font-size: 16px; }
.zona-file:hover, .zona-file.sopra { border-color: var(--accent); background: var(--accent-soft); }
.zona-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
table.carico { min-width: 760px; }
table.carico select, table.carico input.anno { padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); color: var(--ink); width: 100%; }
table.carico input.anno { width: 84px; }
table.carico .nome-file { overflow-wrap: anywhere; max-width: 260px; }
table.carico tr.fatto td { opacity: .7; }

/* Documenti (documenti.php) */
table.documenti tbody tr { cursor: pointer; }
.stato-av { display: inline-grid; grid-template-columns: 90px auto; gap: 8px; align-items: center; }
.avanza { display: block; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.avanza i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.avanza.ok i { background: var(--ok); } .avanza.warn i { background: var(--warn); }
.lista-doc li { justify-content: space-between; }
.lista-doc .chi { min-width: 0; overflow-wrap: anywhere; }
.modulo-imp fieldset.scelta-a { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.modulo-imp fieldset.scelta-a label.check { flex: 0 0 auto; width: auto; white-space: nowrap; }
.modulo-imp fieldset.scelta-a legend { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.due-liste { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lista-dip { display: grid; grid-template-rows: auto auto 1fr; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 0; }
.lista-dip.scelti { grid-template-rows: auto 1fr; background: var(--accent-soft); border-color: var(--accent); }
.testa-lista { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink); }
.lista-dip input { padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); color: var(--ink); min-width: 0; }
.voci-dip { display: grid; align-content: start; gap: 2px; height: 240px; overflow-y: auto; overscroll-behavior: contain; }
.voce-dip { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 9px;
            border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.voce-dip:hover, .voce-dip:focus-visible { background: var(--sunken); }
.lista-dip.scelti .voce-dip:hover, .lista-dip.scelti .voce-dip:focus-visible { background: var(--surface); }
.voce-dip:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.voce-dip .freccia { color: var(--accent-ink); font-weight: 600; flex-shrink: 0; }
.voci-dip .vuoto { padding: 10px 6px; font-size: 13px; }
@media (max-width: 760px) { .due-liste { grid-template-columns: 1fr; } .voci-dip { height: 190px; } }

/* Report per commessa (report_commesse.php) */
.scelta-report { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) 150px 150px auto; gap: 10px; align-items: end; margin-bottom: 12px; }
.scelta-report label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.scelta-report select, .scelta-report input { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; min-width: 0; }
.testa-report { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.testa-report .piccola { display: block; }
.riepilogo b.piccolo-b { font-size: 18px; }
table.report-ore tr.anomalo td { background: var(--err-soft); color: var(--err); }
@media (max-width: 760px) { .scelta-report { grid-template-columns: 1fr 1fr; } .scelta-report .largo, .scelta-report .btn { grid-column: 1 / -1; } }

/* KPI fatture (kpi.php) */
.kpi-soldi { margin-bottom: 14px; }
.kpi-soldi .forte b { color: var(--accent-ink); font-size: 30px; }
.delta.su { color: var(--ok); } .delta.giu { color: var(--err); }
.kpi-due { margin-bottom: 14px; }
.kpi-tab { margin-bottom: 14px; }
.kpi-tab .tabella { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.kpi-torta { height: 340px; }
.kpi-png { padding: 0 16px 14px; display: flex; justify-content: flex-end; }
.kpi-clienti { display: grid; padding: 0 8px 10px; }
.kpi-cliente { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.kpi-cliente:hover { background: var(--surface-2); }
.kpi-cliente .pos { color: var(--faint); font-weight: 600; text-align: right; }
.kpi-cliente .nome { display: grid; gap: 3px; min-width: 0; }
.kpi-cliente .nome b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.kpi-cliente .soldi { font-family: var(--display); font-size: 18px; font-weight: 600; }
.barra-k { display: block; height: 5px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.barra-k i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.incidenza { display: grid; grid-template-columns: minmax(60px, 1fr) 58px; gap: 8px; align-items: center; min-width: 130px; }
.incidenza .num { text-align: right; font-size: 13px; }
.pallino { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.kpi-stati { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; padding: 0 16px 16px; }
.kpi-stato { display: grid; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--line-2); }
.kpi-stato small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.kpi-stato b { font-family: var(--display); font-size: 24px; font-weight: 600; }
.kpi-stato.st-in-corso { border-top-color: var(--info); } .kpi-stato.st-chiusa { border-top-color: var(--warn); }
.kpi-stato.st-fatturata { border-top-color: var(--ok); } .kpi-stato.st-da-iniziare { border-top-color: var(--faint); }
.kpi-tab th .ordina { all: unset; cursor: pointer; } .kpi-tab th .ordina:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) { .kpi-torta { height: 420px; } .kpi-cliente .soldi { font-size: 16px; } }
.soldi-commesse .piccola { line-height: 1.3; }
.soldi-commesse button.filtra { all: unset; cursor: pointer; display: grid; gap: 2px; }
.soldi-commesse button.filtra:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.soldi-commesse .ok b { color: var(--ok); }
#c-filtri select { border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 4px 10px; font-size: 13px; max-width: 200px; }
#c-cerca { min-width: 260px; }
.n-commessa { font-family: var(--display); font-weight: 600; color: var(--accent-ink); font-size: 15px; }
.segnale { display: block; font-size: 11.5px; color: var(--warn); margin-top: 2px; }
.tag.vuota { background: none; border: 1px dashed var(--line-2); color: var(--faint); }
.barra-f { display: block; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; min-width: 80px; margin-bottom: 3px; }
.barra-f i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.barra-f.piena i { background: var(--ok); }
.marg.ok { color: var(--ok); } .marg.warn { color: var(--warn); } .marg.err { color: var(--err); }
table.commesse tbody tr { cursor: pointer; }
table.commesse tr.spento td { color: var(--muted); }
table.commesse td { white-space: nowrap; }
table.commesse td:first-child, table.commesse td:nth-child(2) { white-space: normal; }
table.commesse td.testo-lungo { white-space: normal; min-width: 160px; max-width: 280px; }
table.commesse .taglia { display: block; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.commesse tfoot td { white-space: nowrap; }
#c-filtri button:disabled { opacity: .45; cursor: default; }
table.commesse th .ordina { all: unset; cursor: pointer; }
table.commesse th .ordina:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* vista per stato */
.per-stato { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.colonna-stato { background: var(--sunken); border-radius: 12px; padding: 10px; display: grid; gap: 8px; }
.colonna-stato header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px 4px; }
/* scorrendo, il nome dello stato resta in cima alla sua colonna: sotto la parte alta fissa (computer) o la barra del
   telefono; sfondo e margini negativi coprono il bordo della colonna, così le schede ci passano sotto */
.colonna-stato header { position: sticky; top: var(--alto-fissa, 0px); z-index: 4; background: var(--sunken); margin: -10px -10px 0; padding: 12px 14px 6px; border-radius: 12px 12px 0 0; }
@media (max-width: 760px) { .colonna-stato header { top: calc(53px + env(safe-area-inset-top, 0px)); } }
.colonna-stato h3 { font-size: 17px; font-weight: 600; }
.colonna-stato header span { font-size: 12px; color: var(--muted); }
.carta-commessa { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; display: grid; gap: 4px; text-align: left; width: 100%; }
.carta-commessa:hover { border-color: var(--accent); }
.carta-commessa .riga1 { display: flex; justify-content: space-between; gap: 8px; }
.carta-commessa .t { font-weight: 500; line-height: 1.3; }
/* scheda */
.pannello.largo { width: min(580px, 100%); }
.numero-commessa { font-family: var(--display); font-weight: 700; color: var(--accent-ink); font-size: 15px; }
.passi-stato { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.passi-stato button { border: 0; background: var(--sunken); color: var(--muted); font-size: 12.5px; padding: 7px 4px; border-radius: 6px; font-weight: 500; }
.passi-stato button.fatto { background: var(--accent-soft); color: var(--accent-ink); }
.passi-stato button.ora { background: var(--accent); color: var(--on-accent); }
.tre-soldi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tre-soldi > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; display: grid; gap: 2px; }
.tre-soldi small { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tre-soldi b { font-family: var(--display); font-size: 20px; font-weight: 600; }
.cascata { display: grid; gap: 6px; }
.cascata .r { display: grid; grid-template-columns: 90px 1fr 92px; gap: 10px; align-items: center; font-size: 13px; }
.cascata .r .num { text-align: right; }
.cascata .b { height: 11px; border-radius: 3px; background: var(--sunken); position: relative; overflow: hidden; }
.cascata .b i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
/* scheda della commessa, sezione Fatture: tabella delle righe e modulo per aggiungerne o modificarne una */
.fatture-commessa { display: grid; gap: 10px; }
.fatture-commessa .testa-fatture { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.fatture-commessa h3 { font-size: 15px; font-weight: 600; margin: 0; }
.fatture-commessa table.fatture { width: 100%; min-width: 0; table-layout: fixed; }
.fatture-commessa table.fatture td, .fatture-commessa table.fatture th { padding: 5px 6px; vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.fatture-commessa table.fatture th:nth-child(1) { width: 31%; } .fatture-commessa table.fatture th:nth-child(2) { width: 12%; }
.fatture-commessa table.fatture th:nth-child(3) { width: 17%; } .fatture-commessa table.fatture th:nth-child(5) { width: 21%; }
.fatture-commessa table.documenti th:nth-child(1) { width: 20%; } .fatture-commessa table.documenti th:nth-child(2) { width: auto; }
.fatture-commessa table.documenti th:nth-child(3) { width: 20%; } .fatture-commessa table.documenti th:nth-child(4) { width: 21%; }
.fattura-modulo select { width: 100%; box-sizing: border-box; }
/* allegati di una fattura o di un documento, sotto il numero: nome del file (si apre) e × per eliminarlo, poi "+ allega file" */
.allegati { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 12px; align-items: center; }
.allegati .allegato { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.allegati .allegato .link { flex: 0 1 auto; min-width: 0; padding: 0; font-weight: 500; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.allegati .x { flex: none; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; min-width: 28px; min-height: 28px; padding: 0 4px; cursor: pointer; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }  /* da tocco; flex none: si accorcia il nome del file, non il pulsante */
.allegati .x:hover, .allegati .x.conferma { color: var(--err); background: var(--err-soft, var(--warn-soft)); }
/* secondo passo: la × diventa un vero pulsante rosso «Elimina?», grande da premere */
.allegati .x.conferma { font-size: 13px; font-weight: 600; padding: 6px 12px; min-height: 32px; border: 1px solid var(--err); white-space: nowrap; }
.allegati .link.piccola { font-size: 12px; font-weight: 600; padding: 0; }
.fatture-commessa tr.da-dividere td { background: var(--warn-soft); }
.fatture-commessa table.fatture tr.riga-modulo td { padding: 4px 0; }
.fatture-commessa .azioni-riga .btn { display: block; width: 100%; margin: 0 0 6px; padding: 7px 6px; min-height: 34px; font-size: 13px; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }  /* pulsanti da tocco (34px); «Confermi? +2 allegati» va a capo, non esce dalla scheda */
.btn.piccolo { padding: 2px 9px; font-size: 12px; }
.fattura-modulo { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px 10px; align-items: end; background: var(--sunken); border-radius: 10px; padding: 10px 12px; }
.fattura-modulo label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.fattura-modulo input { width: 100%; box-sizing: border-box; }
.fattura-modulo .largo, .fattura-modulo .azioni, .fattura-modulo .nota { grid-column: 1 / -1; }
.fattura-modulo .azioni { display: flex; gap: 8px; }
@media (max-width: 560px) { .fattura-modulo { grid-template-columns: 1fr 1fr; } .fattura-modulo label:first-of-type { grid-column: 1 / -1; } }
.dati-commessa { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.dati-commessa div { display: grid; gap: 1px; min-width: 0; }
.dati-commessa dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dati-commessa dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dati-commessa .largo { grid-column: 1 / -1; }
.cartella { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px !important; font-weight: 400 !important; background: var(--sunken); padding: 6px 8px; border-radius: 6px; }
@media (min-width: 761px) {
  /* la tabella delle commesse scorre nel suo riquadro, in basso e di lato: intestazione e colonna Commessa restano ferme */
  /* il riquadro prende l'altezza rimasta sullo schermo (js/commesse.js, adattaAltezza): la pagina non scorre, si scorre
     solo la tabella e l'intestazione resta sempre in vista */
  .testa-fissa .tabella.scorre { overflow: auto; max-height: calc(100dvh - var(--alto-fissa, 0px) - 90px); }
  .testa-fissa .tabella.scorre thead th { top: 0; }
  /* Registro presenze: stessa cosa per la tabella dei giorni (js/registro.js, adattaAltezza): la parte alta resta ferma */
  #v-registro .tabella.scorre { overflow: auto; }
  #v-registro .tabella.scorre thead th { position: sticky; top: 0; z-index: 5; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--line); }
  table.commesse th:first-child, table.commesse td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 220px; max-width: 300px; box-shadow: 1px 0 0 var(--line); }
  table.commesse thead th:first-child { z-index: 6; background: var(--surface-2); }
  table.commesse tfoot td:first-child { background: var(--surface-2); }
  table.commesse tbody tr:hover td { background: var(--surface-2); }
  table.commesse tbody tr.in-modifica td { background: var(--accent-soft); }
  table.commesse tfoot td { position: sticky; bottom: 0; background: var(--surface-2); box-shadow: inset 0 1px 0 var(--line); font-weight: 600; }
}
@media (max-width: 560px) {
  .tre-soldi { grid-template-columns: 1fr 1fr; }
  .dati-commessa { grid-template-columns: 1fr; }
  #c-filtri select { max-width: none; flex: 1 1 45%; }
  .colmenu { right: auto; left: 0; }
}

/* parte alta fissa scorrendo una tabella lunga (Attrezzi e dotazioni): titolo, schede, filtri e poi i nomi delle
   colonne; --alto-fissa è l'altezza della parte fissa (la misura il JS della pagina) */
@media (min-width: 761px) {
  .fissa-su { position: sticky; top: 0; z-index: 20; display: grid; gap: 14px; background: var(--bg);
    margin: -22px -28px 0; padding: 18px 28px 12px; }
  .fissa-su.staccata { box-shadow: 0 1px 0 var(--line), 0 6px 12px -8px rgba(8, 24, 25, .25); }
  .fissa-su .filtri { margin-bottom: 0; }
  .fissa-su #imp-sopra:empty { display: none; }
  /* la tabella non fa da contenitore di scorrimento (overflow: clip), così l'intestazione si ferma sotto la parte fissa */
  .testa-fissa .tabella { overflow: clip; }
  .testa-fissa table { min-width: 0; }
  .testa-fissa thead th { position: sticky; top: var(--alto-fissa, 0px); z-index: 5; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--line); }
}

@media (max-width: 760px) {
  .guscio { grid-template-columns: 1fr; }
  .su-tel { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .su-tel img { height: 28px; display: block; background: var(--logo-bg); border-radius: 5px; padding: 1px 3px; }
  .su-tel .in-prova { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 1px 7px; }
  .su-tel .avatar { margin-left: auto; width: 32px; height: 32px; font-size: 12px; }
  /* il menu laterale diventa un pannello che si apre da "Altro" */
  .lato { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); height: auto; transform: translateX(-105%);
    transition: transform .22s ease; padding-top: calc(18px + env(safe-area-inset-top, 0px)); padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  body.menu-aperto .lato { transform: none; box-shadow: var(--shadow-lg); }
  .lato > .marchio { top: calc(-18px - env(safe-area-inset-top, 0px)); margin-top: calc(-18px - env(safe-area-inset-top, 0px)); padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  .velo-menu { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(8, 24, 25, .4); }
  .giu-tel { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: sticky; bottom: 0; z-index: 30; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .giu-tel a, .giu-tel button { display: grid; justify-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); text-decoration: none; padding: 4px 0;
    position: relative; font-weight: 500; border: 0; background: none; }
  .giu-tel .ic { width: 22px; height: 22px; }
  .giu-tel a[aria-current="page"], .giu-tel button[aria-expanded="true"] { color: var(--accent-ink); }
  .giu-tel .pallino { position: absolute; top: 0; left: calc(50% + 6px); width: auto; height: 16px; min-width: 16px; margin: 0; box-sizing: border-box; text-align: center;
    white-space: nowrap; color: #fff; font-size: 10px; font-weight: 600; border-radius: 8px; padding: 0 5px; line-height: 16px; background: var(--muted); }
  .giu-tel .pallino.err { background: var(--err); } .giu-tel .pallino.warn { background: var(--warn); }
  .principale { padding: 16px 16px 24px; gap: 14px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

  .testata h1 { font-size: 25px; flex-basis: 100%; }
  .testata .destra { margin-left: 0; width: 100%; }
  .testata .destra .mese { flex: 1; justify-content: space-between; }
  .schede { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .schede button { flex: 1 0 auto; justify-content: center; white-space: nowrap; }

  .dafare { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 12px; }
  .card .grande { font-size: 32px; }
  .card .piccolo { display: none; }
  .due { grid-template-columns: 1fr; }
  .lista .azioni { width: 100%; margin-left: 42px; }

  .pagina { grid-template-columns: 1fr; }
  .rail, .dip-scelto { display: none; }
  .scegli-mobile { display: block; }
  .scegli-mobile select { width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 11px 12px; font-weight: 500; }
  .riepilogo { grid-template-columns: 1fr 1fr; }
  .riepilogo > div { border-left: 0; border-top: 1px solid var(--line); }
  .riepilogo > div:first-child { grid-column: 1 / -1; border-top: 0; }
  .riepilogo > div:nth-child(odd):not(:first-child) { border-left: 1px solid var(--line); }
  .riepilogo b { font-size: 22px; }

  /* registro del mese: ogni giorno è una scheda */
  #contenuto .tabella { background: none; border: 0; border-radius: 0; overflow: visible; }
  #contenuto table { min-width: 0; }
  #contenuto thead { display: none; }
  #contenuto tbody { display: grid; gap: 8px; }
  #contenuto tr.giorno { display: grid; grid-template-columns: 44px repeat(3, minmax(0, 1fr)); gap: 4px 10px; padding: 10px 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  #contenuto tr.festa { background: var(--surface-2); }
  #contenuto tr.giorno td { padding: 0; border: 0; background: none; width: auto; min-width: 0; white-space: normal; }
  #contenuto td.data { grid-row: 1 / span 3; width: auto; display: grid; align-content: start; }
  #contenuto td.data b { font-size: 24px; margin: 0; }
  #contenuto td.c-turni, #contenuto td.assenze { grid-column: 2 / -1; }
  #contenuto td.assenze:empty, #contenuto td[data-l]:empty { display: none; }
  #contenuto td[data-l] { text-align: left; }
  #contenuto td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
  .legenda { display: none; }
  .filtri input, #g-cerca, #s-cerca, #m-cerca, #d-cerca, #a-cerca, #r-cerca, #rf-cerca, #c-cerca { margin-left: 0; width: 100%; min-width: 0; }
  .filtri button.ordine { margin-left: 0; }
  .segnalazione { padding: 12px; }
  .segnalazione header .quando { margin-left: 0; width: 100%; }
  .segnalazione .azioni { justify-content: flex-start; }
  .richiesta { grid-template-columns: 1fr; }
  .richiesta .azioni { justify-content: flex-start; }

  /* Accessi e Impostazioni: righe delle tabelle come schede */
  table.compatta { min-width: 0; }
  table.compatta thead { display: none; }
  table.compatta, table.compatta tbody { display: block; }
  table.compatta tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.compatta tr:last-child { border-bottom: 0; }
  table.compatta tr.in-modifica { background: var(--accent-soft); }
  table.compatta td { display: block; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; background: none !important; }
  table.compatta td:first-child, table.compatta td.c-blocco, table.compatta td.azione, table.compatta td.c-permessi { grid-column: 1 / -1; }
  table.compatta td[data-l]::before { content: attr(data-l); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
  table.compatta td.azione:empty { display: none; }
  table.commesse tfoot td:empty { display: none; }   /* totali delle commesse: niente caselle vuote nella scheda */
  table.giornata td:first-child { min-width: 0; }
  .commessa-ref { padding: 10px 12px 12px; }
  .commessa-ref table.compatta tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  table.giornata tr.in-turno { box-shadow: inset 3px 0 0 var(--ok); }
  table.giornata tr.in-turno td:first-child { box-shadow: none; }
  .riepilogo-giorno > div:last-child:nth-child(even) { grid-column: 1 / -1; }
  table.compatta td.azione .btn { width: 100%; }
  table.compatta td.azione .azioni-riga { display: flex; width: 100%; }
  table.compatta td.azione .azioni-riga .btn { flex: 1; width: auto; }
  .modulo-imp .campi .largo { grid-column: auto; }
  .modulo-imp .azioni .btn { flex: 1; }
}
@media (max-width: 480px) {
  .scheda .riga { grid-template-columns: 1fr; }
}
/* dito invece del mouse: comandi più grandi; campi a 16 px così il telefono non ingrandisce la pagina */
@media (pointer: coarse) {
  .btn { padding: 9px 14px; }
  .btn.piccolo { padding: 8px 12px; font-size: 13.5px; }
  .mese button { padding: 10px 14px; }
  .schede button { padding: 9px 14px; }
  .filtri button { padding: 8px 14px; font-size: 14px; }
  .rail li button { padding: 10px 8px; }
  .pannello header .chiudi { width: 42px; height: 42px; }
  input, select, textarea { font-size: 16px !important; }
  .scheda input, .scheda select, .modulo-imp input:not([type=checkbox]):not([type=radio]), .campo-num, .blocco-modo select, .filtri input, .scegli-mobile select { min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- stampa del registro: sempre chiara, senza menu ---------- */
@media print {
  #v-registro .tabella.scorre { max-height: none !important; overflow: visible !important; }
  @page { size: A4 landscape; margin: 10mm; }
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f4f6f6; --sunken: #eef2f2; --line: #c9d3d3; --line-2: #c9d3d3;
    --ink: #000; --muted: #444; --faint: #666;
    --accent: #01a4a6; --accent-ink: #017577; --accent-soft: #e0f4f4; --on-accent: #fff;
    --ok: #2d8a55; --ok-soft: #e3f3ea; --warn: #b57a06; --warn-soft: #fbf0d6; --err: #c2413a; --err-soft: #fbe6e4; --info: #3a73ad; --info-soft: #e5eef8;
  }
  body { font-size: 10.5px; }
  .guscio { display: block; }
  #g-filtri, #g-oggi, table.giornata td.azione, table.giornata th:last-child, #rf-filtri, #rf-ieri, .commessa-ref td.azione, .commessa-ref th:last-child, #rf-elenco + .nota-sezione,
  .lato, .su-tel, .giu-tel, .velo-menu, .rail, .scegli-mobile, .schede, .mese button, .esporta, .controlli, .legenda, .velo, .pannello, .toast, #v-richieste { display: none !important; }
  .principale { padding: 0; }
  .pagina { display: block; }
  .dip-scelto { display: flex !important; }
  .riepilogo { grid-template-columns: repeat(6, 1fr) !important; }
  .riepilogo b { font-size: 16px; }
  .riepilogo .barra { display: none; }
  .turno .mezzora, .mezzora-mese { display: none; }
  .tabella { overflow: visible; border: 0; }
  table { min-width: 0 !important; font-size: 10px; }
  #contenuto tbody { display: table-row-group !important; }
  #contenuto tr.giorno { display: table-row !important; }
  #contenuto thead { display: table-header-group !important; }
  tr.giorno, tr.giorno td { break-inside: avoid; }
  .commessa-ref { break-inside: avoid; }
  .tag { border: 1px solid var(--line); background: none !important; }
  .solo-stampa { display: flex; justify-content: space-between; gap: 40px; margin-top: 28px; font-size: 11px; }
  .solo-stampa span { flex: 1; border-top: 1px solid #000; padding-top: 4px; }
  /* stampa delle richieste di assenza (registro.php#richieste): solo titolo, filtro scelto e lista, senza pulsanti */
  body.stampa-richieste #v-richieste { display: block !important; }
  body.stampa-richieste .testata, body.stampa-richieste #v-registro, body.stampa-richieste .dip-scelto,
  body.stampa-richieste #filtri, body.stampa-richieste .richiesta .azioni { display: none !important; }
  body.stampa-richieste .stampa-titolo { display: block; margin-bottom: 10px; }
  body.stampa-richieste .stampa-titolo h2 { font-size: 18px; }
  body.stampa-richieste .stampa-titolo p { color: var(--muted); }
  body.stampa-richieste .richieste { gap: 0; }
  body.stampa-richieste .richiesta { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 5px 0; break-inside: avoid; }
  body.stampa-richieste .richiesta h3 { font-size: 12px; }
  body.stampa-richieste .richiesta .dati { font-size: 10.5px; }
}

/* Nuovo portale (migrazione.php): la scelta "Nuovo" si vede subito */
.schede button.scelta-nuovo[aria-selected="true"] { background: var(--accent); color: var(--on-accent, #fff); }

/* Ruoli: livello di ogni sezione (Nessuno / Lettura / Completo) */
.permessi .livello { display: grid; gap: 4px; }
.permessi .livello .schede { flex-wrap: nowrap; width: max-content; max-width: 100%; }
.permessi .schede label { position: relative; cursor: pointer; }
.permessi .schede input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.permessi .schede label span { display: inline-block; padding: 3px 9px; border-radius: 7px; font-size: 12.5px; color: var(--muted); }
.permessi .schede input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); font-weight: 600; }
.permessi .schede .liv2 input:checked + span { background: var(--accent); color: var(--on-accent); }
.permessi .schede input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Sola lettura (js/sessione.js): i pulsanti che modificano restano invisibili finché la sessione non dice se si può */
html:not([data-scrive-pronto]) [data-scrive] { visibility: hidden; }
#segno-sola-lettura { font-size: 12px; vertical-align: middle; font-family: var(--body); }
[data-legge] { display: none; }

/* accesso con Face ID / impronta (login.php) */
.login-pk { width: 100%; justify-content: center; margin-top: 10px; }
.login-proposta { display: grid; gap: 10px; }
.login-proposta p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.login-proposta p b { color: var(--ink); font-size: 15px; }

/* menu laterale: Accesso con Face ID / impronta (js/passkey_admin.js) */
.voce-pk { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--side-muted); font-size: 12.5px; padding: 2px 4px; text-align: left; }
.voce-pk:hover { color: var(--side-ink); }
.lista-pk { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.lista-pk li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.lista-pk li span { flex: 1; min-width: 0; }
/* finestra Aspetto (js/aspetto_admin.js) */
dialog.finestra.stretta { max-width: min(520px, calc(100vw - 32px)); }
/* popup delle novità (js/novita.js) */
.novita-gruppo h4 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 4px 0 6px; }
.novita-gruppo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.novita-gruppo li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.novita-gruppo li p { margin: 4px 0 6px; color: var(--ink); }
.novita-gruppo li a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.novita-gruppo li a:hover { text-decoration: underline; }
.novita-gruppo li.nuova { border-color: var(--accent); }
.chip-nuova { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
              background: var(--accent); color: var(--on-accent); vertical-align: 1px; }
.scelta-aspetto { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.scelta-aspetto legend { font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.segmenti-asp { display: flex; gap: 4px; background: var(--sunken); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.segmenti-asp button { flex: 1; min-width: 0; border: 0; background: none; border-radius: 7px; padding: 7px 6px; font-weight: 600; color: var(--muted); }
.segmenti-asp button[aria-checked="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow); }
.colori-asp { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.colori-asp button { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
                     padding: 8px 10px; font-weight: 600; color: var(--ink); text-align: left; min-width: 0; }
.colori-asp button i { width: 20px; height: 20px; border-radius: 50%; flex: none; }
.colori-asp button[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.notifica .link { border: 0; background: none; color: var(--accent-ink); padding: 0; font-weight: 600; font-size: 14px; }
/* Formazione: corsi programmati */
.modulo-imp fieldset.senza-bordo { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }
.riga-strumenti { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.presenze-corso { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.blocco-commessa-form { display: grid; gap: 6px; margin-bottom: 14px; max-width: 760px; }
.blocco-commessa-form label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; color: var(--muted); }
.blocco-commessa-form select { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); color: var(--ink); }

/* Registro: copia del turno ad altri dipendenti (un solo elenco, i nomi scelti hanno la spunta) */
.lista-dip.copia .voci-dip { height: 200px; }
.lista-dip.copia .voce-dip[aria-pressed="true"] { background: var(--accent-soft); font-weight: 600; }
.lista-dip.copia .voce-dip[aria-pressed="false"] .freccia { visibility: hidden; }
.lista-dip.copia .azioni { display: flex; gap: 8px; flex-wrap: wrap; }
.lista-dip.copia .testa-lista span .btn + .btn { margin-left: 6px; }

/* Finestre e pagina Formazione sul telefono */
/* date e ore: Safari su iPhone dà ai campi data una larghezza minima propria e li fa uscire dal riquadro */
.modulo-imp input[type="date"], .modulo-imp input[type="time"], .modulo-imp input[type="month"], .modulo-imp input[type="datetime-local"] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; min-height: 38px; text-align: left; }
.modulo-imp input[type="date"]::-webkit-date-and-time-value, .modulo-imp input[type="time"]::-webkit-date-and-time-value,
.modulo-imp input[type="month"]::-webkit-date-and-time-value, .modulo-imp input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; }
.modulo-imp .campi > *, .modulo-imp label { min-width: 0; }
.modulo-imp input[type="radio"] { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.modulo-imp input[type="checkbox"] { flex: 0 0 auto; accent-color: var(--accent); }
/* commessa delle timbrature: una commessa dal nome lungo non allarga la pagina */
.blocco-commessa-form { grid-template-columns: minmax(0, 1fr); }
.blocco-commessa-form label, .blocco-commessa-form select { min-width: 0; max-width: 100%; width: 100%; }
/* filtri: il numero si legge anche sul filtro scelto; la scelta del corso come gli altri filtri */
.filtri button[aria-pressed="true"] .piccola { color: inherit; opacity: .75; }
.filtri select { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 16px; padding: 5px 30px 5px 12px; font-size: 13px; max-width: 100%; min-width: 0; }
/* lista dei scelti vuota: niente riquadro alto e vuoto */
.lista-dip.scelti .voci-dip:has(> .vuoto:only-child) { height: auto; }
@media (max-width: 760px) {
  /* quattro schede: due righe da due invece di una riga che scorre e nasconde l'ultima */
  .schede.quattro { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .schede.quattro button { white-space: normal; text-align: center; min-width: 0; }
  .filtri select { width: 100%; min-height: 42px; font-size: 16px; }
  /* Situazione: le righe dello stesso dipendente stanno insieme, il nome una volta sola */
  table.compatta tr.segue td:first-child { display: none; }
  table.compatta tr.segue { padding-top: 4px; }
  table.compatta tr.continua { border-bottom: 1px dashed var(--line); }
}
