/* Layout: app a schede con barra in basso; carta bianca, inchiostro e rosso delle rubriche liturgiche */
:root {
  --bg: #F6F7F5;
  --surface: #FFFFFF;
  --sunk: #ECEEEB;
  --ink: #1B1D1C;
  --muted: #5D6360;
  --line: #DADEDB;
  --rubric: #A4262C;
  --rubric-ink: #FFFFFF;
  --rubric-soft: #F7E4E4;
  --ok: #2B6A3D;
  --ok-soft: #E0EEE3;
  --warn: #855600;
  --warn-soft: #F6EBD3;
  --v-s: #B0465A; --v-a: #7B5AA0; --v-t: #2A7487; --v-b: #4F6A2C; --v-x: #6B706D;
  --scrim: rgba(20, 22, 21, .42);
  --shadow: 0 10px 30px rgba(20, 22, 21, .14);
  --f-display: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-ui: "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141615; --surface: #1C1F1E; --sunk: #232725; --ink: #E7EBE8; --muted: #9AA19D; --line: #2F3432;
  --rubric: #E06A6E; --rubric-ink: #1A0D0E; --rubric-soft: #3A2224;
  --ok: #7FC690; --ok-soft: #1E3326; --warn: #E4B55E; --warn-soft: #3A2F19;
  --v-s: #E58596; --v-a: #B597DA; --v-t: #6CBACB; --v-b: #9DBF6E; --v-x: #A2A8A4;
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 10px 30px rgba(0, 0, 0, .5); color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #141615; --surface: #1C1F1E; --sunk: #232725; --ink: #E7EBE8; --muted: #9AA19D; --line: #2F3432;
  --rubric: #E06A6E; --rubric-ink: #1A0D0E; --rubric-soft: #3A2224;
  --ok: #7FC690; --ok-soft: #1E3326; --warn: #E4B55E; --warn-soft: #3A2F19;
  --v-s: #E58596; --v-a: #B597DA; --v-t: #6CBACB; --v-b: #9DBF6E; --v-x: #A2A8A4;
  --scrim: rgba(0, 0, 0, .6); --shadow: 0 10px 30px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-ui); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rubric); outline-offset: 2px; }

.wrap {
  max-width: 720px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Barra demo */
.demo {
  background: var(--warn-soft); color: var(--warn); font-size: 13px;
}
.demo .wrap { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding-block: 8px; }
.demo select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; color: var(--ink); }

