﻿:root {
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-alt: #F3F4F8;
  --border: #E3E6EF;
  --text: #1B1F31;
  --text-muted: #656D8A;
  --text-soft: #8D95B0;

  --primary: #3758F9;
  --primary-dark: #2544D8;
  --primary-light: #E8ECFF;

  --green: #16A34A;
  --green-light: #DCFCE7;
  --orange: #F59E0B;
  --orange-light: #FEF3C7;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --indigo-badge: #0EA5E9;
  --indigo-badge-light: #E0F2FE;

  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(18, 20, 31, 0.04);
  --shadow-sm: 0 1px 2px rgba(18, 20, 31, 0.04);
  --shadow-lg: 0px 20px 50px rgba(18, 20, 31, 0.18);
}

:root[data-theme="dark"] {
  --bg: #0C0D15;
  --surface: #12141F;
  --surface-alt: #1B1F31;
  --border: #252A3F;
  --text: #E8EAF4;
  --text-muted: #9AA2BE;
  --text-soft: #6D7592;
  --primary: #5B7FFF;
  --primary-dark: #7A99FF;
  --primary-light: rgba(91, 127, 255, 0.16);
  --green-light: rgba(22, 163, 74, 0.18);
  --orange-light: rgba(245, 158, 11, 0.18);
  --red-light: rgba(239, 68, 68, 0.18);
  --indigo-badge-light: rgba(14, 165, 233, 0.18);
  --shadow: none;
  --shadow-sm: none;
  --shadow-lg: 0px 20px 50px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
/* ---------- App shell : barre du haut ---------- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 58px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-icon { display: block; width: 28px; height: 28px; }
.brand-text { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }

.nav { display: flex; gap: 4px; align-self: stretch; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; border-radius: var(--radius-sm); }
.nav-icon { display: inline-flex; }

/* ---------- Content area ---------- */
.content-area {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 32px 28px 24px;
}
.content-area > main { flex: 1; }

.site-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.025em;
  color: var(--text-soft);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.topbar h1 { margin: 0; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; }
.page-subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 0.9rem; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* ---------- Sync banner ---------- */
.sync-banner {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.sync-banner.error { background: var(--red-light); color: var(--red); }
.sync-banner.info { background: var(--orange-light); color: var(--orange); }

/* ---------- Tab panels ---------- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input[type="search"], .toolbar select, .toolbar input[type="date"], .toolbar input[type="number"] {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.toolbar input[type="search"] { flex: 1; min-width: 180px; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 0.88rem;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  transition: transform 0.05s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(55, 88, 249, 0.24);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { filter: brightness(0.98); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { filter: brightness(0.97); }
.btn-small { padding: 7px 13px; font-size: 0.8rem; }
.btn-ghost { background: transparent; color: var(--text-muted); font-weight: 600; }
.btn-ghost:hover { color: var(--text); background: var(--surface-alt); }
.btn[hidden] { display: none; }
.btn-icon { padding-left: 13px; padding-right: 13px; }

/* ---------- Recipe grid ---------- */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.recipe-card:hover { box-shadow: 0px 22px 48px rgba(112, 144, 176, 0.22); }
.recipe-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.recipe-card h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-midi { background: var(--orange-light); color: var(--orange); }
.badge-soir { background: var(--indigo-badge-light); color: #2A8FBD; }
.badge-both { background: var(--primary-light); color: var(--primary); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.recipe-meta { font-size: 0.82rem; color: var(--text-muted); display: flex; justify-content: space-between; font-weight: 600; }
.recipe-meta span:last-child { color: var(--green); font-weight: 700; }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 20px; }

/* ---------- Planning ---------- */
.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.plan-period { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-width: 0; }
#planPeriod { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; }
.plan-budget-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-light);
  padding: 4px 10px;
  border-radius: 999px;
}
.plan-budget-tag[hidden] { display: none; }
.plan-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.plan-menu { position: relative; }
.plan-menu > summary { list-style: none; }
.plan-menu > summary::-webkit-details-marker { display: none; }
.plan-menu[open] > summary { background: var(--surface-alt); }
.plan-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: min(260px, calc(100vw - 36px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0px 8px 24px rgba(15, 23, 42, 0.12);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan-menu-panel label { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.plan-menu-panel input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
}
.plan-menu-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.day-toggles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day-toggle {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.day-toggle.on { background: var(--primary-light); border-color: transparent; color: var(--primary); }
.day-toggle:hover { border-color: var(--primary); }
.day-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.plan-menu-sep { height: 1px; background: var(--border); margin: 2px -14px; }
.menu-item {
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 10px;
  margin: -4px -6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-alt); }

.plan-weeks { display: flex; flex-direction: column; gap: 30px; }
.week-title { display: flex; align-items: baseline; gap: 10px; font-size: 1rem; font-weight: 800; margin: 0 0 12px; }
.week-title span { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.day-card.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.day-card.past { opacity: 0.55; }
.day-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; padding: 2px 2px 4px; }
.day-head .dow { font-weight: 800; text-transform: capitalize; font-size: 0.95rem; }
.day-head .ddate { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.today-tag {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 999px;
}

.slot {
  border-radius: var(--radius-md);
  padding: 9px 10px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.slot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.slot .slot-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
.slot.empty { border: 1.5px dashed var(--border); justify-content: center; }
.slot.empty .slot-label { text-align: left; }
.slot-add { font-size: 0.82rem; font-weight: 600; color: var(--text-soft); }
.slot.empty:hover { border-color: var(--primary); background: var(--primary-light); }
.slot.empty:hover .slot-add { color: var(--primary); }
.slot.filled { background: var(--primary-light); }
.slot.leftover { background: var(--orange-light); }
.slot.manual { background: var(--surface-alt); border: 1px solid var(--border); }
.slot .slot-recipe { font-weight: 700; font-size: 0.88rem; line-height: 1.3; color: var(--primary); }
.slot.leftover .slot-recipe { color: #B45309; }
:root[data-theme="dark"] .slot.leftover .slot-recipe { color: var(--orange); }
.slot.manual .slot-recipe { color: var(--text); }
.slot .slot-sub { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.slot-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 4px; }
.slot-portions-wrap { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; cursor: default; }
.slot-portions {
  width: 38px;
  padding: 2px 4px;
  font: inherit;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
}
.slot-actions { display: flex; gap: 2px; margin-left: auto; }
.slot-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
}
.slot-actions button:hover { background: var(--surface); }
.slot-actions .slot-remove { font-size: 1.05rem; }
.slot-actions .slot-remove:hover { color: var(--red); }
@media (hover: hover) {
  .slot .slot-actions { opacity: 0; transition: opacity 0.15s ease; }
  .slot:hover .slot-actions, .slot:focus-within .slot-actions { opacity: 1; }
}

/* ---------- Pick modal extras ---------- */
.pick-item.leftover-item .pname::before { content: "🍱 "; }
.manual-meal-row { display: flex; gap: 8px; }
.manual-meal-row input { flex: 1; }
.ai-prompt-hint { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
#aiPromptText { font-family: 'DM Sans', monospace; font-size: 0.82rem; line-height: 1.5; resize: vertical; }

/* ---------- Budget summary ---------- */
.budget-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.budget-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; flex-wrap: wrap; gap: 8px; }
.budget-row .label { color: var(--text-muted); font-size: 0.88rem; font-weight: 600; }
.budget-row .value { font-size: 1.5rem; font-weight: 800; }
.budget-bar { height: 10px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; margin-top: 10px; }
.budget-bar-fill { height: 100%; background: var(--primary); transition: width 0.3s ease; }
.budget-bar-fill.over { background: var(--red); }
.budget-note { font-size: 0.85rem; margin-top: 8px; color: var(--text-muted); font-weight: 600; }
.budget-note.over { color: var(--red); }

/* ---------- Shopping list ---------- */
.shopping-list { display: flex; flex-direction: column; gap: 22px; }
.shopping-category { display: flex; flex-direction: column; gap: 8px; }
.shopping-category-title {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}
.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.shopping-item.checked { opacity: 0.5; text-decoration: line-through; }
.shopping-item .item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shopping-item .item-name { font-weight: 700; }
.shopping-item .item-recipes { font-size: 0.75rem; color: var(--text-muted); }
.shopping-item .item-qty { font-weight: 700; white-space: nowrap; text-align: right; }
.extra-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px 170px auto;
  gap: 8px;
  margin-bottom: 24px;
}
.extra-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  min-width: 0;
}
.extra-form input:focus, .extra-form .select-btn:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.extra-form .select-btn { background: var(--surface); }
.shopping-item .item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.shopping-item .item-remove:hover { color: var(--red); background: var(--red-light); }
.shopping-item .item-qty small { display: block; font-size: 0.7rem; font-weight: 600; color: var(--orange); }
.shopping-item .item-price { font-weight: 800; min-width: 70px; text-align: right; color: var(--primary); white-space: nowrap; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 55, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop[hidden] {
  display: none;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-small { max-width: 420px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
.modal-footer .spacer { flex: 1; }

.modal label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--text-muted); font-weight: 600; flex: 1; }
.modal input, .modal select, .modal textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
}
.form-row { display: flex; gap: 12px; }
.modal h3 { margin: 0; font-size: 0.9rem; font-weight: 700; }
.pick-section { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.pick-section[hidden] { display: none; }

.float-menu {
  position: fixed;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0px 8px 24px rgba(15, 23, 42, 0.14);
  padding: 6px;
  max-height: 236px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.float-menu[hidden] { display: none; }
.menu-option {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.menu-option:hover { background: var(--surface-alt); }
.menu-option.active { background: var(--primary-light); color: var(--primary); }
.menu-hint { padding: 8px 10px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.menu-option + .menu-hint { border-top: 1px solid var(--border); margin-top: 4px; }

.ingredient-rows { display: flex; flex-direction: column; gap: 8px; }
.ingredient-row, .ingredient-head { display: grid; grid-template-columns: 1.6fr 0.7fr 0.7fr 0.8fr 1.2fr 28px; gap: 6px; align-items: center; }
.ingredient-head { margin-bottom: -6px; padding: 0 2px; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ingredient-row input, .ingredient-row select { width: 100%; }
.select-btn {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 10px 28px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
select[hidden] { display: none; }
.toolbar .select-btn { width: auto; min-width: 170px; padding: 11px 36px 11px 14px; font-size: 0.9rem; background: var(--surface); }
.modal label .select-btn { font-size: 0.92rem; font-weight: 400; }
.select-btn span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.15s ease;
}
.select-btn[aria-expanded="true"] { border-color: var(--primary); }
.select-btn[aria-expanded="true"]::after { transform: translateY(-30%) rotate(-135deg); }
.select-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ing-price-wrap { position: relative; display: block; min-width: 0; }
.ing-price-wrap .ing-price { padding-right: 24px; }
.ing-price-wrap span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 0.85rem; font-weight: 600; color: var(--text-muted); pointer-events: none; }
.ing-price { -moz-appearance: textfield; }
.ing-price::-webkit-outer-spin-button, .ing-price::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ingredient-row .btn-remove-ing { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; width: 28px; }
.ingredient-row .btn-remove-ing:hover { color: var(--red); }

.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.pick-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.pick-item:hover { border-color: var(--primary); background: var(--primary-light); }
.pick-item .pname { font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .topnav { padding: 0 16px; gap: 16px; }
  .content-area { padding: 22px 18px 24px; }
}
@media (max-width: 640px) {
  /* Onglets en barre fixe en bas d'écran : toujours visibles, sans défilement horizontal. */
  .nav {
    position: fixed;
    align-self: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  }
  .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 7px 4px;
    font-size: 0.74rem;
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: var(--radius-md);
    text-align: center;
  }
  .nav-item.active { background: var(--primary-light); color: var(--primary); }
  .nav-icon { font-size: 1.2rem; }
  .content-area { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .day-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .extra-form { grid-template-columns: 1fr 1fr; }
  .extra-form #extraName { grid-column: 1 / -1; }
  .extra-form .btn { grid-column: 1 / -1; }
  .form-row { flex-direction: column; }
  .ingredient-row { grid-template-columns: 1fr 1fr; grid-template-areas: "name name" "qty unit" "price category" "remove remove"; }
  .ingredient-row .ing-name { grid-area: name; }
  .ingredient-row .ing-qty { grid-area: qty; }
  .ingredient-row .ing-unit { grid-area: unit; }
  .ingredient-row .ing-price-wrap { grid-area: price; }
  .ingredient-head { display: none; }
  .ingredient-row .ing-category { grid-area: category; }
  .ingredient-row .btn-remove-ing { grid-area: remove; justify-self: end; }
  .topbar { flex-wrap: wrap; row-gap: 10px; }
}

@media print {
  .topnav, .toolbar, .topbar-actions, .sync-banner, .budget-summary .btn, .site-footer, .extra-form, .item-remove { display: none; }
  .app-shell { display: block; }
  body { background: #fff; }
  .shopping-item { border: none; border-bottom: 1px solid #ccc; border-radius: 0; box-shadow: none; }
}

/* ---------- Connexion ---------- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  overflow-y: auto;
}
.login-screen[hidden] { display: none; }
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px 28px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.login-logo { align-self: center; display: block; }
.login-card h1 { margin: 0; text-align: center; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.login-sub { margin: -6px 0 6px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.login-card input[type="text"], .login-card input[type="password"] {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
}
.login-card input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.login-card .login-remember { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.login-card .btn { justify-content: center; padding: 11px 16px; }
.login-foot { margin: 6px 0 0; text-align: center; font-size: 0.78rem; color: var(--text-soft); }
.form-error { margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--red-light); color: var(--red); font-size: 0.85rem; }
.form-error[hidden], .form-msg[hidden] { display: none; }

/* ---------- Modale compte ---------- */
.tabs-mini { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tabs-mini[hidden] { display: none; }
.tabs-mini button { flex: 1; padding: 7px 10px; border: none; border-radius: 6px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.tabs-mini button.active { background: var(--primary); color: #fff; }
.account-who { margin: 0 0 14px; font-size: 0.88rem; color: var(--text-muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.self-start { align-self: flex-start; }
.form-msg { margin: 0; font-size: 0.85rem; color: var(--red); }
.form-msg.ok { color: var(--green); }
.user-list { list-style: none; margin: 0 0 14px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.user-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; }
.user-list li + li { border-top: 1px solid var(--border); }
.user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-info small { color: var(--text-muted); }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.new-user { padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- Zone utilisateur (haut à droite) : compte, thème, déconnexion ---------- */
.sidebar-foot { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; min-width: 0; }
.foot-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.foot-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.foot-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer;
  transition: background 0.15s ease;
}
.foot-btn:hover { background: var(--surface-alt); }
.foot-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (max-width: 640px) { .foot-user .foot-name { display: none; } }/* ---------- Profil, photo, nom d'affichage ---------- */
.avatar { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; font-weight: 700; color: #fff; }
.foot-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.foot-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; font-weight: 600; max-width: 160px; }
.profile { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.profile-photo { display: flex; align-items: center; gap: 16px; }
.stack-tight { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.stack-tight small, .profile small { color: var(--text-muted); font-size: 0.78rem; }
.stack-tight label { width: 100%; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.link-btn { padding: 0; border: none; background: none; font-family: inherit; font-size: 0.78rem; color: var(--text-muted); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--red); }
.pw-form { margin-top: 2px; }
.user-list .avatar { margin-right: 2px; }
.user-list li.editing { display: block; background: var(--surface-alt); }
.user-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.user-edit .wide { grid-column: 1 / -1; }
.user-edit .row-end { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.user-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
@media (max-width: 520px) { .user-edit { grid-template-columns: 1fr; } }


/* ---------- Finitions façon Flow ---------- */
.btn { padding: 9px 14px; font-weight: 600; }
.btn-primary { box-shadow: none; }
.btn-small { padding: 6px 12px; }
.recipe-card { padding: 18px; }
.recipe-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(55, 88, 249, 0.1); }
.modal-header h2, .login-card h1 { font-weight: 700; }
/* ---------- Planning façon maquette « barre du haut » ---------- */
.plan-header { margin-bottom: 16px; }
#planPeriod { font-size: 1.05rem; font-weight: 700; }
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.seg button { padding: 6px 12px; border: none; border-radius: 8px; background: none; font: inherit; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); cursor: pointer; }
.seg button.on { background: var(--primary); color: #fff; }
.seg button:not(.on):hover { color: var(--text); }
.seg button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.plan-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 14px 16px; }
.stat-card small { color: var(--text-muted); font-weight: 500; font-size: 0.82rem; }
.stat-card b { display: block; margin-top: 2px; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; }
.stat-card b em { font-style: normal; font-size: 0.82rem; font-weight: 500; color: var(--text-soft); }
.stat-bar { height: 6px; margin-top: 10px; border-radius: 99px; background: var(--surface-alt); overflow: hidden; }
.stat-bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.stat-bar.over i { background: var(--red); }

.day-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.day-card { padding: 10px; gap: 6px; }
.day-card.past { opacity: 0.7; }
.day-head { justify-content: space-between; flex-wrap: nowrap; padding: 0 2px 2px; }
.day-head .dow { font-weight: 700; font-size: 0.92rem; }
.day-head .ddate { font-size: 0.78rem; color: var(--text-soft); font-weight: 500; }
.today-tag { margin-left: 6px; font-weight: 700; }
.slot { border-radius: 8px; padding: 8px 9px; min-height: 64px; }
.slot .slot-label { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.06em; color: var(--text-soft); }
.slot[data-meal="midi"] .slot-label { color: #B45309; }
.slot[data-meal="soir"] .slot-label { color: var(--primary); }
:root[data-theme="dark"] .slot[data-meal="midi"] .slot-label { color: #FBBF24; }
.slot.filled { background: var(--surface-alt); }
.slot.filled .slot-recipe { color: var(--text); font-weight: 600; font-size: 0.85rem; }
.slot.empty { border-width: 1px; }
.slot.manual { background: var(--surface-alt); }
@media (max-width: 900px) { .plan-stats { grid-template-columns: 1fr; } .plan-header { flex-wrap: wrap; } }
/* ---------- Frigo & stock ---------- */
.nav-item { position: relative; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center; color: #fff; }
.nav-badge[hidden] { display: none; }
.nav-badge.danger { background: var(--red); }
.nav-badge.warn { background: var(--orange); }

.stat-card.stat-danger b { color: var(--red); }
.stat-card.stat-warn b { color: #B45309; }
:root[data-theme="dark"] .stat-card.stat-warn b { color: #FBBF24; }

#pantryAlerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
#pantryAlerts:empty { display: none; }
.alert { padding: 10px 14px; border-radius: var(--radius-md); font-size: 0.88rem; border: 1px solid transparent; }
.alert-danger { background: var(--red-light); color: var(--red); border-color: rgba(239, 68, 68, 0.25); }
.alert-warn { background: var(--orange-light); color: #B45309; border-color: rgba(245, 158, 11, 0.3); }
:root[data-theme="dark"] .alert-warn { color: #FBBF24; }
.alert-info { background: var(--primary-light); color: var(--primary); border-color: rgba(55, 88, 249, 0.2); }

.pantry-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.pantry-form input, .pantry-form select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
}
.pantry-form #pfName { flex: 2 1 240px; }
.pantry-form #pfQty { flex: 1 1 130px; }
.pantry-form input:focus-visible, .pantry-form select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.pantry-group { margin-bottom: 22px; }
.p-count { margin-left: 6px; font-size: 0.78rem; font-weight: 600; color: var(--text-soft); }
.pantry-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.pantry-item.status-expired { border-color: rgba(239, 68, 68, 0.5); background: var(--red-light); }
.pantry-item.status-today, .pantry-item.status-soon { border-color: rgba(245, 158, 11, 0.5); }
.pantry-item.status-none { border-style: dashed; }
.p-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-qty { font-size: 0.78rem; color: var(--text-muted); }
.p-badge { font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: var(--surface-alt); color: var(--text-muted); }
.p-badge.expired { background: var(--red); color: #fff; }
.p-badge.today, .p-badge.soon { background: var(--orange-light); color: #B45309; }
:root[data-theme="dark"] .p-badge.today, :root[data-theme="dark"] .p-badge.soon { color: #FBBF24; }
.p-badge.none { background: var(--primary-light); color: var(--primary); }
.p-badge.ok { background: var(--green-light); color: var(--green); }
.p-date { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 0.85rem; color: var(--text); background: var(--surface); }
.pantry-item.status-none .p-date { border-color: var(--primary); }
.p-move, .p-remove { width: 32px; height: 32px; border: none; border-radius: var(--radius-sm); background: none; color: var(--text-muted); font-size: 1rem; cursor: pointer; }
.p-move:hover, .p-remove:hover { background: var(--surface-alt); color: var(--text); }
.p-remove:hover { color: var(--red); }
@media (max-width: 640px) {
  .pantry-item { flex-wrap: wrap; gap: 8px; }
  .p-main { flex-basis: 100%; }
  .p-badge { order: 3; }
  .p-date { flex: 1; min-width: 130px; }
}

/* ---------- Message de confirmation ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #1B1F31;
  color: #fff;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
}
.toast[hidden] { display: none; }
.toast button { flex-shrink: 0; padding: 4px 10px; border: none; border-radius: var(--radius-sm); background: var(--primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 640px) {
  .nav { grid-template-columns: repeat(4, 1fr); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) { .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); } }

.pantry-form select, .pantry-form input[type=date] { flex: 0 0 auto; width: auto; }

.pantry-form .select-btn { width: auto; min-width: 160px; padding: 10px 36px 10px 12px; font-size: 0.9rem; background: var(--surface); }

/* ---------- Logo & titre ---------- */
.brand { gap: 11px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, #2544D8 0%, #3758F9 55%, #6B8AFF 100%);
  box-shadow: 0 4px 12px rgba(55, 88, 249, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-mark-lg { width: 60px; height: 60px; border-radius: 18px; }
.brand-mark-lg svg { width: 34px; height: 34px; }
.brand-name { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.brand-text { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.03em; }
.brand-tag { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-soft); }
.login-logo { align-self: center; margin-bottom: 2px; }
@media (max-width: 400px) { .brand-tag { display: none; } }

/* ---------- Sélecteur de date ---------- */
.date-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
  transition: border-color 0.15s ease;
}
.date-btn svg { flex-shrink: 0; color: var(--text-muted); }
.date-btn.empty span { color: var(--text-soft); }
.date-btn:hover { border-color: var(--primary); }
.date-btn:focus-visible, .date-btn[aria-expanded="true"] { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.pantry-form .date-btn { padding: 10px 12px; min-width: 190px; }
.pantry-item .date-btn { padding: 6px 10px; font-size: 0.85rem; min-width: 150px; }
.pantry-item.status-none .date-btn { border-color: var(--primary); }
.plan-menu-panel .date-btn { width: 100%; padding: 9px 12px; }
@media (max-width: 640px) { .pantry-item .date-btn { flex: 1; } .pantry-form .date-btn { flex: 1 1 190px; } }

.datepicker {
  position: fixed; z-index: 400; width: 296px; padding: 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(18, 20, 31, 0.18);
}
.datepicker[hidden] { display: none; }
.datepicker button { font: inherit; color: inherit; cursor: pointer; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.dp-title { flex: 1; padding: 6px 8px; border: none; border-radius: var(--radius-sm); background: none; font-weight: 700; font-size: 0.95rem; text-transform: capitalize; }
.dp-title:hover, .dp-nav:hover { background: var(--surface-alt); }
.dp-nav { width: 32px; height: 32px; border: none; border-radius: var(--radius-sm); background: none; font-size: 1.3rem; line-height: 1; color: var(--text-muted); }
.dp-dow, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dp-dow span { padding: 4px 0; text-align: center; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; color: var(--text-soft); }
.dp-grid { gap: 2px; }
.dp-day {
  aspect-ratio: 1; border: 1px solid transparent; border-radius: var(--radius-sm); background: none;
  font-size: 0.85rem; font-weight: 500; font-variant-numeric: tabular-nums;
}
.dp-day.out { color: var(--text-soft); font-weight: 400; }
.dp-day:hover { background: var(--primary-light); }
.dp-day.today { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.dp-day.sel, .dp-day.sel:hover { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.dp-day:focus-visible, .dp-title:focus-visible, .dp-nav:focus-visible, .dp-quick button:focus-visible, .dp-foot button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.dp-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.dp-quick button { padding: 4px 10px; border: none; border-radius: 99px; background: var(--primary-light); color: var(--primary); font-size: 0.78rem; font-weight: 600; }
.dp-quick button:hover { background: var(--primary); color: #fff; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.dp-foot button { padding: 4px 8px; border: none; border-radius: var(--radius-sm); background: none; color: var(--primary); font-size: 0.85rem; font-weight: 600; }
.dp-foot button:hover { background: var(--primary-light); }
@media (max-width: 640px) { .nav-item { padding-left: 2px; padding-right: 2px; font-size: 0.7rem; } .nav-label { white-space: nowrap; } }

.nav-label { white-space: nowrap; }

/* ---------- Piste 5 : bandeau dégradé ---------- */
.app-shell { position: relative; }
.app-shell::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 380px;
  background: linear-gradient(120deg, var(--band-1) 0%, var(--band-2) 48%, var(--band-3) 100%);
  /* Dégradé progressif : le bandeau reste plein derrière le titre et les boutons, puis devient transparent
     de plus en plus vite (courbe d'accélération). C'est un masque : le bas n'a plus de bord du tout. */
  -webkit-mask-image: linear-gradient(to bottom,
    #000 0%, rgba(0, 0, 0, 0.988) 30%, rgba(0, 0, 0, 0.95) 42%, rgba(0, 0, 0, 0.86) 50%, rgba(0, 0, 0, 0.70) 59%,
    rgba(0, 0, 0, 0.48) 68%, rgba(0, 0, 0, 0.24) 78%, rgba(0, 0, 0, 0.07) 88%, transparent 96%);
  mask-image: linear-gradient(to bottom,
    #000 0%, rgba(0, 0, 0, 0.988) 30%, rgba(0, 0, 0, 0.95) 42%, rgba(0, 0, 0, 0.86) 50%, rgba(0, 0, 0, 0.70) 59%,
    rgba(0, 0, 0, 0.48) 68%, rgba(0, 0, 0, 0.24) 78%, rgba(0, 0, 0, 0.07) 88%, transparent 96%);
  z-index: 0;
}
/* Couleurs du bandeau et du fond vers lequel il s'estompe, par thème. */
:root { --bg-rgb: 246, 247, 251; --band-1: #2544D8; --band-2: #3758F9; --band-3: #6B8AFF; }
:root[data-theme="dark"] { --bg-rgb: 12, 13, 21; --band-1: #16205C; --band-2: #2544D8; --band-3: #3758F9; }
.topnav { position: relative; z-index: 2; background: transparent; border-bottom: 0; color: #fff; }
.content-area { position: relative; z-index: 2; }
.brand-mark { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
.brand-text { color: #fff; }
.brand-tag { color: #C9D5FF; }
.foot-name { color: #fff; }
.foot-btn { color: #fff; }
.foot-btn:hover { background: rgba(255, 255, 255, 0.15); }
.topbar { margin-bottom: 34px; }
.topbar h1 { color: #fff; }
.page-subtitle { color: rgba(255, 255, 255, 0.85); }
.topbar-actions .btn-ghost { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; }
.topbar-actions .btn-ghost:hover { background: rgba(255, 255, 255, 0.26); color: #fff; }
.btn svg.i, .menu-item svg.i { margin-right: 6px; vertical-align: -3px; }
.btn-icon svg.i, .slot-reroll svg.i, .p-move svg.i { margin: 0; }
@media (min-width: 641px) {
  .nav-item { margin: 10px 0; padding: 0 14px; border-bottom: 0; border-radius: 99px; color: #DCE4FF; }
  .nav-item:hover { color: #fff; }
  .nav-item.active { background: rgba(255, 255, 255, 0.2); color: #fff; }
}

/* Première rangée de chaque page, posée sur le bandeau */
#planPeriod { color: #fff; }
.plan-actions .seg { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.14); }
.plan-actions .seg button { color: #E6ECFF; }
.plan-actions .seg button.on { background: #fff; color: var(--primary); }
.plan-actions .btn-secondary, .plan-menu > summary { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; box-shadow: none; }
.plan-menu[open] > summary { background: rgba(255, 255, 255, 0.28); }
#tab-recettes .toolbar .btn-primary { background: #fff; color: var(--primary); border: 1px solid #fff; box-shadow: none; }
#tab-recettes .toolbar .btn-secondary { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; box-shadow: none; }
.stat-card, .budget-summary { box-shadow: 0 12px 30px rgba(37, 68, 216, 0.14); }
:root[data-theme="dark"] .stat-card, :root[data-theme="dark"] .budget-summary { box-shadow: none; }

/* Titres de section et de rayon : un seul style partout */
.shopping-category-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary);
}
.shopping-category-title .n, .shopping-category-title .p-count { margin: 0; font-weight: 600; letter-spacing: 0; color: var(--text-soft); }
.shopping-category-title svg { flex-shrink: 0; }
