/* ==========================================================================
   Reparti Nicosia 4 — un'app colorata per i reparti.
   Fondo neutro caldo, schede bianche arrotondate, il bordeaux del fazzolettone (con la sua trama scozzese) come colore
   del gruppo e un colore pieno per ogni settore e per ogni rifiuto. Nessuna emoji. Tema: SOLO chiaro (predefinito) o scuro.
   ========================================================================== */

/* Nunito (variabile, un solo file per tutti i pesi): caricato dal sito stesso. */
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 200 1000; font-display: swap; src: url('/fonts/nunito-latin.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: 'Nunito'; font-style: normal; font-weight: 200 1000; font-display: swap; src: url('/fonts/nunito-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  --bg: #f7f5f3;        /* il fondo (neutro caldo) */
  --card: #ffffff;      /* le schede */
  --card-2: #efebe7;    /* riquadri e campi sulla scheda */
  --line: #e4ddd8;      /* filetti */
  --line-strong: #8c8280; /* bordi dei campi (≥3:1) */
  --ink: #2b2326;       /* testo */
  --ink-2: #675d60;     /* testo secondario */
  --brand: #8a2536;     /* il bordeaux del fazzolettone: azione primaria (sfondo) */
  --brand-ink: #7a1f2e; /* azione primaria (testo e bordi sul fondo) */
  --brand-tint: #f6e6e8;
  /* la cordicina del fazzolettone: la foto del tessuto scozzese del gruppo, solo ritagliata (nessun ritocco); solo come firma */
  --rope: url('/img/tartan.webp');
  --on-brand: #ffffff;
  --red: #c62839;       /* uscite ed errori */
  --green: #1a7d33;     /* entrate, "svolto" */
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 6px 16px -6px rgb(0 0 0 / 0.18);

  /* un colore pieno per ogni settore (testo bianco sopra, ≥4.5:1) */
  --s0: #d92d4b; /* Animazione */
  --s1: #b85300; /* Pulizia generale */
  --s2: #1a7d33; /* Spazzatura */
  --s3: #7a3fe0; /* Pulizia bagni */
  --sx: #6b6165; /* nessun settore */

  --r: 20px;
  --tabbar-h: 68px;
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #151214; --card: #201b1d; --card-2: #2c2629; --line: #3b3337; --line-strong: #8a7e82;
  --ink: #f5eeee; --ink-2: #bcb0b3;
  --brand: #9b2c40; --brand-ink: #f2a9b5; --brand-tint: #3d1c25;
  --red: #ff8b97; --green: #5fd47a;
  --shadow: 0 2px 10px rgb(0 0 0 / 0.45);
}
.sec-0 { --sc: var(--s0); }
.sec-1 { --sc: var(--s1); }
.sec-2 { --sc: var(--s2); }
.sec-3 { --sc: var(--s3); }
.sec-x { --sc: var(--sx); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; accent-color: var(--brand); caret-color: var(--brand); }
::selection { background: var(--brand); color: #fff; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100dvh; overscroll-behavior-y: none; }
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
code { background: var(--card-2); padding: 0.1em 0.4em; border-radius: 6px; font-size: 0.9em; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--ink-2); }
.ic, .picto { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.topbar :focus-visible, .masthead :focus-visible { outline-color: #fff; }

/* ---------- guscio ---------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top) + 10px) max(8px, calc((100% - 560px) / 2 + 8px)) 10px max(16px, calc((100% - 560px) / 2 + 16px));
}
.topbar { padding-top: calc(env(safe-area-inset-top) + 30px); }
.topbar::before { content: ''; position: absolute; left: 0; right: 0; top: env(safe-area-inset-top); height: 20px;
  background: linear-gradient(#0d0708, #0d0708) 0 0 / 100% 1.5px no-repeat, linear-gradient(#0d0708, #0d0708) 0 13.5px / 100% 1.5px no-repeat, linear-gradient(var(--brand), var(--brand)) 0 15px / 100% 5px no-repeat, var(--rope) repeat-x 0 -1.5px / auto 18px; }
.admin .topbar { padding-left: max(16px, calc((100% - 860px) / 2 + 16px)); padding-right: max(8px, calc((100% - 860px) / 2 + 8px)); }
.topbar .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.topbar .who strong { font-weight: 900; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.topbar .who span { font-weight: 700; font-size: 0.85rem; color: #fff; opacity: 0.95; margin-top: 1px; }
.tb { display: inline-grid; place-items: center; width: 2.4em; height: 2.4em; flex: none; vertical-align: middle; border-radius: 50%; color: var(--sc, var(--sx)); font-weight: 900; font-size: 0.8em; }
.tb svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tb .tb-bg { fill: #fff; stroke: var(--sc, var(--sx)); stroke-width: 2.4; }
.tb-txt { background: var(--sc, var(--sx)); color: #fff; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; }
.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none; background: none; border: 0; border-radius: 50%; cursor: pointer; color: inherit; }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:active { background: rgb(255 255 255 / 0.2); }
.icon-btn.danger { color: var(--red); }
main#view { flex: 1; outline: none; }
.page { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 16px; }
.page > * { animation: settle 0.25s ease-out both; }
@keyframes settle { from { opacity: 0; transform: translateY(6px); } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 6px; padding: 8px 8px env(safe-area-inset-bottom); background: var(--card);
  box-shadow: 0 -2px 12px rgb(0 0 0 / 0.1);
}
.tabbar a {
  flex: 1; max-width: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--ink-2); font-weight: 800; font-size: 0.78rem; border-radius: 16px;
}
.tabbar a.on { background: var(--brand-tint); color: var(--brand-ink); }

/* ---------- testo ---------- */
.page-title { font-weight: 900; font-size: 1.8rem; line-height: 1.1; letter-spacing: -0.01em; }
.section-title { font-weight: 900; font-size: 1.2rem; line-height: 1.15; margin-top: 6px; }
.card-title { font-weight: 900; font-size: 1.05rem; margin-bottom: 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.note { font-size: 0.88rem; margin-top: 10px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.pad { padding: 24px 0; }
.full { flex-basis: 100%; }
.eyebrow { font-weight: 800; font-size: 0.82rem; color: var(--ink-2); }
.error { color: var(--red); font-weight: 700; min-height: 1.3em; }
.empty { padding: 24px 16px; text-align: center; color: var(--ink-2); }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--brand-ink); min-height: 44px; text-decoration: none; }
.link-row { display: flex; align-items: center; justify-content: flex-end; gap: 2px; margin-top: 10px; font-weight: 800; color: var(--brand-ink); text-decoration: none; min-height: 44px; }
.link-btn { background: none; border: 0; color: var(--brand-ink); font-weight: 800; padding: 14px; min-height: 48px; cursor: pointer; }
a.link-btn { display: block; text-align: center; text-decoration: none; }
.banner { padding: 12px 14px; border-radius: 14px; background: #fff3cd; color: #5b4300; font-size: 0.9rem; margin-bottom: 10px; }
:root[data-theme='dark'] .banner { background: #4a3a05; color: #ffe9a3; }

/* ---------- schede ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }

/* ---------- bottoni e campi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 18px;
  background: var(--card); color: var(--brand-ink); border: 2px solid var(--brand); border-radius: 16px;
  font-weight: 900; font-size: 1.02rem; line-height: 1.15; text-align: center; cursor: pointer;
  transition: transform 0.1s ease-out, background 0.15s;
}
.btn:active { transform: translateY(1px) scale(0.99); background: var(--brand-tint); }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); box-shadow: 0 4px 12px -4px rgb(0 0 0 / 0.35); }
.btn.primary:active { filter: brightness(0.92); background: var(--brand); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
:root[data-theme='dark'] .btn.danger { color: #2a0a10; }
.btn.quiet { background: none; border-color: transparent; color: var(--ink-2); min-height: 44px; font-size: 0.92rem; box-shadow: none; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.1rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.busy { pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 0.88rem; color: var(--ink-2); }
.field input {
  min-height: 52px; width: 100%; padding: 8px 14px; font: 700 1.1rem/1.3 'Nunito', sans-serif; color: var(--ink);
  background: var(--card); border: 2px solid var(--line-strong); border-radius: 14px;
}
.field input::placeholder { color: var(--ink-2); opacity: 0.85; font-weight: 600; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.field input[aria-invalid='true'] { border-color: var(--red); }
.field-error { color: var(--red); font-weight: 700; font-size: 0.9rem; }
.field-error:empty, .form-error:empty { display: none; }
.form-error { min-height: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* controllo a segmenti (reparto, tipo di movimento, filtri) */
.seg { display: flex; padding: 4px; gap: 4px; background: var(--card-2); border-radius: 16px; }
.seg label, .seg button { flex: 1; position: relative; display: block; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span, .seg button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 6px 10px; width: 100%;
  border-radius: 12px; font-weight: 900; font-size: 1rem; cursor: pointer; border: 0; background: none; text-align: center; color: var(--ink-2);
}
.seg i { font-style: normal; white-space: nowrap; }
.seg input:checked + span, .seg button.on { background: var(--brand); color: var(--on-brand); box-shadow: 0 2px 8px -2px rgb(0 0 0 / 0.3); }
.seg input:focus-visible + span { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.type-seg input[value='ENTRATA']:checked + span { background: var(--green); }
.type-seg input[value='USCITA']:checked + span { background: var(--red); color: #fff; }
:root[data-theme='dark'] .type-seg input[value='ENTRATA']:checked + span, :root[data-theme='dark'] .type-seg input[value='USCITA']:checked + span { color: #151214; }
.filter-seg button { min-height: 42px; }

/* ---------- accesso ---------- */
.login { width: 100%; display: flex; flex-direction: column; flex: 1; }
.masthead { position: relative; overflow: hidden; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 16px; padding: calc(env(safe-area-inset-top) + 54px) 20px 40px; border-radius: 0 0 32px 32px; }
.masthead::before { content: ''; position: absolute; left: 0; right: 0; top: env(safe-area-inset-top); height: 26px;
  background: linear-gradient(#0d0708, #0d0708) 0 0 / 100% 2px no-repeat, linear-gradient(#0d0708, #0d0708) 0 18px / 100% 2px no-repeat, linear-gradient(var(--brand), var(--brand)) 0 20px / 100% 6px no-repeat, var(--rope) repeat-x 0 -2px / auto 24px; }
.masthead .logo { display: block; flex: none; background: #fff; border-radius: 18px; padding: 4px; }
.masthead h1 { font-weight: 900; font-size: 2.2rem; line-height: 1; letter-spacing: 0.01em; }
.masthead p { font-weight: 700; font-size: 0.98rem; color: #fff; margin-top: 6px; }
.login-form { width: 100%; max-width: 440px; margin: -28px auto 0; padding: 0 16px 32px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.login-form > .field:first-child { margin-top: 44px; }
.login-form .error { min-height: 0; }
.login-form .error:empty { display: none; }
.squad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.squad-opt { position: relative; }
.squad-opt input { position: absolute; opacity: 0; inset: 0; }
.squad-opt > span {
  display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 8px 12px; background: var(--card); border-radius: 18px;
  font-weight: 900; font-size: 1.05rem; cursor: pointer; box-shadow: var(--shadow); border: 3px solid transparent;
}
.squad-opt .tb { width: 44px; height: 44px; font-size: 1rem; }
.squad-opt input:checked + span { border-color: var(--brand); background: var(--brand-tint); }
.squad-opt input:focus-visible + span { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.login .seg { background: var(--card); box-shadow: var(--shadow); }

/* ---------- tabellone: la settimana ---------- */
.cal-head { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; }
.cal-nav { width: 48px; height: 48px; display: grid; place-items: center; background: var(--card); color: var(--brand-ink); border: 0; border-radius: 50%; box-shadow: var(--shadow); cursor: pointer; }
.cal-nav:active { background: var(--brand-tint); }
.cal-title { text-align: center; min-width: 0; }
.cal-month { font-weight: 900; font-size: 1.7rem; line-height: 1.05; text-transform: capitalize; }
.cal-sub { font-weight: 800; font-size: 0.88rem; color: var(--ink-2); margin-top: 2px; }
.cal-strip { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 4px; }
.cal-day { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 80px; }
.cal-day .dw { font-weight: 800; font-size: 0.8rem; color: var(--ink-2); text-transform: uppercase; }
.cal-day .dn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font-weight: 900; font-size: 1.15rem; }
.cal-day.today .dn { background: var(--brand); color: var(--on-brand); }
.cal-day.today .dw { color: var(--brand-ink); }
.cal-day .dd { display: flex; gap: 3px; min-height: 12px; margin-top: 2px; }
.cal-day .dd i { width: 11px; height: 11px; border-radius: 50%; background: var(--wc); }
.cal-day .dd i.none { background: none; border: 2px solid var(--line-strong); }
.cal-today { min-height: 44px; margin-top: -4px; background: var(--brand-tint); color: var(--brand-ink); border: 0; border-radius: 14px; font-weight: 900; cursor: pointer; }

/* ---------- il turno ---------- */
.turn { padding: 0; overflow: hidden; }
.turn-head { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--sc, var(--sx)); color: #fff; }
.turn > :not(.turn-head) { padding: 14px 16px; }
.turn > :not(.turn-head) + * { border-top: 1px solid var(--line); }
.task-art, .task-ic { flex: none; display: grid; place-items: center; width: 62px; height: 62px; }
.turn-title { font-weight: 900; font-size: 1.9rem; line-height: 1.05; text-wrap: balance; }
.turn-range { font-weight: 800; font-size: 0.92rem; opacity: 0.95; margin-top: 3px; }
.turn-desc { color: var(--ink-2); }
.turn-wait { min-height: 112px; display: grid; place-items: center; }
.turn-error { display: flex; flex-direction: column; gap: 10px; }
.turn-error p { color: var(--red); font-weight: 800; }
.turn-more summary { cursor: pointer; font-weight: 900; min-height: 32px; display: flex; align-items: center; color: var(--brand-ink); }
.turn-more p { color: var(--ink-2); margin-top: 6px; }
.status { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.status.todo { color: var(--ink-2); }
.mark { flex: none; }
.mark-done { color: var(--green); }
.mark-done .pen { stroke-dasharray: 20; animation: pen 0.3s ease-out both; }
@keyframes pen { from { stroke-dashoffset: 20; } }
.mark-pending { color: var(--ink-2); }
.mark-missed { color: var(--red); }
.task-actions { display: flex; flex-direction: column; gap: 8px; }
.task-actions .btn { width: 100%; }
.photo-btn { cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid.big { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.thumb { padding: 0; border: 0; background: var(--card-2); border-radius: 14px; overflow: hidden; aspect-ratio: 1; cursor: pointer; }
.thumb img, .shot button img, .ev-thumb img, .mini-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-dlg { width: min(96vw, 640px); }
.photo-dlg img { width: 100%; max-height: 70dvh; object-fit: contain; border-radius: 14px; background: #000; }
.task-card { padding: 16px; }
.task-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.task-head h2 { font-weight: 900; font-size: 1.5rem; line-height: 1.1; }
.task-card p { color: var(--ink-2); }
.hist-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--card-2); font-weight: 800; font-size: 0.88rem; line-height: 1.1; white-space: nowrap; }
.pill small { display: block; font-size: 0.74rem; font-weight: 700; margin-top: 1px; color: inherit; opacity: 0.8; }
.pill.ok, .pill.done { background: #dff5e5; color: #14612a; }
.pill.bad, .pill.missed { background: #fde4e8; color: #a31d2f; }
.pill.todo, .pill.pending { background: #fff1cc; color: #6b4a00; }
:root[data-theme='dark'] .pill.ok, :root[data-theme='dark'] .pill.done { background: #17402a; color: #9ae6ae; }
:root[data-theme='dark'] .pill.bad, :root[data-theme='dark'] .pill.missed { background: #4a1d27; color: #ffb3bd; }
:root[data-theme='dark'] .pill.todo, :root[data-theme='dark'] .pill.pending { background: #4a3a05; color: #ffe08a; }

/* ---------- il tabellone circolare ---------- */
.board { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 12px 16px; }
.board-title { font-weight: 900; font-size: 1.1rem; padding: 0 4px; }
#wheel-info, #wheel-box { display: flex; flex-direction: column; gap: 16px; }
.wheel-wrap { display: grid; place-items: center; }
.wheel { width: 100%; max-width: 440px; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; overflow: visible; }
.disc { fill: var(--card-2); stroke: var(--line); stroke-width: 2; }
.sector { cursor: pointer; outline: none; transform-origin: 0 0; transition: transform 0.25s ease-out; }
.sector .shape { fill: color-mix(in srgb, var(--sc) 20%, var(--card)); stroke: var(--card); stroke-width: 3; stroke-linejoin: round; }
.sector .sec-text text { font: 900 11px 'Nunito', sans-serif; letter-spacing: 0.02em; fill: var(--ink); stroke: none; }
.sector.mine .shape { fill: var(--sc); }
.sector.mine .sec-text text { fill: #fff; }
.sector.mine { transform: scale(1.04); filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.28)); }
.sector.selected .shape { stroke: var(--ink); stroke-width: 4; }
.sector:focus-visible .shape { stroke: var(--ink); stroke-width: 4; stroke-dasharray: 6 3; }
.cross { transform-origin: 0 0; transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1); }
.arm .up { transform-origin: 0 0; transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1); }
.arm .drop { fill: var(--sc, var(--sx)); stroke: var(--card); stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.25)); }
.arm .wd { fill: #fff; }
.arm text.ak { font: 900 15px 'Nunito', sans-serif; fill: var(--sc, var(--sx)); }
.arm .totem { transform: scale(0.98); }
.arm .tag { fill: var(--card); stroke: var(--sc, var(--sx)); stroke-width: 2; }
.arm text.tagt { font: 900 10px 'Nunito', sans-serif; fill: var(--sc, var(--sx)); }
.arm .halo { display: none; fill: none; stroke: var(--ink); stroke-width: 3; }
.arm.mine .halo { display: block; }
.hub { fill: var(--card); stroke: var(--line-strong); stroke-width: 3; }
.hub-dot { fill: var(--ink); }
@media (prefers-reduced-motion: reduce) { .cross, .arm .up, .sector { transition: none; } }


/* ---------- differenziata: un colore pieno per ogni rifiuto ---------- */
.waste-grid { display: grid; gap: 12px; }
.waste-box { padding: 16px; border-radius: var(--r); background: var(--bt, var(--card-2)); color: var(--ink); display: flex; flex-direction: column; gap: 8px; }
.waste-box h3 { font-weight: 900; font-size: 1.45rem; line-height: 1.1; }
.when { font-weight: 800; font-size: 0.92rem; opacity: 0.9; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px; background: var(--wc, #5f6b78); color: var(--wi, #fff); font-weight: 900; font-size: 1rem; line-height: 1.1; }
.chip.none { background: var(--card-2); color: var(--ink-2); }
.week-list { list-style: none; margin: 0; padding: 0; }
.week-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.week-list li:last-child { border-bottom: 0; }
.week-list .wd { font-weight: 900; min-width: 140px; }
.week-list .wd em { font-style: normal; font-weight: 900; font-size: 0.72rem; background: var(--brand); color: var(--on-brand); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.week-list li.is-today { background: var(--brand-tint); border-radius: 14px; border-bottom-color: transparent; }
.week-list .chip { padding: 3px 12px; font-size: 0.92rem; }
.guide { border-bottom: 1px solid var(--line); }
.guide:last-child { border-bottom: 0; }
.guide summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; cursor: pointer; list-style: none; min-height: 56px; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary i { width: 18px; height: 18px; border-radius: 50%; background: var(--wc); flex: none; }
.guide summary strong { font-weight: 900; font-size: 1.1rem; }
.guide summary .muted { flex-basis: 100%; padding-left: 28px; order: 5; }
.guide p { padding: 0 16px 14px 44px; color: var(--ink-2); font-size: 0.95rem; }
.turn-more summary::after, .guide summary::after { content: ''; margin-left: auto; width: 14px; height: 14px; flex: none; background: linear-gradient(currentColor, currentColor) center / 100% 3px no-repeat, linear-gradient(currentColor, currentColor) center / 3px 100% no-repeat; border-radius: 2px; }
.turn-more[open] summary::after, .guide[open] summary::after { background: linear-gradient(currentColor, currentColor) center / 100% 3px no-repeat; }
.turn-more summary { list-style: none; }
.turn-more summary::-webkit-details-marker { display: none; }

/* ---------- cassa ---------- */
.summary { display: flex; flex-direction: column; gap: 12px; }
.balance { background: var(--brand); color: #fff; border-radius: var(--r); padding: 20px 16px; text-align: center; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.balance strong { font-weight: 900; font-size: 3rem; line-height: 1.05; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.balance .eyebrow { color: #fff; }
.balance.neg { background: var(--red); }
:root[data-theme='dark'] .balance.neg { color: #2a0a10; }
:root[data-theme='dark'] .balance.neg .eyebrow { color: #4a1d27; }
.balance.big strong { font-size: 2.6rem; }
.in-out { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.in-out > div { border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.in-out .pos { background: #dff5e5; }
.in-out .neg { background: #fde4e8; }
:root[data-theme='dark'] .in-out .pos { background: #17402a; }
:root[data-theme='dark'] .in-out .neg { background: #4a1d27; }
.in-out strong { font-weight: 900; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.in-out .pos strong, .in-out .pos .eyebrow { color: #14612a; }
.in-out .neg strong, .in-out .neg .eyebrow { color: #a31d2f; }
:root[data-theme='dark'] .in-out .pos strong, :root[data-theme='dark'] .in-out .pos .eyebrow { color: #9ae6ae; }
:root[data-theme='dark'] .in-out .neg strong, :root[data-theme='dark'] .in-out .neg .eyebrow { color: #ffb3bd; }
.mov-form { display: flex; flex-direction: column; gap: 14px; }
.mov-form .card-title { margin: 0; }
.mov-list { list-style: none; margin: 0; padding: 0; }
.mov { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mov::before { content: ''; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--green); }
.mov.out::before { background: var(--red); }
.mov:last-child { border-bottom: 0; }
.mov-main { flex: 1; min-width: 0; }
.mov-note { font-weight: 800; overflow-wrap: anywhere; }
.mov-meta { font-weight: 700; font-size: 0.8rem; color: var(--ink-2); }
.mov-amount { font-weight: 900; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--green); }
.mov.out .mov-amount { color: var(--red); }
.mov-actions { display: flex; flex: none; margin-right: -8px; }
.mov-sum { display: grid; gap: 4px; padding: 14px; border-radius: 18px; background: #dff5e5; color: #14612a; }
.mov-sum.out { background: #fde4e8; color: #a31d2f; }
:root[data-theme='dark'] .mov-sum { background: #17402a; color: #9ae6ae; }
:root[data-theme='dark'] .mov-sum.out { background: #4a1d27; color: #ffb3bd; }
.mov-sum-type { font-weight: 800; font-size: 0.9rem; opacity: 0.9; }
.mov-sum-amount { font-weight: 900; font-size: 2.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.mov-sum-note { font-weight: 800; overflow-wrap: anywhere; color: var(--ink); }
.mov-sum-date { font-size: 0.85rem; color: var(--ink-2); }

/* ---------- area capi ---------- */
.sq-card { display: flex; flex-direction: column; gap: 10px; }
.sq-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sq-card h2 { font-weight: 900; font-size: 1.4rem; line-height: 1.1; }
.sq-card dl { display: flex; flex-direction: column; }
.sq-card dl > div { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); }
.sq-card dt { flex: 0 0 110px; color: var(--ink-2); font-weight: 800; font-size: 0.85rem; }
.sq-card dd { margin: 0; flex: 1; min-width: 0; }
.sq-card dd.neg { color: var(--red); }
.sq-card .link-row { margin-top: 0; }
.feed { list-style: none; margin: 0; padding: 0; }
.ev { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.ev:last-child { border-bottom: 0; }
.ev > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ev time { display: block; font-weight: 700; font-size: 0.8rem; color: var(--ink-2); margin-top: 2px; }
.ev-ic { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; }
.ev-ic.out { background: var(--red); }
:root[data-theme='dark'] .ev-ic { color: #151214; }
.ev-thumb { flex: none; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--card-2); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.shot { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.shot button { padding: 0; border: 0; border-radius: 16px; overflow: hidden; aspect-ratio: 1; background: var(--card-2); cursor: pointer; }
.shot figcaption { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--ink-2); line-height: 1.25; }
.shot figcaption strong { color: var(--ink); }
.week-box.loading { opacity: 0.45; }
.week-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.week-head strong { font-weight: 900; font-size: 1.2rem; }
.week-squads { list-style: none; margin: 0; padding: 0; }
.ws { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ws:last-child { border-bottom: 0; }
.ws-art { flex: none; display: grid; place-items: center; width: 48px; height: 48px; }
.ws-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ws-main strong { font-weight: 900; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.ws-main strong .tb { font-size: 0.78em; }
.ws .pill { align-self: center; font-size: 0.8rem; }
.mini-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mini-thumb { width: 46px; height: 46px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--card-2); cursor: pointer; }
.squad-rows { list-style: none; margin: 0; padding: 0; }
.squad-rows li { border-bottom: 1px solid var(--line); }
.squad-rows li:last-child { border-bottom: 0; }
.squad-rows a, .squad-rows .pin-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; text-decoration: none; min-height: 64px; }
.squad-rows li.pin-row { gap: 4px; padding: 8px 8px 8px 16px; }
.sq-name { flex: 1; font-weight: 900; font-size: 1.15rem; display: flex; flex-direction: column; }
.sq-name small, .sq-bal small { font-weight: 700; font-size: 0.8rem; color: var(--ink-2); }
.sq-bal { text-align: right; font-weight: 900; font-size: 1.2rem; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.sq-bal.neg { color: var(--red); }
.pin { font-weight: 900; font-size: 1.25rem; letter-spacing: 0.15em; background: none; }

/* ---------- finestre e avvisi ---------- */
.dlg { border: 0; border-radius: 24px; padding: 20px; width: min(92vw, 420px); background: var(--card); color: var(--ink); box-shadow: 0 20px 50px rgb(0 0 0 / 0.35); }
.dlg::backdrop { background: rgb(14 20 36 / 0.55); }
.dlg form { display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { font-weight: 900; font-size: 1.4rem; line-height: 1.15; }
.dlg p { color: var(--ink-2); overflow-wrap: anywhere; }
.dlg-actions { display: flex; gap: 10px; }
.dlg-actions .btn { flex: 1; }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #2b2326; color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 800; box-shadow: 0 6px 20px rgb(0 0 0 / 0.3); animation: settle 0.2s ease-out; max-width: 100%; text-align: center; }
.toast.err { background: var(--red); color: #fff; }
:root[data-theme='dark'] .toast { background: #f5eeee; color: #2b2326; }
:root[data-theme='dark'] .toast.err { background: var(--red); color: #2a0a10; }
.toast.out { opacity: 0; transition: opacity 0.3s; }

/* ---------- schermi larghi ---------- */
@media (min-width: 700px) {
  .page { padding-top: 24px; }
  .waste-grid { grid-template-columns: 1fr 1fr; }
  .admin .page { max-width: 860px; }
  .admin .photo-grid.big { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Spazi vuoti non occupano spazio; i punti dei rifiuti restano visibili sul tema scuro */
#turn-slot:empty, #hist-slot:empty, #wheel-info:empty { display: none; }
:root[data-theme='dark'] .cal-day .dd i { box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.55); }


/* ---------- i disegni dei settori (megafono, scopa, bidone, water) ---------- */
.art .disc { fill: #fffaf0; stroke: rgb(60 30 40 / 0.22); stroke-width: 1.2; }
.art * { transform-box: fill-box; }
.art g[transform] { transform-box: view-box; } /* le rotazioni fissate nel disegno (es. frecce del riciclo) restano attorno al loro centro */
.art .wave { fill: none; stroke: #e03a4e; stroke-width: 2.6; stroke-linecap: round; animation: wave 1.5s ease-in-out infinite; }
.art .w2 { animation-delay: 0.3s; }
.art .mega { transform-origin: 20% 50%; animation: shout 1.5s ease-in-out infinite; }
.art .note { transform-origin: center; animation: note 3s ease-in-out infinite; }
.art .n2 { animation-delay: 1.4s; }
.art .sweep { transform-origin: 50% 0%; animation: sweep 1.6s ease-in-out infinite; }
.art .dust { transform-origin: center; opacity: 0; animation: dust 1.7s ease-out infinite; }
.art .d2 { animation-delay: 0.85s; }
.art .spark { transform-origin: center; animation: twinkle 1.7s ease-in-out infinite; }
.art .s2 { animation-delay: 0.5s; } .art .s3 { animation-delay: 1s; }
.art .lid { transform-origin: 0% 100%; animation: lid 3.6s ease-in-out infinite; }
.art .ball { transform-box: fill-box; transform-origin: center; opacity: 0; animation: toss 3.6s ease-in-out infinite; }
.art .bin { transform-origin: 50% 100%; animation: bin-wobble 3.6s ease-in-out infinite; }
.art .bub { transform-origin: center; animation: bubble 2.2s ease-in infinite; }
.art .b2 { animation-delay: 0.7s; } .art .b3 { animation-delay: 1.4s; }
.art .disc { stroke: var(--line); }
/* si muovono solo quello del vostro turno e quelli grandi; gli altri restano fermi */
.art * { animation-play-state: paused; }
.turn .art *, .sector.mine .art *, .task-head .art * { animation-play-state: running; }

@keyframes wave { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
@keyframes shout { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) scale(1.06); } }
@keyframes note { 0% { transform: translateY(5px) rotate(-12deg); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-7px) rotate(12deg); opacity: 0; } }
@keyframes sweep { 0%, 100% { transform: translateX(-4px) rotate(-13deg); } 50% { transform: translateX(4px) rotate(13deg); } }
@keyframes swirl { to { transform: rotate(360deg); } }
@keyframes dust { 0%, 40% { opacity: 0; transform: translateY(2px) scale(0.5); } 55% { opacity: 0.85; } 100% { opacity: 0; transform: translateY(-6px) scale(1.5); } }
@keyframes twinkle { 0%, 100% { transform: scale(0.25) rotate(0); opacity: 0.2; } 50% { transform: scale(1.15) rotate(45deg); opacity: 1; } }
@keyframes lid { 0%, 16%, 64%, 100% { transform: rotate(0); } 26%, 52% { transform: rotate(-72deg); } }
@keyframes toss { 0%, 6% { opacity: 0; transform: translate(16px, -2px) rotate(60deg); } 12% { opacity: 1; } 28% { opacity: 1; transform: translate(9px, -7px) rotate(-60deg); } 46% { opacity: 1; transform: translate(2px, 7px) rotate(-170deg); } 54%, 100% { opacity: 0; transform: translate(0, 15px) rotate(-230deg) scale(0.6); } }
@keyframes bin-wobble { 0%, 52%, 100% { transform: rotate(0); } 57% { transform: rotate(-3deg); } 62% { transform: rotate(3deg); } 67% { transform: rotate(0); } }
@keyframes bubble { 0% { transform: translateY(5px) scale(0.5); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-15px) scale(1.15); opacity: 0; } }

/* tema scuro: il pastello del riquadro è ricavato dal colore pieno del rifiuto, così resta lo stesso colore */
:root[data-theme='dark'] .waste-box { background: color-mix(in srgb, var(--bc, #878787) 26%, var(--card)); }

/* disegni: dettagli aggiunti (terza onda, terza nuvoletta di polvere, acqua che gira) */
.art .w3 { animation-delay: 0.6s; }
.art .d3 { animation-delay: 0.4s; }
.art .swirl { transform-origin: 24px 27px; transform-box: view-box; animation: swirl 3.2s linear infinite; }
