/* ==========================================================================
   CareInfo · foglio di stile unico
   1) token e reset  2) componenti  3) pagine  4) responsive
   ========================================================================== */

:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --ink: #1f2a2b;
  --ink-soft: #344442;
  --muted: #5f6f6d;
  --line: #e6dfd2;
  --line-strong: #d5cbb9;
  --primary: #2d6a5f;
  --primary-dark: #23534a;
  --primary-soft: #e2efea;
  --accent: #c96f4a;
  --accent-soft: #f8e7dd;
  --danger: #a9443a;
  --danger-soft: #fbe9e7;
  --radius-lg: 20px;
  --radius: 15px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(31, 42, 43, 0.05), 0 6px 18px rgba(31, 42, 43, 0.04);
  --shadow-md: 0 12px 32px rgba(31, 42, 43, 0.09);
  --wrap: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 2.7vw, 1.95rem); }
h3 { font-size: 1.13rem; }
p { margin: 0 0 1em; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img,
svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 3px solid rgba(45, 106, 95, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

#main { min-height: 62vh; }

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.page { padding: clamp(28px, 4vw, 48px) 0 72px; }
.section { margin-top: clamp(36px, 5vw, 60px); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-head h2 { margin: 0; }
.section-sub { color: var(--muted); max-width: 62ch; margin-top: 6px; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.skip-link:focus { top: 12px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 14px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.eyebrow {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 10px;
}

.link-arrow { font-weight: 700; font-size: 0.92rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- Bottoni --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
  text-align: center;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-soft:hover { background: #d3e7df; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f6d9d5; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; border-radius: 14px; }
.btn-block { width: 100%; }

.btn-text {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
}
.btn-text:hover { text-decoration: underline; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---- Form ------------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 700;
}

.field .hint { font-weight: 400; font-size: 0.82rem; color: var(--muted); }

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

textarea { min-height: 112px; resize: vertical; }
input::placeholder,
textarea::placeholder { color: #97a29f; }

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 95, 0.16);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

.form-success {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---- Badge e avatar -------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-cat {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #cfe0d9;
  color: color-mix(in srgb, var(--cat, var(--primary)) 78%, #000);
  background: color-mix(in srgb, var(--cat, var(--primary)) 13%, #fff);
  border-color: color-mix(in srgb, var(--cat, var(--primary)) 30%, #fff);
}

.badge-role { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }
.badge-solved { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #c4ded5; }

.avatar {
  --h: 160;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: hsl(var(--h) 42% 88%);
  color: hsl(var(--h) 40% 28%);
  font-weight: 800;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar-xs { width: 26px; height: 26px; font-size: 0.66rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.74rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.86rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 78px; height: 78px; font-size: 1.5rem; }

/* ---- Header ---------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 248, 243, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.16rem;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark { flex: none; }
.brand-text span { color: var(--accent); }

.main-nav { display: flex; gap: 2px; margin-left: 6px; }
.main-nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 700;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--ink); background: rgba(45, 106, 95, 0.07); text-decoration: none; }
.main-nav a.active { color: var(--primary-dark); background: var(--primary-soft); }

.nav-badge {
  position: absolute;
  top: 1px;
  right: -3px;
  min-width: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  line-height: 1.55;
  text-align: center;
}

.header-auth { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}
.user-chip:hover { border-color: var(--line-strong); text-decoration: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; border-radius: 2px; background: var(--ink); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- Footer ---------------------------------------------------------------- */
.site-footer {
  margin-top: 72px;
  padding: 48px 0 24px;
  background: #1f2a2b;
  color: #c9d5d1;
}

.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-brand p { margin: 12px 0 0; font-size: 0.92rem; color: #a9b8b4; max-width: 34ch; }
.site-footer h3 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.site-footer a { display: block; padding: 3px 0; color: #e7ede9; font-size: 0.92rem; }
.site-footer a:hover { color: #fff; }
.brand-light { color: #fff; }
.brand-light .brand-text span { color: #e9a382; }
.site-footer .brand { display: inline-flex; }


.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.79rem;
  color: #93a5a1;
}
.footer-bottom p { margin: 0; }

/* ---- Home: hero ------------------------------------------------------------ */
.hero {
  padding: clamp(34px, 6vw, 76px) 0 clamp(28px, 5vw, 56px);
  background:
    radial-gradient(85% 65% at 12% 0%, #e9f1ec 0%, rgba(233, 241, 236, 0) 62%),
    linear-gradient(180deg, #f3efe5 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

.hero h1 { margin-bottom: 14px; }
.hero h1 .accent {
  color: var(--primary);
  background: linear-gradient(transparent 66%, rgba(201, 111, 74, 0.22) 66%);
}
.hero .lead { font-size: 1.08rem; color: var(--ink-soft); max-width: 54ch; }
.hero-actions { margin: 20px 0 14px; }

.hero-card { padding: 22px; }
.hero-card-title {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.emergency {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--ink);
}
.emergency:hover { text-decoration: none; color: var(--primary-dark); }
.emergency-num {
  min-width: 58px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.emergency-label { font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.hero-card .small { margin: 12px 0; }
.hero-card .link-arrow { font-size: 0.88rem; }

/* ---- Home: numeri e funzioni ---------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  padding: 20px 16px;
}
.stat + .stat { border-left: 1px solid var(--line); }
.stat-num {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
}
.stat-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.feature { padding: 22px; }
.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.feature-icon svg { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 6px; }
.feature p { font-size: 0.93rem; color: var(--muted); }
.feature .link-arrow { font-size: 0.86rem; }

.latest-home { max-width: 780px; margin-inline: auto; }

.cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: #fff;
}
.cta-band h2 { margin: 0 0 6px; color: #fff; }
.cta-band p { margin: 0; color: #d8e7e2; max-width: 52ch; }
.cta-band .btn-soft { background: #fff; color: var(--primary-dark); }
.cta-band .btn-ghost { border-color: rgba(255, 255, 255, 0.5); color: #fff; }

/* ---- Testata pagine interne ------------------------------------------------ */
.page-head { max-width: 780px; margin-bottom: 26px; }
.page-head h1 { margin-bottom: 10px; }
.page-head .lead { color: var(--ink-soft); font-size: 1.02rem; }

/* ---- Bacheca --------------------------------------------------------------- */
.post-card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: #cfe0d9;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.post-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-card-title { margin: 10px 0 6px; font-size: 1.12rem; }
.post-card-excerpt { margin: 0 0 12px; font-size: 0.93rem; color: var(--muted); }
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
}
.post-card-meta .dot { opacity: 0.6; }
.post-card-meta .replies { margin-left: auto; font-weight: 700; color: var(--primary-dark); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin: 18px 0 14px;
}
.toolbar select { width: auto; min-width: 170px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
}
.search-box input {
  flex: 1;
  padding: 12px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.search-box input:focus { box-shadow: none; }
.search-box .icon { color: var(--muted); font-size: 1rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.results-line { margin: 0 0 12px; }

/* ---- Dettaglio richiesta --------------------------------------------------- */
.post-detail { padding: clamp(20px, 4vw, 32px); }
.post-detail h1 { font-size: clamp(1.55rem, 3.4vw, 2.15rem); }
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}
.post-body { white-space: pre-line; font-size: 1.01rem; color: var(--ink-soft); }
.post-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.author-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.author-meta { font-size: 0.83rem; color: var(--muted); }

.reply { display: flex; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.reply:first-child { border-top: 0; padding-top: 4px; }
.reply-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--muted);
}
.reply-head strong { color: var(--ink); }
.reply-body { margin: 5px 0 0; font-size: 0.95rem; color: var(--ink-soft); white-space: pre-line; }

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 26px 0 10px;
}
.section-title-row h2 { margin: 0; font-size: 1.25rem; }

/* ---- Guida (Informazioni) -------------------------------------------------- */
.guide-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.guide-layout > .guide-head {
  grid-column: 2;
  grid-row: 1;
  margin-bottom: 0;
}
.guide-layout > .toc {
  grid-column: 1;
  grid-row: 1 / span 2;
}
.guide-layout > .guide-content {
  grid-column: 2;
  grid-row: 2;
}
.toc { position: sticky; top: 88px; padding: 14px; font-size: 0.88rem; }
.toc h2 {
  margin: 4px 6px 8px;
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-weight: 700; }
.toc a:hover { background: var(--primary-soft); color: var(--primary-dark); text-decoration: none; }

.guide-content { display: flex; flex-direction: column; gap: 46px; min-width: 0; }
.guide-content > section + section {
  position: relative;
  border-top: 1px solid var(--line);
  padding-top: 46px;
}
.guide-content > section + section::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  width: 64px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--primary);
  opacity: 0.7;
}
.guide-content section { scroll-margin-top: 84px; }
.guide-content h2 { margin-bottom: 6px; }
.guide-search { margin: 18px 0 0; max-width: 460px; }

.disclaimer {
  max-width: 78ch;
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
  color: #7a4a34;
  font-size: 0.83rem;
}

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.checklist .n {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 0.82rem;
}
.checklist strong { display: block; }
.checklist p { margin: 2px 0 0; font-size: 0.9rem; color: var(--muted); }

.acc {
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.acc + .acc { margin-top: 10px; }
.acc summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: '+'; color: var(--primary); font-size: 1.35rem; font-weight: 400; line-height: 1; }
.acc[open] summary::after { content: '–'; }
.acc-body { padding: 0 0 18px; font-size: 0.94rem; color: var(--ink-soft); }
.acc-body p:last-child,
.acc-body ul:last-child { margin-bottom: 0; }
.acc-body ul { margin: 0 0 1em; padding-left: 20px; }
.acc-body li + li { margin-top: 4px; }
.source { margin: 10px 0 0; font-size: 0.79rem; color: var(--muted); }
.source a { font-weight: 700; }

.numbers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 12px;
}
.numbers-grid + .numbers-grid { margin-top: 12px; }
.num-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
a.num-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); text-decoration: none; }
.num-card .num { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.num-card .label { font-weight: 700; }
.num-card .desc { font-size: 0.83rem; color: var(--muted); }

.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}
.steps strong { display: block; }
.steps p { margin: 2px 0 0; font-size: 0.9rem; color: var(--muted); }

.glossary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin: 0;
}
.term { padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.term dt { color: var(--primary-dark); font-size: 0.92rem; font-weight: 800; }
.term dd { margin: 2px 0 0; font-size: 0.86rem; color: var(--muted); }

.selfcare { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tip-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tip-card h3 { font-size: 1rem; margin-bottom: 4px; }
.tip-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }

.highlight-box {
  margin: 16px 0;
  padding: 20px 22px;
  border: 1px solid #cfe4dc;
  border-radius: var(--radius);
  background: var(--primary-soft);
}
.highlight-box p:last-child { margin-bottom: 0; }

/* ---- Messaggi -------------------------------------------------------------- */
.page-chat { padding: 26px 0 48px; }
.chat-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: clamp(480px, calc(100vh - 220px), 760px);
  overflow: hidden;
  padding: 0;
}
.conv-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.conv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.conv-head h1 { margin: 0; font-size: 1.15rem; }
.conv-list { flex: 1; overflow-y: auto; }

.conv {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--primary-soft); }
.conv-main { flex: 1; min-width: 0; }
.conv-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}
.conv-preview {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.81rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.conv-time { color: var(--muted); font-size: 0.71rem; font-weight: 500; white-space: nowrap; }
.conv-unread {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
}

.chat-panel { display: flex; flex-direction: column; min-width: 0; background: #fdfcf9; }
.chat-empty { max-width: 380px; margin: auto; padding: 40px; color: var(--muted); text-align: center; }
.chat-empty h2 { font-size: 1.25rem; }
.chat-box { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.chat-head .who { font-weight: 700; }
.chat-head .sub { font-size: 0.78rem; color: var(--muted); }
.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 20px 18px;
}
.chat-day { margin: 10px 0; color: var(--muted); font-size: 0.73rem; text-align: center; }
.msg {
  max-width: 72%;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 0.93rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.msg .msg-time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.67rem;
  text-align: right;
}
.msg-me { align-self: flex-end; border-color: transparent; background: var(--primary); color: #fff; }
.msg-me .msg-time { color: rgba(255, 255, 255, 0.75); }
.chat-form {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-form input { flex: 1; }
#chat-back { display: none; }

/* ---- Profilo --------------------------------------------------------------- */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.profile-card { padding: 26px 22px; text-align: center; }
.profile-card h1 { margin: 14px 0 4px; font-size: 1.45rem; }
.profile-role { margin: 0 0 8px; }
.profile-bio { margin: 12px 0 0; color: var(--muted); font-size: 0.9rem; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.profile-stats .num { display: block; color: var(--primary); font-size: 1.2rem; font-weight: 800; }
.profile-stats .lbl { color: var(--muted); font-size: 0.73rem; }

/* ---- Accesso / registrazione ---------------------------------------------- */
.auth-wrap { display: grid; place-items: center; padding: 30px 0 10px; }
.auth-card { width: min(480px, 100%); padding: clamp(22px, 4vw, 34px); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-alt { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 0.9rem; }
.auth-alt a { font-weight: 700; }

.demo-box {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.83rem;
}
.demo-box p { margin: 0 0 8px; }
.demo-box .row { gap: 6px; }
.demo-box button {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary-dark);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
}
.demo-box button:hover { border-color: var(--primary); }

.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  flex: 1;
  min-width: 190px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 600;
}
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { width: auto; margin: 3px 0 0; accent-color: var(--primary); }
.radio-card small { display: block; color: var(--muted); font-weight: 400; }

/* ---- Modale ---------------------------------------------------------------- */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(24, 34, 33, 0.5);
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h2 { margin: 0; font-size: 1.3rem; }

/* ---- Toast ----------------------------------------------------------------- */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}
.toast {
  padding: 12px 16px;
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  animation: toast-in 0.18s ease;
}
.toast-error { border-left-color: #e28074; }
.toast-success { border-left-color: #7fc9a8; }
.toast-out { opacity: 0; transform: translateY(6px); transition: 0.3s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* ---- Stati vuoti e 404 ----------------------------------------------------- */
.empty-state {
  padding: 42px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
}
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { max-width: 46ch; margin: 0 auto 14px; color: var(--muted); font-size: 0.92rem; }
.not-found { max-width: 540px; margin: 8vh auto; text-align: center; }
.not-found .code { color: var(--primary); font-size: 3.4rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.reply-area { margin-top: 18px; }
.form-card { padding: 20px; }
.form-card h2 { font-size: 1.2rem; }
.replies-card { padding: 6px 22px 14px; }
.back-row { margin-bottom: 14px; }
.page-head .btn { margin-top: 4px; }
.modal-list { max-height: 280px; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; overflow-y: auto; }
.not-found .row { justify-content: center; }


/* ---- Guida: tipi di caregiver --------------------------------------------- */
.care-types { display: flex; flex-direction: column; gap: 14px; }
.care-tabs { margin-bottom: 0; }
.care-panel { padding: 20px 22px; }
.care-panel h3 { margin-bottom: 4px; }
.mini-steps { margin: 10px 0 12px; padding-left: 20px; color: var(--ink-soft); font-size: 0.93rem; }
.mini-steps li + li { margin-top: 6px; }
.care-links { margin: 0; font-size: 0.87rem; color: var(--muted); }

/* ---- Guida: strutture ------------------------------------------------------ */
.facility-card { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }
.facility-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.facility-name { margin: 0 0 4px; font-size: 1.08rem; }
.facility-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); }
.badge-facility { background: #eef4f2; border: 1px solid #cfe0d9; color: var(--primary-dark); }
.facility-desc { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }
.facility-for { padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); font-size: 0.86rem; color: var(--muted); }
.facility-for strong { color: var(--ink); }
.facility-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---- Admin ----------------------------------------------------------------- */
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-head h1 { margin-bottom: 6px; }
.report-card { padding: 18px 20px; }
.report-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.report-title { font-weight: 700; }
.report-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
.report-message { margin: 10px 0; white-space: pre-line; font-size: 0.94rem; color: var(--ink-soft); }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge-open { background: var(--accent-soft); border: 1px solid #ecc7b4; color: #8a4a2c; }
.badge-done { background: var(--primary-soft); border: 1px solid #c4ded5; color: var(--primary-dark); }
.admin-facility { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
.admin-facility strong { display: block; }

/* ---- Responsive ------------------------------------------------------------ */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card { max-width: 460px; }
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; min-height: 72vh; }
  .conv-panel { border-right: 0; }
  .chat-panel { display: none; }
  .chat-layout[data-view="chat"] .conv-panel { display: none; }
  .chat-layout[data-view="chat"] .chat-panel { display: flex; }
  #chat-back { display: inline-grid; }
  .msg { max-width: 85%; }
}

@media (max-width: 760px) {
  .guide-layout { grid-template-columns: 1fr; gap: 20px; }
  .guide-layout > .guide-head,
  .guide-layout > .toc,
  .guide-layout > .guide-content {
    grid-column: auto;
    grid-row: auto;
  }
  .toc { position: static; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .toc h2 { display: none; }
  .toc a { padding: 6px 10px; }
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .header-auth { margin-left: 0; }
  .user-chip-name { display: none; }
  .brand { margin-right: auto; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }
  .site-header.nav-open .main-nav { display: flex; }
  .main-nav a { padding: 11px 12px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .wrap { width: min(100% - 28px, var(--wrap)); }
  .header-inner { gap: 10px; }
  .grid-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: none; }
  .post-card { padding: 16px 18px; }
  .post-card-meta .replies { margin-left: 0; }
  .cta-band { flex-direction: column; align-items: flex-start; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .modal { padding: 18px; }
  .page-head { margin-bottom: 20px; }
  .auth-card { padding: 20px; }
}

@media (max-width: 420px) {
  .header-auth .btn-ghost { display: none; }
  .hero-actions .btn { width: 100%; }
}







