:root { --primary: #e11d48; --bg: #fff1f2; --card: #ffffff; --text: #881337; }
body { font-family: -apple-system, sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 10px; padding-bottom: 80px; }
.container { max-width: 600px; margin: 0 auto; }

.tabs { display: flex; gap: 8px; margin-bottom: 15px; position: sticky; top: 0; z-index: 10; background: var(--bg); padding-top: 5px; flex-wrap: wrap; }
.tab { flex: 1; min-width: 90px; padding: 12px; text-align: center; background: #fb7185; color: white; border-radius: 12px; font-weight: bold; cursor: pointer; opacity: 0.6; border: none; font-size: 0.85rem; }
.tab.active { opacity: 1; background: var(--primary); }

.tab-panel.hidden { display: none; }

.card { background: var(--card); padding: 15px; border-radius: 16px; box-shadow: 0 4px 12px rgba(225, 29, 72, 0.08); margin-bottom: 15px; border: 1px solid #fecdd3; }
.section-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 12px; display: block; color: var(--primary); border-left: 4px solid var(--primary); padding-left: 10px; }

.config-row { display: flex; gap: 10px; margin-bottom: 15px; }
.config-group { flex: 1; }
.config-group label { font-size: 0.8rem; font-weight: bold; display: block; margin-bottom: 4px; }

.item-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #ffe4e6; gap: 10px; }
.recipe-meta { font-size: 0.78rem; color: #9f6b78; margin-top: 2px; }
.recipe-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.recipe-photo-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; margin: 4px 0 8px; }

.btn-icon { background: #fff0f5; border: none; font-size: 1.2rem; cursor: pointer; padding: 8px; border-radius: 50%; color: var(--primary); width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-icon-sm { width: 30px; height: 30px; font-size: 0.9rem; }

.recap-item { padding: 12px 0; border-bottom: 1px dashed #fecdd3; }
.recipe-ings { font-size: 0.85rem; color: #666; font-style: italic; margin-top: 4px; }
.prep-link { color: var(--primary); font-size: 0.85rem; font-weight: bold; text-decoration: none; display: inline-block; margin-top: 6px; }

.shopping-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #ffe4e6; cursor: pointer; }
.shopping-row input { width: 20px; height: 20px; margin-right: 12px; accent-color: var(--primary); flex-shrink: 0; }
.shopping-recipe-names { font-size: 0.78rem; color: #9f6b78; margin-top: 2px; }
.checked { text-decoration: line-through; opacity: 0.5; }

input, textarea, select { width: 100%; padding: 12px; margin: 8px 0; border: 1px solid #fecdd3; border-radius: 10px; box-sizing: border-box; font-size: 1rem; font-family: inherit; }

.btn { background: var(--primary); color: white; border: none; padding: 15px; border-radius: 12px; font-weight: bold; width: 100%; cursor: pointer; font-size: 1rem; }
.btn-secondary { background: #6b7280; margin-top: 10px; }
.btn-sm { padding: 8px 12px; font-size: 0.85rem; width: auto; border-radius: 8px; }

#loader { text-align: center; color: var(--primary); padding: 10px; display: none; }
.hidden { display: none !important; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-content { background: white; width: 90%; max-width: 400px; padding: 20px; border-radius: 16px; max-height: 80vh; overflow-y: auto; }

/* Nutri Stats */
.nutri-tag { padding: 2px 6px; border-radius: 4px; color: white; font-weight: bold; font-size: 0.75rem; text-transform: uppercase; }
.status-ok { background: #10b981; }
.status-warn { background: #f59e0b; }
.status-alert { background: #ef4444; }

/* --- Formulaire recette (admin) --- */
.field-label { font-size: 0.85rem; font-weight: bold; display: block; margin: 14px 0 4px; color: var(--text); }
.field-hint { font-size: 0.8rem; color: #9f6b78; margin: 4px 0 10px; }
.field-group { border: 1px solid #fecdd3; border-radius: 10px; padding: 10px 14px; margin: 10px 0; background: #fffafa; }
.field-group summary { font-weight: bold; cursor: pointer; color: var(--primary); }
.field-group input, .field-group select { margin-top: 8px; }

.radio-row { display: flex; gap: 16px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.radio-row label { font-size: 0.9rem; }
.radio-row input { width: auto; margin: 0 4px 0 0; }

.ingredient-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.ingredient-row input, .ingredient-row select { margin: 0; }

.chip-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chip { border: 1px solid var(--primary); background: white; color: var(--primary); border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; cursor: pointer; }
.chip-active, .checkbox-chip.chip-active { background: var(--primary); color: white; }
.checkbox-chip { display: inline-flex; align-items: center; border: 1px solid var(--primary); background: white; color: var(--primary); border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; cursor: pointer; }

.inline-add { display: flex; gap: 6px; align-items: center; flex: 1; min-width: 160px; }
.inline-add input { margin: 0; }

.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.form-actions .btn, .form-actions .btn-secondary { width: auto; flex: 1; margin-top: 0; }

/* --- Planning --- */
.day-block { margin-bottom: 14px; }
.day-label { font-size: 0.8rem; font-weight: bold; color: #9f6b78; text-transform: uppercase; margin-bottom: 6px; }
.meal-cell { background: #fff0f5; border: 1px solid #fecdd3; border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; cursor: pointer; position: relative; overflow: hidden; }
.meal-cell-label { font-size: 0.72rem; font-weight: bold; color: var(--primary); text-transform: uppercase; position: relative; z-index: 1; }
.meal-cell-content { font-size: 0.95rem; margin-top: 2px; position: relative; z-index: 1; }
.meal-cell-merged { background: #ffe4e6; border-color: var(--primary); }
.meal-cell-with-photo { padding-left: 58px; min-height: 44px; }
.meal-cell-thumb { position: absolute; left: 0; top: 0; width: 46px; height: 100%; object-fit: cover; }
.meal-cell-with-photo .meal-cell-label,
.meal-cell-with-photo .meal-cell-content { color: var(--text); }
.meal-cell-split { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; font-size: 0.8rem; }
.meal-cell-readonly { cursor: default; }
.meal-cell-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; z-index: 1; }
.meal-cell-actions .btn-icon-sm { width: 28px; height: 28px; font-size: 0.8rem; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.meal-cell-has-actions .meal-cell-label,
.meal-cell-has-actions .meal-cell-content { padding-right: 100px; }
.meal-cell-skipped { background: #f3f4f6; border-color: #d1d5db; }
.meal-cell-skipped .meal-cell-content { color: #6b7280; font-style: italic; }

/* --- Swipe --- */
.swipe-target { font-weight: bold; color: var(--primary); background: #fff0f5; border: 1px solid #fecdd3; border-radius: 10px; padding: 8px 12px; margin: 8px 0 4px; }
.swipe-deck-container { position: relative; height: 380px; margin: 12px 0; }
.swipe-card {
  position: absolute; inset: 0; background: white; border: 1px solid #fecdd3; border-radius: 20px;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.15); display: flex; flex-direction: column; justify-content: center;
  padding: 24px; box-sizing: border-box; user-select: none; cursor: grab;
}
.swipe-card.dragging { cursor: grabbing; transition: none; }
.swipe-card-inner { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; }
.swipe-card-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.swipe-card-meta { font-size: 0.9rem; color: #9f6b78; }
.swipe-card-allergens { font-size: 0.8rem; color: #b45309; background: #fef3c7; padding: 4px 10px; border-radius: 999px; }
.swipe-card-hint { font-size: 0.8rem; font-weight: bold; color: var(--primary); background: #fff0f5; padding: 4px 10px; border-radius: 999px; }
.swipe-card-overlay .swipe-card-hint { color: white; background: rgba(225,29,72,0.55); }

.swipe-card:has(.swipe-card-photo) { padding: 0; overflow: hidden; justify-content: flex-end; }
.swipe-card-photo { position: relative; width: 100%; height: 100%; }
.swipe-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.swipe-card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 20px 20px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), rgba(0,0,0,0));
  display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center;
}
.swipe-card-overlay .swipe-card-title { color: white; }
.swipe-card-overlay .swipe-card-meta { color: #ffe4e6; }
.swipe-card-overlay .chip { background: rgba(255,255,255,0.15); color: white; border-color: rgba(255,255,255,0.4); }
.swipe-badge {
  position: absolute; top: 24px; padding: 8px 16px; border: 4px solid; border-radius: 10px;
  font-weight: 900; font-size: 1.3rem; text-transform: uppercase; opacity: 0; pointer-events: none;
}
.swipe-badge-like { left: 20px; color: #10b981; border-color: #10b981; transform: rotate(-15deg); }
.swipe-badge-pass { right: 20px; color: #ef4444; border-color: #ef4444; transform: rotate(15deg); }
.swipe-controls { display: flex; justify-content: center; gap: 24px; margin-top: 10px; }
.swipe-controls .btn-icon { width: 60px; height: 60px; font-size: 1.6rem; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.swipe-empty { text-align: center; padding: 40px 20px; color: #9f6b78; }

/* --- Résumé nutritionnel --- */
.nutri-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 12px; padding: 14px; font-size: 0.95rem; }
.nutri-tag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 14px; font-size: 0.9rem; }

/* --- Bannières PWA / notifications --- */
.install-banner {
  position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 200; max-width: 580px; margin: 0 auto;
  background: var(--text); color: white; border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; font-size: 0.85rem; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.install-banner span { flex: 1; }
.install-banner button { background: rgba(255,255,255,0.15); color: white; border: none; border-radius: 8px; padding: 6px 10px; cursor: pointer; flex-shrink: 0; }
.install-banner .btn { width: auto; margin: 0; padding: 6px 12px; }
