/*
 * NeverADiet — styles de base de la vraie UI (démarrée le 15/07/2026 par
 * la vue Compte). Ne référence QUE les jetons sémantiques de theme.css
 * (--bg, --surface, --text, --accent...), jamais les échelles brutes.
 * Priorités actées : pratique et facile d'abord, esthétique ensuite.
 */

* { box-sizing: border-box; }

html { height: 100%; }

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

/* ── En-tête ─────────────────────────────────────────────────────── */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.app-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.app-title .accent { color: var(--accent); }

.theme-controls {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.theme-controls select {
    font: inherit;
    font-size: .8rem;
    padding: .3rem .5rem;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
}

/* ── Zone principale ─────────────────────────────────────────────── */

main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2.5rem 1rem;
}

/* ── Carte (conteneur générique) ─────────────────────────────────── */

.card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
}

.card h2 {
    margin: 0 0 .35rem;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
}

.card .lead {
    margin: 0 0 1.25rem;
    color: var(--text-muted);
    font-size: .9rem;
}

/* ── Onglets Connexion / Créer un compte ─────────────────────────── */

.tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

/* .tab-btn (compte, connexion/inscription) et .detail-tab-btn (vue
   détail produit, barre à 4 sources) partagent le même LOOK mais
   restent deux classes DISTINCTES exprès : appWaiter délègue les clics
   par sélecteur CSS, pas par Mold d'origine — deux composants sur la
   même classe partageraient aussi ses handlers. Bug réel trouvé en
   testant (18/07/2026) : cliquer un onglet de la vue détail déclenchait
   en plus le handler générique de bascule connexion/inscription du
   compte, qui n'a rien à voir. */
.tab-btn,
.detail-tab-btn {
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    padding: .55rem .9rem;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn[aria-selected="true"],
.detail-tab-btn[aria-selected="true"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Onglet sans résultat (barre à 4 sources, vue détail produit) —
   grisé/non cliquable plutôt que masqué (doc/plan_produits_locaux.md
   §1) : la barre reste honnête sur ce qui existe pour ce code-barres. */
.detail-tab-btn:disabled {
    color: var(--text-muted);
    opacity: .5;
    cursor: not-allowed;
}

.detail-off-image {
    max-width: 160px;
    max-height: 160px;
    border-radius: 8px;
    margin: .5rem 0;
}

/* Aperçu photo du wizard (22/07/2026, bug réel : aucune règle n'existait
   du tout ici — une grande image gardait sa taille d'origine et
   débordait). object-fit: cover évite la déformation si le ratio de
   l'image ne correspond pas au carré affiché (contrairement à
   .detail-off-image, qui n'a pas ce problème car max-width/max-height
   seuls y suffisent déjà). */
.wiz-photo-preview {
    display: block;
    width: 100%;
    max-width: 220px;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin: .5rem 0;
}

/* ── Formulaires ─────────────────────────────────────────────────── */

.field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    margin-bottom: 1rem;
}

.field label {
    font-size: .82rem;
    font-weight: 600;
}

/* Contrôles de formulaire à taille intrinsèque (21/07/2026, trouvé sur
   les <select> "Détail nutriments" puis confirmé aussi sur <input>) :
   "height"/"min-height" ne suffisent pas à eux seuls sur ce
   navigateur/système — la taille "naturelle" du contrôle reste plus
   grande et l'emporte. Seul "max-height" force réellement un plafond,
   confirmé en pratique — gardé comme SEULE propriété de hauteur ici. */
.field input,
.field select {
    font: inherit;
    padding: .55rem .7rem;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    max-height: 2.5rem;
    overflow: hidden;
    line-height: 1.4;
}

/* Sans ceci, un <select> non stylé garde le rendu natif du navigateur —
   chrome/flèche natifs, non concernés par la règle ci-dessus. */
.field select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 1.1rem) center, calc(100% - .8rem) center;
    background-size: .3rem .3rem, .3rem .3rem;
    background-repeat: no-repeat;
    padding-inline-end: 2rem;
}

.field input:focus-visible,
button:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 1px;
}

.field .hint {
    font-size: .75rem;
    color: var(--text-muted);
}

/* Sections dépliables du formulaire de création produit
   (doc/plan_produits_locaux.md §3) — natif <details>/<summary>, aucun
   état JS pour l'ouverture/fermeture. */
