/* Lecture, feuilles de réglage et cuisine — même système, usages distincts. */
.sheet, .palette, .toast { box-shadow: 0 4px 16px #10292312; border-color: var(--edge-soft); }
.sheet { border-radius: 16px; overflow: hidden; }
.sheet__body { padding: 28px; max-height: calc(94dvh - 24px); overflow-y: auto; overscroll-behavior: contain; gap: 20px; }
.sheet__head h2, .detail__title { font-family: var(--body); font-weight: 700; letter-spacing: -.025em; }
.sheet__head h2 { font-size: 26px; line-height: 1.2; }
.sheet__foot { border-color: var(--edge-soft); gap: 10px; background: var(--surface); box-shadow: none; }
.sheet .eyebrow { font-family: var(--body); font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
#dish-form { max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
.sheet .compteur { flex-wrap: wrap; }
.sheet .compteur__n { font-family: var(--body); }
#service-date, #plan-date { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 48px; font: inherit; color: var(--ink); color-scheme: light; }
[data-theme="dark"] #service-date, [data-theme="dark"] #plan-date { color-scheme: dark; }

/* Une lecture continue ; seul le corps défile, les actions restent à portée. */
#detail-modal { width: min(940px,calc(100vw - 48px)); height: min(940px,calc(100dvh - 48px)); max-height: none; padding: 0; }
#detail-body { --reader-padding-top: 28px; display: block; height: 100%; max-height: none; overflow-y: auto; overflow-x: hidden; padding: 28px 28px calc(112px + env(safe-area-inset-bottom)); scroll-padding-top: calc(var(--reading-toolbar-height,60px) + 60px); scrollbar-gutter: stable; }
.recipe-toolbar { display: flex; align-items: center; gap: 4px; position: sticky; top: -28px; z-index: 4; margin: -28px -28px 20px; padding: 8px 20px; background: var(--surface); border-bottom: 1px solid var(--edge-soft); }
.recipe-toolbar > .btn { margin-right: auto; padding: 8px 4px; justify-content: flex-start; font-size: 16px; font-weight: 500; border: 0; }
.recipe-toolbar > .btn .ic { transform: rotate(180deg); }
.recipe-toolbar__name { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; min-width: 0; }
.detail.is-scrolled .recipe-toolbar__name { display: block; flex: 1; }
.detail.is-scrolled .recipe-toolbar > .btn { margin-right: 0; }
.detail.is-scrolled .recipe-toolbar > .btn span { display: none; }
.recipe-menu { position: relative; flex: 0 0 44px; }
.recipe-menu[open] > summary { background: var(--selection); }
.recipe-menu > div { position: absolute; right: 0; top: 48px; z-index: 6; width: min(300px,calc(100vw - 40px)); max-height: 65dvh; overflow-y: auto; border: 1px solid var(--edge-soft); border-radius: 12px; padding: 12px; background: var(--surface); box-shadow: 0 4px 16px #10292312; }
.recipe-menu > div > .btn { justify-content: flex-start; width: 100%; }
.recipe-menu .detail__reading { position: static; display: flex; flex-wrap: wrap; padding-block: 12px; gap: 6px; margin-top: 8px; border-block: 1px solid var(--edge-soft); background: none; }
.recipe-menu .detail__reading > span { flex-basis: 100%; font-size: 13px; color: var(--ink-2); }
.recipe-menu .detail__reading .btn { font-size: 13px; flex: 1; padding: 8px; }
.recipe-menu .stars { margin-top: 8px; }
.detail__cover { display: block; width: 100%; aspect-ratio: 2.25; object-fit: cover; border: 0; border-radius: 16px; }
.photo-unavailable { display: flex; align-items: center; gap: 10px; padding-block: 16px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
#detail-title { font-size: 32px; line-height: 1.15; font-weight: 730; letter-spacing: -.035em; margin: 18px 0 8px; outline: none; overflow-wrap: anywhere; }
.detail__meta { font-size: 15px; line-height: 1.5; color: var(--ink-2); margin: 0 0 20px; }
.recipe-sections { position: sticky; top: calc(var(--reading-toolbar-height,60px) - var(--reader-padding-top)); z-index: 3; display: flex; gap: 20px; margin: 0 -28px 24px; padding-inline: 28px; background: var(--surface); border-bottom: 1px solid var(--edge-soft); }
.recipe-sections button { position: relative; min-height: 48px; padding: 10px 0; border: 0; border-radius: 0; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; }
.recipe-sections button[aria-current] { color: var(--ink); font-weight: 650; }
.recipe-sections button[aria-current]::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--ink); border-radius: 2px; }
.recipe-sections button:hover { color: var(--ink); }
.recipe-sections button:focus-visible { outline-offset: -3px; }
.detail__title:focus { outline: none; }
.detail__intro { font-size: 16px; line-height: 1.65; margin: 0 0 24px; white-space: pre-line; max-width: 65ch; }
.detail__cols { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); align-items: start; gap: 28px; margin-top: 24px; }
.detail__cols > section { min-width: 0; }
.detail__title { font-size: 21px; line-height: 1.3; margin: 0 0 16px; text-transform: none; }
.detail__section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.detail__section-head .detail__title { margin: 0; }
.reading-portions { display: inline-flex; align-items: center; justify-content: space-between; border: 1px solid var(--edge-soft); border-radius: 12px; gap: 2px; padding: 2px; font-size: 14px; font-variant-numeric: tabular-nums; }
.reading-portions .icon-btn { font-size: 22px; width: 44px; }
.reading-portions > span { min-width: 88px; text-align: center; }
.recipe-ingredients, .detail__ingredients { list-style: none; margin: 0; padding: 0; font-size: 16px; }
.recipe-ingredients li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 44px; padding: 10px 0; border-bottom: 1px solid var(--edge-soft); line-height: 1.55; }
.recipe-ingredients li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.recipe-ingredients li > span:last-child { color: var(--ink-2); text-align: right; max-width: 45%; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.recipe-ingredients li > span:last-child:empty { display: none; }
.recipe-steps { list-style: none; counter-reset: recipe-step; padding: 0; margin: 0; font-size: 16px; }
.recipe-steps > li { counter-increment: recipe-step; position: relative; min-height: 32px; margin-bottom: 24px; padding: 0 0 0 44px; line-height: 1.65; overflow-wrap: anywhere; }
.recipe-steps > li::before { content: counter(recipe-step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; background: var(--selection); color: var(--ink); border-radius: 50%; font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.detail__notes, .detail__components { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--edge-soft); }
.detail__notes p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.65; white-space: pre-line; }
.detail__organisation { border-top: 1px solid var(--edge-soft); margin-top: 28px; padding-top: 8px; }
.detail__organisation > summary { min-height: 48px; padding-block: 12px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.detail__organisation .detail__collections { margin-top: 12px; }
.detail__organisation .detail__variants { border-color: var(--edge-soft); }
.recipe-source { display: flex; justify-content: space-between; width: 100%; min-height: 52px; margin-top: 24px; padding: 12px 0; font-weight: 500; font-size: 16px; border: 0; border-top: 1px solid var(--edge-soft); border-radius: 0; }
#detail-body .recipe-actions { position: absolute; z-index: 5; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: 1.35fr 1fr; gap: 10px; padding: 14px 28px calc(14px + env(safe-area-inset-bottom)); margin: 0; border-top: 1px solid var(--edge-soft); border-radius: 0; background: var(--surface); }
.recipe-actions .btn { min-height: 52px; flex: none; font-size: 16px; }
.recipe-actions .btn--primary { font-size: 17px; }

/* Planifier : un formulaire, une récapitulation, un geste de confirmation. */
#plan-modal { width: min(540px,calc(100vw - 32px)); }
#plan-form { gap: 18px; max-height: 92dvh; }
#plan-title { outline: none; font-size: 26px; }
.plan-recipe { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--edge-soft); }
.plan-recipe img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.plan-recipe h3 { font-size: 19px; line-height: 1.3; letter-spacing: -.02em; margin: 0 0 4px; }
.plan-recipe p { margin: 0; font-size: 14px; color: var(--ink-2); }
#plan-existing:empty, #plan-usual:empty, #plan-status:empty { display: none; }
#plan-existing { font-size: 13px; margin: 0; }
#plan-controls { display: grid; gap: 20px; min-width: 0; margin: 0; padding: 0; border: 0; }
.plan-field { display: block; min-width: 0; margin: 0; padding: 0; border: 0; }
.plan-field legend, .plan-field > label { display: block; margin-bottom: 10px; padding: 0; font-weight: 650; font-size: 17px; }
label.plan-field { font-weight: 650; font-size: 17px; }
#plan-date { margin-top: 10px; }
.plan-quick-days { margin-top: -12px; color: var(--ink-2); font-size: 13px; }
.plan-quick-days summary { min-height: 44px; padding-block: 12px; cursor: pointer; }
.plan-days { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; padding-top: 8px; }
.plan-slots { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.plan-choice { position: relative; display: flex; min-width: 0; cursor: pointer; }
.plan-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.plan-choice span { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 8px; border: 1px solid var(--edge-soft); border-radius: 12px; text-align: center; font-size: 15px; line-height: 1.3; }
.plan-choice input:checked + span { background: var(--selection); border-color: transparent; color: var(--ink); font-weight: 600; }
.plan-choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.plan-choice input:disabled + span { opacity: .6; }
.plan-people { display: flex; gap: 8px; width: 100%; border: 1px solid var(--edge-soft); border-radius: 12px; padding: 4px; }
.plan-people .btn { flex: 0 0 44px; min-height: 44px; padding: 8px; border: 0; background: var(--surface-2); border-radius: 50%; font-size: 20px; }
.plan-people input { min-width: 0; min-height: 44px; text-align: center; font-size: 17px; border: 0; background: transparent; appearance: textfield; }
.plan-field .muted { margin: 10px 0 0; font-size: 13px; line-height: 1.5; font-weight: 400; }
#plan-usual { display: none; }
.plan-summary { margin: 0; padding-top: 18px; border-top: 1px solid var(--edge-soft); font-size: 14px; font-weight: 600; text-transform: capitalize; }
#plan-status { line-height: 1.5; margin: 0; font-size: 14px; }
#plan-status[role="alert"] { color: var(--accent); font-weight: 600; }
#plan-sync { align-self: flex-start; }
#plan-form:has(#plan-status:empty) #plan-sync { display: none; }
#plan-form .sheet__foot { display: flex; flex-wrap: wrap; margin-top: 0; padding-top: 0; border: 0; gap: 8px; }
#plan-form .sheet__foot [data-plan-undated] { margin-inline: auto; font-size: 14px; font-weight: 400; text-decoration: underline; text-underline-offset: 4px; }
#plan-confirm { width: 100%; min-height: 52px; font-size: 17px; }
#plan-change { margin-right: auto; }

/* Cuisine guidée : les yeux sur l'étape, les commandes près du pouce. */
.cook { background: var(--surface); color: var(--ink); }
.cook__head { min-height: 64px; border-color: var(--edge-soft); padding: 8px 20px; gap: 8px; }
.cook__name { font-family: var(--body); font-size: 18px; font-weight: 650; line-height: 1.35; }
.cook__name span { display: block; font-size: 14px; font-weight: 400; color: var(--ink-2); }
.cook__timer { background: transparent; color: var(--ink-2); border: 0; padding: 4px; font-size: 13px; min-width: 44px; font-variant-numeric: tabular-nums; }
.cook__avancee { padding: 16px 28px 0; gap: 12px; }
.cook__etape { width: auto; height: auto; min-width: 36px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink-2); font-family: var(--body); font-size: 14px; transform: none; box-shadow: none; }
.cook__body { padding: 28px; scroll-padding-block: 20px; }
.cook__step { margin-bottom: 32px; }
.cook__k { font-family: var(--body); text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink-2); font-weight: 500; margin: 0 0 16px; }
.cook__step-title { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; margin: 0 0 16px; }
.cook__x { font-family: var(--body); font-size: clamp(22px,3vw,28px); font-weight: 450; line-height: 1.5; letter-spacing: -.015em; max-width: 46ch; margin: 0; }
.cook__minuteur { width: 100%; min-height: 52px; margin-top: 24px; border: 1px solid var(--edge-soft); background: transparent; font-size: 16px; }
.cook__ing { border-top: 1px solid var(--edge-soft); padding-top: 24px; margin-top: 0; }
.cook__ing .cook__k { font-size: 20px; font-weight: 650; color: var(--ink); margin-bottom: 12px; }
.cook__ing .ing { min-height: 56px; border-bottom: 1px solid var(--edge-soft); padding: 10px 0; gap: 14px; font-size: 16px; }
.cook__ing .ing i { width: 24px; height: 24px; border: 1.5px solid var(--edge); border-radius: 6px; }
.cook__ing .ing--on i { border-color: #4C9C7F; background: #4C9C7F; color: white; }
.cook__notes { padding: 20px; border: 0; border-radius: 12px; background: var(--surface-2); margin-top: 24px; font-size: 15px; line-height: 1.6; }
.cook__notes h3 { margin: 0 0 8px; font-size: 17px; }
.cook__notes p { margin: 0; color: var(--ink-2); }
.cook__recipe-link { margin-top: 20px; padding-inline: 0; width: 100%; justify-content: space-between; border-top: 1px solid var(--edge-soft); border-radius: 0; font-size: 16px; font-weight: 500; }
.cook__foot { display: flex; gap: 10px; padding: 14px 28px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--edge-soft); background: var(--surface); }
.cook__foot .btn { flex: 1; min-height: 52px; font-size: 16px; }
.cook__foot .btn:disabled { opacity: .45; }
.magasin__liste .line { border-bottom: 1px solid var(--edge-soft); }
.magasin .cook__x { font-family: var(--body); font-size: 30px; font-weight: 700; }

