/* Mijote 0.1.0 */
:root {
  --accent: #CF3B27;
  --green: #1F4D3A;
  --cream: #FBF4E8;
  --sage: #DCEBDD;
  --peach: #FFE1D8;
  --ink: #231F1B;
  --muted: #6B6159;
  --line: #EADFCB;
  --white: #fff;
  --radius: 20px;
  --nav-h: 84px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --display: 'Bricolage Grotesque', 'DM Sans', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); }
body { min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: none; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--green); }
h1, h2, h3 { font-family: var(--display); margin: 0; }
input, textarea, select { font-family: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { padding: calc(24px + env(safe-area-inset-top, 0px)) 20px calc(var(--nav-h) + var(--safe-b) + 28px); display: flex; flex-direction: column; gap: 16px; }
.screen.no-nav { padding-bottom: calc(120px + var(--safe-b)); }
.title { font-weight: 800; font-size: 30px; line-height: 1.05; letter-spacing: -0.02em; }
.sub { font-size: 14px; color: var(--muted); font-weight: 500; line-height: 1.4; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Boutons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 18px; border: 0; background: var(--accent); color: #fff; font: 700 16px var(--body); text-decoration: none; box-shadow: 0 8px 20px rgba(207, 59, 39, .25); }
.btn:disabled { opacity: .55; box-shadow: none; }
.btn.green { background: var(--green); box-shadow: none; }
.btn.outline { background: #fff; color: var(--accent); border: 2px solid var(--accent); box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.small { min-height: 44px; border-radius: 14px; font-size: 14px; padding: 0 16px; }
.btn.danger { background: #fff; color: #B3261E; border: 1px solid #E8B9B5; box-shadow: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); display: flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.chip { height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 14px var(--body); white-space: nowrap; }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.pill { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font: 600 13px var(--body); gap: 6px; }
.pill.sage { background: var(--sage); border-color: var(--sage); color: var(--green); font-weight: 700; }
.badge-demo { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: #FFF1B8; color: #5C4A00; font: 700 12px var(--body); }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: #4A413A; }
.input { width: 100%; min-height: 48px; padding: 0 16px; border: 1px solid #D9C9AB; border-radius: 14px; background: #fff; font: 500 16px var(--body); color: var(--ink); }
textarea.input { padding: 14px 16px; min-height: 160px; line-height: 1.45; resize: vertical; }
.input:focus, .searchbox:focus-within { outline: 3px solid rgba(31, 77, 58, .25); border-color: var(--green); }
.searchbox { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 16px var(--body); color: var(--ink); }
.error { padding: 12px 14px; border-radius: 14px; background: #FDE8E6; color: #8C1D18; font-size: 14px; font-weight: 600; line-height: 1.4; }
.notice { padding: 12px 14px; border-radius: 14px; background: var(--sage); color: var(--green); font-size: 14px; font-weight: 600; line-height: 1.4; }

/* Cartes recettes */
.hero { position: relative; display: block; height: 196px; border-radius: 24px; overflow: hidden; color: #fff; text-decoration: none; background: linear-gradient(135deg, #F2704F 0%, #CF3B27 100%); }
.hero svg { position: absolute; right: -18px; top: -6px; width: 190px; height: 142px; }
.hero .tag { position: absolute; left: 18px; top: 16px; height: 28px; padding: 0 12px; border-radius: 999px; background: rgba(255,255,255,.22); display: flex; align-items: center; font: 700 12px var(--body); letter-spacing: .04em; text-transform: uppercase; }
.hero .info { position: absolute; left: 18px; right: 18px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.hero .info b { font: 800 24px/1.1 var(--display); letter-spacing: -0.01em; }
.hero .info span { font-size: 13px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { background: #fff; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); text-decoration: none; color: var(--ink); display: block; position: relative; }
.card .pic { height: 104px; display: flex; align-items: center; justify-content: center; }
.card .pic svg { width: 96px; height: 72px; }
.card .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.card .meta b { font-size: 15px; line-height: 1.2; }
.card .meta span { font-size: 12px; color: var(--muted); font-weight: 500; }
.card .fav { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.9); display: flex; align-items: center; justify-content: center; }
.h0 { background: linear-gradient(135deg, #FFE1D8, #FFC9B8); }
.h1 { background: linear-gradient(135deg, #DCEBDD, #B9D9BF); }
.h2 { background: linear-gradient(135deg, #FFF1B8, #F7D488); }
.h3 { background: linear-gradient(135deg, #F2704F, #CF3B27); }
.h4 { background: linear-gradient(135deg, #EFE4D0, #E2D2B3); }
.empty { text-align: center; padding: 36px 12px; color: var(--muted); font-weight: 500; line-height: 1.5; }

/* Barre du bas */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 640px; height: calc(var(--nav-h) + var(--safe-b)); padding: 0 8px calc(10px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; z-index: 20; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); font: 600 11px var(--body); min-height: 48px; justify-content: center; }
.nav a.on { color: var(--accent); font-weight: 700; }
.nav a svg { stroke: currentColor; box-sizing: content-box; padding: 4px 18px; border-radius: 999px; transition: background .15s; }
.nav a.on svg { background: rgba(207, 59, 39, .14); }
.nav .plus svg { padding: 0; background: none; }
.nav .ico { position: relative; display: flex; }
.nav .badge { position: absolute; top: -2px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--accent); color: #fff; font: 700 11px/18px var(--body); text-align: center; border: 2px solid #fff; box-sizing: content-box; min-width: 14px; height: 14px; line-height: 14px; }
.nav .plus { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; margin-top: -30px; box-shadow: 0 6px 16px rgba(207, 59, 39, .35); }
.nav .plus svg { stroke: #fff; }

/* Segments */
.seg { display: flex; padding: 4px; background: #EFE4D0; border-radius: 16px; gap: 4px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 12px; background: transparent; color: #4A413A; font: 600 14px var(--body); }
.seg button.on { background: #fff; color: var(--green); font-weight: 700; box-shadow: 0 1px 3px rgba(35, 31, 27, .12); }

/* Panneaux, steppers */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.stepper button.plus { background: var(--green); border-color: var(--green); color: #fff; }
.stepper b { font: 800 24px var(--display); min-width: 28px; text-align: center; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--cream); color: var(--ink); font: 700 14px var(--body); text-align: left; }

/* Fiche recette */
.detail-hero { position: relative; height: 200px; overflow: hidden; }
.detail-hero svg.bowl { position: absolute; right: -30px; top: 6px; width: 230px; height: 172px; }
.detail-hero .back { position: absolute; left: 16px; top: calc(16px + env(safe-area-inset-top, 0px)); }
.detail-hero .favb { position: absolute; right: 16px; top: calc(16px + env(safe-area-inset-top, 0px)); }
.sheet { position: relative; margin-top: -50px; background: var(--cream); border-radius: 28px 28px 0 0; padding: 20px 20px calc(130px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.ing { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; font: 600 15px var(--body); color: var(--ink); width: 100%; }
.ing .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--green); flex: none; display: flex; align-items: center; justify-content: center; }
.ing.have .dot { background: #B9D9BF; border-color: #B9D9BF; }
.ing.have .nm { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.ing .qty { font-weight: 700; color: var(--green); }
.ing.have .qty { color: var(--muted); font-weight: 600; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; font-size: 15px; line-height: 1.5; }
.steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; font: 700 14px var(--body); display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 640px; background: #fff; border-top: 1px solid var(--line); padding: 12px 20px calc(16px + var(--safe-b)); display: flex; align-items: center; gap: 14px; z-index: 20; }
.bar .count { display: flex; flex-direction: column; min-width: 70px; }
.bar .count b { font: 800 22px/1 var(--display); }
.bar .count span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Panier */
.prod { display: flex; align-items: center; gap: 12px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.prod.off { opacity: .55; }
.prod .sw { width: 52px; height: 52px; border-radius: 14px; flex: none; }
.prod .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.prod .t b { font-size: 14px; line-height: 1.2; }
.prod .t span { font-size: 12px; color: var(--muted); font-weight: 500; }
.prod .r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.prod .r b { font-weight: 800; font-size: 15px; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--green); font: 700 12px var(--body); min-height: 28px; }
.check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--green); background: #fff; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; }
.check.on { background: var(--green); }
.basketbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b)); width: 100%; max-width: 640px; background: #fff; border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -8px 24px rgba(35, 31, 27, .06); z-index: 15; }
.screen.has-basketbar { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 230px); }

/* Planning */
.week { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 6px; background: #fff; border: 1px solid var(--line); border-radius: 16px; font-weight: 700; }
.week button { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.day { display: flex; align-items: flex-start; gap: 12px; }
.day .d { width: 44px; text-align: center; padding-top: 6px; }
.day .d span { display: block; font: 700 12px var(--body); color: var(--muted); text-transform: uppercase; }
.day .d b { font: 800 20px var(--display); }
.day.today .d b { color: var(--accent); }
.day .slots { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.slot { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; text-align: left; width: 100%; color: var(--ink); font: 700 14px var(--body); }
.slot .sw { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.slot small { font: 700 12px var(--body); color: var(--muted); }
.slot.add { justify-content: center; background: transparent; border: 2px dashed #D9C9AB; color: #4A413A; font-weight: 600; gap: 8px; }

/* Fenêtre basse */
.overlay { position: fixed; inset: 0; background: rgba(35, 31, 27, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 640px; max-height: 86dvh; overflow-y: auto; background: var(--cream); border-radius: 28px 28px 0 0; padding: 22px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; text-align: left; font: 700 15px var(--body); color: var(--ink); }
.pick .sw { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); max-width: 90%; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font: 600 14px var(--body); z-index: 60; }

/* Connexion */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 28px 24px; }
.login .logo { display: flex; align-items: center; gap: 14px; }
.login .logo b { font: 800 56px/1 var(--display); letter-spacing: -0.04em; color: var(--green); }

/* Admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.stat b { display: block; font: 800 32px/1.1 var(--display); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.bar-track { height: 10px; border-radius: 999px; background: #EFE4D0; overflow: hidden; }
.bar-fill { height: 100%; background: var(--green); border-radius: 999px; }
.user { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #F1E8D6; }
.user:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: var(--cream); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.avatar.accent { background: var(--accent); color: #fff; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 0; }
.swatch.on { box-shadow: 0 0 0 3px var(--cream), 0 0 0 5px var(--ink); }
@media (min-width: 900px) { #app.wide { max-width: 980px; } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(31,77,58,.25); border-top-color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