.wiz-section {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: .6rem .8rem;
    margin-bottom: 1rem;
}

.wiz-section summary {
    font-weight: 600;
    cursor: pointer;
}

.wiz-section[open] summary {
    margin-bottom: .8rem;
}

.wiz-section .field:last-child {
    margin-bottom: 0;
}

/* Détail nutriments (18/07/2026) — sous-sections vitamine/minéral/
   lipide/glucide/protéine à l'intérieur d'un .wiz-section. */
.wiz-section h4 {
    font-size: .85rem;
    font-weight: 600;
    margin: .8rem 0 .3rem;
}

.wiz-nutrient-list {
    list-style: none;
    margin: 0 0 .5rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.wiz-nutrient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    font-size: .85rem;
}

.wiz-nutrient-add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}

.wiz-nutrient-add select {
    flex: 1 1 12rem;
}

.wiz-nutrient-add input {
    flex: 0 1 6rem;
}

/* ── Boutons ─────────────────────────────────────────────────────── */

.btn-primary {
    font: inherit;
    font-size: .92rem;
    font-weight: 600;
    width: 100%;
    padding: .65rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-contrast);
    cursor: pointer;
    transition: background .12s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }
.btn-primary[disabled] { opacity: .6; cursor: wait; }

.btn-secondary {
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    padding: .5rem .9rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── Messages d'état ─────────────────────────────────────────────── */

.form-error {
    display: block;
    min-height: 1.2em;
    margin: 0 0 .9rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--danger-text);
}
.form-error:empty { margin: 0; min-height: 0; }

.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .6rem;
    border-radius: 999px;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }

/* ── Statut connecté ─────────────────────────────────────────────── */

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.account-identity { display: flex; flex-direction: column; gap: .15rem; }
.account-identity .name { font-weight: 700; }
.account-identity .email { font-size: .85rem; color: var(--text-muted); }

/* ── Boutons d'icône (hamburger, roue crantée) ───────────────────── */
/* Visibles seulement connecté : app.js pose data-logged sur <body>.  */

.icon-btn {
    font: inherit;
    font-size: 1.15rem;
    line-height: 1;
    padding: .45rem .6rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

body:not([data-logged]) .logged-only { display: none; }

.header-start { display: flex; align-items: center; gap: .6rem; }
.app-title { cursor: pointer; }

/* ── Panneaux latéraux (menu / réglages) ─────────────────────────── */
/* Propriétés logiques (inset-inline-end...) : se retournent seules en
   RTL (arabe), aucune règle dédiée nécessaire. */

#drawer:empty { display: none; }

#drawer {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    width: min(340px, 92vw);
    z-index: 50;
    background: var(--surface);
    border-inline-start: 1px solid var(--border);
    box-shadow: 0 0 24px rgb(0 0 0 / .18);
    overflow-y: auto;
}

.drawer-panel { padding: 1.25rem; }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.drawer-head h2 { margin: 0; font-size: 1.15rem; }

.drawer-nav { display: flex; flex-direction: column; gap: .25rem; }

.menu-item {
    font: inherit;
    font-size: .92rem;
    text-align: start;
    padding: .55rem .7rem;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text);
    cursor: pointer;
}
.menu-item:hover { background: var(--accent-soft); color: var(--accent); }

/* ── Home : bloc scan ────────────────────────────────────────────── */

