@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url("/assets/fonts/inter-latin-400-normal.woff2") format("woff2");}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url("/assets/fonts/inter-latin-500-normal.woff2") format("woff2");}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url("/assets/fonts/inter-latin-600-normal.woff2") format("woff2");}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url("/assets/fonts/inter-latin-700-normal.woff2") format("woff2");}

/* ==========================================================================
   Pizzalonga Away · Design system "Apple"
   Principi: una sola tinta d'azione (rosso brand), superfici chiare a strati,
   linee sottili invece di bordi e ombre, tipografia di sistema (SF su Apple),
   movimenti brevi con l'easing delle app iOS.
   ========================================================================== */
:root {
  /* ---- Palette ufficiale Pizzalonga Away (brand/BRANDBOOK.md) ---- */
  --pa-red-logo: #E50026;     /* solo logo */
  --pa-red: #C5062E;          /* rosso istituzionale: azioni */
  --pa-red-hover: #A4222A;
  --pa-green: #66E526;        /* verde "away": solo decorativo o come fondo */
  --pa-green-herb: #71AF52;
  --pa-flour: #DCD8C8;
  --pa-text: #2B2824;
  --pa-text-muted: #757575;
  --pa-line: #E6E6E6;
  --pa-white: #FFFFFF;

  /* Superfici (app operativa: fondo #FAFAF8 come da linee guida) */
  --bg: #FAFAF8;
  --bg-elev: var(--pa-white);
  --bg-sunken: #F7F6F1;       /* farina al 22% su bianco */
  --bg-grouped: #F4F3EF;      /* farina al 30%: fondo dei fogli modali */
  --info-bg: #EFEDE6;         /* farina al 40%: avvisi informativi */
  --fill: rgba(43, 40, 36, 0.06);
  --fill-strong: rgba(43, 40, 36, 0.11);

  /* Testo */
  --fg: var(--pa-text);
  --fg-muted: var(--pa-text-muted);
  --fg-subtle: #A9A6A1;

  /* Linee */
  --border: var(--pa-line);
  --border-strong: rgba(43, 40, 36, 0.18);
  --hairline: var(--pa-line);

  /* Azione: rosso istituzionale */
  --accent: var(--pa-red);
  --accent-hover: var(--pa-red-hover);
  --accent-soft: rgba(197, 6, 46, 0.07);
  --accent-fg: #FFFFFF;

  /* Stati (linee guida §3): distinti dal rosso del brand */
  --success: #2E7D32;
  --success-soft: rgba(46, 125, 50, 0.10);
  --brand-green: var(--success);
  --brand-green-soft: var(--success-soft);
  --warn: #B26A00;
  --warn-text: #7F4E00;
  --warn-soft: rgba(178, 106, 0, 0.10);
  --danger: #B00020;
  --danger-soft: rgba(176, 0, 32, 0.07);

  /* Forme: arrotondate in stile Apple (scelta esplicita al posto degli angoli vivi) */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Tipografia: una sola famiglia sans, nessun corsivo */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, "Segoe UI", sans-serif;
  --font-serif: var(--font-display);
  --font-mono: var(--font-sans);

  /* Movimento */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Barre fisse */
  --glass: rgba(255, 255, 255, 0.86);
  --glass-filter: saturate(160%) blur(20px);

  --tabbar-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
button:disabled { cursor: default; }
input, select, textarea { font-family: inherit; color: inherit; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
::selection { background: rgba(197, 6, 46, 0.14); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--pa-text); outline-offset: 2px; border-radius: 10px; }

.tnum { font-variant-numeric: tabular-nums; }

.app {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* --------------------------------------------------------------------------
   Tabellone turni: stessa struttura, resa pulita
   -------------------------------------------------------------------------- */
.board-container {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-top: 12px; margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.discord-table {
  width: 100%; min-width: 720px;
  border-collapse: separate; border-spacing: 0;
  font-family: var(--font-sans);
  font-size: 13px; color: var(--fg);
}
.discord-table th, .discord-table td {
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 0; text-align: center; vertical-align: middle;
}
.discord-table tr > *:last-child { border-right: none; }
.discord-table tbody tr:last-child > * { border-bottom: none; }
.discord-table th {
  background: var(--bg);
  font-weight: 600; font-size: 11.5px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--fg-muted);
  padding: 12px 6px;
  position: sticky; top: 0; z-index: 1;
}
.discord-table th.col-corner {
  background: var(--bg); color: var(--fg);
  font-size: 11.5px; min-width: 140px; width: 15%;
}
.discord-table td.store-header-cell {
  background: #FCF3F4;
  font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--pa-red);
  padding: 12px 8px;
}
.discord-table td.shift-header-cell {
  background: var(--bg-sunken);
  font-weight: 600; font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--fg-muted);
  padding: 6px 4px; width: 68px;
}
.discord-table td.shift-header-cell.is-sera { background: var(--info-bg); color: var(--fg); }
.discord-table td.riposi-header-cell,
.discord-table td.ferie-header-cell {
  background: var(--bg);
  font-weight: 700; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--fg-muted);
  padding: 10px 8px; line-height: 1.25;
}
.discord-table td.board-cell {
  background: var(--bg-elev);
  padding: 6px 4px; vertical-align: top;
  height: 80px; width: 12%;
  position: relative;
  transition: background .2s var(--ease);
}
.discord-table td.board-cell.is-editable { cursor: pointer; }
.discord-table td.board-cell.is-editable:hover { background: #FDF6F7; }
.discord-table td.board-cell.is-editable:active { background: #FBEEF0; }

.staff-stack { display: flex; flex-direction: column; gap: 2px; min-height: 100%; }
.staff-line {
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 3px 4px; border-radius: 6px;
  text-align: center; color: var(--fg); line-height: 1.2;
}
/* I tuoi turni: il verde "away" come fondo, testo scuro (uso consentito dal brand) */
.staff-line.my-shift {
  background: rgba(102, 229, 38, 0.30); color: var(--pa-text); font-weight: 700;
}
.empty-cell-hint {
  color: var(--fg-subtle); font-size: 11px;
  padding-top: 20px; text-align: center;
}

/* --------------------------------------------------------------------------
   Barra superiore
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--pa-white);
  border-bottom: 1px solid var(--hairline);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  padding: 8px 16px; min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1000px; margin: 0 auto; width: 100%;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  background: var(--fill);
  border-radius: 999px;
  min-width: 0; max-width: 60%;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-chip-name { font-size: 13px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-loc { font-size: 11.5px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-action {
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--fill); border: none;
  display: grid; place-items: center; color: var(--fg);
  flex-shrink: 0;
  transition: background .2s var(--ease), transform .15s var(--ease);
}
.topbar-action:hover { background: var(--fill-strong); }
.topbar-action:active { transform: scale(0.94); }

/* Logo ufficiale: sempre il PNG, sempre su bianco */
.brand-logo { display: block; height: auto; user-select: none; -webkit-user-drag: none; }
.brand-logo--header { height: 46px; width: auto; flex-shrink: 0; }
.brand-hero { text-align: center; margin: 0 auto 20px; }
.brand-logo--hero { width: 240px; max-width: 72%; margin: 0 auto; }
.brand-hero-sub {
  font-size: 12px; font-weight: 700; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-top: 12px;
}
@media (max-width: 430px) {
  .brand-logo--header { height: 42px; }
  .user-chip { max-width: 56%; }
}

/* --------------------------------------------------------------------------
   Pagina
   -------------------------------------------------------------------------- */
.page {
  padding: 20px 16px 150px;
  max-width: 1000px; margin: 0 auto; width: 100%;
  /* Solo opacita': una trasformazione renderebbe relativi gli elementi fissi interni */
  animation: page-in .32s var(--ease-out) backwards;
}
@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.page-heading {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 700; line-height: 1.1;
  letter-spacing: -0.022em;
  margin: 4px 0 4px; color: var(--fg);
}
.page-sub {
  font-size: 15px; line-height: 1.45;
  color: var(--fg-muted);
  margin: 0 0 18px;
}
@media (max-width: 430px) {
  .page-heading { font-size: 28px; }
}

/* Avanzamento */
.progress { display: flex; gap: 4px; margin: 4px 0 16px; }
.progress-dot {
  flex: 1; height: 4px; border-radius: 999px;
  background: var(--fill-strong);
  transition: background .35s var(--ease);
}
.progress-dot.done { background: var(--success); }
.progress-dot.active { background: var(--accent); }

/* --------------------------------------------------------------------------
   Sezioni a fisarmonica: liste raggruppate stile iOS
   -------------------------------------------------------------------------- */
.section {
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: 0 0 0 1px var(--border);
  transition: box-shadow .3s var(--ease);
}
.section.is-open { box-shadow: 0 0 0 1px var(--border-strong); }
.section-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; width: 100%; text-align: left; min-height: 58px;
  transition: background .2s var(--ease);
}
.section-head:active { background: rgba(0, 0, 0, 0.03); }
.section-num {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--fill); color: var(--fg-muted);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.section.is-done .section-num { background: var(--success); color: #fff; }
.section.is-open .section-num { background: var(--fg); color: #fff; }
.section-title { font-size: 16px; font-weight: 600; color: var(--fg); flex: 1; letter-spacing: -0.01em; }
.section-meta { font-size: 14px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.section.is-done .section-meta { color: var(--brand-green); font-weight: 600; }
.section-caret { width: 14px; height: 14px; color: var(--fg-subtle); transition: transform .35s var(--ease); }
.section.is-open .section-caret { transform: rotate(90deg); }
.section-body { overflow: hidden; transition: max-height .42s var(--ease); }
.section-body-inner { padding: 2px 16px 20px; border-top: 1px solid var(--hairline); }

/* --------------------------------------------------------------------------
   Campi (>=16px: evita lo zoom automatico di Safari su iPhone)
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field-label {
  font-size: 12px; font-weight: 600; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  padding-left: 2px;
}
.field-input, .field-select {
  height: 48px; padding: 0 16px;
  background: var(--fill); border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 17px; font-weight: 400; letter-spacing: -0.01em;
  color: var(--fg); width: 100%; outline: none;
  transition: background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
  padding-right: 40px;
}
.field-input::placeholder, .textarea::placeholder { color: var(--fg-subtle); }
.field-input:focus, .field-select:focus, .textarea:focus {
  background: var(--bg-elev); border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(197, 6, 46, 0.12);
}
.field-input[readonly] { color: var(--fg-muted); }
.currency-input { position: relative; }
.currency-input .field-input { padding-left: 36px; font-variant-numeric: tabular-nums; }
.currency-input::before {
  content: "€"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--fg-subtle); font-size: 17px; font-weight: 400; pointer-events: none;
}
.textarea {
  width: 100%; min-height: 96px; padding: 12px 16px;
  background: var(--fill); border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 16px; line-height: 1.45; color: var(--fg);
  resize: vertical; outline: none;
  transition: background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}

/* --------------------------------------------------------------------------
   Conteggio banconote
   -------------------------------------------------------------------------- */
.denom-grid { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 10px; }
.denom-row {
  display: grid; grid-template-columns: 60px minmax(0, 1fr) 14px 88px;
  align-items: center; gap: 8px;
  background: var(--bg-elev); border-radius: var(--r-md);
  padding: 6px 10px 6px 14px;
  box-shadow: 0 0 0 1px var(--border);
}
.denom-cut { font-size: 15px; font-weight: 600; color: var(--fg); }
.denom-stepper {
  display: flex; align-items: center;
  background: var(--fill);
  border-radius: 999px; height: 36px; overflow: hidden; min-width: 0;
}
.denom-stepper button {
  width: 36px; height: 100%; flex-shrink: 0;
  display: grid; place-items: center; color: var(--fg);
  transition: background .15s var(--ease);
}
.denom-stepper button:active { background: var(--fill-strong); }
.denom-stepper button:disabled { color: var(--fg-subtle); }
.denom-stepper input {
  flex: 1; min-width: 0;
  background: transparent; border: none; text-align: center;
  font-size: 16px; font-weight: 600; color: var(--fg);
  outline: none; padding: 0; font-variant-numeric: tabular-nums;
}
.denom-times { color: var(--fg-subtle); font-size: 12px; text-align: center; }
.denom-total { text-align: right; font-size: 15px; font-weight: 600; color: var(--fg); }
.denom-total.zero { color: var(--fg-subtle); font-weight: 400; }
.denom-sum {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding: 14px 16px;
  background: var(--fg); color: #fff; border-radius: var(--r-md);
}
.denom-sum-label { font-size: 13px; opacity: 0.72; font-weight: 500; }
.denom-sum-val { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }

/* --------------------------------------------------------------------------
   Matrici pasta e cartoni
   -------------------------------------------------------------------------- */
.grid-label-row {
  display: grid; grid-template-columns: 110px repeat(3, 1fr); gap: 6px;
  margin-top: 16px; font-size: 11.5px; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.04em; padding: 0 4px; font-weight: 600;
}
.grid-label-row > div:not(:first-child) { text-align: center; }
.grid-input-row {
  display: grid; grid-template-columns: 110px repeat(3, 1fr); gap: 6px; align-items: center; margin-top: 6px;
}
.grid-input-row .row-label { font-size: 15px; font-weight: 500; color: var(--fg); padding-left: 4px; }
.grid-input-row .mini-input {
  height: 44px; background: var(--fill); border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 16px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
  color: var(--fg); outline: none; width: 100%;
  transition: background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.grid-input-row .mini-input:focus {
  background: var(--bg-elev); border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(197, 6, 46, 0.12);
}
.grid-input-row .mini-input.readonly { background: transparent; color: var(--fg-muted); font-weight: 600; }
.subgrid-title {
  font-size: 12px; font-weight: 600; color: var(--fg-muted);
  margin-top: 22px; text-transform: uppercase; letter-spacing: 0.04em;
}

/* Bibite */
.bibite-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
@media (min-width: 520px) { .bibite-grid { grid-template-columns: 1fr 1fr; } }
.bibita-card {
  background: var(--bg-sunken); border-radius: var(--r-md);
  padding: 12px; border: 1px solid transparent;
  transition: background .25s var(--ease), box-shadow .25s var(--ease);
}
.bibita-card.active { background: var(--bg-elev); box-shadow: 0 0 0 1px var(--border-strong); }
.bibita-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bibita-name { font-size: 15px; font-weight: 600; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.bibita-swatch { width: 10px; height: 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.bibita-sold { font-size: 13px; color: var(--fg-muted); }
.bibita-sold b { color: var(--fg); font-weight: 600; }
.bibita-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bibita-cell { display: flex; flex-direction: column; gap: 4px; }
.bibita-cell-label { font-size: 10.5px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; text-align: center; font-weight: 600; }
.bibita-cell input {
  height: 42px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 16px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums;
  color: var(--fg); outline: none; width: 100%;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.bibita-cell input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(197, 6, 46, 0.12); }

/* Ingredienti: controllo segmentato */
.ing-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
@media (min-width: 520px) { .ing-grid { grid-template-columns: 1fr 1fr; } }
.ing-card { background: var(--bg-sunken); border-radius: var(--r-md); padding: 12px; }
.ing-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.ing-chips { display: flex; gap: 2px; padding: 2px; background: var(--fill); border-radius: 10px; }
.ing-chip {
  flex: 1; padding: 7px 0; border-radius: 8px; border: none;
  background: transparent; font-size: 13px; font-weight: 500; text-align: center;
  color: var(--fg);
  transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.ing-chip.active {
  background: var(--bg-elev); color: var(--accent); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--border);
}

/* --------------------------------------------------------------------------
   Pulsanti
   -------------------------------------------------------------------------- */
.btn {
  height: 50px; padding: 0 22px; border-radius: 999px;
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .18s var(--ease), background .2s var(--ease), opacity .2s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn:disabled:active { transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--fill); color: var(--fg); border: none; }
.btn-secondary:hover { background: var(--fill-strong); }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   Barra delle schede in basso
   -------------------------------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--glass);
  backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter);
  border-top: 1px solid var(--hairline);
  display: flex; align-items: stretch; justify-content: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 8px env(safe-area-inset-bottom, 0px);
}
.tab-item {
  position: relative;
  flex: 1; max-width: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--fg-subtle); font-size: 10.5px; font-weight: 500; letter-spacing: 0.01em;
  transition: color .2s var(--ease), transform .15s var(--ease);
}
.tab-item:active { transform: scale(0.94); }
.tab-item.active { color: var(--accent); font-weight: 600; }
.tab-item.active::before {
  content: ""; position: absolute; top: 0; left: 50%;
  width: 28px; height: 3px; margin-left: -14px;
  border-radius: 0 0 3px 3px; background: var(--accent);
  animation: fade-in .3s var(--ease) both;
}
.tab-item:disabled { opacity: 0.35; cursor: not-allowed; color: var(--fg-subtle); }
.tab-item:disabled:active { transform: none; }
.tab-icon-wrap { position: relative; display: grid; place-items: center; }
.tab-icon-wrap svg { width: 24px !important; height: 24px !important; }
.tab-badge {
  position: absolute; top: -4px; right: -9px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
  display: grid; place-items: center; border: 2px solid #fff;
}

/* Barra di riepilogo sopra le schede */
.footer-bar {
  position: fixed; left: 0; right: 0; z-index: 35;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 10px 16px;
  background: var(--glass);
  backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter);
  border-top: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 12px;
  animation: bar-in .45s var(--ease-out) both;
}
@keyframes bar-in { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.footer-bar-inner { max-width: 820px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 12px; }
.footer-bar .summary { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.footer-bar .summary-label { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footer-bar .summary-val { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.footer-bar .btn { height: 44px; }

/* --------------------------------------------------------------------------
   Avvisi in linea
   -------------------------------------------------------------------------- */
.banner {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--warn-soft); border: none;
  font-size: 14px; line-height: 1.45; color: var(--warn-text);
  display: flex; align-items: flex-start; gap: 10px;
}
.banner.success { background: var(--success-soft); color: var(--success); }
.banner.frozen { background: var(--fill); color: var(--fg-muted); }
.banner-dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; margin-top: 6px; flex-shrink: 0; }
.banner svg { flex-shrink: 0; margin-top: 1px; }

/* --------------------------------------------------------------------------
   Accesso
   -------------------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px 20px; max-width: 420px; margin: 0 auto; width: 100%;
  animation: login-in .5s var(--ease-out) backwards;
}
@keyframes login-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.login-card {
  background: var(--bg-elev);
  border: none; border-radius: var(--r-xl);
  padding: 32px 24px;
  box-shadow: 0 0 0 1px var(--border);
}
@media (max-width: 480px) {
  .login-wrap { max-width: none; background: var(--pa-white); }
  .login-card { box-shadow: none; padding: 8px 4px; }
}

.date-pills { display: flex; gap: 8px; margin-top: 6px; }
.date-pill {
  flex: 1; padding: 10px 12px; border-radius: var(--r-md);
  border: none; background: var(--fill);
  text-align: left; font-size: 15px; font-weight: 600; color: var(--fg);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.date-pill.selected { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.date-pill small { display: block; color: var(--fg-muted); font-size: 12px; font-weight: 400; margin-top: 2px; }

/* Conferma saldo */
.checkrow {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--fill); cursor: pointer; border: none;
  width: 100%; text-align: left; font-size: 15px;
  transition: background .25s var(--ease);
}
.checkrow.on { background: var(--success-soft); }
.checkbox {
  width: 22px; height: 22px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); background: #fff;
  display: grid; place-items: center; flex-shrink: 0;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.checkrow.on .checkbox { background: var(--success); border-color: var(--success); }
.prev-ref {
  margin-top: 8px; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--fill); font-size: 13px; color: var(--fg-muted);
  display: flex; justify-content: space-between;
}
.verify-row {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  padding: 14px 16px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; line-height: 1.4;
}
.verify-row.ok { background: var(--success-soft); color: var(--success); }
.verify-row.ko { background: var(--danger-soft); color: var(--danger); }
.verify-row.idle { background: var(--fill); color: var(--fg-muted); font-weight: 400; }

.libera-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 40px; gap: 6px; align-items: center; margin-top: 6px; }
.libera-del {
  width: 40px; height: 48px; border-radius: var(--r-md);
  background: var(--fill); color: var(--fg-muted);
  display: grid; place-items: center;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.libera-del:hover { background: var(--danger-soft); color: var(--danger); }

/* --------------------------------------------------------------------------
   Fogli modali e finestre di conferma
   -------------------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, 0.32);
  animation: fade-in .3s var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  max-height: 92vh; max-height: 92dvh;
  background: var(--bg-grouped);
  border-radius: 14px 14px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheet-up .5s var(--ease) both;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 720px) {
  .sheet { max-width: 640px; margin: 0 auto; bottom: 16px; border-radius: 20px; }
}
.sheet-handle { width: 36px; height: 5px; background: rgba(43, 40, 36, 0.22); border-radius: 999px; margin: 6px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 8px; }
.sheet-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.sheet-body { flex: 1; overflow-y: auto; padding: 6px 16px 28px; overscroll-behavior: contain; }

.review-group {
  background: var(--bg-elev); border: none;
  border-radius: var(--r-md); margin-bottom: 16px; overflow: hidden;
}
.review-group-head {
  padding: 12px 16px 6px; font-size: 12px; font-weight: 600;
  color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.review-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 11px 16px; font-size: 15px;
  border-top: 1px solid var(--hairline);
  margin-left: 16px; padding-left: 0;
}
.review-row-label { color: var(--fg); }
.review-row-val { color: var(--fg-muted); font-weight: 400; text-align: right; font-variant-numeric: tabular-nums; }

.confirm-pop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.confirm-pop .pop-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.32);
  animation: fade-in .25s var(--ease) both;
}
.confirm-pop .pop-card {
  position: relative; background: var(--bg-elev);
  border-radius: var(--r-xl); padding: 24px;
  max-width: 440px; width: 100%;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.18);
  animation: pop-in .35s var(--ease) both;
  max-height: 88vh; overflow-y: auto;
}
@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Card, statistiche, badge
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-elev); border: none;
  border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px;
  box-shadow: 0 0 0 1px var(--border);
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-box { background: var(--bg-sunken); border-radius: var(--r-md); padding: 12px 14px; }
.stat-box-num { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
}
.badge-pending { background: var(--warn-soft); color: var(--warn-text); }
.badge-done { background: var(--success-soft); color: var(--success); }
.badge-shift { background: var(--fill); color: var(--fg); }

/* Interruttore iOS */
.toggle-switch {
  position: relative; width: 51px; height: 31px; border-radius: 999px;
  background: rgba(43, 40, 36, 0.14); cursor: pointer;
  transition: background .3s var(--ease);
  border: none; padding: 2px; display: inline-flex; align-items: center; flex-shrink: 0;
}
.toggle-switch.on { background: var(--success); }
.toggle-handle {
  width: 27px; height: 27px; border-radius: 999px; background: #fff;
  transition: transform .3s var(--ease);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
}
.toggle-switch.on .toggle-handle { transform: translateX(20px); }

/* Stato bloccato / vuoto */
.module-locked-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 48px 24px;
  background: var(--bg-elev);
  border: none; border-radius: var(--r-xl); margin-top: 16px;
  gap: 10px;
  box-shadow: 0 0 0 1px var(--border);
}
.module-locked-icon {
  width: 56px; height: 56px; border-radius: 999px;
  background: var(--fill); color: var(--fg-muted);
  display: grid; place-items: center; margin-bottom: 4px;
}

/* File orizzontali di filtri: una riga sola, scorrevole, senza barra visibile */
[style*="overflow-x: auto"] > button { white-space: nowrap; flex-shrink: 0; }
[style*="overflow-x: auto"] { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
[style*="overflow-x: auto"]::-webkit-scrollbar { display: none; }
.board-container { scrollbar-width: thin; }
.board-container::-webkit-scrollbar { display: block; height: 8px; }

/* Scrollbar discreta sui desktop */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* Rispetto di chi riduce le animazioni */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

  