:root {
  --bg: #f4f6f8; --panel: #ffffff; --line: #d9dee5; --text: #1f2933; --muted: #6b7785;
  --primary: #2b6cb0; --primary-dark: #1e4e8c; --accent: #2f855a; --danger: #c53030; --warn: #b7791f;
  /* fasce del registro: intestazione piena + sfondo molto tenue per le righe della sezione */
  --mattina: #2f855a; --mattina-tenue: #edf7f1;
  --pomeriggio: #1a365d; --pomeriggio-tenue: #e9eef6;
  --bisogno: #3182ce; --bisogno-tenue: #eaf3fc;
  --notte: #7b4a21; --notte-tenue: #f5ede6;
  --cell-ok: #c6f6d5; --cell-ko: #fed7d7; --cell-parz: #feebc8; --cell-assente: #e2e8f0; --cell-attesa: #fffff0;
  --radius: 8px; --shadow: 0 2px 8px rgba(0,0,0,.08);
  --touch: 44px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 15px; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.flex { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }

/* Layout */
.app { display: grid; grid-template-columns: 230px 1fr; grid-template-rows: 56px 1fr; height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; padding: 0 1rem; background: var(--primary-dark); color: #fff; }
.topbar .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .3px; }
.topbar .brand small { font-weight: 400; opacity: .8; margin-left: .5rem; }
.topbar select { background: #fff; color: var(--text); border: 0; border-radius: 6px; padding: .4rem .6rem; min-height: 36px; }
.topbar .menu-toggle { display: none; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: .75rem 0; }
/* titolo di gruppo: è un pulsante, apre e chiude l'elenco che ha sotto */
.sidebar .group { display: flex; align-items: center; gap: .35rem; width: 100%; padding: .75rem 1rem .25rem;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  background: none; border: 0; font-family: inherit; text-align: left; cursor: pointer; }
.sidebar .group:hover { color: var(--text); }
.sidebar .group .freccia { font-size: .7rem; transition: transform .15s; }
.sidebar .group.chiuso .freccia { transform: rotate(-90deg); }
.sidebar a { display: block; padding: .55rem 1rem; color: var(--text); border-left: 3px solid transparent; min-height: var(--touch); line-height: 1.6; }
.sidebar a:hover { background: #eef2f7; }
.sidebar a.active { border-left-color: var(--primary); background: #e8f0fb; font-weight: 600; }
.sidebar a .ico { display: inline-block; width: 1.6rem; }
.main { overflow: auto; padding: 1.25rem 1.5rem; }
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 56px; left: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 20; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .topbar .menu-toggle { display: inline-block; }
  .main { padding: .75rem; }
}

/* Componenti */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 38px; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; font-size: .95rem; }
.btn:hover { background: #f0f3f7; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-sm { min-height: 30px; padding: .2rem .6rem; font-size: .85rem; }
.btn-icon { min-width: 38px; padding: .3rem; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }
.btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 6px; padding: .45rem .6rem; min-height: 38px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #90cdf4; border-color: var(--primary); }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.field { margin-bottom: .8rem; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.field.error input, .field.error select, .field.error textarea { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: .8rem; margin-top: .2rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 1rem; }
.form-grid .field.full { grid-column: 1 / -1; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; background: #e2e8f0; color: #2d3748; }
.badge-ok { background: var(--cell-ok); color: #22543d; }
.badge-ko { background: var(--cell-ko); color: #742a2a; }
.badge-warn { background: var(--cell-parz); color: #7b341e; }
.badge-info { background: #bee3f8; color: #2a4365; }

/* Tabelle */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); }
table.tbl th, table.tbl td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.tbl th { background: #f7fafc; font-weight: 600; font-size: .85rem; color: #4a5568; white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; z-index: 1; }
table.tbl tr:hover td { background: #f9fbfd; }
table.tbl td.actions { white-space: nowrap; text-align: right; }
table.tbl tr.inactive td { color: var(--muted); font-style: italic; }
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.toolbar input[type=search] { max-width: 320px; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* Modal e toast */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal { background: #fff; border-radius: 10px; width: min(720px, 100%); max-height: 95vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal-wide { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 1rem; overflow: auto; }
.modal-foot { padding: .8rem 1rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; }
.toast-box { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; }
.toast { background: #2d3748; color: #fff; padding: .7rem 1rem; border-radius: 8px; opacity: 0; transform: translateY(10px); transition: all .25s; max-width: 420px; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: none; }
.toast-success { background: var(--accent); }
.toast-error { background: var(--danger); }
.toast-warn { background: var(--warn); }

/* Griglie registro (righe x giorni) */
.griglia-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.griglia { border-collapse: separate; border-spacing: 0; font-size: .82rem; min-width: 100%; }
table.griglia th, table.griglia td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; height: 34px; }
table.griglia thead th { position: sticky; top: 0; z-index: 3; background: #f7fafc; text-align: center; font-weight: 600; padding: .3rem .2rem; min-width: 34px; }
table.griglia thead th.oggi { background: #fefcbf; }
table.griglia thead th.festivo { color: var(--danger); }
table.griglia th.riga, table.griglia td.riga { position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; padding: .2rem .5rem; min-width: 220px; max-width: 320px; white-space: normal; font-weight: 500; }
table.griglia th.riga.orario, table.griglia td.orario { left: 0; min-width: 130px; max-width: 150px; font-size: .95rem; color: var(--text); font-weight: 700; text-transform: uppercase; line-height: 1.15; }
table.griglia td.orario .ora { display: block; font-size: 1.05rem; font-weight: 800; letter-spacing: .02em; }
table.griglia td.riga.farmaco { left: 140px; }
table.griglia thead th.riga { z-index: 4; }
table.griglia tr.sezione td, table.griglia tr.sezione th { background: #edf2f7; font-weight: 700; text-transform: uppercase; font-size: .75rem; letter-spacing: .04em; padding: .25rem .5rem; position: sticky; left: 0; z-index: 2; }
table.griglia tr.sezione.mattina td { background: var(--mattina); color: #fff; }
table.griglia tr.sezione.pomeriggio td { background: var(--pomeriggio); color: #fff; }
table.griglia tr.sezione.notte td { background: var(--notte); color: #fff; }
table.griglia tr.sezione.al_bisogno td { background: var(--bisogno); color: #fff; }
/* le righe che seguono l'intestazione prendono la stessa tinta, molto più tenue */
table.griglia tbody.fascia-mattina td.riga { background: var(--mattina-tenue); }
table.griglia tbody.fascia-pomeriggio td.riga { background: var(--pomeriggio-tenue); }
table.griglia tbody.fascia-notte td.riga { background: var(--notte-tenue); }
table.griglia tbody.fascia-al_bisogno td.riga { background: var(--bisogno-tenue); }
table.griglia tr.sottosezione td { background: #f7fafc; font-weight: 600; font-size: .75rem; padding: .2rem .5rem; position: sticky; left: 0; z-index: 2; }
table.griglia td.cella { text-align: center; cursor: pointer; min-width: 34px; user-select: none; font-weight: 600; }
table.griglia td.cella:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
table.griglia td.cella.attesa { background: var(--cell-attesa); }
table.griglia td.cella.fatto { background: var(--cell-ok); color: #22543d; }
table.griglia td.cella.rifiutato, table.griglia td.cella.non_fatto { background: var(--cell-ko); color: #742a2a; }
table.griglia td.cella.parziale { background: var(--cell-parz); color: #7b341e; }
table.griglia td.cella.assente { background: var(--cell-assente); color: var(--muted); cursor: default; }
table.griglia td.cella.fuori { background: #f1f1f1; color: #cbd5e0; cursor: default; }
table.griglia td.cella.oggi { box-shadow: inset 0 0 0 2px #ecc94b; }
table.griglia td.cella.pianificato { background: #ebf8ff; color: #2b6cb0; }
table.griglia td.cella input { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; text-align: center; padding: 0; font-size: .8rem; background: transparent; }
table.griglia td.cella.valore { font-size: .78rem; font-weight: 500; }
.legenda { display: flex; gap: .75rem; flex-wrap: wrap; font-size: .8rem; margin-top: .5rem; }
.legenda span { display: inline-flex; align-items: center; gap: .3rem; }
.legenda i { display: inline-block; width: 16px; height: 16px; border: 1px solid var(--line); border-radius: 3px; }

/* Vista oggi */
.oggi-ospite { margin-bottom: 1rem; }
.oggi-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); min-height: var(--touch); }
.oggi-item:last-child { border-bottom: 0; }
.oggi-item .nome { flex: 1; }
.oggi-item .stato { font-size: .8rem; }
.oggi-item.fatto { background: #f0fff4; }
.oggi-item.rifiutato, .oggi-item.non_fatto { background: #fff5f5; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; border-bottom: 3px solid transparent; color: var(--muted); min-height: var(--touch); display: inline-flex; align-items: center; }
.tabs a.active { border-bottom-color: var(--primary); color: var(--text); font-weight: 600; }
/* schede dentro un form (es. Anagrafica / Retta nella scheda dell'ospite): stesso aspetto dei tab di pagina */
.tabs button.tab { padding: .5rem .9rem; border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--muted); min-height: var(--touch); font: inherit; cursor: pointer; }
.tabs button.tab.active { border-bottom-color: var(--primary); color: var(--text); font-weight: 600; }
form > .tabs { margin-bottom: .8rem; }

/* Dettaglio ospite */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Stampa */
@media print {
  body { background: #fff; }
  .app { display: block; height: auto; }
  .topbar, .sidebar, .no-print { display: none !important; }
  .main { padding: 0; overflow: visible; }
  .griglia-wrap { max-height: none; overflow: visible; border: 0; }
}

/* Celle griglia: simbolo + sigla, fuori soglia */
table.griglia td.cella .simbolo { display: block; line-height: 1.1; }
table.griglia td.cella .sigla { display: block; font-size: .55rem; font-weight: 400; color: var(--muted); line-height: 1; }
table.griglia td.cella .piano-mark { color: #4a90d9; font-size: 1rem; }
table.griglia td.cella.fuori-soglia { box-shadow: inset 0 0 0 2px var(--danger); color: var(--danger); }
table.griglia td.cella.libero { background: #fff; }
/* giorno in cui la terapia/prestazione non va data: oscurato, niente da compilare */
table.griglia td.cella.non_previsto, .legenda i.non_previsto { background: #7a8290; background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.10) 0 3px, transparent 3px 6px); cursor: default; }
table.griglia td.cella.non_previsto:hover { outline: none; }
table.griglia td.cella.sospeso { background: #e9d8fd; color: #553c9a; }
table.griglia thead th.assente { background: var(--cell-assente); }
.legenda i.cella { display: inline-block; }
.legenda i.fatto { background: var(--cell-ok); }
.legenda i.rifiutato { background: var(--cell-ko); }
.legenda i.attesa { background: var(--cell-attesa); }
.legenda i.attesa.mancante { background: #fff0f0; }
.legenda i.pianificato { background: #ebf8ff; }
.legenda i.sospeso { background: #e9d8fd; }
.legenda i.assente { background: var(--cell-assente); }
.legenda i.fuori { background: #f1f1f1; }
.legenda i.fuori-soglia { box-shadow: inset 0 0 0 2px var(--danger); }

table.griglia td.cella.attesa.mancante { background: #fff0f0; }
table.griglia td.cella.retroattiva { background-image: linear-gradient(135deg, transparent 75%, #ecc94b 75%); }
table.griglia td.cella.forzata { background-image: linear-gradient(45deg, transparent 75%, #e53e3e 75%); }
.legenda i.mancante { background: #fff0f0; }

/* Schermi stretti: la testata non va a capo su tre righe */
@media (max-width: 900px) {
  .topbar { gap: .5rem; }
  .topbar .brand { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .brand small { display: none; }
  .topbar label { display: none; }
  .topbar select { max-width: 45vw; }
}
@media (max-width: 600px) {
  .btn-group { flex-wrap: wrap; }
  .btn-group .btn { border-radius: 6px; }
}

/* ---------- Accesso ---------- */
.login-back { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(160deg, #1e4e8c 0%, #2b6cb0 60%, #2f855a 160%); }
.login-box { width: min(420px, 100%); background: var(--panel); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.3); padding: 1.6rem 1.5rem 1.2rem; }
.login-brand { font-size: 1.45rem; font-weight: 700; }
.login-sub { margin: .1rem 0 1.2rem; color: var(--muted); font-size: .9rem; }
.login-form .field { margin-bottom: .8rem; }
.login-form .btn-lg { width: 100%; min-height: 46px; font-size: 1.05rem; margin-top: .4rem; }
.login-errore { background: var(--cell-ko); color: #742a2a; border-radius: 6px; padding: .5rem .7rem; font-size: .9rem; margin: .3rem 0; }
.login-nota { margin: 1rem 0 0; font-size: .78rem; color: var(--muted); text-align: center; }
.avviso-blocco { background: var(--cell-parz); color: #7b341e; border-radius: 6px; padding: .5rem .7rem; margin: 0 0 .8rem; }

/* ---------- Utente collegato nella barra ---------- */
.utente-wrap { position: relative; }
.utente-box { position: relative; }
.utente-badge { display: flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 999px;
  padding: .3rem .7rem .3rem .35rem; min-height: 38px; cursor: pointer; font: inherit; }
.utente-badge:hover { background: rgba(255,255,255,.24); }
.utente-sigla { background: #fff; color: var(--primary-dark); font-weight: 700; font-size: .8rem; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.utente-nome { font-size: .9rem; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utente-freccia { font-size: .7rem; opacity: .8; }
.utente-menu { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 220px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 50; overflow: hidden; }
.utente-menu-testa { padding: .6rem .7rem; border-bottom: 1px solid var(--line); }
.utente-voce { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .6rem .7rem; cursor: pointer; font: inherit; color: inherit; min-height: var(--touch); }
.utente-voce:hover { background: #eef3f9; }
@media (max-width: 720px) { .utente-nome { display: none; } }

/* ---------- Utenti e permessi ---------- */
.badge-danger { background: var(--cell-ko); color: #742a2a; }
.sigla-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: .1rem .4rem; border-radius: 6px;
  background: #e8f0fb; color: var(--primary-dark); font-weight: 700; font-size: .8rem; }
h4.sezione-form { margin: 1.2rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); font-size: .95rem; }
.ruoli-layout { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .ruoli-layout { grid-template-columns: 1fr; } }
.ruoli-elenco { display: flex; flex-direction: column; }
.ruolo-voce { display: flex; flex-direction: column; gap: .1rem; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: .6rem .7rem; cursor: pointer; font: inherit; color: inherit; }
.ruolo-voce:hover { background: #f2f6fb; }
.ruolo-voce.active { background: #e8f0fb; border-left: 3px solid var(--primary); }
.ruolo-voce.inactive { opacity: .55; font-style: italic; }
.ruolo-testa { border-bottom: 1px solid var(--line); padding-bottom: .6rem; }
.ruolo-azioni { display: flex; gap: .5rem; margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.perm-lista { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.perm-gruppo { background: #eef3f9; padding: .35rem .7rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.perm-riga { display: flex; align-items: center; gap: .6rem; padding: .35rem .7rem; border-bottom: 1px solid #eef1f5; }
.perm-riga:last-child { border-bottom: 0; }
.perm-riga.figlia { padding-left: 2rem; background: #fbfcfe; }
.perm-riga.figlia .perm-label::before { content: '↳ '; color: var(--muted); }
.perm-label { flex: 1; min-width: 0; font-size: .92rem; }
.perm-label code { font-size: .72rem; }
.perm-riga select.liv { width: auto; min-width: 200px; min-height: 34px; padding: .2rem .4rem; font-size: .85rem; }
select.liv-nascosto { background: var(--cell-ko); }
select.liv-lettura { background: var(--cell-parz); }
select.liv-scrittura { background: var(--cell-ok); }
select.liv-eredita { background: #fff; color: var(--muted); }
.perm-campi { background: #fbfcfe; border-top: 1px dashed var(--line); }
@media (max-width: 720px) {
  .perm-riga { flex-wrap: wrap; }
  .perm-riga select.liv { min-width: 160px; flex: 1; }
}

/* Riprendi dal mese precedente */
.riprendi-elenco { border: 1px solid var(--line); border-radius: var(--radius); max-height: 50vh; overflow: auto; }
.riprendi-riga { display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .7rem; border-bottom: 1px solid #eef1f5; color: inherit; margin: 0; font-size: .95rem; }
.riprendi-riga:last-child { border-bottom: 0; }
.riprendi-riga:hover { background: #f7fafc; }
.riprendi-riga input { width: auto; min-height: 0; margin-top: .2rem; }

/* Casa di riposo scelta, nella barra in alto */
.struttura-wrap { display: flex; align-items: center; gap: .4rem; color: #fff; }
.struttura-ico { font-size: 1.05rem; }
.struttura-unica { font-size: .9rem; opacity: .9; white-space: nowrap; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
select.struttura-sel { width: auto; max-width: 15rem; min-height: 34px; padding: .2rem .5rem; border: 0; border-radius: 6px;
  background: rgba(255,255,255,.16); color: #fff; font-size: .9rem; }
select.struttura-sel option { color: var(--text); background: #fff; }
@media (max-width: 720px) { .struttura-unica { display: none; } select.struttura-sel { max-width: 8rem; } }

/* Posologia e note della terapia: devono saltare all'occhio di chi somministra */
.posologia { color: #c00000; font-weight: 700; font-size: .85rem; line-height: 1.2; }
.nota-terapia { color: #c00000; font-weight: 700; font-size: .85rem; line-height: 1.2; white-space: pre-wrap; }
table.griglia td.riga .posologia, table.griglia td.riga .nota-terapia { display: block; margin-top: .1rem; }
.oggi-item .pos.posologia, .oggi-item .pos.nota-terapia { color: #c00000; font-weight: 700; }

/* campo con un pulsante accanto (es. la tendina dei momenti con "ordina") */
.campo-con-azione { display: flex; gap: .4rem; align-items: center; }
.campo-con-azione > select, .campo-con-azione > input { flex: 1; }

/* selettore di fascia nell'elenco dei momenti */
select.mom-fascia-sel { width: auto; min-height: 30px; padding: .1rem .4rem; font-size: .8rem; max-width: 9rem; }

/* momento tolto per un singolo ospite */
.mom-riga.escluso { opacity: .5; background: #f7fafc; }
.mom-riga.escluso .etichetta { text-decoration: line-through; }

/* ---------- ripartizione di un movimento su più centri di costo ---------- */
.ripartizione { border: 1px solid #d8dee6; border-radius: 6px; padding: .5rem; background: #fbfcfd; }
.ripartizione .rip-riga { display: flex; gap: .4rem; align-items: center; margin-bottom: .35rem; }
.ripartizione .rip-riga select { flex: 1; min-width: 0; }
.ripartizione input.rip-perc { width: 6rem; flex: none; text-align: right; }
.ripartizione .rip-segno { color: #5a6676; }
.ripartizione .rip-comandi { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.ripartizione .rip-totale { font-size: .85rem; margin-top: .2rem; }
.ripartizione .rip-totale.ok { color: #1b7a3d; font-weight: 600; }
.ripartizione .rip-totale.no { color: #c00000; font-weight: 600; }
.ripartizione .rip-totale.vuota { color: #5a6676; }
/* elenco: i movimenti divisi si riconoscono a colpo d'occhio */
td .quote-centri { display: block; font-size: .8rem; color: #41506a; }