.home {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.home .card { max-width: none; }

.scan-actions {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .75rem .9rem;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
}
.scan-actions legend {
    font-size: .82rem;
    font-weight: 600;
    padding: 0 .35rem;
}
.scan-action-choice {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    cursor: pointer;
}
.scan-action-choice.disabled { color: var(--text-muted); cursor: not-allowed; }

.scan-controls { display: flex; gap: .5rem; margin-bottom: .75rem; }
.scan-controls .btn-primary { width: auto; }

/* Largeur EXPLICITE obligatoire : html5-qrcode mesure clientWidth au
   démarrage pour dimensionner l'aperçu vidéo — jamais de display:none
   ni de largeur implicite ici (bug réel : caméra allumée mais aperçu
   invisible, mesuré à 0 parce qu'une règle :empty le cachait au moment
   de la mesure). Vide, le div a une hauteur nulle : rien à cacher. */
.scan-reader { width: min(340px, 100%); }

.scan-manual-form { display: flex; gap: .5rem; }
.scan-manual-form input {
    flex: 1;
    font: inherit;
    padding: .5rem .7rem;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
}

.scan-message {
    min-height: 1.2em;
    margin: .75rem 0 0;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.scan-message:empty { margin: 0; min-height: 0; }

.product-detail h3 { margin: 1rem 0 .4rem; font-size: .95rem; }
.lot-list { margin: 0; padding-inline-start: 1.2rem; font-size: .88rem; }

/* Historique des prix (18/07/2026) */
.price-history { margin-top: .5rem; }

.price-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    margin-bottom: .6rem;
}
.price-filters input {
    font: inherit;
    font-size: .8rem;
    padding: .35rem .5rem;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    max-width: 8.5rem;
}
.price-filters label { font-size: .75rem; color: var(--text-muted); }

.price-mode-toggle { display: flex; gap: .4rem; margin-bottom: .6rem; }

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
.price-table th,
.price-table td {
    text-align: start;
    padding: .3rem .5rem;
    border-bottom: 1px solid var(--border);
}
.price-table th { color: var(--text-muted); font-weight: 600; }

.price-graph {
    width: 100%;
    max-width: 360px;
    height: auto;
    color: var(--text-muted); /* stroke="currentColor" des axes */
}

/* ── Home : cartes de configuration (disparaissent une fois réglées) ── */

.setup-cards { display: flex; flex-direction: column; gap: .6rem; }
.setup-cards:empty { display: none; }

.setup-card {
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
    text-align: start;
    padding: .85rem 1rem;
    border: 1px solid var(--warning-text);
    border-radius: 10px;
    background: var(--warning-bg);
    color: var(--warning-text);
    cursor: pointer;
}
.setup-title { font-weight: 700; font-size: .92rem; }
.setup-body { font-size: .82rem; }

/* ── Home : à surveiller / quoi manger ───────────────────────────── */

.watch-panel h3, .eat-panel h3 { margin: .8rem 0 .3rem; font-size: .9rem; }
#home-watch-slot:empty, #home-eat-slot:empty, #home-setup-slot:empty { display: none; }

/* ── Home : cards de fonctionnalités ─────────────────────────────── */

.features h2 { margin: 0 0 .5rem; font-size: 1.1rem; }

.home-notice {
    min-height: 1.2em;
    margin: 0 0 .6rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--warning-text);
}
.home-notice:empty { margin: 0; min-height: 0; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .75rem;
}

.feature-card {
    font: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 84px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-align: center;
    transition: border-color .12s, color .12s;
}
.feature-card:hover { border-color: var(--accent); color: var(--accent); }
.feature-label { font-size: .92rem; font-weight: 600; }

/* Fonctionnalité pas encore accessible (22/07/2026) : grisée, non
   cliquable (l'attribut disabled empêche déjà le clic) — reléguée en fin
   de grille par le tri, voir sortedFeatureCards(). */
.feature-card-disabled,
.feature-card-disabled:hover {
    cursor: not-allowed;
    opacity: .45;
    border-color: var(--border);
    color: var(--text-muted);
    background: var(--bg);
}
.menu-item-disabled {
    cursor: not-allowed;
    opacity: .45;
    color: var(--text-muted);
}

/* Vue Profil : réutilise .field / .form-error / .card ; en-tête comme les
   autres écrans. */
.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}
.profile-header h2 { margin: 0; }
.profile-form h3 { margin: 1rem 0 .25rem; }
.profile-form h3:first-of-type { margin-top: 0; }

/* Sauvegarde chiffrée (Réglages) : les formulaires d'état (configurer /
   débloquer / restaurer / changer) séparés par un filet léger. */
.backup-setup-form,
.backup-unlock-form,
.backup-restore-form,
.backup-change-form {
    margin: .5rem 0 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.backup-now-btn { width: auto; margin: .25rem 0 1rem; }

/* ── Wizard d'ajout de produit ───────────────────────────────────── */

.wizard h3 { margin: 0 0 .8rem; font-size: 1rem; }

.wizard-nav {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1.25rem;
}
.wizard-nav .btn-primary { width: auto; flex: 1; }

.wiz-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: .35rem 0 .6rem;
}
.wiz-suggestions .hint { width: 100%; margin: 0 0 .1rem; font-size: .78rem; }
.wiz-suggestion { font-size: .82rem; padding: .35rem .7rem; }
.wiz-suggestions:empty { display: none; }

