/* ============================================================
   Mes courses — feuille de style unique
   Version 5 : recettes dépliables, compteurs 5 colonnes
   ============================================================ */

:root {
    --bg:           #f1f5f9;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;
    --surface-3:    #eef2f7;

    --texte:        #0f172a;
    --texte-doux:   #475569;
    --texte-faible: #94a3b8;

    --bordure:      #e2e8f0;
    --bordure-2:    #cbd5e1;

    --accent:       #2563eb;
    --accent-fonce: #1d4ed8;
    --accent-pale:  #dbeafe;
    --accent-texte: #1e40af;

    --ok:           #10b981;
    --ok-pale:      #d1fae5;
    --ok-texte:     #047857;

    --attente:      #f59e0b;
    --attente-pale: #fef3c7;
    --attente-texte:#b45309;

    --danger:       #ef4444;
    --danger-pale:  #fee2e2;
    --danger-texte: #b91c1c;

    --recette:       #2563eb;
    --recette-pale:  #dbeafe;
    --recette-texte: #1e40af;

    --ingredient:     #059669;
    --ingredient-pale:#d1fae5;
    --ingredient-texte:#047857;

    --article:       #7c3aed;
    --article-pale:  #ede9fe;
    --article-texte: #5b21b6;

    --midi:         #fbbf77;
    --midi-pale:    #fef3e2;
    --midi-texte:   #b45309;
    --midi-fond:    #fff8ee;

    --soir:         #a5b4fc;
    --soir-pale:    #e8ebff;
    --soir-texte:   #4338ca;
    --soir-fond:    #f5f6ff;

    --e1: 4px;
    --e2: 8px;
    --e3: 12px;
    --e4: 16px;
    --e5: 20px;
    --e6: 24px;
    --e8: 32px;
    --e10: 40px;
    --e12: 48px;

    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-full: 9999px;

    --ombre-1: 0 1px 2px rgba(15,23,42,.06);
    --ombre-2: 0 1px 3px rgba(15,23,42,.08), 0 4px 16px rgba(15,23,42,.06);
    --ombre-fab: 0 4px 12px rgba(37,99,235,.35), 0 8px 24px rgba(37,99,235,.25);

    --max: 100%;
    --pad: 1rem;
    --header-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--texte);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Layout — header sticky + main
   ============================================================ */

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: var(--e3);
    height: var(--header-h);
    padding: 0 var(--pad);
    background: var(--surface);
    border-bottom: 1px solid var(--bordure);
    box-shadow: var(--ombre-1);
}
.app-header .logo {
    display: block;
    height: 32px;
    width: auto;
    margin: 0;
}
.app-header .titre {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--texte);
}
.app-header .espace { flex: 1; }
.app-header .utilisateur {
    font-size: .85rem;
    font-weight: 600;
    color: var(--texte-doux);
    padding: var(--e1) var(--e3);
    background: var(--surface-2);
    border-radius: var(--r-full);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.app-header .lien-deconnexion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 var(--e4);
    font-size: .85rem;
    font-weight: 600;
    color: var(--texte-doux);
    background: transparent;
    border: 1px solid var(--bordure-2);
    border-radius: var(--r-full);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.app-header .lien-deconnexion:hover {
    background: var(--surface-2);
    color: var(--texte);
    border-color: var(--texte-faible);
}

.app-main {
    flex: 1;
    max-width: var(--max);
    width: 100%;
    margin: 0 auto;
    padding: var(--pad);
}

/* ============================================================
   Navigation principale
   ============================================================ */

.nav-principale {
    display: flex;
    gap: var(--e2);
    overflow-x: auto;
    padding: var(--e2) 0;
    margin-bottom: var(--e4);
    border-bottom: 1px solid var(--bordure);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-principale::-webkit-scrollbar { display: none; }
.nav-principale form { margin: 0; flex-shrink: 0; }
.nav-principale button {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 var(--e4);
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--texte-doux);
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.nav-principale button:hover {
    background: var(--surface-2);
    color: var(--texte);
}
.nav-principale button.actif {
    color: var(--accent-texte);
    background: var(--accent-pale);
}

/* ============================================================
   Cartes
   ============================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--r-md);
    padding: var(--e5);
    box-shadow: var(--ombre-1);
    margin-bottom: var(--e4);
}
.card h2 {
    margin: 0 0 var(--e4);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--texte-faible);
}
.card p {
    margin: 0 0 var(--e3);
    color: var(--texte-doux);
    font-size: .92rem;
}
.card-titre {
    margin: 0 0 var(--e5);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--texte);
}

/* ============================================================
   Boutons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--e2);
    padding: var(--e2) var(--e4);
    font: inherit;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.2;
    min-height: 40px;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--r-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover  { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--accent-pale); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-secondaire {
    color: var(--texte);
    background: var(--surface);
    border-color: var(--bordure-2);
    box-shadow: var(--ombre-1);
}
.btn-secondaire:hover {
    background: var(--surface-2);
    color: var(--texte);
    border-color: var(--texte-faible);
}

.btn-danger {
    color: var(--danger-texte);
    background: var(--surface);
    border-color: var(--bordure-2);
    box-shadow: var(--ombre-1);
}
.btn-danger:hover {
    background: var(--danger-pale);
    border-color: var(--danger);
    color: var(--danger-texte);
}

.btn-petit {
    min-height: 32px;
    padding: var(--e1) var(--e3);
    font-size: .8rem;
    border-radius: var(--r-xs);
}
.btn-large {
    width: 100%;
    min-height: 44px;
    font-size: .95rem;
}

/* ============================================================
   FAB
   ============================================================ */

.fab {
    position: fixed;
    right: var(--pad);
    bottom: var(--pad);
    z-index: 90;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--e2);
    height: 56px;
    padding: 0 var(--e5);
    font: inherit;
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--r-full);
    cursor: pointer;
    box-shadow: var(--ombre-fab);
    transition: background .15s, transform .1s, box-shadow .15s;
    text-decoration: none;
}
.fab:hover {
    background: var(--accent-fonce);
    transform: translateY(-2px);
}
.fab:active { transform: translateY(0); }
.fab-icone { font-size: 1.4rem; line-height: 1; font-weight: 300; }
.fab-label { display: inline; }

