:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface2: #f4f0ea;
  --border: #e8e1d6;
  --text: #2a2218;
  --text-muted: #8a7f72;
  --accent: #c4622d;
  --accent-light: #f5e6dd;
  --green: #3a7d44;
  --green-light: #e0f0e3;
  --orange: #d4840a;
  --orange-light: #fef3dc;
  --red: #c0392b;
  --red-light: #fde8e6;
  --blue: #2563a8;
  --blue-light: #deeaf8;
  --radius: 12px;
  --radius-sm: 7px;
  --shadow: 0 2px 12px rgba(42,34,24,0.07);
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── HEADER ── */
header {
  background: var(--text);
  color: white;
  padding: 28px 24px 22px;
  text-align: center;
}
header h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
header p {
  opacity: 0.55;
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── HISTORY BANNER ── */
#history-banner {
  display: none;
  background: var(--blue);
  color: white;
  padding: 10px 20px;
  text-align: center;
  font-size: 0.88rem;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
#history-banner.visible { display: flex; }
#history-banner button {
  background: white;
  color: var(--blue);
  border: none;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── TABS ── */
.tabs {
  display: flex;
  background: var(--text);
  padding: 0 24px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  background: none;
  border: none;
  padding: 12px 18px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn.active { color: white; border-bottom-color: var(--accent); }
.tab-btn:hover { color: rgba(255,255,255,0.8); }

/* ── CONTENT ── */
.tab-content { display: none; padding: 24px 16px 60px; max-width: 900px; margin: 0 auto; }
.tab-content.active { display: block; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 12px; font-size: 1rem; }
.empty-state a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.empty-state a:hover { text-decoration: underline; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
}
.badge-solo    { background: var(--blue-light); color: var(--blue); }
.badge-deux    { background: var(--accent-light); color: var(--accent); }
.badge-partage { background: var(--green-light); color: var(--green); }
.badge-separe  { background: var(--orange-light); color: var(--orange); }
.badge-absent  { background: var(--surface2); color: var(--text-muted); }
.badge-invites { background: var(--surface2); color: var(--text-muted); }

/* ── GLUCIDES ── */
.gluco {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}
.gluco.ok     { background: var(--green-light); color: var(--green); }
.gluco.warn   { background: var(--orange-light); color: var(--orange); }
.gluco.danger { background: var(--red-light); color: var(--red); }
.gluco-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── DAY CARDS (Menus) ── */
.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.day-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-name {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 400;
}
.day-date { font-size: 0.78rem; color: var(--text-muted); }
.day-chevron {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.25s;
  flex-shrink: 0;
}
.day-card.open .day-chevron { transform: rotate(180deg); }
.day-body { display: none; }
.day-card.open .day-body { display: block; }

/* ── MEAL ROWS ── */
.meal-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.meal-row:last-child { border-bottom: none; }
.meal-label {
  padding: 12px 14px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  padding-top: 14px;
}
.meal-adult {
  padding: 12px 14px;
  border-right: 1px solid var(--border);
}
.meal-baby { padding: 12px 14px; }
.meal-section-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.meal-dish {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 5px;
}
.meal-dish a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
}
.meal-dish a:hover { color: var(--accent); }
.meal-absent { font-size: 0.85rem; color: var(--text-muted); font-style: italic; }
.meal-detail { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }

/* ── INVITES CARD ── */
.invites-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
  box-shadow: var(--shadow);
}

.disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 10px 0 4px;
  text-align: center;
}

/* ── PRODUCTION ── */
.prod-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.prod-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.prod-day-title {
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 400;
}
.prod-day-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.time-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 20px;
}
.time-peu      { background: var(--green-light); color: var(--green); }
.time-moyen    { background: var(--orange-light); color: var(--orange); }
.time-beaucoup { background: var(--blue-light); color: var(--blue); }
.time-rien     { background: var(--surface2); color: var(--text-muted); }
.prod-chevron { font-size: 0.8rem; color: var(--text-muted); transition: transform 0.25s; }
.prod-day.open .prod-chevron { transform: rotate(180deg); }
.prod-day-body { display: none; padding: 14px 16px; }
.prod-day.open .prod-day-body { display: block; }

.prod-section { margin-bottom: 14px; }
.prod-section:last-child { margin-bottom: 0; }
.prod-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 8px;
}
.prod-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 6px;
  font-size: 0.87rem;
  line-height: 1.4;
}
.prod-icon { flex-shrink: 0; margin-top: 1px; }
.prod-baby {
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 8px;
}
.prod-baby-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  margin-bottom: 5px;
}
.prod-baby-item {
  font-size: 0.83rem;
  color: #2a5c32;
  margin-bottom: 3px;
  display: flex;
  gap: 6px;
}

/* ── COURSES ── */
.courses-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.btn-uncheck-all {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
}
.btn-uncheck-all:hover { color: var(--accent); border-color: var(--accent); }

.courses-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.courses-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
}
.courses-icon { font-size: 1.1rem; }
.courses-body { padding: 10px 16px 14px; }

.course-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.course-item:last-child { border-bottom: none; }
.course-cb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.course-item.checked .course-cb {
  background: var(--green);
  border-color: var(--green);
}
.course-item.checked .course-cb::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}
.course-text { font-size: 0.9rem; line-height: 1.35; transition: color 0.15s; }
.course-item.checked .course-text { color: var(--text-muted); text-decoration: line-through; }
.course-note { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 1px; }

/* ── HISTORY ── */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-entry:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 16px rgba(196,98,45,0.12);
}
.history-entry-title {
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 4px;
}
.history-entry-meta { font-size: 0.78rem; color: var(--text-muted); }
.history-arrow { color: var(--text-muted); font-size: 0.9rem; flex-shrink: 0; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .meal-row { grid-template-columns: 60px 1fr; }
  .meal-adult {
    border-right: none;
    border-bottom: 1px solid var(--border);
    grid-column: 2;
  }
  .meal-baby { grid-column: 2; }
  .meal-label { grid-row: span 2; align-items: center; padding-top: 12px; }
  .tabs { padding: 0 8px; gap: 0; }
  .tab-btn { padding: 12px 10px 14px; font-size: 0.75rem; }
  .prod-day-title { font-size: 0.9rem; }
}