.wiz-status {
    min-height: 1.1em;
    margin: 0 0 .6rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
}
.wiz-status:empty { margin: 0; min-height: 0; }
.wiz-status-existing { color: var(--accent); }

.wiz-off-suggestion {
    display: block;
    margin: 0 0 .9rem;
    border-style: dashed;
}

/* ── Gestionnaire de listes de courses (22/07/2026) ──────────────── */

.shopping,
.shopping-detail {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.shopping .card,
.shopping-detail .card { max-width: none; }

.shopping-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
}
.shopping-header h2 { margin: 0; }
.shopping-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.shopping-header-actions .btn-secondary { width: auto; }

.shopping-list-list,
.shopping-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.shopping-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.shopping-list-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.shopping-list-name {
    font: inherit;
    font-weight: 600;
    padding: 0;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
}
.shopping-list-name:hover { text-decoration-color: var(--accent); }

.shopping-list-actions {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}
.shopping-list-actions .btn-secondary,
.shopping-delete-list { width: auto; font-size: .8rem; padding: .4rem .65rem; }

/* Table éditable (22/07/2026) : wrap avec overflow-x propre à lui — la
   page ne doit jamais scroller horizontalement, seul le tableau. */
.shopping-table-wrap { width: 100%; overflow-x: auto; }

.shopping-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

.shopping-table th {
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}