/* ============================================================
   Formulaires
   ============================================================ */

.formulaire {
    display: flex;
    flex-direction: column;
    gap: var(--e3);
    max-width: 480px;
    margin: 0 auto;
}
.formulaire.tout-large { max-width: none; }

.champ { display: flex; flex-direction: column; gap: var(--e1); }
.champ label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--texte-doux);
}
.champ .aide {
    font-size: .78rem;
    color: var(--texte-faible);
    font-style: italic;
    margin: 0;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
input[type="number"],
select,
textarea {
    display: block;
    width: 100%;
    padding: var(--e2) var(--e3);
    font: inherit;
    font-size: .95rem;
    color: var(--texte);
    background: var(--surface);
    border: 1px solid var(--bordure-2);
    border-radius: var(--r-sm);
    min-height: 44px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-pale);
}
input::placeholder { color: var(--texte-faible); }
textarea { min-height: 90px; resize: vertical; }

/* ============================================================
   Messages
   ============================================================ */

.message-erreur,
.message-succes {
    padding: var(--e3) var(--e4);
    border-radius: var(--r-sm);
    border-left: 4px solid;
    margin-bottom: var(--e4);
    font-size: .92rem;
    line-height: 1.5;
}
.message-erreur {
    background: var(--danger-pale);
    color: var(--danger-texte);
    border-color: var(--danger);
}
.message-succes {
    background: var(--ok-pale);
    color: var(--ok-texte);
    border-color: var(--ok);
}
.message-erreur p, .message-succes p { margin: 0; color: inherit; }

/* ============================================================
   Placeholder
   ============================================================ */

.placeholder {
    padding: var(--e8) var(--e4);
    text-align: center;
    color: var(--texte-faible);
    font-size: .92rem;
    font-style: italic;
    background: var(--surface-2);
    border: 1px dashed var(--bordure-2);
    border-radius: var(--r-md);
    margin: var(--e3) 0;
}