/* Testata */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-block: 12px 10px; }
.brand { font-family: var(--f-display); font-size: 15px; letter-spacing: .02em; color: var(--muted); }
.brand b { color: var(--rubric); font-weight: 600; }
/* consumi: email del giorno e spazio dei PDF */
.consumo { display: grid; gap: 4px; }
.consumo-t { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.consumo-b { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.consumo-b i { display: block; height: 100%; background: var(--ink); }
.consumo.pieno .consumo-b i { background: var(--rubric); }
/* promemoria del coro: una riga per tipo di evento */
.regola { display: grid; gap: 4px; }
.regola-c { display: flex; gap: 8px; flex-wrap: wrap; }
.regola-c select { flex: 1 1 180px; min-width: 0; }
.regola-c input { width: 110px; }
.regola-c select, .regola-c input { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--ink); }
/* menu dei cori, solo per chi è in più di uno */
.coro-scelta {
  flex: 1 1 auto; min-width: 0; max-width: 240px; margin-right: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px;
  color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
h1 { font-family: var(--f-display); font-weight: 500; font-size: 30px; line-height: 1.1; margin: 0; text-wrap: balance; }
h2 { font-family: var(--f-display); font-weight: 600; font-size: 20px; margin: 0; text-wrap: balance; }
.eyebrow { font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

main { padding-block: 18px calc(96px + env(safe-area-inset-bottom, 0px)); }
.view { display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Schede in basso */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs .wrap { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 8px; font-size: 11.5px; font-weight: 500; color: var(--muted);
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--rubric); }

/* Controlli */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 9px 14px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--rubric); border-color: var(--rubric); color: var(--rubric-ink); }
.btn.danger { color: var(--rubric); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 32px; padding: 5px 10px; font-size: 13.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }

.seg { display: inline-flex; background: var(--sunk); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { appearance: none; border: 0; background: none; border-radius: 8px; padding: 6px 11px; font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.search {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; min-height: 42px;
}

.fab {
  position: fixed; z-index: 7;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--rubric); color: var(--rubric-ink); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.fab svg { width: 24px; height: 24px; }
@media (min-width: 760px) { .fab { right: calc(50% - 360px + 16px); } }

/* Liste */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
}
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: var(--sunk); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.static { cursor: default; }
.row.static:hover { background: none; }

/* Sezioni SATB */
.voice {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--f-display); font-weight: 600; font-size: 16px;
  color: var(--v); background: color-mix(in srgb, var(--v) 14%, transparent);
}
.voice[data-v="0"] { --v: var(--v-s); } .voice[data-v="1"] { --v: var(--v-a); }
.voice[data-v="2"] { --v: var(--v-t); } .voice[data-v="3"] { --v: var(--v-b); }
.voice[data-v="4"], .voice[data-v="x"] { --v: var(--v-x); }
.voice { font-size: 13px; }
.voice.sm { font-size: 10.5px; width: auto; min-width: 22px; padding: 0 5px; border-radius: 11px; }
.voice.sm { width: 22px; height: 22px; font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.due { background: var(--rubric-soft); color: var(--rubric); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.n { background: var(--sunk); color: var(--muted); }

/* Calendario */
.month { font-family: var(--f-display); font-size: 19px; font-style: italic; color: var(--muted); margin: 6px 2px -8px; }
.ev { align-items: flex-start; }
.date {
  flex: none; width: 46px; text-align: center; border-right: 2px solid var(--line); padding-right: 10px; margin-right: 2px;
}
.date .d { font-family: var(--f-display); font-size: 26px; line-height: 1; font-weight: 600; }
.date .w { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 3px; }
.ev[data-tipo="concerto"] .date { border-color: var(--rubric); }
.ev[data-tipo="concerto"] .date .d { color: var(--rubric); }
.ev[data-tipo="servizio"] .date { border-color: var(--v-a); }
.ev .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center; }
.ev .t { white-space: normal; }

/* Riepilogo quote */
.sum { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; }
.sum .big { font-family: var(--f-display); font-size: 34px; line-height: 1; font-weight: 500; }
.sum .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sum .grid > div { min-width: 0; }
.sum .k { font-size: 12px; color: var(--muted); }
.sum .v { font-weight: 600; font-size: 16px; }
.bar { height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

/* Schede di dettaglio */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd a:not(.linkbtn) { color: inherit; text-underline-offset: 2px; }
@media (max-width: 420px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }

/* Foglio (modale dal basso) */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92%; overflow: auto;
  border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: up .2s ease-out;
}
@media (min-width: 600px) { .scrim { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes up { from { transform: translateY(24px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }

form { display: grid; gap: 12px; }
.f { display: grid; gap: 5px; min-width: 0; }
.f label, .f .lbl { font-size: 13px; font-weight: 500; color: var(--muted); }
.f input, .f select, .f textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 11px; min-height: 42px;
}
.f textarea { min-height: 70px; resize: vertical; }
.f2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.f3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .f3 { grid-template-columns: 1fr 1fr; } .f3 > :first-child { grid-column: 1 / -1; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--rubric); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 5px; cursor: pointer; font-size: 14px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { border-color: var(--rubric); background: var(--rubric-soft); }
.chip:has(input:focus-visible) { outline: 2px solid var(--rubric); outline-offset: 2px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.actions .spacer { flex: 1; }
.err { color: var(--rubric); font-size: 13.5px; }
.confirm { background: var(--rubric-soft); border-radius: 10px; padding: 12px; display: grid; gap: 10px; font-size: 14px; }

/* Accesso */
.login { min-height: 100vh; display: grid; place-items: center; padding-block: 40px; }
.login .box { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.login .staff { height: 34px; background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 7px); border-radius: 2px; position: relative; }
.login .staff::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--rubric); }

.pick { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 10px; min-height: 38px; font-size: 13.5px; max-width: 100%; }
.linkbtn { appearance: none; border: 0; background: none; padding: 0; color: var(--rubric); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: 13px; justify-self: start; }

/* Tariffe per categoria */
.tariffe { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; }
.tariffe-list { display: flex; flex-wrap: wrap; gap: 6px 14px; min-width: 0; }
.tar { display: inline-flex; gap: 6px; align-items: baseline; font-size: 13.5px; color: var(--muted); }
.tar b { color: var(--ink); font-weight: 600; }
.tar b.miss { color: var(--rubric); font-weight: 500; }
.tar-form { display: grid; }
.tar-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tar-row > span:first-child { display: grid; gap: 2px; min-width: 0; }
.tar-row .muted { font-size: 12.5px; }
.euro-in { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.euro-in input { width: 96px; text-align: right; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; min-height: 40px; font-variant-numeric: tabular-nums; }
.euro-in input[readonly] { background: transparent; border-color: transparent; }
.euro-in span { color: var(--muted); }

/* Prima nota */
.amt { flex: none; font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.amt.in { color: var(--ok); } .amt.out { color: var(--rubric); } .amt.gir { color: var(--muted); font-weight: 500; }
.mov { align-items: flex-start; }
.mov .amt { padding-top: 1px; }
.mov .s { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rnd-wrap { display: grid; gap: 18px; }
.rnd h3 { font-family: var(--f-display); font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.rnd-sub { font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 10px 0 2px; }
.rnd-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; border-bottom: 1px dotted var(--line); }
.rnd-row > span:first-child { min-width: 0; }
.rnd-row > span:last-child { flex: none; }
.rnd-row.zero { display: none; color: var(--muted); }
.show-zero .rnd-row.zero { display: flex; }
.rnd-row.tot { font-weight: 600; border-bottom-style: solid; }
.rnd-row.res { font-weight: 600; background: var(--sunk); border-radius: 8px; padding: 8px 10px; border: 0; margin-top: 6px; }

.pdfs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pdf { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 9px; padding: 6px 10px 6px 8px; font-size: 13.5px; font-weight: 500; text-decoration: none; cursor: pointer; max-width: 100%; }
.pdf svg { color: var(--rubric); flex: none; }
.pdf span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf small { color: var(--muted); font-weight: 400; }
.pdf:hover { border-color: var(--muted); }
.cart { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.cart li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.cart li:first-child { border-top: 0; }
.cart .n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 1px; }
.cart .main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cart .t { font-weight: 600; }
.cart .s { font-size: 13px; color: var(--muted); }
.cart .ord { display: flex; gap: 2px; flex: none; }
.cart .ord .btn { min-height: 32px; padding: 4px 8px; }
.cart .ord svg { width: 16px; height: 16px; }
.linkplain { appearance: none; border: 0; background: none; padding: 0; text-align: left; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.linkplain:hover { color: var(--rubric); }
.cartella { border-top: 1px solid var(--line); padding-top: 12px; }
.frow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.frow svg { color: var(--rubric); flex: none; }
.frow .fname { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.frow .fname input { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 8px; min-height: 36px; width: 100%; }
.frow small { font-size: 12px; }
.upload { display: inline-flex; align-items: center; gap: 6px; justify-self: start; border: 1px dashed var(--muted); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 500; position: relative; }
.upload svg { width: 16px; height: 16px; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload:focus-within { outline: 2px solid var(--rubric); outline-offset: 2px; }
.tab span { white-space: nowrap; }
.evchips { display: flex; flex-wrap: wrap; gap: 6px; }
.evchip { appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 9px; padding: 5px 10px; display: inline-grid; text-align: left; cursor: pointer; font: inherit; font-size: 13.5px; }
.evchip span { font-size: 12px; color: var(--muted); }
.evchip:hover { border-color: var(--muted); }
.gruppo + .gruppo { margin-top: 14px; }
.gtit { font-family: var(--f-display); font-style: italic; font-size: 16px; color: var(--muted); margin-top: 6px; }
.ev .per { white-space: normal; color: var(--rubric); font-size: 12.5px; }
.conclist { display: grid; gap: 4px; }
.check.conc { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.check.conc:has(input:checked) { border-color: var(--rubric); background: var(--rubric-soft); }
.check.conc > span { display: grid; gap: 1px; }
.check.conc .muted { font-size: 12.5px; }
.azioni-st { display: grid; gap: 8px; }
.azione { appearance: none; text-align: left; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 12px 14px; display: grid; gap: 3px; cursor: pointer; font: inherit; }
.azione b { font-size: 15.5px; }
.azione span { font-size: 13px; color: var(--muted); }
.azione:hover { border-color: var(--muted); }
.azione:disabled { opacity: .55; cursor: progress; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.tag.piu { background: transparent; padding-inline: 2px; }
.tag.link { appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; font: inherit; font-size: 12.5px; padding: 5px 10px; }
.tag.link:hover { border-color: var(--muted); }
.tag.on { background: var(--rubric-soft); color: var(--rubric); font-size: 13px; padding: 5px 4px 5px 10px; }
.tag.on button { appearance: none; border: 0; background: none; color: inherit; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.tagbar { display: flex; flex-wrap: wrap; gap: 6px; }
.tagf { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.tagf .num { color: var(--muted); font-size: 11.5px; margin-left: 2px; }
.tagf[aria-pressed="true"] { background: var(--rubric); border-color: var(--rubric); color: var(--rubric-ink); }
.tagf[aria-pressed="true"] .num { color: inherit; opacity: .8; }
.tagf.altro { border-style: dashed; color: var(--muted); }
.taginput { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 6px 8px; min-height: 42px; }
.taginput:focus-within { outline: 2px solid var(--rubric); outline-offset: 1px; }
.taginput #br-tags { display: contents; }
.taginput input { flex: 1; min-width: 120px; border: 0; background: transparent; padding: 4px; outline: none; }
.pdf .vv { font-weight: 700; color: var(--rubric); font-size: 11px; letter-spacing: .03em; }
.pdf.mio { border-color: var(--rubric); background: var(--rubric-soft); }
.pdf.altrui { opacity: .6; }
.vocisel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.vbtn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 7px; min-width: 30px; height: 28px; padding: 0 7px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.vbtn[aria-pressed="true"] { background: var(--rubric); border-color: var(--rubric); color: var(--rubric-ink); }
.vlbl { font-size: 12px; color: var(--muted); margin-left: 4px; }
.avviso-data { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; line-height: 1.4; }
.chip.sub { font-size: 13px; padding-block: 3px; }
.vbtn.sub { font-weight: 500; font-size: 11.5px; }
#conti-zone { min-width: 0; }
#conti-zone .s { white-space: normal; }
.chiuso { background: var(--sunk); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.chiuso.aperto { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.s.prog { color: var(--rubric); font-size: 12.5px; }
.bar.sottile { height: 4px; margin-top: 6px; }
.bar.oltre i { background: var(--rubric); }
.prow { padding: 2px 0 6px; }
.prow .rnd-row { border-bottom: 0; padding-bottom: 2px; }
.vrow { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.vrow .num { flex: none; width: 2.6em; }
.vrow .vn { flex: 1; min-width: 0; }
.vrow.off .vn { color: var(--muted); }
.sezchk { display: grid; gap: 2px; margin-top: 6px; }
.pvrow { display: grid; grid-template-columns: 92px 1fr 96px auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.pvrow select, .pvrow input { min-width: 0; }
@media (max-width: 420px) { .pvrow { grid-template-columns: 1fr 96px auto; } .pvrow select { grid-column: 1 / -1; } }
.arretrati { appearance: none; width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.arretrati b { font-weight: 600; }
.docgrp { margin-top: 10px; }
.docrow { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.docrow .pdf { flex: 1; min-width: 0; }
.docsrc { display: flex; gap: 8px; flex-wrap: wrap; }
.docsrc .btn { cursor: pointer; }
.segr { position: relative; }
.segr input { position: absolute; opacity: 0; pointer-events: none; }
.segr span { display: block; border-radius: 8px; padding: 6px 11px; font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer; }
.segr input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.segr input:focus-visible + span { outline: 2px solid var(--rubric); }
.pagine { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pagine figure { margin: 0; position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sunk); aspect-ratio: 3 / 4; }
.pagine img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pagine figcaption { position: absolute; left: 6px; bottom: 4px; font-size: 12px; font-weight: 600; background: var(--surface); border-radius: 6px; padding: 0 5px; }
.pagine .x { position: absolute; top: 3px; right: 3px; appearance: none; border: 0; background: var(--surface); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.pagine .x svg { width: 14px; height: 14px; }
.accrow { display: flex; gap: 8px; }
.accrow input { flex: 1; min-width: 0; }
.storico summary, .pers summary { cursor: pointer; font-size: 13.5px; color: var(--muted); font-weight: 500; padding: 6px 0; }
.pers { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px 10px; }
.pers[open] summary { color: var(--ink); }
.row.sub { padding-left: 22px !important; }
.escl { cursor: pointer; gap: 10px; }
.escl input { width: 20px; height: 20px; accent-color: var(--rubric); flex: none; }
.escl.off .t { text-decoration: line-through; color: var(--muted); }
.escl .main { display: grid; gap: 1px; }
.escl .s { font-size: 12.5px; color: var(--muted); }
.autore { font-weight: 500; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.avviso { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}
.spin { padding: 50px 0; text-align: center; color: var(--muted); }