.shopping-table td {
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.shopping-col-check,
.shopping-col-delete { width: 2rem; }

.shopping-item-row.checked .shopping-item-label { text-decoration: line-through; color: var(--text-muted); }

.shopping-item-check { width: 1.15rem; height: 1.15rem; cursor: pointer; }

.shopping-item-label { font-weight: 600; overflow-wrap: anywhere; }
.shopping-item-category,
.shopping-item-price { color: var(--text-muted); white-space: nowrap; }

/* Marque (22/07/2026, retour utilisateur — deux corrections) : DANS la
   même cellule que le nom ("Pâtes – Panzani"), plus une colonne à part
   (retiré le <th>/<td> dédiés) ; jamais aucun état survol/focus (une
   case apparaissait au survol alors que ce champ n'est pas éditable — un
   encadré qui ne réagit à rien au clic est trompeur, contrairement à
   qté/prix juste en dessous qui SONT éditables et méritent ce signal).
   font-weight normal explicite : .shopping-item-label (la cellule
   parente) met tout en gras par défaut, la marque doit rester en retrait
   (italique, atténuée), pas aussi appuyée que le nom. */
.shopping-item-brand {
    font-weight: 400;
    font-style: italic;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Lignes déjà ajoutées (22/07/2026, retour utilisateur) : les champs
   qté/prix manuel doivent se lire comme du TEXTE de liste, pas comme des
   inputs — bordure/fond transparents par défaut, visibles seulement au
   survol/focus (le moment où on les touche pour éditer). La ligne de
   CRÉATION (.shopping-draft-qty) garde l'apparence input habituelle,
   voir .shopping-draft-name juste après : c'est elle qu'on doit
   reconnaître comme "pas encore une vraie ligne". */
.shopping-item-qty,
.shopping-item-manual-price {
    font: inherit;
    font-size: .85rem;
    width: 4.2rem;
    padding: .3rem .4rem;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
}
.shopping-item-qty:hover,
.shopping-item-qty:focus,
.shopping-item-manual-price:hover,
.shopping-item-manual-price:focus {
    border-color: var(--border-strong);
    background: var(--surface);
}

/* Repère "vient de la base" vs "édité, pas encore ajouté" (22/07/2026) :
   un prix édité garde une bordure visible EN PERMANENCE (pas seulement
   au survol, contrairement à la règle générale ci-dessus) — c'est
   justement l'information à voir sans avoir à toucher le champ. Réutilise
   le même violet/accent que le focus, jamais une nouvelle couleur. */
.price-source-edited .shopping-item-manual-price {
    border-color: var(--accent);
    background: var(--surface);
}

.shopping-draft-qty {
    font: inherit;
    font-size: .85rem;
    width: 4.2rem;
    padding: .3rem .4rem;
    border-radius: 6px;
    border: 1px dashed var(--border-strong);
    background: var(--surface);
    color: var(--text);
}

.shopping-draft-name {
    font: inherit;
    font-size: .88rem;
    width: 100%;
    min-width: 9rem;
    padding: .3rem .4rem;
    border-radius: 6px;
    border: 1px dashed var(--border-strong);
    background: var(--surface);
    color: var(--text);
}

/* Suggestions (22/07/2026) : position + top/left posés en JS (voir
   renderShoppingSuggestions, app.js) — 'fixed' calculé depuis
   getBoundingClientRect(), pas 'absolute' + CSS : .shopping-table-wrap a
   overflow-x:auto, ce qui force aussi overflow-y à se comporter en
   "auto" (règle CSS Overflow, un seul axe ne peut pas rester "visible"
   si l'autre ne l'est pas) — un menu 'absolute' resterait coupé/
   scrollable dans ce conteneur quoi qu'on fasse ici. Vide -> masqué
   (même idiome que .wiz-suggestions, .scan-message : :empty plutôt
   qu'une classe "hidden" à gérer à la main). */
.shopping-suggestions {
    z-index: 5;
    display: flex;
    flex-direction: column;
    width: max-content;
    max-width: 16rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    overflow: hidden;
}
.shopping-suggestions:empty { display: none; }

.shopping-suggestion {
    font: inherit;
    font-size: .85rem;
    text-align: left;
    padding: .45rem .65rem;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.shopping-suggestion:hover,
.shopping-suggestion:focus-visible { background: var(--bg); color: var(--accent); }

/* Pastilles de source (22/07/2026, recherche multi-bases) : vert = Local
   (cet appareil, prod4i_lokal), bleu = Prod (catalogue serveur, y
   compris les articles génériques — toujours résolus depuis Prod).
   Violet réservé à Collab (couleurs déjà décidées avec l'utilisateur),
   pas utilisé ici — les brouillons non promus ne sont jamais proposés en
   suggestion, voir décision du 22/07/2026. Même légende dans les
   réglages (.settings-source-legend), mêmes couleurs, jamais dupliquées
   en dur ailleurs. */
.source-dot {
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.source-dot-local { background: var(--source-local); }
.source-dot-prod { background: var(--source-prod); }
.source-dot-collab { background: var(--source-collab); }
/* Mode contraste : jamais la couleur seule comme signal (voir
   theme.css, en-tête) — une bordure marquée s'ajoute à la couleur. */
:root[data-mode="contrast"] .source-dot { border: 1px solid #ffffff; }

.settings-source-legend {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.shopping-item-delete {
    width: auto;
    padding: .3rem .5rem;
    font-size: .85rem;
}

/* Panneau "Ajouter les prix" (22/07/2026, tiroir #drawer) — la liste à
   cocher réutilise .scan-action-choice telle quelle (même look que le
   choix d'action de scan), seule la liste elle-même a besoin d'un
   réglage. */
.price-record-items {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-height: 40vh;
    overflow-y: auto;
}

/* ── Recettes (22/07/2026) ───────────────────────────────────────────
   Réutilise au maximum les motifs de la liste de courses (mêmes en-tête,
   tableau, suggestions .shopping-suggestions partagées telles quelles).
   Seuls les écarts propres aux recettes sont définis ici. */
.recipe-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
}
.recipe-header h2 { margin: 0; }

.recipe-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.recipe-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.recipe-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.recipe-name {
    font: inherit;
    font-weight: 600;
    padding: 0;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
}
.recipe-name:hover { text-decoration-color: var(--accent); }
.recipe-portions-badge { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }
.recipe-actions .btn-secondary { width: auto; font-size: .8rem; padding: .4rem .65rem; }
/* Nom d'une recette référentiel : non cliquable (pas d'édition directe,
   il faut la copier), donc pas de style de bouton — juste le texte. */
.recipe-name-static { font-weight: 600; overflow-wrap: anywhere; }

.recipe-portions-control {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}
.recipe-target-portions { width: 5rem; }

.recipe-table-wrap { width: 100%; overflow-x: auto; }
.recipe-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.recipe-table th {
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
.recipe-table td {
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.recipe-col-delete { width: 2.5rem; }
.recipe-ingredient-label { font-weight: 600; overflow-wrap: anywhere; }
.recipe-ingredient-qty,
.recipe-ingredient-unit { color: var(--text-muted); white-space: nowrap; }
.recipe-ingredient-delete,
.recipe-step-delete {
    width: auto;
    padding: .3rem .5rem;
    font-size: .85rem;
}
.recipe-ingredient-add { width: auto; padding: .35rem .6rem; font-size: .85rem; }

.recipe-step-list {
    margin: 0 0 .75rem;
    padding-left: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.recipe-step-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
}
.recipe-step-text { overflow-wrap: anywhere; }
.recipe-step-add-form { display: flex; gap: .5rem; }
.recipe-step-add-form input {
    flex: 1;
    padding: .5rem .65rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.recipe-step-add-form .btn-primary { width: auto; }

.recipe-total-mass { font-weight: 600; margin: 0 0 .5rem; }
.recipe-composition {
    list-style: none;
    margin: 0 0 .5rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: .5rem;
}
.recipe-composition li {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.recipe-comp-label { font-size: .75rem; color: var(--text-muted); }
.recipe-comp-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.recipe-cook-btn { width: auto; margin-top: .25rem; }

/* Panneau « Cuisiner » (tiroir) : liste des ingrédients à retirer, chaque
   ligne = case + libellé, puis (si lot) info lot + quantité éditable. */
.recipe-cook-items {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-height: 45vh;
    overflow-y: auto;
}
.recipe-cook-item { display: flex; flex-direction: column; gap: .3rem; }
.recipe-cook-lot {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding-left: 1.7rem;
}
.recipe-cook-remove { width: 6rem; }
.recipe-cook-absent { padding-left: 1.7rem; }

/* ── Notifications (22/07/2026) ──────────────────────────────────────
   Non lue = accent porté par une barre latérale (repère non chromatique,
   lisible en mode contraste) + fond légèrement teinté. Lue = atténuée. */
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}
.notif-header h2 { margin: 0; }
.notif-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.notif-header-actions .btn-secondary { width: auto; }

.notif-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.notif-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 8px;
}
.notif-row.unread {
    border-left-color: var(--accent);
    background: var(--bg);
}
.notif-row.read { opacity: .7; }
.notif-body { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-width: 12rem; }
.notif-meta { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.notif-type { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--accent); }
.notif-row.read .notif-type { color: var(--text-muted); }
.notif-time { font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.notif-message { overflow-wrap: anywhere; }
.notification-mark-read { width: auto; font-size: .8rem; padding: .35rem .6rem; }

/* ── Stock / Structures (22/07/2026) ─────────────────────────────────
   Réutilise en-tête + tableau (mêmes motifs que listes de courses). */
.stock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}
.stock-header h2 { margin: 0; }
.stock-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.stock-header-actions .btn-secondary { width: auto; }
.stock-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .1rem;
    font-size: .85rem;
}
.stock-crumb {
    font: inherit;
    font-size: .85rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
}
.stock-crumb:hover { text-decoration-color: var(--accent); }
.stock-crumb-sep { color: var(--text-muted); }
.stock-crumb-current { font-weight: 600; }

.stock-structure-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.stock-structure-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.stock-open {
    font: inherit;
    font-weight: 600;
    padding: 0;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    flex: 1;
}
.stock-open::before { content: "📦 "; }
.stock-max-badge {
    font-size: .72rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding: .1rem .4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
}
.stock-structure-actions .btn-secondary { width: auto; font-size: .8rem; padding: .3rem .55rem; }
.stock-create-form .btn-primary { width: auto; }

.stock-table-wrap { width: 100%; overflow-x: auto; }
.stock-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.stock-table th {
    text-align: left;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
.stock-table td {
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.stock-col-delete { width: 2.5rem; }
.stock-lot-label { font-weight: 600; overflow-wrap: anywhere; }
.stock-lot-expiry { color: var(--text-muted); white-space: nowrap; }
.stock-lot-qty { width: 5rem; }
.stock-lot-open { width: 1.15rem; height: 1.15rem; cursor: pointer; }
.stock-lot-delete { width: auto; padding: .3rem .5rem; font-size: .85rem; }

/* ── Divers ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

@media (max-width: 480px) {
    main { padding: 1.25rem .75rem; }
    .card { padding: 1.25rem; }
    .app-header { flex-wrap: wrap; }
}