/* ============================================================
   Actions centrées
   ============================================================ */

.actions-centre {
    display: flex;
    justify-content: center;
    gap: var(--e3);
    margin: var(--e4) 0 var(--e2);
    flex-wrap: wrap;
}
.actions-centre form { margin: 0; }

/* ============================================================
   Pied
   ============================================================ */

.pied {
    text-align: center;
    color: var(--texte-faible);
    font-size: .78rem;
    margin: var(--e6) 0 0;
    padding-top: var(--e4);
    border-top: 1px solid var(--bordure);
}

/* ============================================================
   Page d'accueil (login + register)
   ============================================================ */

.page-auth {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--pad);
}
.page-auth .container { width: 100%; max-width: 420px; }
.page-auth .logo {
    display: block;
    height: 64px;
    margin: 0 auto var(--e4);
}
.page-auth .entete {
    text-align: center;
    margin-bottom: var(--e6);
}
.page-auth .entete h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--texte);
}
.page-auth .entete .sous-titre {
    margin: var(--e1) 0 0;
    font-size: .92rem;
    color: var(--texte-doux);
}
.page-auth .conteneur-cartes {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--e4);
    margin-bottom: var(--e4);
}
.page-auth .conteneur-cartes > .card { margin-bottom: 0; }

/* ============================================================
   Tables de données (PC) + cartes (mobile)
   ============================================================ */

.table-donnees {
    display: none;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--r-md);
    box-shadow: var(--ombre-1);
    overflow: hidden;
}
.table-donnees thead th {
    padding: var(--e3) var(--e4);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--texte-faible);
    text-align: left;
    background: var(--surface-2);
    border-bottom: 1px solid var(--bordure);
    white-space: nowrap;
}
.table-donnees tbody td {
    padding: var(--e3) var(--e4);
    font-size: .92rem;
    border-bottom: 1px solid var(--bordure);
    vertical-align: middle;
}
.table-donnees tbody tr:last-child td { border-bottom: none; }
.table-donnees tbody tr:hover { background: var(--surface-2); }
.table-donnees .col-actions { text-align: right; width: 1%; white-space: nowrap; }
.table-donnees .col-nombre   { text-align: right; font-variant-numeric: tabular-nums; }
.table-donnees .cell-actions {
    display: flex;
    gap: var(--e2);
    justify-content: flex-end;
    flex-wrap: nowrap;
}
.table-donnees .cell-actions form { margin: 0; }

.cartes-donnees {
    display: flex;
    flex-direction: column;
    gap: var(--e3);
}
.carte-donnee {
    padding: var(--e4);
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--r-md);
    box-shadow: var(--ombre-1);
    display: flex;
    flex-direction: column;
    gap: var(--e2);
}
.carte-donnee-entete {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--e3);
}
.carte-donnee-titre {
    font-size: 1rem;
    font-weight: 600;
    color: var(--texte);
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.carte-donnee-meta {
    font-size: .82rem;
    color: var(--texte-faible);
}
.carte-donnee-actions {
    display: flex;
    gap: var(--e2);
    flex-wrap: wrap;
    padding-top: var(--e2);
    border-top: 1px solid var(--bordure);
}
.carte-donnee-actions form { margin: 0; flex: 1 1 auto; }
.carte-donnee-actions .btn { width: 100%; }

/* ============================================================
   Badges
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--e1);
    padding: 2px var(--e3);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-radius: var(--r-full);
    white-space: nowrap;
}
.badge-neutre { background: var(--surface-3); color: var(--texte-doux); }
.badge-ok      { background: var(--ok-pale);      color: var(--ok-texte); }
.badge-attente { background: var(--attente-pale); color: var(--attente-texte); }
.badge-danger  { background: var(--danger-pale);  color: var(--danger-texte); }
.badge-accent  { background: var(--accent-pale);  color: var(--accent-texte); }

/* ============================================================
   Onglets
   ============================================================ */

.tabs {
    display: flex;
    gap: var(--e1);
    padding: var(--e1);
    margin-bottom: var(--e5);
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--r-md);
    box-shadow: var(--ombre-1);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs form { margin: 0; flex: 1; min-width: 0; }
.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    padding: 0 var(--e4);
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--texte-doux);
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.tab:hover { background: var(--surface-2); color: var(--texte); }
.tab-actif { color: var(--accent-texte); background: var(--accent-pale); }

