:root {
    --bg: #f4f8f4;
    --surface: #ffffff;
    --text: #0f2419;
    --muted: #5b7266;
    --border: #dbe6dd;
    --primary: #045534;
    --primary-hover: #023a24;
    --primary-soft: #d7f0dd;
    --success: #3b8a14;
    --success-soft: #e3f4d6;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --radius: 20px;
    --accent: #46990b;
    --info: #0369a1;
    --info-soft: #e0f2fe;
    --shadow: 0 1px 2px rgba(15, 36, 25, .06), 0 12px 32px -12px rgba(4, 85, 52, .25);
}

*, *::before, *::after { box-sizing: border-box; }

/* l'attribut hidden doit toujours masquer, même sur un élément qui définit son propre display (grid, flex…) */
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background:
        radial-gradient(900px 400px at 10% -10%, var(--primary-soft), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a { color: var(--primary); text-decoration: none; }

.container { width: 100%; max-width: 640px; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* ---------- Barre du haut ---------- */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: .25rem 0 1rem; }
.brand { display: block; justify-self: center; line-height: 0; }
.brand-logo { display: block; height: 80px; width: auto; }
.user { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.avatar {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; text-transform: uppercase;
}
.user-email { color: var(--muted); font-size: .85rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
    color: var(--muted); border: 1px solid var(--border); background: var(--surface);
    transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--danger); border-color: var(--danger); }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }

