/* Composants de l'application (les jetons du thème Basilic sont dans tokens.css). */
:root { --muted: #566259; --danger: #9B2C2C; --content-w: 720px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 1.75rem; line-height: 1.15; }
h2 { font-size: 1.125rem; margin: 24px 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Coque : écran plein, vue au centre qui défile, onglets en bas */
.shell { display: flex; flex-direction: column; height: 100dvh; }
.view-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pad { padding: max(20px, env(safe-area-inset-top)) max(20px, calc((100% - var(--content-w)) / 2)) 28px; }
.tabbar { display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1 1 0; min-width: 0; padding: 0 2px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: clamp(12px, 0.75rem, 14px); text-decoration: none; color: var(--muted); }       /* comme la barre d'onglets d'iOS, le libellé grandit peu : 5 onglets doivent tenir à toute taille de texte */
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.active { color: var(--accent); font-weight: 600; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; max-width: 100%; text-align: center; overflow-wrap: anywhere; padding-block: 8px; line-height: 1.25; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.big { flex: 1; min-height: 64px; font-size: 1.125rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.danger-text { color: var(--danger); border-color: var(--danger); margin-top: 28px; }
.round { width: 44px; height: 44px; min-height: 44px; border-radius: 50%; font-size: 1.375rem; padding: 0; cursor: pointer; }
.round:disabled { opacity: .4; }
.file-btn { position: relative; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon-btn { min-width: 44px; min-height: 44px; background: none; color: var(--muted); font-size: 1.375rem; cursor: pointer; }

/* Liste */
.list-head { padding: max(16px, env(safe-area-inset-top)) max(16px, calc((100% - var(--content-w)) / 2)) 8px; display: grid; gap: 10px; }
.list-head h1 { font-size: 1.625rem; }
.search { width: 100%; min-height: 44px; border-radius: 12px; }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px max(16px, calc((100% - var(--content-w)) / 2)) 10px; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); font-weight: 600; font-size: 0.875rem; cursor: pointer; }
.cat-tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cat-tab .count { font-size: 0.75rem; font-weight: 600; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--pale); color: var(--text); text-align: center; }
.cat-tab.active .count { background: rgba(255, 255, 255, .22); color: var(--on-accent); }
.list-body { position: relative; flex: 1; min-height: 0; display: flex; }
.list-scroll { flex: 1; position: relative; }
.spacer { position: relative; width: 100%; }
.letter-header { position: absolute; left: 0; right: 0; display: flex; align-items: flex-end; padding: 0 16px 4px max(16px, calc((100% - var(--content-w)) / 2)); font-size: 0.8125rem; font-weight: 700; color: var(--accent); }
.recipe-row { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 14px; padding: 0 48px 0 max(16px, calc((100% - var(--content-w)) / 2)); border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.thumb { width: 52px; height: 52px; flex: none; border-radius: 10px; object-fit: cover; background: var(--pale); }
.row-text { display: grid; min-width: 0; gap: 2px; }
.row-title { font-size: 1.0625rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 0.8125rem; color: var(--muted); }
.empty { position: absolute; inset: 24px 20px auto; text-align: center; color: var(--muted); }
.alpha-index { position: absolute; right: 0; top: 8px; bottom: 8px; width: 44px; display: flex; flex-direction: column; align-items: center; overflow-y: auto; scrollbar-width: none; }
.alpha-index::-webkit-scrollbar { display: none; }
.alpha-index > :first-child { margin-top: auto; }
.alpha-index > :last-child { margin-bottom: auto; }
.alpha-letter { flex: 0 0 24px; min-height: 24px; width: 44px; padding: 0; background: none; border: 0; color: var(--accent); font-size: 0.75rem; font-weight: 700; line-height: 1; cursor: pointer; }

/* Fiche recette */
.hero-wrap { position: relative; }
.hero { display: block; width: 100%; height: clamp(220px, 46vw, 380px); object-fit: cover; background: var(--pale); }
.overlay-btn { position: absolute; top: max(12px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(20, 28, 22, .62); color: #fff; }
.overlay-btn.left { left: 12px; }
.overlay-btn.right { right: 12px; }
.content { padding: 20px max(20px, calc((100% - var(--content-w)) / 2)) 32px; }
.eyebrow { margin: 0 0 4px; font-size: 0.8125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.servings { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-weight: 600; }
.servings-value { min-width: 28px; text-align: center; font-size: 1.25rem; }
.ingredients, .steps { margin: 0; padding: 0; }
.ingredients { list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.ingredients li { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.steps { padding-left: 24px; display: grid; gap: 14px; line-height: 1.5; }

/* Formulaire */
.field { display: grid; gap: 8px; margin: 18px 0; }
.field > label, .label { font-size: 0.875rem; font-weight: 600; }
.input { width: 100%; }
textarea.input { font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); resize: vertical; }
.narrow { max-width: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); font-weight: 600; cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.add-row { display: flex; gap: 8px; align-items: flex-start; }
.add-row .input { flex: 1; min-width: 0; }
.editable { margin: 0; padding-left: 22px; }
.editable li { padding: 4px 0; }
.editable li > span { margin-right: 8px; }
.editable li { display: list-item; }
.photo-preview { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; }
.error { margin: 0; font-size: 0.8125rem; color: var(--danger); }
.ok { margin: 0; font-size: 0.875rem; color: var(--accent); font-weight: 600; }
.stack { gap: 12px; }
.choice { display: grid; gap: 4px; text-decoration: none; color: var(--text); }
.choice span { color: var(--muted); font-size: 0.875rem; }

/* Mode cuisine */
.cook-head { display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 8px; }
.cook-head h1 { font-size: 1.125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook-index { margin: 8px 0; font-weight: 700; color: var(--accent); font-size: 1.125rem; }
.cook-text { font-size: 1.625rem; line-height: 1.4; margin: 0 0 20px; min-height: 8em; }
.cook-nav { display: flex; gap: 12px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.check { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-size: 1.0625rem; }
.check input { width: 24px; height: 24px; padding: 0; flex: none; }

/* Boîte de confirmation */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(20, 28, 22, .5); }
.dialog { width: min(100%, 360px); }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Langue et unités */
.title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; }
.flags { display: flex; gap: 8px; }
.flag { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; overflow: hidden; border: 2px solid var(--line); background: var(--card); cursor: pointer; display: block; line-height: 0; }
.flag svg { display: block; }
.flag.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--pale); }
.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); margin: 4px 0 8px; }
.seg-btn { min-height: 44px; padding: 8px 18px; min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; border-radius: 0; background: transparent; color: var(--text); cursor: pointer; }
.seg-btn.active { background: var(--accent); color: var(--on-accent); }

/* Écrans hors session et administration */
.auth { max-width: 420px; margin: 0 auto; padding: max(32px, env(safe-area-inset-top)) 20px 28px; display: grid; gap: 16px; align-content: start; }
.members { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.member { display: grid; gap: 6px; }
.member-id { overflow-wrap: anywhere; }
.member .danger-text { margin-top: 0; }
.muted { color: var(--muted); font-weight: 400; }
.member .row-actions { flex-wrap: wrap; justify-content: flex-start; }
/* Import (lien et texte) : aperçu éditable */
.import-results { margin-top: 20px; display: grid; gap: 4px; }
.pv { display: grid; gap: 4px; }
.pv-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--pale); font-size: 0.75rem; font-weight: 600; }
.pill.level-low { background: #F4D9D3; }
.pv-source { margin: 0; font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.warns { display: grid; gap: 6px; }
.warn { margin: 6px 0; padding: 10px 12px; border-radius: 12px; background: #F6EFD2; font-size: 0.875rem; }
.warn p { margin: 0 0 6px; }
.warn ul { margin: 0; padding-left: 18px; }
.warn.strong { background: #F4D9D3; }
.radio-chip { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
input[type=radio], input[type=checkbox] { width: 22px; height: 22px; padding: 0; flex: none; accent-color: var(--accent); }
.pv-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pv-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
.pv-row:last-child { border-bottom: 0; }
.pv-list input.qty { width: 56px; flex: none; padding: 8px 6px; text-align: center; }
.pv-list input.qty.invalid { border-color: var(--danger); }
.ing-label, .step-text { flex: 1; min-width: 0; padding: 8px 4px; overflow-wrap: anywhere; }
.ing-label:focus, .step-text:focus, .notes-box:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-radius: 6px; }
.pv-group, .pv-step-title, .ing-group { padding: 10px 12px 4px; font-weight: 700; color: var(--accent); font-size: 0.875rem; list-style: none; }
.ing-group { padding: 12px 16px 4px; border-bottom: 0 !important; }
.steps-edit { counter-reset: step; }
.steps-edit .step-row { counter-increment: step; }
.steps-edit .step-row::before { content: counter(step) "."; font-weight: 700; color: var(--accent); min-width: 22px; }
.notes-box { white-space: pre-wrap; min-height: 72px; overflow-wrap: anywhere; }
.notes-box:empty::before { content: attr(aria-label); color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--pale); font-size: 0.8125rem; }
.tag-x { min-height: 28px; min-width: 28px; padding: 0; background: none; color: var(--muted); font-size: 1rem; }
.recipe-notes { white-space: pre-wrap; line-height: 1.5; }
.recipe-source { font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.multi-list { list-style: none; margin: 0 0 16px; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.multi-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.multi-item:last-child { border-bottom: 0; }
.multi-item.open { background: var(--pale); }
.multi-title { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.multi-status { font-size: 0.8125rem; color: var(--accent); font-weight: 600; }
.multi-found { margin: 0; font-weight: 700; }
.multi-count { margin: 0 0 8px; color: var(--muted); }


/* Liste de courses et Rappels */
.input { min-height: 44px; }
.row-actions.wrap { flex-wrap: wrap; }
.row-actions.start { justify-content: flex-start; margin: 12px 0; }
.sync { font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.sync[data-status="pending"], .sync[data-status="offline"] { color: var(--danger); }
.sync-bar { display: flex; justify-content: flex-end; padding: 2px 14px; background: var(--card); border-top: 1px solid var(--line); }
.sync-bar .sync { font-size: 0.75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.notice { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--pale); font-size: 0.875rem; }
.aisle h2 { margin: 20px 0 6px; font-size: 0.875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.shop-list { list-style: none; margin: 0; padding: 0; }
.shop-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.shop-item[data-checked="true"] .shop-line { text-decoration: line-through; color: var(--muted); }
.shop-check { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.shop-check input { width: 24px; height: 24px; padding: 0; }
.shop-main { flex: 1; min-width: 0; }
.shop-line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.shop-name { font-weight: 600; overflow-wrap: anywhere; }
.shop-qty { color: var(--muted); font-size: 0.875rem; }
.shop-origins { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.75rem; }
.shop-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; }
.shop-actions .icon-btn { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; background: none; border-radius: 10px; }
.shop-actions .icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--pale); }
.sheet-overlay { align-items: end; }
.sheet { width: min(100%, 520px); max-height: 85dvh; overflow-y: auto; }
.sheet-title { margin: 0; }
.toast { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--text); color: #fff; font-size: 0.875rem; pointer-events: none; max-width: calc(100% - 24px); }
.toast-btn { pointer-events: auto; min-height: 36px; padding: 0 12px; background: transparent; border: 1px solid #fff; color: #fff; }
/* Guides et machine à pain */
.pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.guide-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 48px; text-align: left; cursor: pointer; color: var(--text); }
.guide-body { padding: 8px 4px 12px; display: grid; gap: 10px; }
.empty-inline { margin: 12px 0; color: var(--muted); }
.bread-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; }
.bread-facts dt { color: var(--muted); font-weight: 600; }
.bread-facts dd { margin: 0; }
.warning { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: #FBEFD5; border: 1px solid #E5C77A; color: #5B4300; }
.pan-order { margin: 0; padding: 0 0 0 36px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.pan-order li { padding: 12px 16px 12px 4px; border-bottom: 1px solid var(--line); }
.pan-order li:last-child { border-bottom: 0; }
.sheet { position: fixed; inset: 0; z-index: 10; overflow: auto; background: var(--bg); padding: max(16px, env(safe-area-inset-top)) 20px 24px; }


/* S4 : photo, recherche web, création par IA, traduction */
.shots { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 8px 0; padding: 0; }
.shots li { position: relative; }
.shot { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; display: block; }
.shots .icon-btn { position: absolute; top: 2px; right: 2px; background: var(--card); border-radius: 999px; }
.hint { margin: 6px 0; font-size: 0.8125rem; color: var(--muted); }
.site { color: var(--muted); font-weight: 400; }
.pill.ai-badge { background: var(--accent); color: var(--on-accent); }
.translate-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }

.btn.danger-text { color: var(--danger); border-color: var(--danger); }

/* Texte agrandi : un mot long (adresse, russe) passe à la ligne au lieu d'élargir la carte */
.card > * { min-width: 0; overflow-wrap: anywhere; }