/* ============================================================
   Grille semaine — 1 jour par ligne, couleurs midi/soir pastel
   ============================================================ */

.grille-semaine {
    display: flex;
    flex-direction: column;
    gap: var(--e3);
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: var(--e4);
}

.jour-bloc {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--ombre-1);
}

.jour-entete {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-fonce) 100%);
    color: #fff;
    padding: var(--e3) var(--e4);
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.jour-entete .date {
    font-size: .78rem;
    font-weight: 500;
    opacity: .9;
    letter-spacing: .02em;
    text-transform: none;
}

.repas {
    display: grid;
    grid-template-columns: 80px 1fr;
    border-top: 1px solid var(--bordure);
}
.repas:first-of-type { border-top: none; }

.repas-moment {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--e3) var(--e2);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    border-right: 1px solid var(--bordure);
    color: var(--texte);
}
.repas-midi .repas-moment { background: var(--midi); }
.repas-soir .repas-moment { background: var(--soir); }

.repas-contenu {
    display: flex;
    flex-direction: column;
    gap: var(--e2);
    padding: var(--e3);
}
.repas-midi .repas-contenu { background: var(--midi-fond); }
.repas-soir .repas-contenu { background: var(--soir-fond); }

.repas-vide {
    padding: var(--e3);
    font-size: .82rem;
    color: var(--texte-faible);
    font-style: italic;
    text-align: center;
    background: var(--surface-2);
    border: 1px dashed var(--bordure-2);
    border-radius: var(--r-sm);
}

/* ============================================================
   Ligne de repas : recette ou ingrédient
   ============================================================ */

.ligne-repas {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--e2) var(--e3);
    padding: var(--e2) var(--e3);
    border-radius: var(--r-sm);
    border: 1px solid var(--bordure);
    background: var(--surface);
    font-size: .92rem;
    transition: border-color .15s;
}
.ligne-repas:hover { border-color: var(--bordure-2); }

.ligne-repas.type-recette {
    background: var(--recette-pale);
    border-color: #bfdbfe;
}
.ligne-repas.type-ingredient {
    background: var(--ingredient-pale);
    border-color: #a7f3d0;
}

.ligne-repas .nom {
    font-weight: 600;
    color: var(--texte);
    line-height: 1.3;
    word-break: break-word;
}

.ligne-repas .valeur {
    display: inline-flex;
    align-items: center;
    gap: var(--e1);
    font-size: .85rem;
    color: var(--texte-doux);
    white-space: nowrap;
}

.ligne-repas .valeur input[type="number"] {
    width: 68px;
    padding: var(--e1) var(--e2);
    font-size: .85rem;
    text-align: right;
    min-height: 32px;
    border-radius: var(--r-xs);
    background: var(--surface);
    font-variant-numeric: tabular-nums;
}

.ligne-repas .valeur select {
    width: auto;
    padding: var(--e1) var(--e2);
    font-size: .85rem;
    min-height: 32px;
    border-radius: var(--r-xs);
    background: var(--surface);
}

.ligne-repas .supprimer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--danger-texte);
    background: var(--surface);
    border: 1px solid var(--bordure-2);
    border-radius: var(--r-xs);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    flex-shrink: 0;
}
.ligne-repas .supprimer:hover {
    background: var(--danger-pale);
    border-color: var(--danger);
}

/* ============================================================
   Bouton d'ajout de ligne
   ============================================================ */

.ajouter-ligne {
    display: inline-flex;
    align-items: center;
    gap: var(--e1);
    padding: var(--e2) var(--e3);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    color: var(--accent-texte);
    background: transparent;
    border: 1px dashed var(--bordure-2);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background .15s, border-color .15s;
    align-self: flex-start;
}
.ajouter-ligne:hover {
    background: var(--accent-pale);
    border-color: var(--accent);
    border-style: solid;
}
.ajouter-ligne .plus {
    font-size: 1rem;
    font-weight: 300;
    line-height: 1;
}

