/* Questionario CSA Adria – stile
   Nessun font esterno: si usano i caratteri già presenti nel dispositivo,
   così il browser non contatta server di terze parti. */

:root {
  /* Colori del Centro Servizi Anziani di Adria (dal sito csaadria.it) */
  --carta: #fff6f5;
  --foglio: #ffffff;
  --inchiostro: #2b2323;
  --tenue: #6b5c5b;
  --linea: #f0d6d4;
  --rosa: #ff9592;          /* rosa del logo e dei pulsanti del sito */
  --brand: #b2504d;         /* rosso mattone del piè di pagina del sito */
  --brand-scuro: #8e3c39;
  --brand-chiaro: #ffe9e8;
  --accento: #2b2323;       /* contorno di messa a fuoco, ben visibile */
  --accento-chiaro: #fff1e0;
  --rosso: #a3261f;
  --rosso-chiaro: #fde0dc;
  --raggio: 6px;
  --ombra: 0 1px 2px rgba(120, 50, 48, .06), 0 6px 20px rgba(120, 50, 48, .07);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--carta);
  color: var(--inchiostro);
  font: 18px/1.55 "Open Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}
h1, h2, h3 { font-family: "Open Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); margin: .2em 0 .5em; }
h2 { font-size: 1.4rem; margin: 1.8em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1.2em 0 .4em; }
p { margin: 0 0 1em; }
a { color: var(--brand-scuro); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
small, .nota { color: var(--tenue); font-size: .9rem; }
:focus-visible { outline: 3px solid var(--accento); outline-offset: 2px; border-radius: 6px; }

.contenitore { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
.contenitore.largo { max-width: 1040px; }

/* Testata: bianca con logo rosa, come la barra laterale del sito */
.testata { background: #fff; border-bottom: 6px solid var(--rosa); }
.testata .contenitore { padding-top: 14px; padding-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.testata .logo { display: block; height: 60px; width: auto; }
.testata .titolo-q { text-align: right; font-size: .85rem; color: var(--tenue); line-height: 1.35; }
.testata .titolo-q strong { display: block; color: var(--brand); font-size: 1rem; }
@media (max-width: 520px) { .testata .logo { height: 48px; } .testata .titolo-q { text-align: left; } }

/* Avanzamento */
.progresso { position: sticky; top: 0; z-index: 5; background: var(--carta); padding: 10px 0 8px; }
.progresso-testo { display: flex; justify-content: space-between; font-size: .85rem; color: var(--tenue); margin-bottom: 6px; }
.progresso-barra { height: 6px; background: var(--linea); border-radius: 99px; overflow: hidden; }
.progresso-barra span { display: block; height: 100%; background: var(--rosa); width: 0; transition: width .3s ease; }

.sopra { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--brand); font-weight: 700; margin: 0; }
.sopra::before { content: ""; display: inline-block; width: 22px; height: 3px; background: var(--rosa); vertical-align: middle; margin-right: 8px; }

/* Schede */
.scheda { background: var(--foglio); border: 1px solid var(--linea); border-radius: var(--raggio); box-shadow: var(--ombra); padding: 22px 20px; margin: 18px 0; }
.scheda.errore { border-color: var(--rosso); box-shadow: 0 0 0 2px var(--rosso-chiaro); }
.scheda .msg-errore { color: var(--rosso); font-size: .9rem; font-weight: 600; margin: 8px 0 0; display: none; }
.scheda.errore .msg-errore { display: block; }
.domanda { font-weight: 600; margin: 0 0 12px; font-size: 1.05rem; }
.domanda .num { color: var(--brand); margin-right: 4px; }

.punti { padding-left: 0; list-style: none; margin: 0 0 1em; }
.punti li { padding: 8px 0 8px 30px; position: relative; border-bottom: 1px dashed var(--linea); }
.punti li:last-child { border-bottom: 0; }
.punti li::before { content: ""; position: absolute; left: 6px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--rosa); }

.riquadro { background: var(--brand-chiaro); border-radius: 10px; padding: 14px 16px; margin: 0 0 1em; }
.riquadro.ambra { background: var(--accento-chiaro); border-left: 4px solid #e0a35a; }

/* Opzioni (radio e checkbox grandi, comodi da smartphone) */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.opzioni { display: grid; gap: 8px; }
.opz { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--linea); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.opz:hover { border-color: #b9ae9a; }
.opz input { position: absolute; opacity: 0; pointer-events: none; }
.opz .segno { flex: none; width: 22px; height: 22px; border: 2px solid #9a917f; border-radius: 50%; display: grid; place-items: center; background: #fff; }
.opz input[type=checkbox] + .segno { border-radius: 6px; }
.opz input:checked + .segno { border-color: var(--brand); background: var(--brand); }
.opz input:checked + .segno::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.opz input[type=checkbox]:checked + .segno::after { width: 6px; height: 11px; border-radius: 0; background: none; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.opz:has(input:checked) { border-color: var(--brand); background: var(--brand-chiaro); }
.opz:has(input:focus-visible) { outline: 3px solid var(--accento); outline-offset: 2px; }
.opz:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* Scala numerata con significato accanto a ogni numero */
.scala .opz { padding-left: 10px; }
.scala .n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--carta); border: 1.5px solid var(--linea); font-variant-numeric: tabular-nums; }
.scala .opz:has(input:checked) .n { background: var(--brand); color: #fff; border-color: var(--brand); }
.scala .opz .segno { display: none; }
.scala .opz.nonso .n { font-size: .8rem; }
.scala-titolo { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--tenue); font-weight: 600; margin: 0 0 8px; }
.due-scale { display: grid; gap: 18px; }
@media (min-width: 700px) { .due-scale { grid-template-columns: 1fr 1fr; } }

.valore-nome { font-size: 1.35rem; margin: 0; color: var(--brand); }
.valore-desc { color: var(--tenue); margin: 2px 0 16px; }

/* Campi di testo */
textarea, input[type=text], select, .pericolo input {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 1.5px solid var(--linea); border-radius: 10px; padding: 12px 14px;
}
textarea { resize: vertical; min-height: 96px; }
textarea:focus, input[type=text]:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-chiaro); }
.tre-parole { display: grid; gap: 8px; }
@media (min-width: 600px) { .tre-parole { grid-template-columns: repeat(3, 1fr); } }
.contatore { text-align: right; font-size: .8rem; color: var(--tenue); margin-top: 4px; }

/* Pulsanti */
.btn { appearance: none; border: 0; border-radius: var(--raggio); background: var(--brand); color: #fff; font: inherit; font-weight: 600; padding: 14px 22px; min-height: 52px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--brand-scuro); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sec { background: transparent; color: var(--brand-scuro); border: 1.5px solid var(--brand); }
.btn.sec:hover { background: var(--brand-chiaro); color: var(--brand-scuro); }
.btn.rosso { background: var(--rosso); }
.btn.rosso:hover { background: #7f2d21; }
.navigazione { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap-reverse; }
.navigazione .btn { flex: 1 1 180px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-scuro); text-decoration: underline; cursor: pointer; }

.errore-generale { background: var(--rosso-chiaro); color: var(--rosso); border-radius: 10px; padding: 12px 14px; font-weight: 600; display: none; }
.errore-generale.vis { display: block; }

.centro { text-align: center; }
.grazie-segno { width: 72px; height: 72px; border-radius: 50%; background: var(--brand); margin: 24px auto 8px; display: grid; place-items: center; }
.grazie-segno::after { content: ""; width: 18px; height: 34px; border: solid #fff; border-width: 0 5px 5px 0; transform: rotate(45deg) translate(-3px, -3px); }

.pie { border-top: 1px solid var(--linea); margin-top: 32px; padding-top: 16px; font-size: .85rem; color: var(--tenue); }
.fascia { background: var(--brand); color: #fff; margin-top: 48px; }
.fascia .contenitore { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; padding-top: 28px; padding-bottom: 28px; font-size: .88rem; line-height: 1.5; }
.fascia img { height: 64px; width: auto; }
.fascia a { color: #fff; }
.fascia a:hover { color: var(--brand-chiaro); }

/* Informativa */
.informativa h2 { font-size: 1.15rem; margin-top: 1.6em; }
.informativa table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.informativa td, .informativa th { border-bottom: 1px solid var(--linea); padding: 8px 6px; text-align: left; vertical-align: top; }

/* ------------------ Pagine riservate (dashboard e area Restart HR) ------------------ */
body.riservata { font-size: 16px; }
.intesta { margin-bottom: 8px; }
.azioni { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.stato { display: inline-block; padding: 4px 12px; border-radius: 99px; background: var(--linea); font-weight: 600; font-size: .85rem; }
.stato.ok { background: var(--brand-chiaro); color: var(--brand-scuro); }
.kpi { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0 12px; }
.kpi > div { background: var(--foglio); border: 1px solid var(--linea); border-radius: var(--raggio); padding: 16px 20px; min-width: 200px; flex: 1; }
.kpi-n { display: block; color: var(--brand); font-size: 2.6rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-l { color: var(--tenue); font-size: .9rem; }
.avanz { height: 12px; background: var(--linea); border-radius: 99px; overflow: hidden; }
.avanz span { display: block; height: 100%; background: var(--brand); }
.giorno { display: grid; grid-template-columns: 96px 1fr 40px; gap: 10px; align-items: center; padding: 4px 0; font-variant-numeric: tabular-nums; }
.g-barra { height: 14px; background: var(--linea); border-radius: 4px; overflow: hidden; }
.g-barra span { display: block; height: 100%; background: var(--brand); }
.g-n { text-align: right; font-weight: 600; }
.tab { width: 100%; border-collapse: collapse; background: var(--foglio); border: 1px solid var(--linea); border-radius: 10px; overflow: hidden; }
.tab th, .tab td { padding: 9px 12px; border-bottom: 1px solid var(--linea); text-align: left; vertical-align: top; }
.tab thead th { background: var(--carta); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tenue); }
.tab .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tab .alto { color: var(--rosso); font-weight: 700; }
.tab tr.gruppo th { background: var(--brand-chiaro); color: var(--brand-scuro); }
.scorri { overflow-x: auto; }
.filtro { display: flex; gap: 10px; flex-wrap: wrap; }
.filtro select { max-width: 520px; flex: 1; }
.avviso { background: var(--accento-chiaro); border-radius: 10px; padding: 12px 14px; }
.parole { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.parole li { background: var(--foglio); border: 1px solid var(--linea); border-radius: 99px; padding: 4px 12px; }
.parole li span { color: var(--brand); font-weight: 700; margin-left: 4px; }
details { background: var(--foglio); border: 1px solid var(--linea); border-radius: 10px; margin: 8px 0; padding: 4px 14px; }
summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
summary .conta { color: var(--tenue); font-weight: 400; font-size: .85rem; margin-left: 6px; }
.citazioni { padding-left: 18px; }
.citazioni li { margin: 0 0 10px; }
.pericolo-t { color: var(--rosso); }
.pericolo { border: 1.5px solid var(--rosso); border-radius: var(--raggio); padding: 18px; background: #fff; }
.pericolo label { display: block; margin: 8px 0 6px; font-weight: 600; }
.pericolo input { max-width: 380px; display: block; margin-bottom: 12px; }
.pericolo hr { border: 0; border-top: 1px solid var(--linea); margin: 18px 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .progresso, .navigazione, .azioni, .pericolo, .pericolo-t, .filtro { display: none !important; }
  body { background: #fff; }
}

/* Parti da completare prima della pubblicazione (da eliminare quando sono compilate) */
.dc { background: #fff0a8; padding: 0 4px; border-radius: 4px; font-weight: 600; }
