:root {
  --bg: #FFF6EA; --card: #FFFFFF; --ink: #3A2A22; --muted: #8A7468; --line: #EBDDCB;
  --accent: #CF5A3C; --accent-ink: #fff; --accent-soft: #FBE3D8; --green: #5E8C4A; --green-soft: #E4EFD9;
  --gold: #E5A42B; --danger: #B3261E; --shadow: 0 2px 10px rgba(90, 50, 20, .08);
  --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1E1713; --card: #2A201A; --ink: #F6E9DA; --muted: #A99485; --line: #3D2F26;
    --accent: #E0694B; --accent-soft: #4A2A20; --green: #8DBB74; --green-soft: #2C3A24; --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { font-family: Georgia, "Iowan Old Style", serif; line-height: 1.2; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }

#app { max-width: 720px; margin: 0 auto; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--accent); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.topbar h1 { font-size: 1.3rem; flex: 1; }
.topbar img { width: 32px; height: 32px; border-radius: 8px; }
.iconbtn { background: transparent; border: 0; color: inherit; font-size: 1.4rem; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.iconbtn:active { background: rgba(255,255,255,.2); }
main { padding: 14px 16px 110px; }

/* champs */
input[type=text], input[type=search], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
label.f { display: block; margin: 12px 0 0; font-size: .85rem; color: var(--muted); font-weight: 600; }
label.f > :is(input, select, textarea) { margin-top: 4px; font-weight: 400; color: var(--ink); }
.row { display: flex; gap: 10px; } .row > * { flex: 1; min-width: 0; }

/* boutons */
.btn { border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; background: var(--accent); color: var(--accent-ink); }
.btn.alt { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px; font-size: .9rem; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); margin: 0 4px 4px 0; font-weight: 600; }
.tag.ai { background: var(--accent-soft); color: var(--accent); }

/* liste */
.search { display: flex; gap: 8px; align-items: center; }
.search .btn { padding: 11px 16px; }
.panel { background: var(--card); border-radius: var(--r); padding: 12px 14px 14px; margin: 8px 0; box-shadow: var(--shadow); }
.panel h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 6px; font-family: inherit; }
.count { color: var(--muted); font-size: .85rem; margin: 6px 2px; display: flex; justify-content: space-between; align-items: center; }
.count button { background: none; border: 0; color: var(--accent); font-weight: 600; }
.cards { display: grid; gap: 12px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); position: relative; border-left: 6px solid var(--accent); text-decoration: none; color: inherit; display: block; }
.card.c-dessert { border-color: #D9739B; } .card.c-entrée { border-color: var(--green); } .card.c-apéro { border-color: var(--gold); }
.card.c-petit-déj, .card.c-goûter { border-color: #E59A3A; } .card.c-boisson { border-color: #4A90B8; }
.card h2 { font-size: 1.12rem; padding-right: 28px; }
.card .fav { position: absolute; top: 10px; right: 12px; color: var(--gold); font-size: 1.2rem; }
.meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 6px; }
.desc { margin: 4px 0 8px; color: var(--muted); font-size: .92rem; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty img { width: 96px; border-radius: 22px; margin-bottom: 14px; }

/* FAB + feuille */
.fab { position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 2rem; box-shadow: 0 6px 18px rgba(150, 50, 20, .4); z-index: 20; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 720px; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet h3 { margin-bottom: 10px; }
.sheet .opt { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 0; border-radius: 14px; padding: 14px; margin-top: 8px; box-shadow: var(--shadow); }
.sheet .opt b { display: block; } .sheet .opt small { color: var(--muted); } .sheet .opt .e { font-size: 1.7rem; }

/* détail */
.hero h1 { font-size: 1.7rem; margin-bottom: 6px; }
.stars button { background: none; border: 0; font-size: 1.5rem; color: var(--line); padding: 0 2px; } .stars button.on { color: var(--gold); }
.stepper { display: inline-flex; align-items: center; gap: 10px; background: var(--card); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; font-weight: 700; }
.section { margin-top: 22px; } .section h2 { font-size: 1.2rem; margin-bottom: 8px; color: var(--accent); }
.ing { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.ing li { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.ing li:last-child { border: 0; } .ing li b { min-width: 64px; color: var(--accent); }
.ing li.done { opacity: .45; text-decoration: line-through; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.steps li { counter-increment: s; background: var(--card); border-radius: var(--r); padding: 12px 14px 12px 54px; margin-bottom: 10px; position: relative; box-shadow: var(--shadow); }
.steps li::before { content: counter(s); position: absolute; left: 12px; top: 11px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.steps li.done { opacity: .45; }
.note { background: var(--green-soft); border-radius: var(--r); padding: 12px 14px; }

/* mode cuisine */
.cook { position: fixed; inset: 0; background: var(--bg); z-index: 40; display: flex; flex-direction: column; padding: calc(14px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); }
.cook .bar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.cook .body { flex: 1; overflow: auto; display: flex; flex-direction: column; justify-content: center; }
.cook .num { color: var(--accent); font-weight: 700; }
.cook .txt { font-size: 1.55rem; line-height: 1.4; font-family: Georgia, serif; margin: 10px 0; }
.cook .ingl { font-size: .95rem; color: var(--muted); }
.cook .nav { display: flex; gap: 10px; } .cook .nav .btn { flex: 1; padding: 16px; font-size: 1.1rem; }

/* IA */
.loader { text-align: center; padding: 40px 10px; color: var(--muted); }
.loader img { width: 80px; border-radius: 20px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-4deg); } }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 2px; }

/* verrou */
.lock { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: var(--accent); color: #fff; }
.lock img { width: 128px; height: 128px; border-radius: 30px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.lock h1 { font-size: 2.2rem; margin: 18px 0 4px; } .lock p { opacity: .9; margin: 0 0 24px; }
.lock .btn { background: #fff; color: var(--accent); font-size: 1.1rem; padding: 15px 28px; }
.lock .err { margin-top: 16px; background: rgba(0,0,0,.2); padding: 8px 14px; border-radius: 12px; min-height: 1em; }
.lock input { max-width: 300px; margin-bottom: 14px; text-align: center; border: 0; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #3A2A22; color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.dev { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .dev > div { flex: 1; } .dev small { color: var(--muted); display: block; }

/* ---- v2 : photos, badge, minuteurs, courses, planning ---- */
.card { display: flow-root; }
.card .thumb { float: right; width: 78px; height: 78px; object-fit: cover; border-radius: 12px; margin: 0 0 6px 10px; }
.card .fav { z-index: 1; background: var(--card); border-radius: 50%; }
.hero .photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--r); margin-bottom: 12px; box-shadow: var(--shadow); }
.badge-w { position: relative; }
.badge { position: absolute; top: 2px; right: 0; background: #fff; color: var(--accent); font-style: normal; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.tmb { margin: 8px 6px 0 0; background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.cook .tms { margin-top: 8px; } .cook .tmb { font-size: 1.1rem; padding: 10px 18px; }
#tbar { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom)); left: 12px; right: 90px; z-index: 25; display: flex; flex-direction: column; gap: 6px; pointer-events: none; align-items: center; }
.tm { pointer-events: auto; background: #3A2A22; color: #fff; border-radius: 999px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.35); max-width: 100%; }
.tm span { font-weight: 700; font-variant-numeric: tabular-nums; } .tm small { opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.tm button { border: 0; background: rgba(255,255,255,.18); color: #fff; border-radius: 999px; min-width: 32px; height: 32px; padding: 0 10px; }
.tm.done { background: var(--green); animation: pulse 1s infinite; } @keyframes pulse { 50% { transform: scale(1.04); } }
.shoplist li { cursor: pointer; align-items: center; } .shoplist .cb { font-size: 1.3rem; color: var(--accent); }
.shoplist li.done { text-decoration: line-through; } .src { display: block; color: var(--muted); font-size: .75rem; }
.day.today { border: 2px solid var(--accent); } .day h3 { text-transform: capitalize; margin-top: 0; }
.slot { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); } .slot:first-of-type { border-top: 0; }
.slot .sl { width: 64px; flex: none; font-size: .85rem; color: var(--muted); } .slot .se { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.pe { display: flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 10px; padding: 4px 4px 4px 10px; } .pe a { flex: 1; color: var(--ink); text-decoration: none; font-weight: 600; }
.pe button { border: 0; background: transparent; color: var(--muted); font-size: 1rem; width: 28px; height: 28px; }
body:has(.cook) #tbar { bottom: auto; top: calc(64px + env(safe-area-inset-top)); right: 12px; }
#toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
body:has(.cook) #tbar { z-index: 45; }
.tm span, .tm small { white-space: nowrap; } .tm { flex-wrap: nowrap; }