/* ============================================================
   Placard — liste colorée modifiable
   ============================================================ */

.liste-produits {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--e2);
}
.liste-produits li {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--e2) var(--e3);
    padding: var(--e2) var(--e3);
    background: var(--surface-2);
    border: 1px solid var(--bordure);
    border-radius: var(--r-sm);
    font-size: .92rem;
}
.liste-produits li.type-ingredient {
    background: var(--ingredient-pale);
    border-color: #a7f3d0;
}
.liste-produits li.type-article {
    background: var(--article-pale);
    border-color: #ddd6fe;
}

.liste-produits li .nom {
    font-weight: 600;
    color: var(--texte);
    line-height: 1.3;
    word-break: break-word;
}

.liste-produits li .valeur {
    display: inline-flex;
    align-items: center;
    gap: var(--e1);
    font-size: .85rem;
    color: var(--texte-doux);
    white-space: nowrap;
}
.liste-produits li .valeur input[type="number"] {
    width: 68px;
    padding: var(--e1) var(--e2);
    font-size: .85rem;
    text-align: right;
    min-height: 32px;
    border-radius: var(--r-xs);
    background: var(--surface);
    font-variant-numeric: tabular-nums;
}
.liste-produits li .valeur select {
    width: auto;
    padding: var(--e1) var(--e2);
    font-size: .85rem;
    min-height: 32px;
    border-radius: var(--r-xs);
    background: var(--surface);
}
.liste-produits li .supprimer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--danger-texte);
    background: var(--surface);
    border: 1px solid var(--bordure-2);
    border-radius: var(--r-xs);
    cursor: pointer;
    flex-shrink: 0;
}
.liste-produits li .supprimer:hover {
    background: var(--danger-pale);
    border-color: var(--danger);
}

/* ============================================================
   Barre d'action semaine (navigation + copie)
   ============================================================ */

.barre-semaine {
    display: flex;
    flex-wrap: wrap;
    gap: var(--e2);
    align-items: center;
}
.barre-semaine form {
    display: inline-flex;
    gap: var(--e2);
    align-items: center;
    margin: 0;
    flex-wrap: wrap;
}
.barre-semaine .copier-semaine .btn { min-height: 40px; }

/* ============================================================
   Soldes / compteurs
   ============================================================ */

.soldes {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--e3);
}

.solde {
    padding: var(--e4) var(--e5);
    background: var(--surface-2);
    border: 1px solid var(--bordure);
    border-radius: var(--r-md);
    display: flex;
    flex-direction: column;
    gap: var(--e1);
    text-align: center;
}

.solde-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--texte-faible);
}

.solde-valeur {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--texte);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Liste des courses — avec statut et bouton
   ============================================================ */

.liste-courses {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--e1);
}

.liste-courses li {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: var(--e3);
    padding: var(--e3) var(--e4);
    background: var(--surface-2);
    border: 1px solid var(--bordure);
    border-radius: var(--r-sm);
    font-size: .95rem;
}

.liste-courses li .nom {
    font-weight: 600;
    color: var(--texte);
    line-height: 1.3;
}

.liste-courses li .qte {
    font-size: .88rem;
    font-weight: 600;
    color: var(--accent-texte);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    background: var(--accent-pale);
    padding: var(--e1) var(--e3);
    border-radius: var(--r-full);
}

.liste-courses li .statut {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 2px var(--e3);
    border-radius: var(--r-full);
    white-space: nowrap;
}

.liste-courses li .statut-a-prendre {
    background: var(--attente-pale);
    color: var(--attente-texte);
}

.liste-courses li .statut-pris {
    background: var(--ok-pale);
    color: var(--ok-texte);
}

.liste-courses li form { margin: 0; }
.liste-courses li .btn { margin: 0; }

@media (max-width: 599px) {
    .liste-courses li {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "nom statut"
            "qte button";
        row-gap: var(--e2);
    }
    .liste-courses li .nom    { grid-area: nom; }
    .liste-courses li .statut { grid-area: statut; }
    .liste-courses li .qte    { grid-area: qte; justify-self: start; }
    .liste-courses li form    { grid-area: button; justify-self: end; }
}

