/* Mon Suivi Nutrition — design tokens et styles */
:root {
  --bg: #f1f4ee;
  --card: #ffffff;
  --text: #17251f;
  --text-2: #6f7d75;
  --border: #e6ebe5;
  --c-accent: #2fa36b;
  --c-accent-dark: #1d7a52;
  --c-accent-deep: #145c3d;
  --c-accent-soft: #e0f3e9;
  --c-over: #d95763;
  --c-fast: #e8a13c;
  --c-water: #3e8ed0;
  --c-gluc: #e8a13c;
  --c-prot: #c75b5b;
  --c-lip: #5b8dc7;
  --ring-track: #edf1ee;
  --radius: 26px;
  --radius-s: 14px;
  --shadow:
    0 1px 2px rgba(23, 37, 31, 0.04),
    0 10px 30px rgba(23, 37, 31, 0.07);
  --shadow-lift:
    0 2px 4px rgba(23, 37, 31, 0.05),
    0 16px 40px rgba(23, 37, 31, 0.11);
  --grad-hero: linear-gradient(140deg, #37b578 0%, #1d7a52 62%, #16613f 100%);
  --grad-btn: linear-gradient(135deg, #35ad72, #1f8158);
  --nav-h: 84px;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

/* Halos d'ambiance en fond */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(520px 340px at 12% -4%, rgba(55, 181, 120, 0.16), transparent 65%),
    radial-gradient(460px 320px at 96% 12%, rgba(232, 161, 60, 0.12), transparent 65%),
    radial-gradient(520px 380px at 55% 108%, rgba(62, 142, 208, 0.10), transparent 65%);
  pointer-events: none;
}

.hidden { display: none !important; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }

#main { padding: 18px 16px calc(var(--nav-h) + 26px); }

/* ---- En-tête de page ---- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 18px;
  gap: 8px;
}

.page-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: capitalize;
}

.page-date { text-align: center; flex: 1; }

.page-date .page-title { font-size: 1.3rem; }

.link-today {
  background: none;
  border: none;
  color: var(--c-accent-dark);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px;
}

.nav-arrow {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 2px 8px rgba(23, 37, 31, 0.06);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.12s;
}

.nav-arrow:hover {
  background: var(--c-accent-soft);
  color: var(--c-accent-dark);
  transform: scale(1.06);
}

/* ---- Cartes ---- */
.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow 0.25s;
}

.card:hover { box-shadow: var(--shadow-lift); }

/* ---- Carte résumé (héro dégradé) ---- */
.summary-card { padding: 0; overflow: hidden; }

.summary-hero {
  position: relative;
  background: var(--grad-hero);
  padding: 26px 20px 22px;
  color: #fff;
}

.summary-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(240px 160px at 85% -10%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(200px 140px at 0% 110%, rgba(255, 255, 255, 0.10), transparent 70%);
  pointer-events: none;
}

.summary-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-side { text-align: center; min-width: 74px; }

.summary-hero .side-val { color: #fff; }

.summary-hero .side-lbl { color: rgba(255, 255, 255, 0.75); }

.summary-hero .ring-big { color: #fff; }

.summary-hero .ring-sub { color: rgba(255, 255, 255, 0.8); }

.side-val { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }

.side-lbl {
  font-size: 0.68rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  margin-top: 2px;
}

.summary-card .macros { padding: 18px 20px 20px; }

/* ---- Anneaux ---- */
.ring-wrap { position: relative; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.10)); }

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ring-big { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.04em; }

.ring-sub { font-size: 0.72rem; color: var(--text-2); font-weight: 600; }

.ring-anim { transition: stroke-dasharray 0.7s cubic-bezier(0.16, 1, 0.3, 1); }

/* ---- Macros ---- */
.macros { display: flex; flex-direction: column; gap: 11px; }

.macro-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 5px;
}

.macro-name { font-weight: 700; letter-spacing: -0.01em; }

.macro-val { color: var(--text-2); font-weight: 500; }

.bar-track {
  height: 8px;
  border-radius: 5px;
  background: var(--ring-track);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 5px;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.08);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Repas ---- */
.meal-head {
  display: flex;
  align-items: center;
  gap: 13px;
}

