:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --header-bg: #0f172a;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-soft: #d1fae5;
  --sky: #0ea5e9;
  --sky-soft: #e0f2fe;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

.offline-banner {
  background: #f59e0b;
  color: #0f172a;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 12px;
}

/* ==================== HEADER ==================== */
.app-header {
  background: var(--header-bg);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
}

.header-inner {
  max-width: 1260px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.brand-title {
  display: block;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  display: block;
  font-size: 0.72rem;
  color: #94a3b8;
}

.desktop-nav {
  display: none;
  gap: 4px;
}

.desktop-nav .nav-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 13px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.desktop-nav .nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.desktop-nav .nav-btn.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-switcher-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-radius: 999px;
  padding: 4px 12px 4px 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-switcher-pill:hover {
  background: rgba(255, 255, 255, 0.18);
}

.avatar-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  color: #ffffff;
  flex-shrink: 0;
}

.user-pill-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
}

.user-pill-text strong {
  font-size: 0.85rem;
}

.user-pill-text small {
  font-size: 0.7rem;
  color: #cbd5e1;
}

.chevron {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* ==================== LAYOUT & CARDS ==================== */
.main-container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.18s ease;
}

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

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.card h3 {
  margin: 0 0 10px 0;
  font-size: 0.98rem;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ==================== BUTTONS & BADGES ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--emerald);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--emerald-dark);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--surface-alt);
  border-color: #cbd5e1;
}

.btn-outline.active-completed {
  background: var(--emerald-soft);
  border-color: var(--emerald);
  color: #065f46;
}

.btn-outline-light {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.btn-ghost {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-ghost:hover {
  background: #e2e8f0;
}

.btn-danger-outline {
  background: transparent;
  border-color: #fecaca;
  color: var(--danger);
}

.btn-danger-outline:hover {
  background: var(--danger-soft);
}

.icon-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text);
}

.icon-btn:hover {
  background: #e2e8f0;
}

.link-btn {
  background: none;
  border: none;
  color: var(--sky);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge-green, .badge-emerald {
  background: var(--emerald-soft);
  color: #065f46;
}

.badge-sky {
  background: var(--sky-soft);
  color: #0369a1;
}

.badge-amber {
  background: var(--amber-soft);
  color: #92400e;
}

.badge-slate {
  background: #e2e8f0;
  color: #334155;
}

.badge-danger {
  background: var(--danger-soft);
  color: #991b1b;
}

/* ==================== DATE TOOLBAR & WEEK STRIP ==================== */
.date-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.date-controls, .date-status-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}

