:root {
  --bg: #fbf6ee; --card: #fff; --ink: #2b2622; --muted: #7a7068; --line: #eadfd2;
  --accent: #c2553a; --accent-soft: #f7e4dc; --green: #4f7a52; --green-soft: #e4efe2;
  --warn: #b7791f; --warn-soft: #fbf0d9; --red: #b3402f;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.1rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 6px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
small { display: block; color: var(--muted); font-size: .82rem; }

#top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
#top h1 { flex: 1; font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#view { max-width: 640px; margin: 0 auto; padding: 12px 16px 150px; display: flex; flex-direction: column; gap: 12px; }
#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs a { flex: 1; max-width: 128px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: .7rem; color: var(--muted); }
#tabs a.on { color: var(--accent); font-weight: 600; }
#tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.sync { width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.sync.s-ok { background: var(--green); }
.sync.s-sync { background: var(--warn); }
.sync.s-erreur { background: var(--red); }

.icon { border: 0; background: none; font-size: 1.6rem; line-height: 1; padding: 4px 10px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.hint, .empty { color: var(--muted); font-size: .9rem; }
.empty { text-align: center; padding: 20px 0; }
.lead { font-size: 1.1rem; font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 600; text-align: center; }
.btn.ghost { background: var(--card); color: var(--accent); border-color: var(--line); }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn.rec { background: var(--red); color: #fff; }
.link { border: 0; background: none; color: var(--accent); text-decoration: underline; padding: 0 4px; font-size: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions { position: fixed; bottom: calc(58px + env(safe-area-inset-bottom)); left: 0; right: 0; z-index: 4; display: flex; gap: 8px; justify-content: center; padding: 10px 16px; background: linear-gradient(transparent, var(--bg) 35%); }
.actions .btn { flex: 1; max-width: 300px; }
.actions.static { position: static; background: none; padding: 0; flex-wrap: wrap; }
.fab { position: fixed; right: 18px; bottom: calc(74px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); z-index: 4; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: .9rem; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.type { align-self: center; }
.chip.type.enfants { background: var(--green-soft); border-color: var(--green); color: var(--green); font-weight: 600; }
.chip.type.solo { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.badge { font-style: normal; font-size: .7rem; font-weight: 600; background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }

.weeknav { display: flex; align-items: center; justify-content: space-between; text-align: center; }
.bilan { display: flex; flex-wrap: wrap; gap: 6px; font-size: .8rem; }
.bilan span { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.alerte { color: var(--warn); font-size: .88rem; }
.day h3 { margin-top: 4px; }
.day.today h3 { color: var(--accent); }
.slot { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.slot .moment { flex: none; width: 36px; font-size: .75rem; color: var(--muted); padding-top: 3px; }
.slot .corps { flex: 1; min-width: 0; }
.slot .qui { flex: none; color: var(--muted); font-size: .85rem; padding-top: 2px; }
.slot.reste, .slot.congel { background: var(--green-soft); border-color: transparent; }
.slot.vide, .slot.resto { background: transparent; border-style: dashed; color: var(--muted); }
.slot.vide b, .slot.resto b { font-weight: 400; }
.slot.fait { opacity: .6; }
.slot.fait .qui { color: var(--green); font-weight: 700; }
.rempl { font-size: .85rem; color: var(--accent); margin-top: 2px; }

.seg { display: flex; gap: 4px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg > button { display: block; width: 100%; text-align: center; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 4px; font-size: .85rem; }
.seg input:checked + span, .seg > button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.tabs2 { background: var(--line); border-radius: 12px; padding: 3px; }
.tabs2 a { flex: 1; text-align: center; padding: 8px; border-radius: 10px; font-size: .9rem; color: var(--muted); }
.tabs2 a.on { background: var(--card); color: var(--ink); font-weight: 600; }
.avis { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }

.rcard { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; position: relative; }
.rcard b { display: block; padding-right: 76px; }
.gouts { position: absolute; top: 12px; right: 12px; display: flex; gap: 3px; }
.g { font-style: normal; width: 22px; height: 22px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.g.aime { background: var(--green); color: #fff; }
.g.bof { background: var(--warn); color: #fff; }
.g.non { background: var(--red); color: #fff; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: 1rem; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ing { display: grid; grid-template-columns: 64px 92px 1fr 36px; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; }
.ing .wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ing .mini { flex-direction: row; align-items: center; gap: 6px; font-size: .78rem; }
.ing .mini input { width: 56px; flex: none; }
.ing .icon { padding: 4px; }
.addrow { display: flex; gap: 6px; }
.addrow .n { width: 70px; flex: none; }
.addrow .btn { flex: none; min-width: 46px; padding: 10px; }

.stepper { display: flex; align-items: center; gap: 12px; align-self: flex-start; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 1.3rem; }
.stepper.sm button { width: 34px; height: 34px; }
.meta { color: var(--muted); }
.ings { list-style: none; margin: 0; padding: 0; }
.ings li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ings b { white-space: nowrap; }
.etapes { white-space: normal; line-height: 1.6; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.urgent { color: var(--red); font-weight: 600; }

.rayon h3 { margin-top: 8px; }
.item { flex-direction: row; align-items: flex-start; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 6px; color: var(--ink); font-size: 1rem; }
.item span { flex: 1; }
.item em { font-style: normal; color: var(--accent); font-weight: 600; }
.item.ok { opacity: .5; }
.item.ok b { text-decoration: line-through; font-weight: 400; }
#thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
#thumbs button { position: relative; border: 0; padding: 0; background: none; }
#thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; display: block; }

#sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(43, 38, 34, .45); }
.sheet-body { position: relative; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; background: var(--bg); border-radius: 18px 18px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sheet-body form { display: flex; flex-direction: column; gap: 10px; }
.busy { text-align: center; padding: 24px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.spin { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: tour 1s linear infinite; }
@keyframes tour { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(130px + env(safe-area-inset-bottom)); z-index: 20; max-width: 480px; margin: 0 auto; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; text-align: center; font-size: .95rem; }
.form { gap: 12px; }