/* ============================================================
   Liste de recettes dépliables (details/summary)
   ============================================================ */

.recettes-liste {
    display: flex;
    flex-direction: column;
    gap: var(--e2);
}

.recette {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.recette:hover { border-color: var(--bordure-2); }
.recette[open] {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-pale);
}

.recette summary {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--e3);
    padding: var(--e3) var(--e4);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.recette summary::-webkit-details-marker { display: none; }
.recette summary::marker { content: ""; }

.recette summary::after {
    content: "▸";
    font-size: 1rem;
    font-weight: 700;
    color: var(--texte-faible);
    transition: transform .2s;
    grid-column: 3;
}
.recette[open] summary::after {
    transform: rotate(90deg);
    color: var(--accent);
}

.recette-nom {
    font-weight: 600;
    color: var(--texte);
    font-size: .95rem;
    line-height: 1.3;
    word-break: break-word;
}

.recette-meta {
    font-size: .8rem;
    color: var(--texte-faible);
    white-space: nowrap;
    grid-column: 2;
}

.recette-detail {
    padding: var(--e3) var(--e4) var(--e4);
    background: var(--surface-2);
    border-top: 1px solid var(--bordure);
}

.recette-ingredients {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--e3);
    display: flex;
    flex-direction: column;
    gap: var(--e1);
}

.recette-ingredients li {
    display: flex;
    justify-content: space-between;
    gap: var(--e3);
    padding: var(--e2) var(--e3);
    background: var(--surface);
    border-radius: var(--r-xs);
    font-size: .9rem;
}
.recette-ingredients li .nom {
    color: var(--texte);
    font-weight: 500;
}
.recette-ingredients li .qte {
    color: var(--accent-texte);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.recette-actions {
    display: flex;
    gap: var(--e2);
    flex-wrap: wrap;
}
.recette-actions form { margin: 0; }
.recette-actions .btn { width: auto; }

@media (max-width: 599px) {
    .recette summary {
        grid-template-columns: 1fr auto;
        row-gap: var(--e1);
    }
    .recette-meta {
        grid-column: 1 / -1;
        white-space: normal;
    }
    .recette summary::after {
        grid-column: 2;
        grid-row: 1;
    }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (min-width: 720px) {
    :root { --pad: 1.5rem; --max: 720px; }
    .table-donnees { display: table; }
    .cartes-donnees { display: none; }
    .fab { height: 52px; padding: 0 var(--e4); }
    .fab-label { display: none; }
    .soldes { grid-template-columns: repeat(3, 1fr); }
    .soldes-5 { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 900px) {
    .page-auth .container { max-width: 900px; }
    .page-auth .conteneur-cartes { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (min-width: 1024px) {
    :root { --max: 1100px; --header-h: 64px; }
    .app-header .utilisateur { max-width: 220px; }
    .app-main { padding: var(--e6) var(--pad) var(--e8); }
    .fab { height: 56px; padding: 0 var(--e5); right: var(--e6); bottom: var(--e6); }
    .fab-label { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
    .fab:hover { transform: none; }
}

/* ============================================================
   Bloc d'informations (page paramètres)
   ============================================================ */

.info-compte {
    display: flex;
    flex-direction: column;
    gap: var(--e2);
}

.info-ligne {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--e3);
    padding: var(--e3) var(--e4);
    background: var(--surface-2);
    border: 1px solid var(--bordure);
    border-radius: var(--r-sm);
    font-size: .92rem;
}

.info-label {
    font-weight: 600;
    color: var(--texte-doux);
}

.info-valeur {
    font-weight: 600;
    color: var(--texte);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Carte « zone de danger »
   ============================================================ */

.card-danger {
    border-color: #fecaca;
    background: #fffafb;
}

.card-danger h2 {
    color: var(--danger-texte);
}

.card-danger p {
    color: var(--texte-doux);
}

.card-danger .btn-danger {
    border-color: var(--danger);
    color: #fff;
    background: var(--danger);
}

.card-danger .btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}