:root {
  --text: #393D32;
  --primary: #672714;
  --primary-dark: #3C1D0D;
  --accent: #86BA9D;
  --bg: #F3EFE7;
  --bg-light: #E7DFCE;
  --card: #FCFAF5;
  --muted: #8A8472;
  --shadow: 0 4px 18px rgba(60, 29, 13, 0.10);
  --shadow-sm: 0 2px 8px rgba(60, 29, 13, 0.08);
  --navh: 60px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh; min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.app {
  width: 100%; max-width: 540px; margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
}

/* Header Sara — foto + bolla chat + navigazione */
.hello { padding: calc(20px + env(safe-area-inset-top)) 0 0; }
.hello-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.hello-identity { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.hello-avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  border: 2px solid var(--bg-light);
}
.hello-from {
  display: block; font-size: 13px; font-weight: 700; color: var(--text);
}
.hello-role {
  display: block; font-size: 11px; font-weight: 500; color: var(--muted);
}
.hello-link {
  margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted);
  text-decoration: none; white-space: nowrap;
}
.hello-bubble {
  display: inline-block; align-self: flex-start; max-width: 100%;
  background: var(--card); border-radius: 4px 16px 16px 16px;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(60,29,13,.06);
  padding: 10px 14px 11px;
}
.hello-text { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.topnav { display: flex; gap: 8px; padding-bottom: 4px; }
.topnav a {
  flex: 1; text-decoration: none; text-align: center;
  background: var(--bg-light); color: var(--primary);
  border-radius: 9999px; padding: 9px 8px;
  font-size: 13px; font-weight: 600; transition: background .15s;
}
.topnav a.attivo { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }

/* Sezioni pasto impilate */
.pasto { margin-top: 22px; scroll-margin-top: 14px; }
.pasto-head { display: flex; align-items: center; gap: 9px; padding: 0 4px 9px; }
.pasto-head .icona { font-size: 19px; }
.pasto-head .nome { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.pasto:not(.corrente) .pasto-head { opacity: .55; }
.ora-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--primary); padding: 3px 9px; border-radius: 9999px;
}
.pasto.corrente .lista {
  border-color: var(--accent); border-width: 1.5px;
  box-shadow: 0 6px 22px rgba(134,186,157,.28);
}

/* Lista alimenti raggruppata, compatta */
.lista {
  background: var(--card); border-radius: 18px;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(60,29,13,.06); overflow: hidden;
}
.card {
  padding: 12px 16px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  border-top: 1px solid rgba(60,29,13,.07); transition: background .12s;
}
.card:first-child { border-top: none; }
.card:active { background: var(--bg-light); }
.card .nome { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; line-height: 1.3; }
.card .nome .star { color: var(--primary); margin-left: 6px; font-size: 12px; vertical-align: 1px; }
.card .qta { flex: 0 0 auto; font-size: 14px; font-weight: 500; color: var(--muted); text-align: right; white-space: nowrap; }
.card.singola { cursor: default; }
.card.singola:active { background: transparent; }

.nota { margin-top: 22px; font-size: 12.5px; line-height: 1.5; color: var(--muted); text-align: center; padding: 0 8px; }

/* Bottom sheet alternative (pagina piano) */
.overlay {
  position: fixed; inset: 0; background: rgba(33, 27, 15, .42);
  opacity: 0; pointer-events: none; transition: opacity .22s;
  z-index: 50; backdrop-filter: blur(2px);
}
.overlay.aperto { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; top: 50%; z-index: 51;
  transform: translate(-50%, -50%) scale(.96);
  width: calc(100% - 36px); max-width: 440px; max-height: 80dvh;
  background: var(--bg); border-radius: 24px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(33,27,15,.30);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .22s cubic-bezier(.32,.72,0,1);
}
.sheet.aperto { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.sheet h2 { margin: 20px 20px 2px; font-size: 20px; font-weight: 700; }
.sheet .sub { margin: 0 20px 14px; font-size: 13px; color: var(--muted); font-weight: 500; }
.opzioni { overflow-y: auto; padding: 0 16px 18px; -webkit-overflow-scrolling: touch; }
.opz-group { background: var(--card); border-radius: 16px; overflow: hidden; border: 1px solid rgba(60,29,13,.06); }
.opz {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: transparent; border: none; border-top: 1px solid rgba(60,29,13,.07);
  padding: 11px 14px; font-family: inherit; text-align: left; cursor: pointer; transition: background .12s;
}
.opz:first-child { border-top: none; }
.opz:active { background: var(--bg-light); }
.opz .n { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.opz .q { flex: 0 0 auto; font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; text-align: right; }
.opz.preferita { background: #fff; }
.opz.preferita .n { font-weight: 700; }
.opz.originale .tag {
  font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted); background: var(--bg-light); padding: 2px 7px; border-radius: 6px;
  margin-left: 8px; vertical-align: middle;
}
.check {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--bg-light); display: flex; align-items: center; justify-content: center;
}
.opz.preferita .check { background: var(--primary); border-color: var(--primary); }
.opz.preferita .check svg { display: block; }
.opz .check svg { display: none; }

/* Pagina consigli */
.info-sez { margin-top: 24px; }
.info-sez h3 { font-size: 17px; font-weight: 700; margin: 0 0 10px; padding-left: 4px; }
.info-card { background: var(--card); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-sm); border: 1px solid rgba(60,29,13,.06); }
.info-card p { font-size: 14px; line-height: 1.55; margin: 0 0 12px; }
.info-card ul { margin: 6px 0 12px; padding-left: 20px; }
.info-card li { font-size: 14px; line-height: 1.5; margin-bottom: 5px; }
.info-card b { font-weight: 700; }
.info-footer { margin-top: 28px; text-align: center; font-size: 12.5px; line-height: 1.6; color: var(--muted); padding: 0 8px; }