.meal-ico {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.meal-ico svg { width: 23px; height: 23px; }

.meal-ico.pdj { background: #fdf1dc; color: #d98a0c; }

.meal-ico.dej { background: var(--c-accent-soft); color: var(--c-accent-dark); }

.meal-ico.din { background: #eaecfb; color: #5560d8; }

.meal-ico.col { background: #fdeaf2; color: #d64f8e; }

.meal-ico.eau { background: #e3f0fa; color: var(--c-water); }

.meal-ico.act { background: #fdf1dc; color: var(--c-fast); }

.meal-titles { flex: 1; min-width: 0; }

.meal-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -0.02em; }

.meal-kcal { font-size: 0.8rem; color: var(--text-2); font-weight: 500; }

.btn-add {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--c-accent-soft);
  color: var(--c-accent-dark);
  font-size: 1.5rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(47, 163, 107, 0.14);
  transition: transform 0.15s, background 0.18s, color 0.18s, box-shadow 0.18s;
}

.btn-add:hover {
  background: var(--grad-btn);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 6px 14px rgba(47, 163, 107, 0.35);
}

.btn-add.water { background: #e3f0fa; color: var(--c-water); }

.btn-add.water:hover { background: var(--c-water); color: #fff; box-shadow: 0 6px 14px rgba(62, 142, 208, 0.35); }

.btn-add.burn { background: #fdf1dc; color: var(--c-fast); }

.btn-add.burn:hover { background: var(--c-fast); color: #fff; box-shadow: 0 6px 14px rgba(232, 161, 60, 0.35); }

.entry-list { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 6px; }

.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  margin: 0 -8px;
  border-radius: 12px;
  transition: background 0.15s;
}

.entry:hover { background: #f7faf6; }

.entry-info { flex: 1; min-width: 0; }

.entry-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-qty { font-size: 0.74rem; color: var(--text-2); }

.entry-kcal { font-size: 0.86rem; font-weight: 700; white-space: nowrap; letter-spacing: -0.01em; }

.entry-kcal.burn { color: var(--c-fast); }

.entry-kcal.ok { color: var(--c-accent-dark); }

.btn-del {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #b9c3bc;
  font-size: 1.15rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.btn-del:hover { background: #fbe9ea; color: var(--c-over); }

.btn-del.big { width: 36px; height: 36px; font-size: 1.5rem; }

/* ---- Hydratation ---- */
.glasses { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }

.glass {
  width: 38px;
  height: 46px;
  border: none;
  border-radius: 12px;
  background: #f0f4f7;
  color: #ccd9e3;
  cursor: pointer;
  padding: 9px 8px;
  transition: color 0.18s, background 0.18s, transform 0.14s, box-shadow 0.18s;
}

.glass svg { width: 100%; height: 100%; }

.glass.full {
  background: linear-gradient(150deg, #58a5e0, #2f7cbe);
  color: #fff;
  box-shadow: 0 4px 10px rgba(62, 142, 208, 0.30);
}

.glass:hover { transform: translateY(-3px) scale(1.06); }

/* ---- Boutons et champs ---- */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  margin-top: 14px;
  transition: filter 0.15s, transform 0.12s, box-shadow 0.18s;
}

.btn:active { transform: scale(0.97); }

.btn.primary {
  background: var(--grad-btn);
  color: #fff;
  box-shadow: 0 6px 18px rgba(47, 163, 107, 0.35);
}

.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 8px 22px rgba(47, 163, 107, 0.45); }

.btn.primary:disabled { filter: saturate(0.3) opacity(0.6); cursor: not-allowed; box-shadow: none; }

.btn.ghost {
  background: var(--c-accent-soft);
  color: var(--c-accent-dark);
}

.btn.ghost:hover { background: #d2ecdf; }

.btn.danger { background: var(--c-over); color: #fff; box-shadow: 0 6px 18px rgba(217, 87, 99, 0.3); }

.btn.danger.outline {
  background: transparent;
  color: var(--c-over);
  border: 1.5px solid var(--c-over);
  box-shadow: none;
}

.input {
  display: block;
  width: 100%;
  padding: 12px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-s);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fafcfa;
  color: var(--text);
  margin-bottom: 4px;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.input:focus {
  outline: none;
  border-color: var(--c-accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 163, 107, 0.12);
}

.input.search { margin-bottom: 10px; }

.field-lbl {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 13px 0 6px;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }

.help-text { font-size: 0.85rem; color: var(--text-2); margin-bottom: 8px; }

.help-text.center { text-align: center; }

.empty { font-size: 0.85rem; color: var(--text-2); padding: 12px 0; text-align: center; }

/* ---- Segments et puces ---- */
.seg {
  display: flex;
  background: var(--ring-track);
  border-radius: var(--radius-s);
  padding: 4px;
  gap: 4px;
  margin-bottom: 10px;
}

.seg-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 11px;
  background: transparent;
  font-size: 0.83rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.seg-btn.on {
  background: var(--card);
  color: var(--c-accent-dark);
  box-shadow: 0 2px 6px rgba(23, 37, 31, 0.10);
}

.chips { display: flex; gap: 8px; margin: 10px 0; overflow-x: auto; padding-bottom: 2px; }

.chips.wrap { flex-wrap: wrap; overflow: visible; }

.chips.center { justify-content: center; }

.chip {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(23, 37, 31, 0.05);
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.chip:hover { border-color: var(--c-accent); transform: translateY(-1px); }

.chip.on {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
  color: var(--c-accent-dark);
}

.chip.big {
  border-radius: var(--radius-s);
  padding: 11px 17px;
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

.chip-sub { font-size: 0.67rem; font-weight: 600; color: var(--text-2); }

/* ---- Modales ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 21, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
  animation: fadein 0.2s ease;
}

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  border-radius: 28px 28px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(15, 26, 21, 0.25);
  animation: slideup 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideup {
  from { transform: translateY(48px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 22px 10px;
}

.modal-head::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
}

.modal-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }

.modal-body { padding: 4px 22px 28px; overflow-y: auto; }

/* ---- Liste d'aliments ---- */
.food-list {
  max-height: 44vh;
  overflow-y: auto;
  margin: 4px 0 10px;
  border-top: 1px solid var(--border);
}

.food-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 10px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.13s;
}

.food-item:hover { background: var(--c-accent-soft); }

.food-name { font-size: 0.9rem; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }

.food-meta { font-size: 0.76rem; color: var(--text-2); }

.food-go { color: #b9c3bc; font-size: 1.25rem; }

.food-detail-name { font-size: 1.3rem; font-weight: 800; margin-top: 8px; letter-spacing: -0.03em; }

.link-back {
  background: none;
  border: none;
  color: var(--c-accent-dark);
  font-weight: 700;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 0;
}

.qty-preview {
  background: linear-gradient(140deg, var(--c-accent-soft), #eef8f2);
  border: 1px solid #cfe9db;
  border-radius: var(--radius-s);
  padding: 16px;
  text-align: center;
  margin-top: 12px;
}

.preview-kcal { font-size: 1.6rem; font-weight: 800; color: var(--c-accent-dark); letter-spacing: -0.03em; }

.preview-macros {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 4px;
}

.preview-macros.left { justify-content: flex-start; margin: 6px 0 2px; }

/* ---- Jeûne ---- */
.center-card { text-align: center; display: flex; flex-direction: column; align-items: center; }

.fast-state {
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--c-fast);
}

.fast-state.ok { color: var(--c-accent-dark); }

.fast-times {
  display: flex;
  gap: 44px;
  margin: 18px 0 4px;
  font-size: 0.92rem;
}

/* ---- Statistiques ---- */
.stat-row { display: flex; gap: 12px; margin-bottom: 16px; }

.stat-row.inner { margin: 16px 0 0; }

.stat-row .stat { flex: 1; text-align: center; margin-bottom: 0; padding: 16px 8px; }

.stat-row.inner .stat {
  background: #f7faf6;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  box-shadow: none;
}

.stat-val { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.03em; }

.stat-val.ok { color: var(--c-accent-dark); }

.stat-val.warn { color: var(--c-fast); }

.stat-lbl {
  font-size: 0.66rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 2px;
}