.status { text-align: center; }
.badge {
    display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .8rem; border-radius: 999px;
    font-size: .85rem; font-weight: 600; background: var(--primary-soft); color: var(--primary);
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.is-present .badge { background: var(--success-soft); color: var(--success); }
.status.is-present .badge::before { animation: pulse 1.6s ease-in-out infinite; }

.timer { margin: 1.1rem 0 .25rem; font-size: clamp(2.4rem, 12vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.status-hint { margin: 0 0 1.5rem; color: var(--muted); }
.status:not(.is-present) .status-hint { margin-top: 1rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .6rem; width: 100%;
    padding: 1rem 1.25rem; border: 0; border-radius: 16px; cursor: pointer;
    font: inherit; font-size: 1.05rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--accent), #045534);
    box-shadow: 0 8px 20px -8px rgba(4, 85, 52, .55);
    transition: transform .1s, box-shadow .15s, filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, input:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.btn-depart { background: linear-gradient(135deg, #f97316, #ef4444); box-shadow: 0 8px 20px -8px rgba(239, 68, 68, .6); }

/* ---------- Messages ---------- */
.flash { display: flex; align-items: center; gap: .6rem; margin: 0 0 1rem; padding: .8rem 1rem; border-radius: 14px; font-weight: 500; }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-warning { background: var(--warning-soft); color: var(--warning); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Listes ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 2rem .25rem .75rem; }
.section-title h2 { margin: 0; font-size: 1.1rem; }
.section-title span { color: var(--muted); font-size: .85rem; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.history-item {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .25rem 1rem;
    padding: .9rem 1.1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.history-date { font-weight: 600; }
.history-times { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.pill {
    grid-row: 1 / span 2; grid-column: 2; padding: .35rem .75rem; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums;
}
.pill.is-ongoing { background: var(--success-soft); color: var(--success); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 2px dashed var(--border); border-radius: 16px; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth .card { width: 100%; max-width: 400px; padding: 2rem 1.75rem; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-logo { display: block; width: 240px; max-width: 100%; height: auto; margin: 0 auto .75rem; }
.auth-head h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.auth-head p { margin: 0; color: var(--muted); }

.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input {
    width: 100%; padding: .85rem 1rem; font: inherit; color: var(--text);
    background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
    transition: border-color .15s, background .15s;
}
.field input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }

@keyframes pulse { 50% { opacity: .35; transform: scale(1.4); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Formulaires (thème form/theme.html.twig) ---------- */
.field select {
    width: 100%; padding: .85rem 1rem; font: inherit; color: var(--text);
    background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
}
.field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 500; }
.back { display: inline-block; margin: .5rem 0 1rem; font-weight: 600; }
.page-title { margin: 0 0 1.25rem; font-size: 1.3rem; }
.edit-link { grid-column: 1 / -1; font-size: .85rem; font-weight: 600; }
.history-date::first-letter { text-transform: uppercase; }
.status-hint::first-letter { text-transform: none; }

/* ---------- Formulaire à deux colonnes (arrivée | départ) ---------- */
.container-wide { max-width: 760px; }
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.form-col { min-width: 0; margin: 0; padding: 1rem 1rem .25rem; border: 1px solid var(--border); border-radius: 16px; }
.form-col legend { padding: 0 .5rem; font-weight: 700; }
.form-col:first-child legend { color: var(--success); }
.form-col:last-child legend { color: var(--danger); }
@media (max-width: 560px) { .form-cols { grid-template-columns: 1fr; } }

/* ---------- Notes ---------- */
.note-input, .field textarea {
    width: 100%; padding: .75rem 1rem; font: inherit; color: var(--text); resize: vertical;
    background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
}
.note-input { margin-bottom: .9rem; text-align: left; }
.note-input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.note { margin: -.75rem 0 1.25rem; color: var(--muted); font-style: italic; white-space: pre-line; overflow-wrap: anywhere; }
.history-note { grid-column: 1 / -1; margin: .35rem 0 0; padding: .5rem .75rem; border-radius: 10px; background: var(--bg); font-size: .9rem; white-space: pre-line; overflow-wrap: anywhere; }
.history-note strong { margin-right: .4rem; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Navigation ---------- */
.tabs { display: flex; gap: .25rem; padding: .25rem; margin-bottom: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.tabs a { flex: 1; text-align: center; padding: .55rem; border-radius: 10px; font-weight: 600; color: var(--muted); }
.tabs a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }

/* ---------- Passkeys ---------- */
.btn-secondary { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.btn-secondary:hover { filter: none; background: color-mix(in srgb, var(--primary-soft) 80%, var(--primary)); }
.btn-secondary:disabled { opacity: .6; cursor: wait; }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.passkey-intro { margin: 0 0 1rem; color: var(--muted); }
[data-passkey-block] .history { margin-bottom: 1rem; }
[data-passkey-status] { margin-bottom: 1rem; }
.passkey-item { grid-template-columns: 1fr; }

/* ---------- Comptes et rôles ---------- */
.checks { display: grid; gap: .5rem; }
.check { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; color: var(--text); font-weight: 500; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.check input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); }
.field-help, .field small, .help-text { color: var(--muted); font-size: .8rem; }
.roles { display: flex; flex-wrap: wrap; gap: .35rem; }
.role-chip { padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.role-admin { background: var(--danger-soft); color: var(--danger); }
.role-editor { background: var(--primary-soft); color: var(--primary); }
.role-validator { background: var(--success-soft); color: var(--success); }
.role-viewer { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.role-accompanying { background: var(--warning-soft); color: var(--warning); }
.account-link { margin: 1.25rem 0 0; text-align: center; font-weight: 600; }

/* ---------- Mon compte ---------- */
.user-link { display: flex; align-items: center; gap: .6rem; color: inherit; }
.account-roles { margin-bottom: 1.25rem; }
.rename summary { cursor: pointer; color: var(--primary); list-style: none; }
.rename summary::-webkit-details-marker { display: none; }
.rename[open] { flex-basis: 100%; }
.rename form { display: grid; gap: .5rem; margin-top: .6rem; }
.rename .note-input { margin: 0; }
.btn-small { padding: .55rem 1rem; font-size: .9rem; }
.item-actions { flex-wrap: wrap; align-items: flex-start; }
.field .help, .field small { display: block; }
.empty + [data-passkey-status], .empty + button { margin-top: 1rem; }
a.btn { text-decoration: none; }

/* onglets : quatre entrées tiennent sur une ligne, même sur mobile */
.tabs a { padding: .55rem .2rem; font-size: .9rem; white-space: nowrap; }
@media (max-width: 400px) { .tabs a { font-size: .82rem; } }

/* ---------- MonAssiette : mise en page ---------- */
.container { max-width: 880px; }
.container-wide { max-width: 880px; }
.container-xl { max-width: 1180px; }
.tabs { overflow-x: auto; scrollbar-width: thin; }
.tabs a { flex: 0 0 auto; padding: .55rem .9rem; }
.stack { display: grid; gap: .75rem; }
.card-compact { padding: 1rem 1.15rem; }
.card-flush { padding: 0; overflow: hidden; }
.scroll-x { overflow-x: auto; }
.card-title { margin: 0 0 .35rem; font-size: 1.05rem; }
.subtitle { margin: 1.75rem 0 .5rem; font-size: 1.05rem; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.head-row .page-title { margin: 0; }
.muted { color: var(--muted); }
.muted small, small.muted { font-size: .85em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.print-only { display: none; }
.plain { margin: .25rem 0 .75rem; padding-left: 1.1rem; }
.note-block { padding: .6rem .85rem; border-radius: 12px; background: var(--bg); overflow-wrap: anywhere; white-space: pre-line; }
.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; }
.pill-slot { grid-row: 1 / span 2; grid-column: 2; justify-self: end; }
.history-item > a.history-date { color: var(--text); }
.history-item > a.history-date:hover { color: var(--primary); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.actions form { margin: 0; }
.versions { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .9rem; }
.versions .current { font-weight: 800; color: var(--text); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem 1rem; margin: 1rem 0; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* statistiques cliquables */
a.stat { color: inherit; }
.stats { display: grid; gap: .75rem; }
.stats-4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 1rem; }
.stat {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; text-align: center;
    padding: 1rem .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); transition: border-color .15s;
}
a.stat:hover { border-color: var(--primary); }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--primary); }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-warn .stat-value { color: var(--warning); }
@media (max-width: 560px) { .stats-4 { grid-template-columns: repeat(2, 1fr); } .stat-value { font-size: 1.6rem; } }

/* filtres */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.filters input[type=search], .filters input[type=date], .filters select {
    padding: .6rem .85rem; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px;
}
.filters input[type=search] { flex: 1 1 220px; }
.filters .btn { width: auto; }
.filter-date { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .85rem; }
.check-inline { display: inline-flex; padding: .5rem .8rem; }
a.btn, .btn-inline { text-decoration: none; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 1rem .25rem 0; color: var(--muted); font-size: .9rem; }

/* pastilles de statut */
.status-pill { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.status-draft { background: var(--bg); color: var(--muted); }
.status-pending-validation { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.status-validated, .status-completed { background: var(--success-soft); color: var(--success); border-color: transparent; }
.status-published { background: var(--info-soft); color: var(--info); border-color: transparent; }
.status-archived { background: var(--bg); color: var(--muted); text-decoration: line-through; }

/* allergènes : toujours texte + couleur */
.astatus { display: inline-block; padding: .1rem .5rem; border-radius: 8px; font-size: .78rem; font-weight: 700; }
.astatus-present { background: var(--danger-soft); color: var(--danger); }
.astatus-traces { background: var(--warning-soft); color: var(--warning); }
.astatus-unknown { background: #e0e7ff; color: #4338ca; }
.astatus-not-declared { background: var(--bg); color: var(--muted); }
.agroup { margin: 0 0 .75rem; }
.agroup-title { display: inline-block; margin-bottom: .35rem; padding: .05rem .5rem; border-radius: 8px; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.achips { display: flex; flex-wrap: wrap; gap: .35rem; }
.achip { padding: .25rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 1px solid transparent; }
.achip-present { background: var(--danger-soft); color: var(--danger); }
.achip-traces { background: var(--warning-soft); color: var(--warning); border-style: dashed; border-color: currentColor; }
.achip-unknown { background: #e0e7ff; color: #4338ca; border-style: dotted; border-color: currentColor; }
.provenances { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .88rem; display: grid; gap: .2rem; }
.alerts { margin: .75rem 0 0; padding: .6rem .9rem .6rem 1.9rem; border-radius: 12px; background: var(--warning-soft); color: var(--warning); font-size: .88rem; }
.disclaimer { margin: 1rem 0 0; font-size: .8rem; color: var(--muted); }

/* tableaux */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .55rem .75rem; text-align: left; border-top: 1px solid var(--border); vertical-align: top; }
.table thead th { border-top: 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-flush .table th, .card-flush .table td { padding-left: 1rem; }

/* formulaire ingrédient : 14 allergènes */
.declarations { display: grid; gap: .5rem; }
.declaration { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(130px, 1fr) minmax(130px, 1.2fr); gap: .5rem; align-items: center; padding: .5rem .7rem; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.declaration label { font-weight: 600; }
.declaration select, .declaration input { width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.declaration .field-error { grid-column: 1 / -1; }
@media (max-width: 640px) { .declaration { grid-template-columns: 1fr; } }
.field input[type=checkbox], .field input[type=radio], .check input { width: auto; }
.field textarea { display: block; }
.field input[type=number] { font-variant-numeric: tabular-nums; }

/* lignes de collection (recette, menu) */
.line { display: grid; grid-template-columns: minmax(180px, 3fr) minmax(80px, 1fr) minmax(90px, 1fr) auto; gap: .5rem; align-items: start; margin-bottom: .5rem; padding: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.line-head { background: none; border: 0; padding: 0 .5rem; margin-bottom: .25rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.line select, .line input[type=text], .line input[type=number], .line input:not([type]) { width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.line-menu { grid-template-columns: minmax(180px, 3fr) minmax(110px, 1fr) minmax(110px, 1.2fr) auto auto; }
.line-alt { margin: 0; padding: .45rem .6rem; }
.line-tools { display: flex; gap: .25rem; }
.line-tools .icon-btn { width: 34px; height: 34px; border-radius: 10px; font: inherit; cursor: pointer; }
.line .field-error { grid-column: 1 / -1; }
@media (max-width: 640px) { .line, .line-menu { grid-template-columns: 1fr 1fr; } .line-ingredient { grid-column: 1 / -1; } .line-head { display: none; } }
[data-add] { margin: .25rem 0 1.25rem; }

/* menu déroulant avec icônes (icon-select.js) */
.isel { position: relative; }
.isel-button { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .85rem 1rem; font: inherit; color: var(--text); text-align: left; cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; }
.isel-button:focus-visible, .isel-button[aria-expanded="true"] { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.isel-label { flex: 1; }
.isel-chevron { color: var(--muted); transition: transform .15s; }
.isel-button[aria-expanded="true"] .isel-chevron { transform: rotate(180deg); }
.isel-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .3rem; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.isel-list li { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; border-radius: 10px; cursor: pointer; }
.isel-list li[data-active] { background: var(--bg); }
.isel-list li[aria-selected="true"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.isel .icon { flex: none; color: var(--primary); }

/* autocomplétion d'ingrédient (ingredient-picker.js) */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto; margin: 0; padding: .25rem; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.combo-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem .65rem; border-radius: 8px; cursor: pointer; }
.combo-list li[aria-selected="true"] { background: var(--primary-soft); color: var(--primary); }
.combo-list .combo-group { position: sticky; top: -.25rem; padding: .35rem .65rem .2rem; background: var(--surface); color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; cursor: default; }
.combo-list li[role="option"] { padding-left: 1rem; }
.combo-unit { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.combo-new { font-weight: 700; color: var(--primary); }
.combo-empty { color: var(--muted); cursor: default !important; }
.combo-create { display: grid; gap: .5rem; margin-top: .4rem; padding: .7rem; background: var(--surface); border: 1px solid var(--primary); border-radius: 12px; }
.combo-create-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.combo-error { margin: 0; color: var(--danger); font-size: .85rem; }
.combo-note { margin: .4rem 0 0; font-size: .85rem; color: var(--muted); }
button.icon-btn { cursor: pointer; font: inherit; }

/* planning */
.plan-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.plan-nav { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.plan-title { margin: 0; font-size: 1.2rem; text-transform: capitalize; }
.plan-today { font-weight: 600; font-size: .85rem; }
.plan-views { display: flex; padding: .2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.plan-views a { padding: .35rem .8rem; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--muted); }
.plan-views a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.plan { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 760px; }
.plan th, .plan td { border: 1px solid var(--border); padding: .4rem; vertical-align: top; }
.plan thead th { background: var(--bg); font-size: .8rem; text-transform: capitalize; }
.plan thead th a { color: var(--text); }
.plan tbody th { width: 110px; background: var(--bg); font-size: .85rem; text-align: left; }
.plan .is-today { box-shadow: inset 0 0 0 2px var(--primary); }
.pcell { display: flex; flex-direction: column; gap: .3rem; min-height: 78px; padding: .45rem; border-radius: 10px; color: var(--text); background: var(--bg); border: 1px solid transparent; }
a.pcell:hover { border-color: var(--primary); }
.pcell-hit { background: var(--danger-soft); border-color: var(--danger); }
.pcell-menus { font-size: .82rem; font-weight: 600; overflow-wrap: anywhere; }
.pcell-allergens { font-size: .95rem; letter-spacing: .1em; }
.pcell-empty, .pcell-none { align-items: center; justify-content: center; color: var(--muted); font-size: 1.2rem; background: none; border: 1px dashed var(--border); }
.card > .pcell { min-height: 0; }
.plan-month td { height: 96px; }
.plan-daynum { font-weight: 800; font-size: .85rem; color: var(--text); }
.plan-month .is-out { opacity: .45; }
.mchip { display: inline-block; margin: 2px 2px 0 0; padding: .1rem .4rem; border-radius: 6px; font-size: .7rem; font-weight: 700; }
.row-tools { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.row-tools form { margin: 0; }

/* matrice des allergènes */
.print-head { padding: 1rem 1.25rem .25rem; }
.matrix { width: 100%; border-collapse: collapse; font-size: .85rem; }
.matrix th, .matrix td { padding: .45rem .5rem; border-top: 1px solid var(--border); text-align: left; }
.matrix .mhead { padding: .5rem .2rem; text-align: center; vertical-align: bottom; }
.mhead-text { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: .72rem; font-weight: 700; }
.mcell { text-align: center; font-weight: 800; }
.mcell-present { color: var(--danger); background: var(--danger-soft); }
.mcell-traces { color: var(--warning); background: var(--warning-soft); }
.mcell-unknown { color: #4338ca; background: #e0e7ff; }
.mcell-not-declared { color: var(--muted); }
.mlegend { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; margin: 0; padding: .75rem 1.25rem 0; font-size: .85rem; }
.mlegend span { display: inline-block; min-width: 1.4rem; text-align: center; font-weight: 800; border-radius: 6px; }
.card-flush .disclaimer { padding: 0 1.25rem 1rem; }

/* planning : vue semaine en cartes jour (une colonne sur mobile, jusqu'à 7 sur grand écran) */
.week { display: grid; gap: .6rem; grid-template-columns: 1fr; }
.wday { display: grid; gap: .45rem; align-content: start; padding: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.wday.is-today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.wday.is-past { opacity: .75; }
.wday-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0; font-size: .95rem; text-transform: capitalize; }
.wday-title a { color: var(--text); }
.wday-now { padding: .1rem .5rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .7rem; font-weight: 700; text-transform: none; }
.wslot { display: grid; gap: .2rem; }
.wslot-type { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.wday .pcell { min-height: 0; }
.wday .pcell-empty { min-height: 2.2rem; font-size: 1rem; }
@media (min-width: 640px) { .week { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
@media (min-width: 1100px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } .wday { padding: .5rem; } }

/* planning : barre de navigation et filtres compacts sur mobile */
@media (max-width: 639px) {
    .plan-bar { flex-direction: column; align-items: stretch; }
    .plan-nav { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; }
    .plan-title { text-align: center; font-size: 1.05rem; }
    .plan-today { grid-column: 1 / -1; text-align: center; }
    .plan-views { width: 100%; }
    .plan-views a { flex: 1; text-align: center; }
    .filters select { flex: 1 1 calc(50% - .25rem); min-width: 0; }
    .filters select[name=allergen] { flex-basis: 100%; }
    .filters .btn { flex: 1 1 auto; justify-content: center; }
}

/* planning : vue mois lisible sans défilement sur mobile (pastilles de couleur) */
.plan-month { min-width: 0; }
@media (max-width: 639px) {
    .plan-month th, .plan-month td { padding: .2rem; }
    .plan-month td { height: 64px; }
    .plan-month thead th { font-size: .7rem; }
    .plan-month .mchip { width: .8rem; height: .8rem; margin: 3px 2px 0 0; padding: 0; border-radius: 50%; }
    .plan-month .mchip-text { display: none; }
}

/* service : boutons d'action pleine largeur sur mobile */
@media (max-width: 639px) {
    .actions { flex-direction: column; }
    .actions .btn, .actions form, .actions form .btn { width: 100%; justify-content: center; }
    .head-row .row-tools { margin-left: auto; }
}

/* impression : planning et matrice lisibles sur papier */
@media print {
    body { background: #fff; color: #000; }
    .topbar, .tabs, .filters, .actions, .back, .row-tools, .plan-bar, .flash, .pager, [data-add] { display: none !important; }
    .print-only { display: block; }
    .card { box-shadow: none; border-color: #999; break-inside: avoid; }
    .container, .container-xl { max-width: none; padding: 0; }
    .scroll-x { overflow: visible; }
    .plan { min-width: 0; }
    .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
    .wday { padding: 4px; border-color: #999; opacity: 1; box-shadow: none; break-inside: avoid; }
    .wday-now { display: none; }
    .pcell { background: none; border-color: #bbb; }
    .astatus, .achip, .status-pill, .mcell { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* photos d'allergènes */
.athumb { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; vertical-align: -5px; margin-right: .15rem; background: var(--bg); }
.athumb-lg { width: 36px; height: 36px; margin-right: .5rem; vertical-align: middle; }
.declaration label { display: flex; align-items: center; }
.matrix .mhead .athumb { margin: 0 0 .25rem; }
.credits { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.credits li { display: grid; grid-template-columns: 64px 1fr; gap: .9rem; align-items: center; padding: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.credits img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.site-footer { text-align: center; padding: 0 1rem 2rem; font-size: .85rem; }
@media print { .site-footer { display: none; } }

/* navigation à deux niveaux */
.tabs { margin-bottom: .6rem; }
.tabs a { flex: 1; text-align: center; }
.subtabs { display: flex; justify-content: center; gap: 1.6rem; margin: 0 .25rem 1.25rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.subtabs a { padding: .5rem .1rem; font-weight: 600; font-size: .92rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subtabs a:hover { color: var(--text); }
.subtabs a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs + :not(.subtabs) { margin-top: .6rem; }
@media print { .subtabs { display: none !important; } }

/* raccourcis du tableau de bord */
.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; margin: 0 0 1rem; }
.shortcut { display: flex; flex-direction: column; gap: .15rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; color: var(--text); transition: border-color .15s; }
.shortcut:hover { border-color: var(--primary); }
.shortcut strong { font-size: .95rem; }
.shortcut span { font-size: .8rem; color: var(--muted); }

@media (max-width: 480px) { .brand-logo { height: 64px; } .user-email { display: none; } }

/* boutons compacts et liens d'action (rétablis) */
.btn-inline { width: auto; display: inline-flex; padding: .6rem 1.1rem; gap: .4rem; font-size: .95rem; }
.btn-inline .icon { width: 16px; height: 16px; }
.link-danger { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--danger); cursor: pointer; }
.link-danger:hover { text-decoration: underline; }

/* vues simplifiées (menu, service) */
.summary-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.summary-bar .back { margin: 0; }
.summary { padding: 1.5rem 1.75rem; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.summary-head h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.01em; }
.summary-date { margin: .15rem 0 0; font-size: 1.05rem; text-transform: capitalize; }
.dish-cat { margin: 1.6rem 0 .6rem; padding-bottom: .35rem; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); border-bottom: 2px solid var(--primary-soft); }
.dish-menu { font-size: 1rem; text-transform: none; letter-spacing: 0; }
.dish-sub { margin: 1rem 0 .3rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dishes { display: grid; }
.dish { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.dish:last-child { border-bottom: 0; }
.dish-name { font-size: 1.05rem; font-weight: 700; }
.minis { display: flex; flex-wrap: wrap; gap: .3rem; }
.mini { display: inline-flex; align-items: center; gap: .1rem; padding: .15rem .6rem .15rem .35rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--danger-soft); color: var(--danger); }
.mini-traces { background: var(--warning-soft); color: var(--warning); }
.mini .athumb { margin-right: .3rem; }
.mini-none { font-size: .85rem; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.tile { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .8rem .5rem; text-align: center; background: var(--danger-soft); border: 2px solid var(--danger); border-radius: 16px; color: var(--text); }
.tile img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.tile-emoji { font-size: 2rem; line-height: 56px; }
.tile strong { font-size: .88rem; line-height: 1.2; }
.tile small { font-size: .72rem; font-weight: 700; color: var(--warning); }
.tile-traces { background: var(--warning-soft); border: 2px dashed var(--warning); }
.tile-warn { margin: 1rem 0 0; padding: .6rem .85rem; border-radius: 12px; background: #e0e7ff; color: #4338ca; font-size: .85rem; font-weight: 600; }
@media print { .summary { padding: 0; border: 0; } .summary-bar { display: none; } .tile, .mini, .tile-warn { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

.summary-logo { display: block; height: 56px; width: auto; margin: 0 auto .75rem; }

/* icônes des boutons et des onglets */
.btn .icon { width: 18px; height: 18px; flex: none; }
.btn-inline .icon { width: 16px; height: 16px; }
.tabs a, .subtabs a { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.tabs a .icon, .subtabs a .icon { width: 18px; height: 18px; flex: none; }
.subtabs a .icon { width: 16px; height: 16px; }
@media (max-width: 520px) {
    .tabs a { flex-direction: column; gap: .15rem; font-size: .78rem; padding: .45rem .2rem; }
}

/* navigation entre les jours (vue simplifiée de la journée) */
.day-nav { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: .75rem; margin: 0 0 1rem; }
.day-nav .icon-btn { width: 48px; height: 48px; border-radius: 16px; color: var(--primary); }
.day-nav .icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.day-nav .icon-btn .icon { width: 24px; height: 24px; }
.day-title { text-align: center; }
.day-title h1 { margin: 0; font-size: 1.5rem; text-transform: capitalize; letter-spacing: -.01em; }
.day-today { margin: 0 0 1rem; text-align: center; }
.summary-head h2 { margin: 0; font-size: 1.4rem; }
@media print { .day-nav, .day-today { display: none !important; } }

/* éléments en attente de validation : bordure jaune en pointillés */
.history-pending .history-item { border: 2px dashed #eab308; background: var(--warning-soft); }

/* « Aucun allergène déclaré » */
.none-declared { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; }
.none-declared .icon { width: 16px; height: 16px; flex: none; }
p.none-declared { display: flex; }

/* lien discret vers /manage dans les vues simplifiées */
.manage-link { position: fixed; top: calc(.6rem + env(safe-area-inset-top)); right: calc(.75rem + env(safe-area-inset-right)); z-index: 10; padding: .2rem .6rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .75rem; font-weight: 600; opacity: .55; transition: opacity .15s, color .15s; }
.manage-link:hover, .manage-link:focus-visible { opacity: 1; color: var(--primary); }
@media print { .manage-link { display: none !important; } }

/* En-tête de largeur fixe, quelle que soit la largeur du contenu (ex. .container-xl du planning) */
.topbar, .tabs, .subtabs { max-width: 880px; margin-inline: auto; }

/* groupe icône + saisie (portions de référence), aligné sur le menu déroulant à icônes */
.igroup { display: flex; align-items: center; gap: .65rem; padding-left: 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; }
.igroup:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.igroup-icon { display: inline-flex; color: var(--primary); }
.field .igroup input, .field .igroup input:focus { flex: 1; min-width: 0; padding-left: 0; background: transparent; border: 0; box-shadow: none; outline: none; }
.portions { display: inline-flex; align-items: center; gap: .3rem; vertical-align: bottom; }
.portions .icon { width: 1.1em; height: 1.1em; color: var(--primary); }

/* gros bouton « Afficher vue du jour » dans l'en-tête, centré dans le premier tiers */
.day-btn { display: inline-flex; align-items: center; justify-content: center; gap: .75rem; justify-self: center; max-width: 100%; padding: .8rem 1.4rem .8rem 1rem; color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1.2; text-align: left; text-decoration: none; background: var(--primary); border: 2px solid var(--primary-hover); border-radius: 16px; box-shadow: 0 4px 0 var(--primary-hover), 0 10px 22px -8px rgba(4, 85, 52, .55); transition: background .15s, transform .12s, box-shadow .12s; }
.day-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.day-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-hover); }
.day-btn:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 3px; }
.day-btn-icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .2); }
.day-btn-icon .icon { width: 24px; height: 24px; }
@media (max-width: 640px) { .day-btn { padding: .6rem .9rem .6rem .6rem; font-size: .95rem; gap: .55rem; } .day-btn-icon { width: 34px; height: 34px; } }
@media (max-width: 480px) { .day-btn { padding: .55rem; border-radius: 16px; } .day-btn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }

/* section repliable avec bouton (fold.js) */
.fold .section-title { align-items: center; gap: 1rem; }
.fold .section-title h2 { display: inline-flex; align-items: center; gap: .6rem; }
.fold .count { padding: .1rem .6rem; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: .85rem; font-weight: 700; }
.fold-toggle { width: auto; gap: .45rem; }
.fold-toggle .icon { width: 18px; height: 18px; transition: transform .15s; }
.fold-toggle:not(.is-open) .icon { transform: rotate(-90deg); }