@media (min-width: 1000px) {
  .cook__head, .cook__avancee, .cook__body, .cook__foot { width: min(900px,100%); margin-inline: auto; }
}
@media (max-width: 600px) {
  .sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .sheet__body { padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 94dvh; }
  #detail-modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  #detail-body { --reader-padding-top: calc(20px + env(safe-area-inset-top)); padding: var(--reader-padding-top) 20px calc(104px + env(safe-area-inset-bottom)); scrollbar-gutter: auto; }
  .recipe-toolbar { top: calc(-20px - env(safe-area-inset-top)); margin: calc(-20px - env(safe-area-inset-top)) -20px 16px; padding: calc(6px + env(safe-area-inset-top)) 16px 6px; }
  .recipe-toolbar > .btn { font-size: 16px; }
  .detail__cover { aspect-ratio: 1.8; }
  #detail-title { font-size: 29px; margin-top: 16px; }
  .detail__meta { margin-bottom: 20px; }
  .recipe-sections { margin-inline: -20px; padding-inline: 20px; gap: 24px; }
  .detail__cols { grid-template-columns: 1fr; gap: 32px; margin-top: 20px; }
  .detail__title { font-size: 22px; }
  .detail__intro { font-size: 16px; }
  .detail__section-head { gap: 8px; }
  .reading-portions { font-size: 13px; }
  .reading-portions > span { min-width: 78px; }
  #detail-body .recipe-actions { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
  .recipe-actions .btn { padding-inline: 8px; font-size: 15px; }
  #plan-modal { width: 100%; max-width: 100%; }
  #plan-form { gap: 16px; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); }
  #plan-title { font-size: 24px; }
  .plan-days { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .plan-choice span { font-size: 14px; }
  .plan-recipe { gap: 14px; }
  .plan-recipe img { width: 64px; height: 64px; }
  .cook__head { padding-inline: 16px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .cook__name { font-size: 17px; }
  .cook__avancee { padding-inline: 20px; }
  .cook__body { padding: 24px 20px; }
  .cook__step-title { font-size: 28px; }
  .cook__x { font-size: 23px; line-height: 1.5; }
  .cook__foot { padding-inline: 20px; }
  .cook__foot .btn { padding-inline: 10px; font-size: 15px; }
}
@media (prefers-reduced-motion: no-preference) {
  .view:not([hidden]) { animation: content-reveal 180ms ease-out; }
  .sheet[open] { animation: sheet-reveal 180ms ease-out; }
  .card__photo img { transition: opacity 140ms; }
  .card__photo:active img { opacity: .88; }
  .case { transition: background-color 140ms, border-color 140ms; }
  @keyframes content-reveal { from { opacity: .65; } to { opacity: 1; } }
  @keyframes sheet-reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
}

/* Confirmation de couverture : fichier réel, cible lisible, envoi explicite. */
#recipe-cover-editor { width: min(600px, 94vw); max-height: 94dvh; }
#recipe-cover-editor > .sheet__head { padding: 20px 24px 16px; align-items: center; gap: 16px; border-bottom: 1px solid var(--edge-soft); }
#recipe-cover-editor .sheet__head h2 { font-size: 22px; }
#recipe-cover-editor .sheet__body { max-height: calc(94dvh - 96px); gap: 16px; }
#recipe-cover-editor fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
#recipe-cover-editor label { display: inline-flex; cursor: pointer; }
#recipe-cover-editor label:has(+ input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
#recipe-cover-editor .muted { margin: 10px 0 0; font-size: 14px; }
#recipe-cover-editor figure { margin: 20px 0 0; }
#recipe-cover-editor figure img { width: 100%; border-radius: 10px; }
#recipe-cover-editor figcaption { font-size: 14px; margin-top: 8px; overflow-wrap: anywhere; }
#recipe-cover-editor [data-cover-target] { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
#recipe-cover-editor [data-cover-status] { margin: 0; line-height: 1.5; }
#recipe-cover-editor .sheet__foot { bottom: 0; flex-wrap: wrap; padding: 16px 0 0; }
#recipe-cover-editor [data-cover-save] { width: 100%; }
@media (max-width: 760px) {
  #recipe-cover-editor { width: 100%; }
  #recipe-cover-editor > .sheet__head { padding: 16px 20px; }
  #recipe-cover-editor .sheet__body { padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
}
