* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #F6F8F7 0%, #EAF7EF 40%, #D5F0E0 100%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  position: relative;
  overflow-x: hidden;
  color: #16241D;
  -webkit-tap-highlight-color: transparent;
}
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(50px);
  z-index: 0;
  pointer-events: none;
}
.blob-1 { width: 320px; height: 320px; background: #8FD3A8; top: -5%; left: -15%; opacity: 0.4; }
.blob-2 { width: 280px; height: 280px; background: #8FD3A8; bottom: 10%; right: -10%; opacity: 0.45; }

.container { width: 100%; max-width: 384px; margin: 0 auto; position: relative; z-index: 1; padding-top: 16px; padding-bottom: 80px; }

.serif { font-family: 'Inter', system-ui, -apple-system, sans-serif; }
.serif-i { font-family: 'Inter', system-ui, -apple-system, sans-serif; font-style: italic; }
.tabular { font-variant-numeric: tabular-nums; }

/* HEADER */
.header {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark-link {
  text-decoration: none;
  color: inherit;
  display: inline-block;
  transition: opacity 0.15s;
}
.wordmark-link:hover { opacity: 0.75; }
.wordmark-link:active { opacity: 0.55; }
.wordmark {
  font-weight: 700;
  letter-spacing: -0.035em;
  font-size: 1.75rem;
  line-height: 1;
}
.wordmark .dot {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  color: #16A34A;
  font-weight: 400;
}
.save-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: #5C6B63;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
}
.save-indicator.visible { opacity: 1; }
.save-indicator .dot-saved {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16A34A;
}

/* TABS */
.tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid rgba(26, 15, 8, 0.05);
  backdrop-filter: blur(8px);
}
.tab {
  flex: 1;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 10px 5px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #5C6B63;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab.active {
  background: #FFFFFF;
  color: #16241D;
  box-shadow: 0 2px 8px -2px rgba(26, 15, 8, 0.12);
}

/* RECIPE TOOLBAR (new recipe + history buttons at top) */
.recipe-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.btn-new-recipe {
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  cursor: pointer;
  box-shadow: 0 8px 18px -6px rgba(255, 91, 58, 0.5);
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-new-recipe:active { transform: translateY(1px); }
.btn-history {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid rgba(26, 15, 8, 0.1);
  background: #FFFFFF;
  color: #16241D;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.btn-history:active { background: #F6F8F7; }
.btn-history .history-badge {
  background: #16A34A;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* STEP HEADERS */
.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 4px 10px 4px;
}
.step-header:first-of-type { margin-top: 0; }
.step-number {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #16241D;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.step-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 1.25rem;
  color: #16241D;
}

/* TAGLINE */
.tagline {
  margin-bottom: 18px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.625rem;
  line-height: 1.2;
}
.tagline em { font-style: italic; color: #16A34A; }

/* CARD */
.card {
  background: #FFFFFF;
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 50px -15px rgba(255, 91, 58, 0.18), 0 4px 20px -8px rgba(26, 15, 8, 0.08);
}
.field { margin-bottom: 20px; }
.field:last-of-type { margin-bottom: 24px; }
.label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: #5C6B63;
  letter-spacing: 0.08em;
}

/* INPUT BOXES */
.input-box {
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 1.5px solid;
  transition: border-color 0.15s;
}
.input-box.peach { background: #F6F8F7; border-color: #EAF7EF; }
.input-box.mint { background: #F0FDF4; border-color: #DCFCE7; }
.input-box:focus-within { border-color: #16A34A; }
.input-box.mint:focus-within { border-color: #16A34A; }
.input-box input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.875rem;
  color: #16241D;
  font-variant-numeric: tabular-nums;
  width: 100%;
}
.input-box .unit {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
}
.input-box .unit.orange { color: #16A34A; }
.input-box .unit.green { color: #16A34A; }

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* TVA BUTTONS */
.tva-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tva-btn {
  font-family: inherit;
  padding: 14px 8px;
  border-radius: 16px;
  background: #F6F8F7;
  border: 1.5px solid #E8ECEA;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.tva-btn .tva-label {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.25rem;
  line-height: 1;
  color: #16241D;
}
.tva-btn.active { transform: translateY(-1px); }
.tva-btn.active .tva-label { color: #FFFFFF; }
.tva-btn[data-color="green"].active { background: #16A34A; border-color: #16A34A; box-shadow: 0 8px 18px -5px rgba(22, 163, 74, 0.4); }
.tva-btn[data-color="yellow"].active { background: #FACC15; border-color: #FACC15; box-shadow: 0 8px 18px -5px rgba(250, 204, 21, 0.45); }
.tva-btn[data-color="yellow"].active .tva-label { color: #16241D; }
.tva-btn[data-color="purple"].active { background: #7C3AED; border-color: #7C3AED; box-shadow: 0 8px 18px -5px rgba(124, 58, 237, 0.4); }

/* SIMULATE BUTTON */
.btn-simulate {
  width: 100%;
  font-family: inherit;
  padding: 16px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border: none;
  transition: all 0.2s;
  cursor: not-allowed;
  background: #F1F5F2;
  color: #BDB3A8;
}
.btn-simulate.enabled {
  background: linear-gradient(135deg, #16241D 0%, #2D1810 100%);
  color: #FFFFFF;
  cursor: pointer;
  box-shadow: 0 10px 25px -8px rgba(26, 15, 8, 0.4);
}
.btn-simulate.enabled:active { transform: translateY(1px); }

/* RESULT CARD */
.result {
  border-radius: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  box-shadow: 0 14px 32px -10px rgba(255, 91, 58, 0.55);
  animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.15em;
  text-align: center;
  margin-bottom: 6px;
}
.result-value {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: clamp(2.5rem, 11vw, 3.25rem);
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  margin-bottom: 18px;
  white-space: nowrap;
}
.result-value .euro {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: clamp(1.5rem, 7vw, 2rem);
  color: rgba(255,255,255,0.9);
  margin-left: 6px;
}
.result-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.22);
}
.result-detail { text-align: center; min-width: 0; overflow: hidden; }
.result-detail .detail-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.result-detail .detail-value {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: clamp(1rem, 4.2vw, 1.5rem);
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  white-space: nowrap;
}

.error-msg {
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  background: #FEF2F2;
  color: #DC2626;
  border: 1.5px solid #FECACA;
}

/* RECIPE NAME BOX */
.recipe-name-box {
  background: #FFFFFF;
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 8px;
  box-shadow: 0 8px 24px -10px rgba(26, 15, 8, 0.08);
}
.recipe-name-box .label { display: block; margin-bottom: 6px; }
.recipe-name-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  color: #16241D;
}
.recipe-name-input::placeholder { color: #BDB3A8; font-style: italic; }

/* INGREDIENT CARD */
.ingredient-card {
  background: #FFFFFF;
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px -6px rgba(26, 15, 8, 0.08);
  animation: fadeUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.ingredient-card::before {
  content: attr(data-index);
  position: absolute;
  top: 14px;
  left: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #16A34A;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px -2px rgba(255, 91, 58, 0.5);
}
.ingredient-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-left: 14px;
}
.ingredient-name-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.ingredient-name {
  width: 100%;
  min-width: 0;
  border: 1.5px solid #E8ECEA;
  outline: none;
  background: #F6F8F7;
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #16241D;
  transition: border-color 0.15s, background 0.15s;
}
.ingredient-name:focus { border-color: #16A34A; background: #FFFFFF; }
.ingredient-name::placeholder { color: #BDB3A8; font-weight: 400; }

/* Liste de suggestions (autocomplétion bibliothèque) */
.ingredient-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  border-radius: 12px;
  box-shadow: 0 12px 28px -8px rgba(26, 15, 8, 0.25);
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
}
.ing-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  border-bottom: 1px solid #F1F5F2;
  transition: background 0.12s;
}
.ing-suggestion:last-child { border-bottom: none; }
.ing-suggestion:hover { background: #F6F8F7; }
.ing-sugg-name {
  font-size: 14px;
  font-weight: 600;
  color: #16241D;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ing-sugg-price {
  font-size: 12px;
  font-weight: 600;
  color: #16A34A;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.btn-delete {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid #FECACA;
  background: #FEF2F2;
  color: #DC2626;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-delete:active { transform: scale(0.95); background: #FEE2E2; }

.ingredient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.mini-field { position: relative; }
.mini-field .mini-label {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 600;
  color: #5C6B63;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
  padding-left: 2px;
}
.mini-input, .mini-select {
  width: 100%;
  border: 1.5px solid #E8ECEA;
  background: #F6F8F7;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  color: #16241D;
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, background 0.15s;
}
.mini-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2378615C' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 26px;
}
.mini-input:focus, .mini-select:focus { border-color: #16A34A; background: #FFFFFF; }

.tva-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.tva-mini-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 8px;
  background: #F6F8F7;
  border: 1.5px solid #E8ECEA;
  color: #5C6B63;
  cursor: pointer;
  transition: all 0.15s;
}
.tva-mini-btn[data-color="green"].active { background: #16A34A; border-color: #16A34A; color: #FFFFFF; }
.tva-mini-btn[data-color="yellow"].active { background: #FACC15; border-color: #FACC15; color: #16241D; }
.tva-mini-btn[data-color="purple"].active { background: #7C3AED; border-color: #7C3AED; color: #FFFFFF; }

/* Dual TVA layout (achat + vente) */
.tva-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.tva-dual .mini-label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tva-custom-badge {
  font-size: 8px;
  background: #16A34A;
  color: #FFFFFF;
  padding: 1px 5px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tva-reset-link {
  font-size: 9px;
  color: #16A34A;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  padding-left: 4px;
}

.ingredient-cost {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #E8ECEA;
}
.ingredient-cost .cost-cell { text-align: left; }
.ingredient-cost .cost-cell:last-child { text-align: right; }
.ingredient-cost .cost-label {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  color: #5C6B63;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.ingredient-cost .cost-value {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.25rem;
  color: #16241D;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ingredient-cost .cost-value.accent { color: #16A34A; }

.unit-warning {
  margin-top: 10px;
  padding: 8px 12px;
  background: #F1F5F2;
  border: 1.5px solid #FED7AA;
  border-radius: 10px;
  font-size: 12px;
  color: #166534;
  font-weight: 500;
}

.btn-add-ingredient {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  border: 2px dashed #8FD3A8;
  background: rgba(255, 248, 242, 0.6);
  color: #16A34A;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}
.btn-add-ingredient:active { transform: translateY(1px); background: rgba(255, 248, 242, 0.9); }

/* COST SUMMARY (dark card) */
.cost-summary {
  background: linear-gradient(135deg, #16241D 0%, #2D1810 100%);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 12px 30px -10px rgba(26, 15, 8, 0.4);
  color: #FFFFFF;
}
.cost-summary .summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 0;
}
.cost-summary .summary-row + .summary-row {
  border-top: 1px solid rgba(255,255,255,0.12);
}
.cost-summary .row-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cost-summary .row-value {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}
.cost-summary .summary-row.highlight .row-label {
  color: #FFFFFF;
  font-weight: 700;
}
.cost-summary .summary-row.highlight .row-value {
  color: #FACC15;
  font-size: 2rem;
}

/* TVA BREAKDOWN (now at bottom) */
.breakdown-card {
  background: #FFFFFF;
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px -6px rgba(26, 15, 8, 0.08);
}
.breakdown-header { margin-bottom: 10px; }
.breakdown-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 1.125rem;
  color: #16241D;
}
.tva-breakdown-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.tva-breakdown-row + .tva-breakdown-row { border-top: 1px solid #F1F5F2; }
.tva-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  min-width: 50px;
  text-align: center;
}
.tva-pill[data-color="green"]  { background: #DCFCE7; color: #16A34A; }
.tva-pill[data-color="yellow"] { background: #FEF3C7; color: #92400E; }
.tva-pill[data-color="purple"] { background: #EDE9FE; color: #7C3AED; }
.tva-breakdown-amounts {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}
.tva-breakdown-amounts .tva-amount {
  font-size: 11px;
  color: #5C6B63;
  font-weight: 500;
}
.tva-breakdown-amounts .tva-amount strong {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 1rem;
  color: #16241D;
  margin-left: 2px;
}

/* MARGIN SECTION */
.margin-section {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFFFFF 100%);
  border: 1px solid #EAF7EF;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px -6px rgba(255, 91, 58, 0.1);
}

/* Big "save and new" button at bottom */
.btn-new-recipe-bottom {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 18px 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  cursor: pointer;
  box-shadow: 0 12px 28px -8px rgba(255, 91, 58, 0.55);
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.btn-new-recipe-bottom:active { transform: translateY(2px); box-shadow: 0 6px 18px -6px rgba(255, 91, 58, 0.5); }
.btn-new-recipe-bottom:disabled {
  background: #F1F5F2;
  color: #BDB3A8;
  cursor: not-allowed;
  box-shadow: none;
}

/* Save recipe button (after simulation) */
.btn-save-recipe {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid #16A34A;
  background: #F0FDF4;
  color: #16A34A;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-save-recipe:active { transform: translateY(1px); background: #DCFCE7; }
.btn-save-recipe.saved { background: #16A34A; color: #FFFFFF; cursor: default; }

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: #BDB3A8;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 1.125rem;
  background: rgba(255,255,255,0.5);
  border: 1px dashed #E8ECEA;
  border-radius: 14px;
}

/* MODAL (history) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 15, 8, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal {
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  max-height: 85dvh; /* dvh = dynamic viewport height, prend en compte la barre d'adresse mobile et le clavier */
  background: linear-gradient(180deg, #F6F8F7 0%, #FFFFFF 100%);
  border-radius: 14px 24px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  animation: slideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  box-shadow: 0 -20px 50px -10px rgba(26, 15, 8, 0.3);
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: #DCE2DF;
  border-radius: 999px;
  margin: 0 auto 16px;
}
.modal-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 1.5rem;
  color: #16241D;
}
.modal-close {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 14px;
  color: #5C6B63;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:active { background: rgba(0,0,0,0.05); }

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: #BDB3A8;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
}

.history-item {
  background: #FFFFFF;
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.history-item:active {
  transform: translateY(1px);
  background: #F6F8F7;
}
.history-item-content {
  flex: 1;
  min-width: 0;
}
.history-item-name {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.25rem;
  color: #16241D;
  line-height: 1.2;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-meta {
  font-size: 11px;
  color: #5C6B63;
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-item-meta .dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #BDB3A8;
}
.history-marge-badge {
  background: #DCFCE7;
  color: #16A34A;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.history-item-cost {
  flex-shrink: 0;
  text-align: right;
}
.history-item-cost .cost-amount {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.125rem;
  color: #16A34A;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.history-item-cost .cost-label {
  font-size: 9px;
  color: #5C6B63;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.history-item-delete {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #FECACA;
  background: #FEF2F2;
  color: #DC2626;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-item-delete:active { background: #FEE2E2; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #16241D;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.4);
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast .toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16A34A;
}

/* ============ REVERSE TAB STYLES ============ */
.reverse-intro {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 91, 58, 0.15);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}
.reverse-intro-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(255, 91, 58, 0.5);
  transform: rotate(-8deg);
}
.reverse-intro-text { flex: 1; min-width: 0; }
.reverse-intro-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  line-height: 1.15;
  color: #16241D;
  margin: 0 0 4px 0;
}
.reverse-intro-title em { font-style: italic; color: #16A34A; }
.reverse-intro-subtitle {
  font-size: 12px;
  color: #5C6B63;
  line-height: 1.4;
  margin: 0;
}

/* Reverse step layout: small number + content (lighter than recipe steps) */
.reverse-step {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}
.reverse-step:last-of-type { margin-bottom: 22px; }
.reverse-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #F1F5F2;
  color: #5C6B63;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.reverse-step-content { flex: 1; min-width: 0; }
.reverse-step-hint {
  font-size: 11px;
  color: #BDB3A8;
  margin-top: 2px;
  font-style: italic;
}

/* Reverse result: subtle visual cue that it's "reversed" */
.reverse-result {
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  position: relative;
}
.reverse-context-pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0 auto 10px;
  text-align: center;
  font-weight: 500;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.reverse-context-pill strong {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.reverse-result {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.reverse-result .result-label,
.reverse-result .result-value,
.reverse-result .result-details {
  width: 100%;
}

/* ============ RESPONSIVE: very small screens ============ */
@media (max-width: 380px) {
  .container { padding-top: 12px; }
  .wordmark { font-size: 1.5rem; }
  .tab { font-size: 11px; padding: 9px 6px; letter-spacing: -0.01em; }
  .reverse-intro { padding: 14px; gap: 12px; }
  .reverse-intro-icon { width: 38px; height: 38px; font-size: 1.25rem; }
  .reverse-intro-title { font-size: 1.3rem; }
  .reverse-intro-subtitle { font-size: 11px; }
  .card { padding: 20px 18px; }
  .input-box { padding: 11px 14px; }
  .input-box input { font-size: 1.625rem; }
  .input-box .unit { font-size: 1.375rem; }
  .tva-btn { padding: 12px 6px; }
  .tva-btn .tva-label { font-size: 1.125rem; }
  .result { padding: 18px 16px; }
  .reverse-context-pill { font-size: 10px; padding: 4px 10px; }
  .reverse-context-pill strong { font-size: 12px; }
}

/* Even smaller: under 340px */
@media (max-width: 340px) {
  .tab { font-size: 10px; padding: 8px 4px; }
}

/* ============ DARK MODE ============ */{
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #E8ECEA;
}{ padding-top: 4px; }

/* SEO content section */
.seo-section {
  margin-top: 48px;
  padding: 28px 24px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}
.seo-h2 {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 1.625rem;
  font-weight: normal;
  color: #16241D;
  margin-bottom: 12px;
  line-height: 1.2;
}
.seo-h2 em { color: #16A34A; }
.seo-h3 {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  color: #16241D;
  margin: 22px 0 8px 0;
  line-height: 1.3;
}
.seo-section p {
  font-size: 14px;
  line-height: 1.6;
  color: #3D2E26;
  margin-bottom: 12px;
}
.seo-section p strong { color: #16241D; font-weight: 600; }
.seo-section em { font-style: italic; color: #5A4A40; }
.seo-intro {
  margin-bottom: 20px;
}

/* Accordion items inside SEO section */
.seo-accordion {
  background: #FFFFFF;
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 16px;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px -8px rgba(255, 91, 58, 0.08);
}
.seo-accordion summary {
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.15s;
}
.seo-accordion summary::-webkit-details-marker { display: none; }
.seo-accordion summary:hover { background: #F6F8F7; }
.seo-accordion-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.125rem;
  color: #16241D;
  line-height: 1.3;
  flex: 1;
}
.seo-accordion summary::after {
  content: "+";
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #EAF7EF;
  color: #16A34A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.15s;
}
.seo-accordion[open] summary::after {
  content: "−";
  background: #16A34A;
  color: #FFFFFF;
  transform: rotate(180deg);
}
.seo-accordion-content {
  padding: 0 18px 16px 18px;
  animation: accordionOpen 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes accordionOpen {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.seo-accordion-content p {
  font-size: 14px;
  line-height: 1.65;
  color: #3D2E26;
  margin-bottom: 0;
}
.seo-accordion-content p strong { color: #16241D; font-weight: 600; }
.seo-accordion-content em { font-style: italic; color: #5A4A40; }
.seo-list { list-style: none; padding: 0; margin: 0; }
.seo-list li {
  font-size: 14px;
  line-height: 1.6;
  color: #3D2E26;
  padding: 8px 0 8px 24px;
  position: relative;
  border-bottom: 1px solid rgba(26, 15, 8, 0.05);
}
.seo-list li:last-child { border-bottom: none; }
.seo-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 8px;
  color: #16A34A;
  font-weight: 700;
}

/* Legal collapsibles */
.legal-block {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(26, 15, 8, 0.06);
  border-radius: 16px;
  overflow: hidden;
}
.legal-block summary {
  padding: 14px 20px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #16241D;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}
.legal-block summary::-webkit-details-marker { display: none; }
.legal-block summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: #5C6B63;
}
.legal-block[open] summary::after { content: "−"; }
.legal-block summary:hover { background: rgba(255, 255, 255, 0.3); }
.legal-content { padding: 0 20px 16px 20px; }
.legal-content p {
  font-size: 12px;
  line-height: 1.6;
  color: #3D2E26;
  margin-bottom: 8px;
}
.legal-content a {
  color: #16A34A;
  text-decoration: none;
  font-weight: 600;
}
.legal-content a:hover { text-decoration: underline; }

.footer {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: #5C6B63;
}
.footer-credit {
  margin-top: 14px;
  font-size: 11px;
  color: #5C6B63;
}.footer em { font-family: 'Inter', system-ui, -apple-system, sans-serif; font-style: italic; }
.hidden { display: none !important; }

/* ============ RESPONSIVE PROGRESSIVE ============ */
/* Mobile par défaut : max-width 384px (comportement existant) */

/* --- TABLETTE PORTRAIT (≥ 600px) --- */
@media (min-width: 600px) {
  .container {
    max-width: 560px;
    padding-top: 32px;
  }
  body { padding: 24px; }
  .blob-1 { width: 420px; height: 420px; top: -8%; left: -8%; }
  .blob-2 { width: 380px; height: 380px; bottom: 8%; right: -5%; }

  /* Header & title */
  .wordmark { font-size: 2rem; }

  /* Tagline plus généreuse */
  .tagline { font-size: 2rem; margin-bottom: 24px; }

  /* Cards plus aérées */
  .card { padding: 32px; border-radius: 16px; }
  .field { margin-bottom: 24px; }
  .input-box { padding: 14px 20px; border-radius: 14px; }
  .input-box input { font-size: 2.125rem; }
  .input-box .unit { font-size: 1.75rem; }

  /* Boutons TVA plus grands */
  .tva-btn { padding: 16px 10px; border-radius: 14px; }
  .tva-btn .tva-label { font-size: 1.375rem; }

  /* Result card */
  .result { padding: 28px 24px; border-radius: 14px; }

  /* Tabs plus larges et lisibles */
  .tab { font-size: 14px; padding: 12px 16px; }

  /* Recipe name input */
  .recipe-name-input { font-size: 1.75rem; }

  /* Ingredient cards */
  .ingredient-card { padding: 18px; border-radius: 14px; }
  .ingredient-name { padding: 11px 14px; font-size: 15px; }
  .mini-input, .mini-select { padding: 10px 12px; font-size: 15px; }

  /* Step header */
  .step-title { font-size: 1.5rem; }
  .step-number { width: 28px; height: 28px; font-size: 14px; }

  /* Reverse intro */
  .reverse-intro { padding: 20px 22px; }
  .reverse-intro-icon { width: 50px; height: 50px; font-size: 1.75rem; }
  .reverse-intro-title { font-size: 1.75rem; }
  .reverse-intro-subtitle { font-size: 13px; }

  /* SEO */
  .seo-section { padding: 36px 32px; border-radius: 16px; }
  .seo-h2 { font-size: 2rem; }
  .seo-intro { font-size: 15px; line-height: 1.7; }
  .seo-accordion { border-radius: 14px; margin-bottom: 12px; }
  .seo-accordion summary { padding: 16px 22px; }
  .seo-accordion-title { font-size: 1.25rem; }
  .seo-accordion-content { padding: 0 22px 18px 22px; }
  .seo-accordion-content p { font-size: 15px; line-height: 1.7; }

  /* Legal */
  .legal-block summary { padding: 16px 24px; font-size: 14px; }
  .legal-content { padding: 0 24px 18px 24px; }

  /* Modales */
  .modal { max-width: 520px; padding: 28px; }

  /* Buttons */
  .btn-simulate { padding: 18px; font-size: 15px; }
  .btn-new-recipe-bottom { padding: 20px 18px; font-size: 15px; }
}

/* --- DESKTOP (≥ 900px) --- */
@media (min-width: 900px) {
  .container {
    max-width: 680px;
    padding-top: 48px;
  }
  body { padding: 32px; }
  .blob-1 { width: 520px; height: 520px; opacity: 0.35; }
  .blob-2 { width: 460px; height: 460px; opacity: 0.4; }

  /* Header */
  .wordmark { font-size: 2.25rem; }

  /* Tagline qui devient un hero */
  .tagline { font-size: 2.5rem; margin-bottom: 32px; line-height: 1.1; }

  /* Cards */
  .card { padding: 40px; }

  /* Inputs */
  .input-box input { font-size: 2.5rem; }
  .input-box .unit { font-size: 2rem; }

  /* TVA buttons deviennent vraiment généreux */
  .tva-btn { padding: 18px 10px; }
  .tva-btn .tva-label { font-size: 1.5rem; }

  /* Result plus imposant */
  .result { padding: 32px 28px; }

  /* Reverse */
  .reverse-intro { padding: 24px 28px; gap: 18px; }
  .reverse-intro-icon { width: 56px; height: 56px; font-size: 2rem; border-radius: 16px; }
  .reverse-intro-title { font-size: 2rem; }
  .reverse-intro-subtitle { font-size: 14px; }

  /* SEO hero plus fort */
  .seo-section { padding: 44px 40px; }
  .seo-h2 { font-size: 2.25rem; }
  .seo-intro { font-size: 16px; }
  .seo-accordion summary { padding: 18px 24px; }
  .seo-accordion-title { font-size: 1.375rem; }
  .seo-accordion-content p { font-size: 15px; }

  /* Recipe specific */
  .recipe-toolbar { gap: 10px; }
  .btn-new-recipe { font-size: 14px; padding: 14px 16px; }
  .btn-history { font-size: 14px; padding: 14px 18px; }

  /* Cost summary (carte noire) plus impactante */
  .cost-summary { padding: 24px 28px; border-radius: 14px; }
  .cost-summary .row-value { font-size: 1.75rem; }
  .cost-summary .summary-row.highlight .row-value { font-size: 2.25rem; }

  /* Modal email */
  .modal { max-width: 560px; padding: 32px; }
}

/* --- GRAND DESKTOP (≥ 1200px) --- */
@media (min-width: 1200px) {
  .container {
    max-width: 760px;
    padding-top: 56px;
  }
  .tagline { font-size: 3rem; }
  .seo-h2 { font-size: 2.5rem; }
  .reverse-intro-title { font-size: 2.25rem; }

  /* On laisse respirer davantage les blobs */
  .blob-1 { width: 600px; height: 600px; }
  .blob-2 { width: 520px; height: 520px; }
}

/* --- HOVER STATES (uniquement pour périphériques avec vraie souris) --- */
@media (hover: hover) {
  .tab:not(.active):hover { background: rgba(255, 255, 255, 0.4); }
  .tva-btn:not(.active):hover { background: #E8ECEA; }
  .tva-mini-btn:not(.active):hover { background: #E8ECEA; }
  .btn-add-ingredient:hover { background: rgba(255, 248, 242, 0.9); border-color: #16A34A; }
  .btn-simulate.enabled:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -10px rgba(26, 15, 8, 0.5); }
  .btn-new-recipe:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(255, 91, 58, 0.6); }
  .btn-new-recipe-bottom:hover { transform: translateY(-1px); box-shadow: 0 14px 32px -8px rgba(255, 91, 58, 0.6); }
  .btn-history:hover { background: #F6F8F7; }
  .btn-save-recipe:hover { background: #DCFCE7; }
  .btn-delete:hover { background: #FEE2E2; }
  .ingredient-card:hover { box-shadow: 0 6px 18px -6px rgba(26, 15, 8, 0.12); }
  .history-item:hover { background: #F6F8F7; transform: translateX(2px); }
}
/* ============================================================
   NOUVEAUX STYLES POUR LES 12 FEATURES
   ============================================================ */

/* ----- Portions field (feature #2) ----- */
.recipe-name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: flex-end;
}
.recipe-name-main { min-width: 0; }
.portions-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.portions-input {
  width: 60px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #EAF7EF;
  background: #F6F8F7;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 22px;
  color: #16241D;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.portions-input:focus { border-color: #16A34A; background: #FFFFFF; }

/* ----- Bouton bibliothèque ----- */
.btn-library {
  width: 100%;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px dashed #16A34A;
  background: rgba(255, 91, 58, 0.05);
  color: #16A34A;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
}
.btn-library:hover { background: rgba(255, 91, 58, 0.1); }
.btn-library .lib-icon { font-size: 16px; }

/* ----- Alerte marge (feature #6) ----- */
.margin-warning {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  animation: fadeUp 0.3s ease;
}
.margin-warning.warning {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.margin-warning.danger {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

/* ----- Coût & PV par portion ----- */
.per-portion-card {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
}
.portion-label {
  font-size: 10px;
  color: #5C6B63;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}
.portion-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.portion-cell {
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: #FFFFFF;
}
.portion-cell.portion-highlight {
  background: linear-gradient(135deg, #F6F8F7 0%, #EAF7EF 100%);
  border: 1px solid #D5F0E0;
}
.pc-label {
  font-size: 9px;
  color: #5C6B63;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 4px;
}
.pc-value {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  color: #16241D;
  font-variant-numeric: tabular-nums;
}

/* ----- Actions recette (PDF + partage) ----- */
.recipe-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.btn-action {
  padding: 12px 10px;
  border-radius: 14px;
  border: 1.5px solid #EAF7EF;
  background: #F6F8F7;
  color: #16A34A;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}
.btn-action:hover { background: #EAF7EF; }
.btn-action:active { transform: translateY(1px); }
.btn-action-icon { font-size: 15px; }

/* ----- Historique amélioré ----- */
.history-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0 4px;
}
.history-search-wrap { min-width: 0; }
.history-search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid #EAF7EF;
  background: #F6F8F7;
  font-family: inherit;
  font-size: 13px;
  color: #16241D;
  outline: none;
  transition: all 0.15s;
}
.history-search:focus { border-color: #16A34A; background: #FFFFFF; }
.history-search::placeholder { color: #BDB3A8; }
.history-sort {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid #EAF7EF;
  background: #F6F8F7;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #16241D;
  cursor: pointer;
  outline: none;
}
.history-sort:focus { border-color: #16A34A; }

/* Bouton duplicate dans item d'historique */
.history-item-duplicate {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 91, 58, 0.08);
  color: #16A34A;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  margin-right: 4px;
}
.history-item-duplicate:hover { background: rgba(255, 91, 58, 0.16); }

/* Badge marge en warning */
.history-marge-badge.badge-warning {
  background: #FEE2E2;
  color: #991B1B;
}

/* Modal header actions (bouton comparateur) */
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 91, 58, 0.1);
  color: #16A34A;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-action-btn:hover { background: rgba(255, 91, 58, 0.2); }
.modal-hint {
  font-size: 12px;
  color: #5C6B63;
  margin: 0 4px 14px 4px;
  line-height: 1.5;
}

/* ----- Bibliothèque d'ingrédients ----- */
.library-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  border-radius: 14px;
  margin-bottom: 8px;
}
.lib-main { flex: 1; min-width: 0; }
.lib-name {
  font-weight: 600;
  color: #16241D;
  font-size: 14px;
  margin-bottom: 4px;
}
.lib-meta {
  font-size: 11px;
  color: #5C6B63;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lib-price { font-weight: 600; color: #16A34A; }
.lib-trend {
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
}
.lib-trend.trend-up { background: #FEE2E2; color: #991B1B; }
.lib-trend.trend-down { background: #DCFCE7; color: #166534; }
.lib-usage {
  padding: 2px 8px;
  background: #F6F8F7;
  border-radius: 999px;
  font-size: 10px;
  color: #92400E;
  font-weight: 600;
}
.lib-history-btn, .lib-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.03);
  color: #5C6B63;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.lib-history-btn:hover { background: rgba(255, 91, 58, 0.1); }
.lib-delete-btn:hover { background: #FEE2E2; color: #DC2626; }

/* ----- Comparateur ----- */
.comparator-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.stat-tile {
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.stat-tile.stat-danger { background: #FEE2E2; border-color: #FECACA; }
.stat-label {
  font-size: 9px;
  color: #5C6B63;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-value {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 20px;
  color: #16241D;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-danger .stat-value { color: #991B1B; }
.comp-list { display: flex; flex-direction: column; gap: 8px; }
.comp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.comp-row:hover {
  background: #F6F8F7;
  transform: translateX(2px);
}
.comp-row.comp-warning { border-color: #FECACA; }
.comp-main { flex: 1; min-width: 0; }
.comp-name {
  font-weight: 600;
  color: #16241D;
  font-size: 14px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.comp-meta {
  font-size: 11px;
  color: #5C6B63;
}
.comp-metrics {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.comp-metric {
  text-align: right;
  min-width: 48px;
}
.mlabel {
  font-size: 9px;
  color: #5C6B63;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 2px;
}
.mval {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: #16241D;
  font-variant-numeric: tabular-nums;
}
.mval-success { color: #16A34A; }
.mval-danger { color: #991B1B; font-weight: bold; }
.empty-comparator {
  padding: 40px 20px;
  text-align: center;
  color: #5C6B63;
}

/* ----- Onglet Menu ----- */
.menu-intro {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 20px 8px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  margin-bottom: 16px;
}
.menu-intro-icon {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 4px;
}
.menu-intro-content { min-width: 0; }
.menu-intro-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.75rem;
  font-weight: normal;
  color: #16241D;
  line-height: 1.1;
  margin-bottom: 8px;
}
.menu-intro-title em { font-style: italic; color: #16A34A; }
.menu-intro-subtitle {
  font-size: 13px;
  color: #5C6B63;
  line-height: 1.5;
}
.menu-courses {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.menu-course-slot { min-height: 72px; }
.menu-course-empty {
  width: 100%;
  padding: 18px 16px;
  border-radius: 16px;
  border: 2px dashed #D5F0E0;
  background: rgba(255, 248, 242, 0.5);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
}
.menu-course-empty:hover {
  background: #F6F8F7;
  border-color: #16A34A;
}
.course-empty-label {
  font-size: 11px;
  color: #5C6B63;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 4px;
}
.course-empty-hint {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 16px;
  color: #16A34A;
}
.menu-course-filled {
  position: relative;
  padding: 14px 44px 14px 16px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  cursor: pointer;
  transition: all 0.15s;
}
.menu-course-filled:hover { background: #F6F8F7; }
.course-label {
  font-size: 10px;
  color: #5C6B63;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 4px;
}
.course-recipe-name {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  color: #16241D;
  line-height: 1.2;
  margin-bottom: 6px;
}
.course-recipe-meta {
  font-size: 11px;
  color: #5C6B63;
  display: flex;
  align-items: center;
  gap: 8px;
}
.course-remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: #5C6B63;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.course-remove-btn:hover { background: #FEE2E2; color: #DC2626; }

/* Recipe picker */
.picker-item {
  width: 100%;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  border-radius: 14px;
  margin-bottom: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.picker-item:hover {
  background: #F6F8F7;
  transform: translateX(2px);
}
.picker-item-name {
  font-weight: 600;
  color: #16241D;
  font-size: 14px;
  margin-bottom: 4px;
}
.picker-item-meta {
  font-size: 11px;
  color: #5C6B63;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----- CSS d'impression (feature #7 - Export PDF) ----- */
.print-only {
  position: absolute;
  left: -9999px;
  top: -9999px;
}
@media print {
  body { background: #FFFFFF !important; padding: 0 !important; }
  body > *:not(#printArea) { display: none !important; }
  body.printing > *:not(#printArea) { display: none !important; }
  #printArea {
    display: block !important;
    position: static !important;
    left: 0 !important;
    top: 0 !important;
    padding: 20mm 16mm;
    color: #16241D;
    font-family: 'Inter', Georgia, serif;
    font-size: 11pt;
    line-height: 1.5;
  }
  .pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 12px;
    border-bottom: 2px solid #16A34A;
    margin-bottom: 24px;
  }
  .pdf-brand {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 20pt;
    color: #16241D;
  }
  .pdf-dot { color: #16A34A; font-style: italic; }
  .pdf-date { font-size: 10pt; color: #5C6B63; }
  .pdf-title {
    font-family: 'Inter', Georgia, serif;
    font-style: italic;
    font-size: 32pt;
    color: #16241D;
    margin-bottom: 4px;
  }
  .pdf-sub { font-size: 11pt; color: #5C6B63; margin-bottom: 24px; }
  #printArea h2 {
    font-family: 'Inter', Georgia, serif;
    font-style: italic;
    font-size: 18pt;
    color: #16A34A;
    margin: 24px 0 12px 0;
    font-weight: normal;
  }
  #printArea h3 {
    font-family: 'Inter', Georgia, serif;
    font-size: 14pt;
    color: #16241D;
    margin: 16px 0 8px 0;
    font-weight: normal;
  }
  #printArea table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
  }
  #printArea th, #printArea td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 0.5pt solid #DCE2DF;
    font-size: 10pt;
  }
  #printArea th {
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 8pt;
    color: #5C6B63;
    font-weight: 600;
  }
  .pdf-idx { width: 32px; color: #5C6B63; }
  .pdf-name { font-weight: 500; }
  .pdf-qty { color: #5C6B63; }
  .pdf-cost {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
  }
  .pdf-ing tfoot td {
    background: #F6F8F7;
    padding: 10px 6px;
  }
  .pdf-pv td {
    padding: 8px 6px;
  }
  .pdf-pv td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .pdf-tva td {
    padding: 6px;
  }
  .pdf-tva td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .pdf-footer {
    margin-top: 32px;
    padding-top: 12px;
    border-top: 1px solid #DCE2DF;
    font-size: 9pt;
    color: #5C6B63;
    text-align: center;
    font-style: italic;
  }
}
/* ============================================================
   STYLES COMPTES / DASHBOARD / MULTI-UTILISATEUR
   ============================================================ */

/* ----- Header right ----- */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #EAF7EF;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.15s;
}
.user-chip:active { transform: scale(0.94); }
.chip-avatar {
  color: #FFFFFF;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  font-weight: 500;
}

/* ----- AUTH OVERLAY ----- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(160deg, #F6F8F7 0%, #EAF7EF 45%, #D5F0E0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: #FFFFFF;
  border-radius: 16px;
  padding: 32px 26px;
  box-shadow: 0 30px 70px -20px rgba(255, 91, 58, 0.35);
}
.auth-card-wide { max-width: 440px; }
.auth-brand {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.03em;
  color: #16241D;
  text-align: center;
}
.auth-dot { color: #16A34A; font-family: 'Inter', system-ui, -apple-system, sans-serif; font-style: italic; }
.auth-subtitle {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 22px;
  color: #16A34A;
  text-align: center;
  margin-top: 4px;
  margin-bottom: 12px;
}
.auth-hint {
  font-size: 13px;
  color: #5C6B63;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 24px;
}
.auth-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: #5C6B63;
  margin-bottom: 6px;
  margin-top: 16px;
}
.auth-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid #EAF7EF;
  background: #F6F8F7;
  font-family: inherit;
  font-size: 15px;
  color: #16241D;
  outline: none;
  transition: all 0.15s;
}
.auth-input:focus { border-color: #16A34A; background: #FFFFFF; }
.auth-btn {
  width: 100%;
  margin-top: 24px;
  padding: 15px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(255, 91, 58, 0.5);
  transition: transform 0.15s;
}
.auth-btn:active { transform: translateY(1px); }
.auth-legal {
  font-size: 11px;
  color: #BDB3A8;
  text-align: center;
  margin-top: 16px;
}

/* ----- Profile selection (Netflix-style) ----- */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}
.profile-tile {
  position: relative;
  background: #F6F8F7;
  border: 1.5px solid #EAF7EF;
  border-radius: 14px;
  padding: 20px 12px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}
.profile-tile:hover {
  border-color: #16A34A;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px rgba(255, 91, 58, 0.4);
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 26px;
}
.profile-name {
  font-weight: 600;
  font-size: 14px;
  color: #16241D;
  text-align: center;
}
.profile-role {
  font-size: 11px;
  color: #5C6B63;
}
.profile-lock {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 12px;
}

/* ----- USER MENU ----- */
.um-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 20px;
  border-bottom: 1px solid #F1F5F2;
  margin-bottom: 16px;
}
.um-avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 24px;
}
.um-name { font-weight: 700; font-size: 16px; color: #16241D; }
.um-role { font-size: 12px; color: #5C6B63; margin-top: 2px; }
.um-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.um-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #EAF7EF;
  background: #F6F8F7;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #16241D;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.um-action:hover { background: #EAF7EF; }
.um-action span { font-size: 18px; }
.um-section { margin-top: 8px; }
.um-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: #5C6B63;
  margin-bottom: 10px;
}
.um-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #F6F8F7;
  border-radius: 12px;
  margin-bottom: 8px;
}
.um-member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #EAF7EF;
  color: #16A34A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  flex-shrink: 0;
}
.um-member-info { flex: 1; min-width: 0; }
.um-member-name { font-weight: 600; font-size: 13px; color: #16241D; }
.um-member-role { font-size: 11px; color: #5C6B63; }
.um-member-remove {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(0,0,0,0.04);
  color: #5C6B63;
  font-size: 16px;
  cursor: pointer;
}
.um-member-remove:hover { background: #FEE2E2; color: #DC2626; }
.um-member-you {
  font-size: 10px;
  color: #16A34A;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.um-add-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #16A34A;
  background: rgba(255, 91, 58, 0.05);
  color: #16A34A;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}
.um-add-btn:hover { background: rgba(255, 91, 58, 0.1); }

/* ----- DASHBOARD ----- */
.dash-establishment {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-style: italic;
  font-size: 20px;
  color: #16A34A;
  text-align: center;
  margin-bottom: 16px;
}
.dash-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.dash-kpi {
  background: #F6F8F7;
  border: 1px solid #EAF7EF;
  border-radius: 16px;
  padding: 16px 14px;
  text-align: center;
}
.dash-kpi-primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  border: none;
}
.dash-kpi-primary .kpi-label { color: rgba(255,255,255,0.9); }
.dash-kpi-primary .kpi-value { color: #FFFFFF; }
.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: #5C6B63;
  margin-bottom: 6px;
}
.kpi-value {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 30px;
  color: #16241D;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.dash-kpi-primary .kpi-value { font-size: 38px; }
.dash-alert {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.dash-section { margin-bottom: 20px; }
.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #16241D;
  margin-bottom: 10px;
}
.dash-recipe-list { display: flex; flex-direction: column; gap: 6px; }
.dash-recipe-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.dash-recipe-row:hover { background: #F6F8F7; transform: translateX(2px); }
.dash-recipe-row.dash-warn { border-color: #FECACA; }
.dash-recipe-name { font-weight: 500; font-size: 14px; color: #16241D; }
.dash-recipe-marge {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.text-danger { color: #DC2626; }
.text-success { color: #16A34A; }

/* ----- ACTION LOG ----- */
.log-entry {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #F1F5F2;
}
.log-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #EAF7EF;
  color: #16A34A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  flex-shrink: 0;
}
.log-content { flex: 1; min-width: 0; }
.log-text { font-size: 13px; color: #16241D; line-height: 1.4; }
.log-meta { font-size: 11px; color: #5C6B63; margin-top: 2px; }

/* ----- Read-only mode ----- */
body.read-only .btn-simulate,
body.read-only .btn-add-ingredient,
body.read-only #saveRecipeBtn,
body.read-only .btn-save-recipe,
body.read-only #saveAndNewRecipeBtn {
  opacity: 0.5;
  pointer-events: none;
}

/* ----- FICHE TECHNIQUE (kitchen sheet) - print ----- */
@media print {
  .ks-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 2px solid #16241D;
    margin-bottom: 20px;
  }
  .ks-brand {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 11pt;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #5C6B63;
  }
  .ks-est {
    font-family: 'Inter', Georgia, serif;
    font-style: italic;
    font-size: 16pt;
    color: #16241D;
    margin-top: 2px;
  }
  .ks-date { font-size: 10pt; color: #5C6B63; }
  .ks-title {
    font-family: 'Inter', Georgia, serif;
    font-style: italic;
    font-size: 30pt;
    color: #16241D;
    margin-bottom: 8px;
  }
  .ks-portions-badge {
    display: inline-block;
    background: #16241D;
    color: #FFFFFF;
    padding: 4px 14px;
    border-radius: 999px;
    font-family: 'Inter', sans-serif;
    font-size: 10pt;
    font-weight: 600;
    margin-bottom: 24px;
  }
  .ks-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 28px;
  }
  .ks-table th {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 2px solid #16241D;
    font-family: 'Inter', sans-serif;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #5C6B63;
    font-weight: 600;
  }
  .ks-table td {
    padding: 12px 8px;
    border-bottom: 0.5pt solid #DCE2DF;
    font-size: 12pt;
  }
  .ks-name { font-weight: 500; }
  .ks-qty { font-variant-numeric: tabular-nums; }
  .ks-perportion {
    font-variant-numeric: tabular-nums;
    color: #16A34A;
    font-weight: 600;
  }
  .ks-notes { margin-top: 20px; }
  .ks-notes-title {
    font-family: 'Inter', sans-serif;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #5C6B63;
    font-weight: 600;
    margin-bottom: 12px;
  }
  .ks-line {
    border-bottom: 0.5pt solid #C7BFB4;
    height: 24px;
  }
  .ks-footer {
    margin-top: 40px;
    padding-top: 12px;
    border-top: 1px solid #DCE2DF;
    font-size: 9pt;
    color: #5C6B63;
    text-align: center;
    font-style: italic;
  }
}

/* ============================================================
   DIALOGUES (remplacent alert / confirm / prompt natifs)
   ============================================================ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(26, 15, 8, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: dialogFade 0.18s ease;
}
@keyframes dialogFade { from { opacity: 0; } to { opacity: 1; } }
.dialog-card {
  width: 100%;
  max-width: 340px;
  background: #FFFFFF;
  border-radius: 14px;
  padding: 24px 22px 18px;
  box-shadow: 0 24px 60px -16px rgba(26, 15, 8, 0.45);
  animation: dialogPop 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes dialogPop {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.dialog-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1.375rem;
  color: #16241D;
  line-height: 1.25;
  margin-bottom: 8px;
}
.dialog-message {
  font-size: 13px;
  color: #5C6B63;
  line-height: 1.55;
  margin-bottom: 18px;
}
.dialog-fields { margin-bottom: 16px; }
.dialog-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: #5C6B63;
  margin-bottom: 6px;
  margin-top: 14px;
}
.dialog-fields .dialog-label:first-child { margin-top: 0; }
.dialog-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #EAF7EF;
  background: #F6F8F7;
  font-family: inherit;
  font-size: 15px;
  color: #16241D;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.dialog-input:focus { border-color: #16A34A; background: #FFFFFF; }
select.dialog-input { cursor: pointer; }
.dialog-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 14px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.dialog-btn {
  padding: 11px 18px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.dialog-btn:active { transform: translateY(1px); }
.dialog-btn-primary {
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
}
.dialog-btn-danger { background: #DC2626; color: #FFFFFF; }
.dialog-btn-ghost {
  background: transparent;
  color: #5C6B63;
  border: 1px solid #E8ECEA;
}
.dialog-btn-ghost:hover { background: #F6F8F7; }

/* Historique des prix dans un dialogue */
.ph-unit {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5C6B63;
  font-weight: 600;
  margin-bottom: 10px;
}
.ph-list { max-height: 260px; overflow-y: auto; }
.ph-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #F1F5F2;
  font-size: 13px;
}
.ph-row:last-child { border-bottom: none; }
.ph-current { font-weight: 600; }
.ph-date { color: #5C6B63; font-size: 12px; }
.ph-price {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  color: #16241D;
  font-variant-numeric: tabular-nums;
}
.ph-delta { font-size: 10px; font-weight: 700; margin-left: 8px; font-family: 'Inter', sans-serif; }
.ph-up { color: #DC2626; }
.ph-down { color: #16A34A; }
.ph-empty { font-size: 14px; color: #16241D; }
.ph-note { font-size: 12px; color: #5C6B63; }

/* Bandeau lecture seule */
.read-only-banner {
  background: #EDE9FE;
  color: #5B21B6;
  border: 1px solid #DDD6FE;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 12px;
}

/* Erreur inline sur l'écran de création de cuisine */
.auth-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 18px;
}

/* ============================================================
   MODE INVITÉ / PITCH COMPTE / INDICE DE SIMULATION
   ============================================================ */
.simulate-hint {
  margin-top: 10px;
  padding: 10px 14px;
  background: #F6F8F7;
  border: 1px dashed #D5F0E0;
  border-radius: 12px;
  font-size: 12.5px;
  color: #92400E;
  line-height: 1.45;
  text-align: center;
}

/* Chip en mode invité */
.user-chip.chip-guest {
  width: auto;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid #16A34A;
}
.chip-guest-label {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #16A34A;
  white-space: nowrap;
}

/* Argumentaire compte gratuit */
.pitch-badge {
  display: inline-block;
  background: #DCFCE7;
  color: #166534;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.pitch-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}
.pitch-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: #16241D;
  line-height: 1.45;
  padding: 6px 0;
}
.pitch-ok {
  color: #16A34A;
  font-weight: 700;
  flex-shrink: 0;
}

/* Bouton "continuer sans compte" */
.auth-skip {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  background: transparent;
  border: none;
  color: #5C6B63;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.auth-skip:hover { color: #16A34A; }

/* ============================================================
   BLOC 6 — ÉTAPES DE LA RECETTE (style Cookidoo)
   ============================================================ */
.steps-intro {
  font-size: 12px;
  color: #5C6B63;
  line-height: 1.5;
  margin: -4px 0 14px 0;
}

.recipe-step {
  background: #FFFFFF;
  border: 1px solid #EAF7EF;
  border-radius: 14px;
  padding: 14px 16px 12px;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px -8px rgba(255, 91, 58, 0.18);
  transition: box-shadow 0.15s;
}
.recipe-step:focus-within {
  box-shadow: 0 6px 20px -8px rgba(255, 91, 58, 0.32);
  border-color: #D5F0E0;
}

.rstep-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.rstep-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  flex-shrink: 0;
}
.rstep-title {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: #F6F8F7;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  color: #16241D;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.rstep-title:focus { border-color: #16A34A; background: #FFFFFF; }
.rstep-title::placeholder {
  color: #C7BFB4;
  font-size: 14px;
  font-style: italic;
}
.rstep-move {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.rstep-arrow {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #EAF7EF;
  background: #F6F8F7;
  color: #5C6B63;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.rstep-arrow:hover:not(:disabled) { background: #EAF7EF; color: #16A34A; }
.rstep-arrow:disabled { opacity: 0.3; cursor: default; }
.rstep-delete {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  color: #5C6B63;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.rstep-delete:hover { background: #FEE2E2; color: #DC2626; }

.rstep-text {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #16241D;
  resize: none;
  outline: none;
  overflow: hidden;
  padding: 0;
  min-height: 44px;
}
.rstep-text::placeholder { color: #BDB3A8; }

.rstep-params {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #F1F5F2;
}
.rstep-param {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #F6F8F7;
  border: 1px solid #EAF7EF;
  border-radius: 10px;
  padding: 5px 10px;
}
.rstep-param-icon { font-size: 12px; opacity: 0.75; }
.rstep-param-input {
  width: 42px;
  border: none;
  background: transparent;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  color: #16241D;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.rstep-param-input::-webkit-outer-spin-button,
.rstep-param-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rstep-param-input::placeholder { color: #BDB3A8; }
.rstep-param-unit {
  font-size: 11px;
  color: #5C6B63;
  font-weight: 500;
}

/* ---- Étapes sur la fiche technique imprimée ---- */
@media print {
  .ks-steps { margin-top: 28px; }
  .ks-steps-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #16241D;
    padding-bottom: 8px;
    margin-bottom: 14px;
  }
  .ks-steps-title {
    font-family: 'Inter', sans-serif;
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: #5C6B63;
  }
  .ks-steps-total {
    font-family: 'Inter', sans-serif;
    font-size: 9pt;
    font-weight: 600;
    color: #16241D;
  }
  .ks-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 0.5pt solid #DCE2DF;
    page-break-inside: avoid;
  }
  .ks-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1pt solid #16241D;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', Georgia, serif;
    font-size: 11pt;
    flex-shrink: 0;
  }
  .ks-step-body { flex: 1; }
  .ks-step-title {
    font-family: 'Inter', Georgia, serif;
    font-size: 13pt;
    font-weight: 600;
    color: #16241D;
    margin-bottom: 2px;
  }
  .ks-step-text { font-size: 11.5pt; line-height: 1.45; }
  .ks-step-meta {
    font-family: 'Inter', sans-serif;
    font-size: 8.5pt;
    color: #16A34A;
    font-weight: 600;
    margin-top: 3px;
    letter-spacing: 0.04em;
  }
  /* Case à cocher pour le suivi en cuisine */
  .ks-step-check {
    width: 16px;
    height: 16px;
    border: 1pt solid #C7BFB4;
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 3px;
  }
}

/* ============================================================
   TYPE DE RECETTE (Entrée / Plat / Dessert / Accomp. / Boisson)
   ============================================================ */
.recipe-type-field { margin-top: 16px; }
.recipe-type-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.recipe-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 1.5px solid #EAF7EF;
  background: #F6F8F7;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  color: #5C6B63;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.1;
}
.recipe-type-btn .rt-icon { font-size: 18px; line-height: 1; }
.recipe-type-btn:hover { border-color: #D5F0E0; background: #EAF7EF; }
.recipe-type-btn.active {
  border-color: #16A34A;
  background: linear-gradient(135deg, #16A34A 0%, #22B455 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px -4px rgba(255, 91, 58, 0.5);
}
.recipe-type-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.recipe-type-grid.shake { animation: shakeX 0.4s; }
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Badge de type (dans Mes recettes / comparateur) */
.type-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #EAF7EF;
  color: #166534;
  margin-right: 4px;
  vertical-align: middle;
}