.cycle-pill {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.top-quick-add-bar {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}

.top-quick-add-primary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-quick-add-meals {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.top-meal-chip {
  background: var(--surface-alt);
  border-radius: 999px;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.week-day-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.week-day-pill:hover {
  border-color: var(--sky);
  transform: translateY(-1px);
}

.week-day-pill.selected {
  border: 2px solid var(--emerald);
  background: #f0fdf4;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.week-day-pill.is-reset-day .wd-name::after {
  content: ' ↻';
  color: var(--sky);
  font-weight: 800;
}

.wd-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.wd-date {
  font-size: 0.84rem;
  font-weight: 700;
}

.wd-pts {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
}

.wd-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.wd-tag.plus {
  background: var(--emerald-soft);
  color: #065f46;
}

.wd-tag.minus {
  background: var(--amber-soft);
  color: #92400e;
}

.wd-tag.neutral {
  background: #f1f5f9;
  color: #64748b;
}

/* ==================== DASHBOARD HERO GRID ==================== */
.dashboard-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

/* Ring Chart */
.ring-layout {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ring-wrapper {
  position: relative;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 12;
}

.ring-fill {
  fill: none;
  stroke: var(--emerald);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease, stroke 0.2s ease;
}

.ring-fill.over-budget {
  stroke: var(--amber);
}

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

.ring-big {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}

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

.ring-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--border);
}

.stat-line:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.text-emerald { color: var(--emerald-dark); }
.text-amber { color: #b45309; }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

/* Cagnotte d'extra Card */
.pool-balance-box {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 12px;
}

.pool-label {
  font-size: 0.78rem;
  opacity: 0.9;
  font-weight: 600;
}

.pool-number-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}

.pool-big {
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1;
}

.pool-unit {
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0.92;
}

.pool-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.breakdown-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 8px;
  text-align: center;
}

.breakdown-chip span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.breakdown-chip strong {
  font-size: 0.88rem;
}

.breakdown-chip.chip-green {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.breakdown-chip.chip-amber {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.pool-footer-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

/* Calories & Macros Card */
.calories-summary {
  margin-bottom: 12px;
}

.calories-numbers {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.cal-big {
  font-size: 1.65rem;
  font-weight: 800;
}

.cal-unit {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.cal-target-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-bg.progress-lg {
  height: 10px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.fill-amber { background: var(--amber); }
.fill-violet { background: var(--violet); }
.fill-pink { background: var(--pink); }
.fill-sky { background: var(--sky); }
.fill-emerald { background: var(--emerald); }
.fill-danger { background: var(--danger); }

.macros-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

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

.muted-inline {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.72rem;
}

/* ==================== MEAL LOGS ==================== */
.meals-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.meals-section-header h2 {
  margin: 0;
  font-size: 1.12rem;
}

.meals-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.meal-card {
  padding: 15px 16px;
}

.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.meal-title {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.meal-subtotals {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.meal-favorites-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 7px 9px;
  margin-bottom: 10px;
}

.fav-bar-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #92400e;
}

.fav-chip-group {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  overflow: hidden;
}

.fav-quick-btn {
  background: transparent;
  border: none;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #78350f;
  cursor: pointer;
}

.fav-quick-btn:hover {
  background: #fef3c7;
}

.fav-remove-btn {
  background: transparent;
  border: none;
  border-left: 1px solid #fde68a;
  padding: 3px 6px;
  font-size: 0.7rem;
  color: #b45309;
  cursor: pointer;
}

.fav-remove-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.row-action-btn.fav {
  color: #94a3b8;
}

.row-action-btn.fav.is-fav {
  color: #d97706;
  border-color: #fcd34d;
  background: #fef3c7;
}

.fav-sections-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fav-section-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.fav-section-check:hover {
  border-color: var(--amber);
}

.badge-fav {
  background: #fef3c7;
  color: #92400e;
}

.meal-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meal-empty {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 0;
}

.meal-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid #f1f5f9;
}

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

.meal-item-name {
  font-weight: 600;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meal-item-macros {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.meal-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sp-pill {
  background: var(--header-bg);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 3px 8px;
  border-radius: 999px;
}

.sp-pill.is-zp {
  background: var(--emerald);
}

.row-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.row-action-btn:hover {
  background: #e2e8f0;
  color: var(--text);
}

.row-action-btn.del:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}

/* ==================== FOODS CATALOG & FORMS ==================== */
.subtab-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.subtab-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  color: var(--text-muted);
}

.subtab-btn.active {
  background: var(--header-bg);
  color: #ffffff;
  border-color: var(--header-bg);
}

.food-subpanel {
  display: none;
}

.food-subpanel.active {
  display: block;
}

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.store-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.store-pill {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.store-pill:hover {
  border-color: var(--sky);
  color: var(--text);
}

.store-pill.active {
  background: var(--sky);
  border-color: var(--sky);
  color: #ffffff;
}

.badge-colruyt {
  background: #ffedd5;
  color: #9a3412;
}

.badge-intermarche {
  background: #fee2e2;
  color: #991b1b;
}

.badge-belgique {
  background: #fef3c7;
  color: #854d0e;
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #ffffff;
  color: var(--text);
}

.input:focus {
  outline: 2px solid rgba(14, 165, 233, 0.3);
  border-color: var(--sky);
}

.filter-bar .input {
  flex: 1;
  min-width: 200px;
}

.select-compact {
  max-width: 220px;
}

.input-barcode {
  max-width: 240px;
}

.input-color {
  height: 40px;
  padding: 3px 6px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.foods-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.food-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.food-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.food-card-name {
  font-weight: 700;
  font-size: 0.94rem;
}

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

.food-card-macros {
  font-size: 0.78rem;
  color: #334155;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
}

.food-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.food-form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.calculator-preview-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.calc-sp-circle {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #0ea5e9);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.calc-sp-circle span {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.calc-sp-circle small {
  font-size: 0.72rem;
  opacity: 0.9;
}

.formula-note {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.formula-note code {
  display: block;
  margin-top: 4px;
  background: #e2e8f0;
  padding: 4px 6px;
  border-radius: 6px;
  color: #0f172a;
}

/* ==================== FORM GRIDS ==================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field > span {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.field-hint {
  font-size: 0.72rem;
  color: #64748b;
}

.field-hint.is-error {
  color: #dc2626;
  font-weight: 600;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

/* ==================== WEEK TABLE & BARS ==================== */
.week-bars-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  height: 160px;
  padding: 14px 10px 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.week-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
}

.week-bar-track {
  width: 28px;
  flex: 1;
  background: #e2e8f0;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  position: relative;
}

.week-bar-fill {
  width: 100%;
  background: var(--emerald);
  border-radius: 8px 8px 0 0;
  transition: height 0.3s ease;
}

.week-bar-fill.over {
  background: var(--amber);
}

.week-bar-val {
  font-size: 0.74rem;
  font-weight: 700;
}

.week-bar-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th, .data-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-alt);
}

.data-table tr.selected-row {
  background: #f0fdf4;
}

/* ==================== WEIGHT TAB ==================== */
.weight-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.weight-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mini-kpi {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.mini-kpi span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.mini-kpi strong {
  font-size: 1.1rem;
}

.weight-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr auto;
  gap: 10px;
  align-items: end;
}

.weight-chart-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-height: 170px;
}

/* ==================== PROFILE TAB ==================== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.auto-preview-card {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 11px;
  padding: 12px 14px;
}

.auto-preview-card h4 {
  margin: 0 0 4px 0;
  font-size: 0.88rem;
  color: #0369a1;
}

.auto-quotas-line {
  margin: 4px 0 0 0;
  font-weight: 700;
  color: #0f172a;
}

.custom-targets-box {
  padding: 12px;
  border-radius: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.custom-targets-box.disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* ==================== MODALS & TOASTS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.modal-sm { max-width: 440px; }
.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-weight: 700;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-alt);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.user-card.active {
  border-color: var(--emerald);
  background: #ecfdf5;
}

.user-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.quick-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.quick-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.quick-add-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.portion-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.preset-chip:hover {
  border-color: var(--sky);
  background: var(--sky-soft);
}

.portion-preview-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.preview-sp {
  background: var(--emerald);
  color: #ffffff;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
  min-width: 78px;
}

.preview-sp strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
}

.preview-sp span {
  font-size: 0.68rem;
  font-weight: 600;
}

.preview-macros {
  font-size: 0.84rem;
}

/* ==================== MOBILE NAV, FAB & TOASTS ==================== */
.mobile-fab-btn {
  position: fixed;
  right: 16px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 65;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.38);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mobile-fab-btn:active {
  transform: scale(0.96);
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 60;
  padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
}

.mobile-bottom-nav .nav-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.mobile-bottom-nav .nav-btn span {
  font-size: 1.15rem;
}

.mobile-bottom-nav .nav-btn.active {
  color: var(--emerald-dark);
}

.toast-container {
  position: fixed;
  bottom: 84px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: var(--header-bg);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.toast.error {
  background: var(--danger);
}

/* ==================== SMART ROW (WATER, SPORT, COACH) ==================== */
.pool-breakdown.pool-breakdown-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.breakdown-chip.chip-sky {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.dashboard-smart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.water-kpi-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.water-big {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0284c7;
}

.water-glasses {
  font-size: 1rem;
  letter-spacing: 2px;
}

.water-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.activity-inline-form {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 0.7fr auto;
  gap: 6px;
  align-items: center;
}

.input-num-sm {
  padding: 7px 8px;
  font-size: 0.85rem;
}

.activities-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.activity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.coach-tips {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: #334155;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 8px 10px;
}

.coach-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
}

.coach-suggestion-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 0.78rem;
}

/* ==================== SCANNER & RECETTES ==================== */
.scanner-box {
  background: #0f172a;
  color: #ffffff;
  border-radius: 12px;
  padding: 12px;
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 600;
}

.barcode-video {
  width: 100%;
  max-height: 240px;
  border-radius: 8px;
  background: #000000;
  object-fit: cover;
}

.recipes-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

.recipe-builder-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  align-self: start;
}

.field-label-sm {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.mb-xs { margin-bottom: 6px; }

.recipe-draft-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recipe-draft-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

/* ==================== PROJECTION & EXPORT / MCP ==================== */
.projection-banner {
  background: linear-gradient(135deg, #ecfdf5 0%, #e0f2fe 100%);
  border: 1px solid #a7f3d0;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #065f46;
}

.export-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mcp-code-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  overflow-x: auto;
  margin: 0;
}

/* ==================== AUTHENTIK / OPENID CONNECT ==================== */
body.app-locked .desktop-nav,
body.app-locked .mobile-bottom-nav,
body.app-locked .mobile-fab-btn,
body.app-locked main,
body.app-locked #active-user-btn {
  display: none !important;
}

.auth-gate {
  min-height: calc(100vh - 96px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
}

.auth-gate-card {
  max-width: 440px;
  width: 100%;
  padding: 24px 20px;
  text-align: left;
}

.auth-gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.auth-gate-brand h1 {
  margin: 0 0 2px 0;
  font-size: 1.35rem;
}

.auth-gate-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}

.auth-gate-desc {
  margin: 0 0 18px 0;
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.5;
}

.auth-error-banner {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.oidc-account-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 11px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.auth-gate .btn {
  text-decoration: none;
}

#header-logout-btn,
.oidc-account-box .btn {
  text-decoration: none;
}

/* ==================== SCANNER CODE-BARRES UNIVERSEL ==================== */
.barcode-scanner-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.barcode-reader-box {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  margin-bottom: 10px;
}

.barcode-reader-box video {
  width: 100% !important;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
}

.barcode-cam-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.barcode-manual-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.barcode-result-card {
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.barcode-product-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.barcode-product-thumb {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  flex-shrink: 0;
}

.barcode-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==================== COACH IA RECETTES ==================== */
.ai-coach-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px;
}

.ai-coach-controls {
  display: grid;
  grid-template-columns: 0.9fr 1.6fr;
  gap: 6px;
}

.ai-coach-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-recipes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.ai-recipe-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px;
}

.ai-recipe-top {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.ai-recipe-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-recipe-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ai-modal-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.ai-modal-img {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-modal-list {
  margin: 6px 0 0 18px;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.5;
}

/* ==================== GRILLES DYNAMIQUES SECTIONS & ADMIN ==================== */
.dashboard-hero-grid.grid-cols-1,
.dashboard-smart-grid.grid-cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-hero-grid.grid-cols-2,
.dashboard-smart-grid.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-hero-grid.grid-cols-3,
.dashboard-smart-grid.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dash-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.section-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.section-toggle-row:hover {
  border-color: var(--sky);
}

.section-toggle-row.is-enabled {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.section-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.section-toggle-info strong {
  font-size: 0.88rem;
}

.section-toggle-info small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.switch-pill {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch-pill input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.switch-pill input:checked + .switch-slider {
  background: var(--emerald);
}

.switch-pill input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.admin-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-policy-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.admin-inline-form {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.admin-rule-form {
  display: grid;
  grid-template-columns: 1.5fr auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.admin-backups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.admin-backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 0.82rem;
}

.status-pill-active {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: #065f46;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill-excluded {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: #991b1b;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill-admin {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sky-soft);
  color: #075985;
  font-size: 0.75rem;
  font-weight: 700;
}

.admin-actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Utilities */
.w-full { width: 100%; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 10px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 22px; }
.mb-sm { margin-bottom: 10px; }
.muted-text { color: var(--text-muted); font-size: 0.83rem; margin: 0; }

/* ==================== RESPONSIVE ==================== */
@media (min-width: 900px) {
  body {
    padding-bottom: 24px;
  }
  .desktop-nav {
    display: flex;
  }
  .mobile-bottom-nav,
  .mobile-fab-btn {
    display: none !important;
  }
  .toast-container {
    bottom: 20px;
  }
}

@media (max-width: 1060px) {
  .dashboard-hero-grid,
  .dashboard-hero-grid.grid-cols-2,
  .dashboard-hero-grid.grid-cols-3,
  .dashboard-smart-grid,
  .dashboard-smart-grid.grid-cols-2,
  .dashboard-smart-grid.grid-cols-3,
  .recipes-layout {
    grid-template-columns: 1fr;
  }
  .admin-rule-form {
    grid-template-columns: 1fr;
  }
  .meals-grid {
    grid-template-columns: 1fr;
  }
  .profile-grid,
  .weight-layout,
  .food-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  /* En-tête mobile épuré */
  .header-inner {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
  }
  .brand-title {
    font-size: 0.98rem;
  }
  .brand-sub {
    display: none;
  }
  .user-switcher-pill {
    padding: 3px 10px 3px 4px;
    gap: 6px;
  }
  #header-user-name {
    display: block;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Conteneurs & cartes */
  .main-container {
    padding: 12px;
  }
  .card {
    padding: 14px;
    border-radius: 12px;
  }

  /* Barre de date & cycle WW */
  .date-toolbar {
    padding: 10px 12px;
    gap: 8px;
  }
  .date-controls {
    width: 100%;
    justify-content: space-between;
  }
  .date-input {
    flex: 1;
    min-width: 0;
  }
  .date-status-actions {
    width: 100%;
    justify-content: space-between;
  }
  .cycle-pill {
    font-size: 0.74rem;
    padding: 5px 8px;
  }
  .top-quick-add-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 8px;
  }
  .top-quick-add-primary-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    width: 100%;
  }
  #top-quick-add-btn,
  #top-scan-barcode-btn {
    padding: 10px 14px;
    font-size: 0.9rem;
  }
  .barcode-cam-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .barcode-cam-controls > * {
    justify-content: center;
    text-align: center;
  }
  .barcode-manual-row,
  .ai-coach-controls {
    grid-template-columns: 1fr;
  }
  .top-quick-add-meals {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .top-quick-add-meals::-webkit-scrollbar {
    display: none;
  }
  .top-meal-chip {
    flex: 1 0 auto;
    white-space: nowrap;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  /* Bandeau 7 jours défilable avec snap */
  .week-strip {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .week-strip::-webkit-scrollbar {
    display: none;
  }
  .week-day-pill {
    min-width: 72px;
    flex: 0 0 auto;
    padding: 8px 6px;
    scroll-snap-align: center;
  }

  /* Anneau SmartPoints côte à côte compact */
  .ring-layout {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .ring-wrapper {
    width: 104px;
    height: 104px;
  }
  .ring-big {
    font-size: 1.55rem;
  }
  .ring-sub {
    font-size: 0.68rem;
  }
  .ring-stats {
    flex: 1;
    min-width: 0;
  }
  .stat-line {
    font-size: 0.8rem;
    gap: 8px;
    align-items: baseline;
  }
  .stat-line strong {
    text-align: right;
    white-space: nowrap;
  }

  /* Macros sur 1 colonne lisible */
  .macros-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Hydratation 3 boutons & formulaire sport 2 lignes */
  .water-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .water-actions .btn {
    padding: 8px 6px;
    font-size: 0.76rem;
    white-space: nowrap;
  }
  .activity-inline-form {
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
  }
  .activity-inline-form #act-type {
    grid-column: 1 / -1;
  }

  /* Repas & cibles tactiles */
  .meals-section-header {
    gap: 8px;
    flex-wrap: wrap;
  }
  .meal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .meal-header > div:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .meal-item-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }
  .meal-item-right {
    justify-content: flex-end;
    width: 100%;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
  }
  .meal-item-right .sp-pill {
    margin-right: auto;
  }
  .row-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Sous-onglets & filtres enseignes en rubans horizontaux */
  .subtab-bar,
  .store-filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .subtab-bar::-webkit-scrollbar,
  .store-filter-bar::-webkit-scrollbar {
    display: none;
  }
  .subtab-btn,
  .store-pill {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .select-compact,
  .input-barcode,
  .filter-bar .btn {
    max-width: 100%;
    width: 100%;
  }

  /* Grilles formulaires & poids */
  .form-row-2,
  .form-row-3,
  .form-row-4,
  .weight-form {
    grid-template-columns: 1fr;
  }
  .weight-kpis,
  .admin-stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Anti-zoom clavier iOS Safari / Chrome Mobile */
  .input,
  .date-input,
  .input-num-sm {
    font-size: 16px;
  }

  /* Modales en Bottom Sheet ergonomique */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-card {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  }

  /* Toasts au-dessus du FAB / barre nav mobile */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}