/* Pagina ricettario: shell a colonna a tutta altezza con scroller orizzontale */
body.ric { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.ric-top { max-width: 540px; margin: 0 auto; width: 100%; padding: 0 16px; flex: 0 0 auto; }
.cat-tabs { display: flex; gap: 8px; padding: 12px 0 10px; }
.cat-tab {
  flex: 1; border: none; cursor: pointer; background: var(--bg-light); color: var(--primary);
  padding: 9px 8px; border-radius: 9999px; font-family: inherit; font-size: 13px; font-weight: 600;
  transition: transform .12s, background .15s;
}
.cat-tab:active { transform: scale(0.96); }
.cat-tab.attivo { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.ric-conta { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 6px; }

.ric-scroller {
  flex: 1 1 auto; min-height: 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ric-scroller::-webkit-scrollbar { display: none; }
.ric-card {
  flex: 0 0 100vw; scroll-snap-align: center;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 16px 24px;
}
.ric-inner { max-width: 520px; margin: 0 auto; }
.ric-box {
  background: var(--card); border-radius: 20px; padding: 18px 20px;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(60,29,13,.06);
}
.ric-nome { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 10px; line-height: 1.2; }
.ric-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.ric-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 9999px; background: var(--bg-light); color: var(--primary);
}
.ric-tag.stagione { background: var(--accent); color: var(--text); }
.ric-box h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 16px 0 8px;
}
.ric-box h4:first-of-type { margin-top: 0; }
.ric-box ul, .ric-box ol { margin: 0; padding-left: 20px; }
.ric-box li { font-size: 14px; line-height: 1.5; margin-bottom: 6px; }
.ric-box ol li { padding-left: 4px; }
.ric-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

/* ---- Pulsante "Prenota appuntamento" (fisso, in fondo al centro) ---- */
.cta-prenota {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  z-index: 80;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 9999px;
  padding: 12px 22px; font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 10px 28px rgba(60,29,13,.34);
  transition: transform .12s, box-shadow .15s;
}
.cta-prenota:active { transform: translateX(-50%) scale(.96); }
.cta-prenota .em { font-size: 16px; }
/* Spazio extra in coda al contenuto perché il pulsante fisso non copra nulla */
.app { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
body.ric .ric-card { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }

/* ---- Modale contatti ---- */
.contatti-overlay {
  position: fixed; inset: 0; background: rgba(33,27,15,.42);
  opacity: 0; pointer-events: none; transition: opacity .22s;
  z-index: 200; backdrop-filter: blur(2px);
}
.contatti-overlay.aperto { opacity: 1; pointer-events: auto; }
.contatti-modal {
  position: fixed; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(92vw, 420px); max-height: 84dvh;
  background: var(--bg); border-radius: 22px;
  display: flex; flex-direction: column; overflow: hidden;
  z-index: 201; box-shadow: 0 24px 60px rgba(33,27,15,.30);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .22s cubic-bezier(.32,.72,0,1);
}
.contatti-modal.aperto { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.contatti-header {
  display: flex; align-items: flex-start; padding: 18px 20px 6px; flex-shrink: 0;
}
.contatti-header .tit { flex: 1; }
.contatti-header h2 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.2; }
.contatti-header .sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.contatti-close {
  background: none; border: none; cursor: pointer; font-size: 20px;
  color: var(--muted); padding: 2px 4px; line-height: 1; margin: -4px -4px 0 8px;
}
.contatti-body { overflow-y: auto; padding: 12px 16px 18px; -webkit-overflow-scrolling: touch; }
.contatti-group {
  background: var(--card); border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(60,29,13,.06);
}
.contatto-riga {
  display: flex; align-items: center; gap: 12px; width: 100%;
  text-decoration: none; color: var(--text);
  background: transparent; border: none; border-top: 1px solid rgba(60,29,13,.07);
  padding: 12px 14px; font-family: inherit; text-align: left; cursor: pointer;
  transition: background .12s;
}
.contatto-riga:first-child { border-top: none; }
.contatto-riga:active { background: var(--bg-light); }
.contatto-riga .ic {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  background: var(--bg-light); display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
/* Contatto standard: etichetta a sinistra, valore a destra */
.contatto-riga > .lab { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; line-height: 1.25; }
.contatto-riga > .val {
  flex: 0 0 auto; text-align: right; white-space: nowrap;
  font-size: 13px; color: var(--muted); font-weight: 500;
}
/* Sede: etichetta sopra, indirizzo a capo sotto */
.contatto-riga .txt { flex: 1; min-width: 0; }
.contatto-riga .txt .lab { display: block; font-size: 15px; font-weight: 600; line-height: 1.25; }
.contatto-riga .txt .val { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; line-height: 1.35; margin-top: 2px; }
.contatti-titolo-sez {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 16px 0 7px; padding-left: 4px;
}

