/* ============================================================
   Pina — stile mobile-first.
   Palette verde "salute", card morbide, tema chiaro.
   ============================================================ */

:root {
  --green: #16a34a;
  --green-dark: #15803d;
  --green-soft: #dcfce7;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --p: #ef4444;  /* proteine */
  --c: #f59e0b;  /* carboidrati */
  --f: #3b82f6;  /* grassi */
  --radius: 18px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

/* Garantisce che l'attributo hidden nasconda sempre (anche con display custom). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px calc(28px + var(--safe-bottom));
}

/* ---------- Card generica ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

/* ---------- Barra superiore / navigazione giorno ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px 12px;
}
.page-title { font-size: 1.25rem; margin: 0; }
.day-label {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  background: none;
  border: none;
  color: var(--text);
  padding: 8px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 1.4rem;
  color: var(--green-dark);
  cursor: pointer;
}

/* ---------- Barra superiore (logo) + menu a scomparsa ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
}
.appbar--hidden { transform: translateY(-100%); }
.menu-btn {
  border: none;
  background: none;
  font-size: 1.5rem;
  color: var(--green-dark);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 10px;
}
.appbar-brand { flex: 1; display: flex; justify-content: center; align-items: center; }
.appbar-logo { height: 60px; width: auto; }
.appbar-end { width: 40px; }
.menu-backdrop { position: fixed; inset: 0; background: transparent; z-index: 25; }
.menu {
  position: fixed;
  top: 70px;
  left: 10px;
  width: 220px;
  max-width: 80vw;
  background: var(--card);
  border: 2px solid var(--green);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(22, 163, 74, 0.18);
  z-index: 30;
  padding: 40px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.95rem;
  cursor: pointer;
}
.menu a {
  display: block;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--green-soft);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
}
.menu a.active { background: var(--green-soft); color: var(--green-dark); border-color: var(--green); }
.menu-install {
  display: block; width: 100%; text-align: left;
  padding: 13px 14px; border-radius: 12px; cursor: pointer; font-family: inherit;
  border: 1px solid var(--green); background: var(--green-soft);
  color: var(--green-dark); font-weight: 700; font-size: 1.05rem;
}
.auth-install { margin-top: 6px; }

/* Icona Pina nei pulsanti (al posto del robottino) */
.btn-ic { height: 22px; width: auto; vertical-align: -6px; margin-right: 2px; }

/* ---------- Riepilogo: anello calorie con faccia di Pina ---------- */
.summary { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ring-wrap { position: relative; width: 180px; height: 180px; }
.ring-face {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 124px;
  width: auto;
  max-width: 116px;
  object-fit: contain;
  pointer-events: none;
}
.ring-stats { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rs-kcal { font-size: 1rem; color: var(--muted); }
.rs-kcal b { font-size: 1.9rem; color: var(--text); font-weight: 800; }
.daynav { display: flex; align-items: center; justify-content: center; gap: 8px; }
.daynav .icon-btn {
  width: 32px; height: 32px; font-size: 1.1rem;
  box-shadow: none; background: var(--bg);
}
.daynav .day-label { flex: 0 1 auto; font-size: 0.95rem; padding: 4px 12px; }

/* etichette del grafico */
.goal-lab { fill: var(--muted); font-size: 9px; }
.burn-mark { font-size: 9px; }

/* grafico a linea (andamento calorie) */
.k-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.k-area { fill: var(--green-soft); opacity: 0.45; }
.k-dot.ok { fill: var(--green); stroke: #fff; stroke-width: 1.5; }
.k-dot.over { fill: var(--p); stroke: #fff; stroke-width: 1.5; }

/* Calendario calorie (faccina di Pina per giorno) */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-head { text-align: center; font-size: 0.68rem; color: var(--muted); }
.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1.42;
  background: var(--bg);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0 3px;
  overflow: hidden;
}
.cal-cell.empty { background: transparent; }
.cal-cell.off { opacity: 0.4; }
.cal-d { font-size: 0.58rem; color: var(--muted); align-self: flex-start; margin-left: 4px; line-height: 1.1; }
.cal-face { width: 34px; height: 34px; object-fit: contain; margin: -1px 0; }
.cal-k { font-size: 0.62rem; font-weight: 700; color: var(--text); line-height: 1; margin-top: auto; }
.cal-act { position: absolute; top: 1px; right: 2px; font-size: 0.62rem; }
/* tinte per stato (si capisce il risultato a colpo d'occhio) */
.cal-cell.cal-felice { background: #dcfce7; }
.cal-cell.cal-normale { background: #fef9c3; }
.cal-cell.cal-arrabbiata { background: #fee2e2; }

/* badge "media X kcal" */
.chart-avg {
  font-size: 0.75rem;
  color: var(--green-dark);
  background: var(--green-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.chart-avg b { font-size: 0.95rem; }

/* Card "Il tuo percorso" (Obiettivi) */
.prog-weights {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 8px 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}
.prog-weights b { color: var(--green-dark); font-size: 1.5rem; }
.prog-bar { height: 12px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--green); border-radius: 99px; width: 0; transition: width 0.5s ease; }
.prog-meta { margin-top: 10px; font-size: 0.95rem; }
.prog-adherence { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.prog-goal { font-size: 0.92rem; color: var(--green-dark); margin: 2px 0 10px; }

/* chip rapidi per l'obiettivo nel wizard */
.goal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 2px; }
.goal-chips button {
  width: auto;
  border: 1px solid var(--green-soft);
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}
.goal-chips button:active { transform: scale(0.96); }
.prog-weigh { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.prog-weigh input { flex: 1; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--green-soft); stroke-width: 12; }
.ring-fg {
  fill: none;
  stroke: var(--green);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-value { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.ring-sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.ring-left { color: var(--green-dark); font-weight: 600; font-size: 0.85rem; margin-top: 6px; }
.ring-left.over { color: var(--p); }

/* ---------- Barre macro ---------- */
.macros { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.macro-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 5px;
}
.bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 99px; transition: width 0.4s ease; }
.bar-fill.p { background: var(--p); }
.bar-fill.c { background: var(--c); }
.bar-fill.f { background: var(--f); }

/* ---------- Sezioni pasto ---------- */
.meal-head { display: flex; align-items: center; justify-content: space-between; }
.meal-head h2 { font-size: 1.05rem; margin: 0; }
.add-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.meal-list { list-style: none; margin: 10px 0 0; padding: 0; }
.meal-list:empty::after {
  content: "Niente ancora — tocca ＋";
  color: var(--muted);
  font-size: 0.85rem;
  display: block;
  padding: 4px 2px;
}
.meal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.meal-item:first-child { border-top: none; }
.mi-main { flex: 1; min-width: 0; }
.mi-name { font-weight: 600; font-size: 0.95rem; }
.mi-sub { color: var(--muted); font-size: 0.78rem; }
.mi-kcal { font-weight: 600; white-space: nowrap; }
.mi-del {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 4px 6px;
  cursor: pointer;
}

/* ---------- Tab bar inferiore ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 20;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0 12px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.72rem;
}
.tab-ic { font-size: 1.25rem; }
.tab.active { color: var(--green-dark); font-weight: 600; }

/* ---------- Bottoni ---------- */
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-dark); }
.btn.ghost { background: var(--bg); color: var(--text); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 0.85rem; }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 30;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(20px + var(--safe-bottom));
  max-width: 520px;
  margin: 0 auto;
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 42px; height: 5px;
  background: var(--border);
  border-radius: 99px;
  margin: 6px auto 10px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h3 { margin: 0; font-size: 1.1rem; }

.field-label { display: block; font-size: 0.85rem; color: var(--muted); margin: 8px 0 6px; }
textarea, select,
input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea:focus, select:focus,
input:not([type="radio"]):not([type="checkbox"]):focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
textarea::placeholder, input::placeholder { color: #9ca3af; }
.field > span { font-weight: 600; color: var(--text); font-size: 0.82rem; }
textarea { resize: vertical; }

.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }

/* ---------- Revisione righe (stima da modificare) ---------- */
.review-head, .review-row {
  display: grid;
  grid-template-columns: 1fr 56px 40px 40px 40px;
  gap: 6px;
  align-items: center;
}
.review-head {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 8px 2px 4px;
  text-transform: uppercase;
}
.review-row { margin-bottom: 8px; }
.review-row input { padding: 9px 6px; font-size: 0.85rem; text-align: center; }
.review-row input.r-name { text-align: left; }
.review-row .r-del {
  grid-column: 1 / -1;
  justify-self: end;
  background: none; border: none;
  color: var(--p); font-size: 0.78rem;
  cursor: pointer; padding: 0 2px 4px;
}
.review-total { text-align: right; font-weight: 700; margin: 6px 2px; }

/* ---------- Form obiettivi ---------- */
.goals-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }

/* ---------- Hint / messaggi ---------- */
.hint { font-size: 0.85rem; color: var(--muted); margin: 10px 0 0; }
.hint.ok { color: var(--green-dark); }
.hint.err { color: var(--p); }

/* ---------- Stato vuoto ---------- */
.empty-state { text-align: center; color: var(--muted); }
.empty-state p:first-child { font-size: 2.4rem; margin: 6px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.88rem;
  z-index: 50;
  box-shadow: var(--shadow);
}

/* ---------- Pagina login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card { max-width: 340px; width: 100%; text-align: center; }
.login-logo { font-size: 3rem; }
.login-card h1 { margin: 4px 0 2px; }
.login-card input { margin: 14px 0; }

.spin { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Autenticazione (login / registrazione) ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { max-width: 380px; width: 100%; text-align: center; }
.auth-logo { height: 96px; width: auto; margin-bottom: 2px; }
.auth-card h1 { font-size: 1.3rem; margin: 4px 0 14px; }
.auth-card .field { text-align: left; margin-bottom: 10px; }
.auth-switch { margin-top: 14px; font-size: 0.9rem; color: var(--muted); }
.auth-switch a { color: var(--green-dark); font-weight: 600; }
.avatar-pick { display: flex; gap: 12px; justify-content: center; margin: 6px 0 16px; }
.avatar-opt { cursor: pointer; }
.avatar-opt input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-opt img {
  width: 66px; height: 66px;
  object-fit: contain;
  border: 3px solid transparent;
  border-radius: 16px;
  background: var(--bg);
  padding: 2px;
}
.avatar-opt input:checked + img { border-color: var(--green); background: var(--green-soft); }

/* avatar nella barra + voci menu utente/logout */
.appbar-avatar { width: 40px; height: 40px; object-fit: contain; border-radius: 50%; background: var(--green-soft); }
.menu-user { font-weight: 700; padding: 2px 6px 10px; }
.menu-logout { color: var(--p) !important; border-color: #fecaca !important; }

/* selettore lingua (pagine di accesso) */
.lang-switch { margin-top: 16px; font-size: 0.85rem; }
.lang-switch a { color: var(--green-dark); font-weight: 600; margin: 0 4px; }

/* privacy + zona pericolosa */
.privacy-body { text-align: left; font-size: 0.92rem; line-height: 1.5; margin: 10px 0; }
.privacy-body p { margin: 8px 0; }
.profile-privacy { text-align: center; font-size: 0.85rem; margin: 4px 0 20px; }
.profile-privacy a { color: var(--muted); }
/* Elimina account: tenue e discreto, niente "zona pericolosa" */
.account-delete { text-align: center; box-shadow: none; border: none; background: transparent; padding: 4px 0; }
.btn-delete-soft {
  display: inline-block; background: transparent; color: #d97a7a;
  border: 1px solid #f0d2d2; border-radius: 10px; padding: 9px 18px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all .15s;
}
.btn-delete-soft:hover { background: #fdf2f2; border-color: #e9b9b9; color: #c9595a; }
.account-delete .del-warn { color: #c98a8a; margin-bottom: 10px; }
.del-actions { display: flex; gap: 10px; margin-top: 4px; }
.del-actions .btn { flex: 1; }
.btn.ghost { background: #f1f3f2; color: var(--muted); }
.btn.danger-soft { background: #e88b8b; color: #fff; }
.btn.danger-soft:hover { background: #de7373; }

/* scritte CSS tradotte per l'inglese */
html[lang="en"] .meal-list:empty::after { content: "Nothing yet — tap ＋"; }

/* ---------- Quick-add "Recenti" (libreria alimenti) ---------- */
.recent-wrap { margin-top: 14px; }
.recent-wrap .muted { color: var(--muted); font-weight: 400; font-size: 0.8rem; }
.recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.recent-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.recent-chip:active { transform: scale(0.96); }
.recent-chip .rc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.recent-chip .rc-kcal {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green-dark);
  white-space: nowrap;
}
.recent-chip .rc-kcal::after { content: ' kcal'; font-weight: 400; color: var(--muted); }

/* ---------- Storico ---------- */
.seg {
  display: inline-flex;
  background: var(--green-soft);
  border-radius: 999px;
  padding: 3px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.seg-btn.active { background: var(--green); color: #fff; }

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chart-head h2 { font-size: 1.05rem; margin: 0; }
.chart-avg { font-size: 0.85rem; color: var(--muted); }
.mb { font-size: 1.05rem; margin: 0 0 12px; }

.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 24px 8px;
}
.bar.ok { fill: var(--green); }
.bar.over { fill: var(--p); }
.goal-line { stroke: var(--green); stroke-width: 1.6; stroke-dasharray: 5 4; opacity: 0.85; fill: none; }
.x-lab { fill: var(--muted); font-size: 9px; }

.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}
.chart-legend .dot,
.chart-legend .dash {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 3px;
}
.chart-legend .dot.ok { background: var(--green); }
.chart-legend .dot.over { background: var(--p); }
.chart-legend .dash {
  width: 14px; height: 0;
  border-top: 2px dashed var(--green);
  border-radius: 0;
}

/* Medie macro */
.macro-avg { display: flex; gap: 10px; }
.ma-item {
  flex: 1;
  text-align: center;
  background: var(--bg);
  border-radius: 14px;
  padding: 12px 6px;
}
.ma-k { display: block; font-size: 1.4rem; font-weight: 700; }
.ma-k.p { color: var(--p); }
.ma-k.c { color: var(--c); }
.ma-k.f { color: var(--f); }
.ma-k::after { content: ' g'; font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.ma-l { font-size: 0.78rem; color: var(--muted); }

/* Peso */
.w-line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.w-area { fill: var(--green-soft); opacity: 0.6; }
.w-dot { fill: var(--green-dark); }
.weight-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.weight-form input { flex: 1; }
.wf-unit { color: var(--muted); font-size: 0.9rem; }

/* ---------- Programma / wizard / profili ---------- */
.program-cta .muted { display: block; margin: 6px 0 14px; font-size: 0.9rem; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.form-grid .field span { font-size: 0.8rem; }

.manual-goals summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0;
}
.manual-goals .goals-form { margin-top: 12px; }

/* Risultato del calcolo */
.result-kcal {
  text-align: center;
  margin: 4px 0 12px;
}
.result-kcal .rk-num {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--green-dark);
}
.result-kcal .rk-unit { display: block; color: var(--muted); font-size: 0.85rem; }
.result-macros {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.result-macros > div {
  flex: 1;
  text-align: center;
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 4px;
}
.rm-k { display: block; font-size: 1.2rem; font-weight: 700; }
.rm-k.p { color: var(--p); } .rm-k.c { color: var(--c); } .rm-k.f { color: var(--f); }
.rm-k::after { content: ' g'; font-size: 0.7rem; font-weight: 400; color: var(--muted); }
.rm-l { font-size: 0.72rem; color: var(--muted); }
.result-estimates {
  background: var(--green-soft);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.result-estimates .warn { color: #b45309; }
.result-note {
  margin-top: 10px;
  padding: 12px;
  border-left: 3px solid var(--green);
  background: var(--bg);
  border-radius: 0 10px 10px 0;
  font-size: 0.92rem;
  line-height: 1.45;
}
.result-note .note-ic { margin-right: 4px; }

/* Lista profili */
.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.profile-row:last-child { border-bottom: 0; }
.profile-row.active { }
.pr-main { flex: 1; min-width: 0; }
.pr-name { font-weight: 600; }
.pr-sub { font-size: 0.78rem; color: var(--muted); }
.pr-badge {
  font-size: 0.72rem;
  background: var(--green);
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
}
.pr-del {
  border: 0; background: transparent; cursor: pointer;
  font-size: 1rem; opacity: 0.6; padding: 4px;
}

/* ---------- Attività fisica ---------- */
.ring-burn {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ea580c;
}
.activity-card .act-empty { margin: 8px 2px 0; }
.mi-kcal.burn { color: #ea580c; }

.act-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.preset-chip {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.85rem;
  cursor: pointer;
}
.preset-chip:active { transform: scale(0.96); }
.act-result {
  background: #fff7ed;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  font-size: 1.05rem;
  color: #9a3412;
  margin: 6px 0 4px;
}
.act-result .muted { font-size: 0.8rem; }

/* ---------- Pasto raggruppato (riassunto apribile) + modifica ---------- */
.mi-edit {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  padding: 4px 4px;
  cursor: pointer;
}
.meal-group { border-top: 1px solid var(--border); }
.meal-group:first-child { border-top: none; }
.mg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: none;
  padding: 10px 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.mg-caret { color: var(--muted); font-size: 0.8rem; width: 12px; }
.mg-main { flex: 1; min-width: 0; }
.mg-name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mg-sub { color: var(--muted); font-size: 0.78rem; }
.mg-items {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 22px;
}
.mg-items .meal-item { padding: 6px 0; }

.edit-macros {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  margin: 12px 0 4px;
}
.edit-macros label {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  color: var(--muted);
  gap: 4px;
}

/* ---------- Card "Oggi" (motivazione / task) ---------- */
.today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.today-greet { font-weight: 700; font-size: 1.05rem; }
.today-streak {
  background: #fff7ed;
  color: #c2410c;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
}
.today-tip {
  margin: 10px 0 4px;
  padding: 10px 12px;
  background: var(--green-soft);
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--green-dark);
}
.task-list { list-style: none; margin: 12px 0 0; padding: 0; }
.task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.92rem;
}
.task + .task { border-top: 1px solid var(--border); }
.task-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.task.done .task-box { background: var(--green); border-color: var(--green); }
.task-label { flex: 1; }
.task.done .task-label { color: var(--muted); text-decoration: line-through; }
.task-auto {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 6px;
}
