/* ==========================================================================
   MaCommande — application
   Charte Ma Commande (brand/, identique au Portal) appliquée par-dessus Bootstrap 5.3.
   Deux identités :
     - la boutique (.theme-ferme) prend la couleur de l'exploitation (--ferme*, posées par
       ThemeStyle), vert sapin par défaut ;
     - le back-office (.espace-admin) porte la marque Ma Commande, quelle que soit la ferme.
   Les règles lisent --primary* : c'est la seule couleur « active » d'un élément.
   ========================================================================== */

@font-face {
    font-family: "Public Sans";
    src: url("/fonts/public-sans-var.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Schibsted Grotesk";
    src: url("/fonts/schibsted-grotesk-var.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

/* --- Jetons ---------------------------------------------------------------- */
:root {
    /* Marque Ma Commande (brand/tokens.css) */
    --mc-accent: #1e5b45;
    --mc-accent-rgb: 30, 91, 69;
    --mc-accent-strong: #143f30;
    --mc-accent-soft: #e2eee7;
    --mc-straw: #f2c94c;
    --mc-straw-soft: #fbf1cf;
    --mc-night: #14231c;
    --mc-night-text: #cfdcd5;
    --mc-night-line: rgba(255, 255, 255, 0.14);

    --ink: #17231e;
    --text: #34413b;
    --muted: #56625c;
    --line: #dbe3dc;
    --field-line: #b9c6bd;
    --mist: #f1f5f1;
    --paper: #ffffff;

    --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Schibsted Grotesk", "Public Sans", system-ui, sans-serif;

    --radius-s: 8px;
    --radius: 12px;
    --radius-l: 20px;
    --shadow: 0 1px 2px rgba(20, 35, 28, 0.05);
    --shadow-lg: 0 18px 40px -18px rgba(20, 35, 28, 0.28);

    /* Couleur de l'exploitation : défauts, surchargés par ThemeStyle et maCommande.appliquerTheme */
    --ferme: #1e5b45;
    --ferme-rgb: 30, 91, 69;
    --ferme-hover: #184836;
    --ferme-light: #e0e9e6;
    --ferme-dark: #143d2e;

    /* Couleur active : celle de la ferme, sauf dans le back-office */
    --primary: var(--ferme);
    --primary-rgb: var(--ferme-rgb);
    --primary-hover: var(--ferme-hover);
    --primary-light: var(--ferme-light);
    --primary-dark: var(--ferme-dark);

    /* États */
    --success: #17693d;
    --success-soft: #daf3e5;
    --danger: #b3261e;
    --danger-soft: #fde0e1;
    --warning: #7a5406;
    --warning-soft: #fbf1cf;
    --info: #1d5a85;
    --info-soft: #e1eef8;

    /* Noms historiques, lus par ReconnectModal.razor.css et quelques règles */
    --secondary: var(--muted);
    --body-bg: var(--paper);
    --card-bg: var(--paper);
    --text-color: var(--text);
    --text-muted: var(--muted);
    --heading-color: var(--ink);
    --border-color: var(--line);
    --sidebar-width: 264px;
    --font: var(--font-body);

    /* Bootstrap 5.3 — valeurs fixes seulement : une variable qui en lirait une autre serait
       calculée ici, à la racine, et ne suivrait pas la couleur du back-office. */
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.6;
    --bs-body-color: #34413b;
    --bs-body-color-rgb: 52, 65, 59;
    --bs-emphasis-color: #17231e;
    --bs-heading-color: #17231e;
    --bs-secondary-color: #56625c;
    --bs-tertiary-bg: #f1f5f1;
    --bs-border-color: #dbe3dc;
    --bs-border-radius: 12px;
    --bs-border-radius-sm: 8px;
    --bs-border-radius-lg: 20px;
    --bs-border-radius-pill: 999px;
    --bs-success: #17693d;
    --bs-danger: #b3261e;
}

/* Back-office : la marque, pas la ferme */
.espace-admin {
    --primary: var(--mc-accent);
    --primary-rgb: var(--mc-accent-rgb);
    --primary-hover: var(--mc-accent-strong);
    --primary-light: var(--mc-accent-soft);
    --primary-dark: var(--mc-accent-strong);
}

/* Dans le back-office, ce qui montre la boutique (aperçu) reprend la couleur de la ferme */
.theme-ferme {
    --primary: var(--ferme);
    --primary-rgb: var(--ferme-rgb);
    --primary-hover: var(--ferme-hover);
    --primary-light: var(--ferme-light);
    --primary-dark: var(--ferme-dark);
}

/* --- Base ---------------------------------------------------------------------- */
body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--paper);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    color: var(--ink);
    font-weight: 650;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

h1, .h1 { font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; }
h2, .h2 { font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }

a { color: var(--primary); text-underline-offset: 0.18em; }
a:hover { color: var(--primary-hover); }

.text-muted { color: var(--muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: #b7791f !important; }
.bg-primary { background-color: var(--primary) !important; }
.bg-primary-subtle { background-color: var(--primary-light) !important; }
.border-primary { border-color: var(--primary) !important; }

:focus-visible {
    outline: 3px solid rgba(var(--primary-rgb), 0.35);
    outline-offset: 2px;
}

/* --- Boutons ----------------------------------------------------------------------- */
.btn {
    --bs-btn-font-family: var(--font-body);
    --bs-btn-font-weight: 600;
    --bs-btn-border-width: 1.5px;
    --bs-btn-border-radius: 999px;
    --bs-btn-padding-x: 1.15rem;
    --bs-btn-padding-y: 0.5rem;
    --bs-btn-focus-box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-sm {
    --bs-btn-padding-x: 0.8rem;
    --bs-btn-padding-y: 0.3rem;
    --bs-btn-font-size: 0.875rem;
    --bs-btn-border-radius: 999px;
}

.btn-lg {
    --bs-btn-padding-x: 1.6rem;
    --bs-btn-padding-y: 0.75rem;
    --bs-btn-font-size: 1.0625rem;
    --bs-btn-border-radius: 999px;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active,
.btn-primary:disabled, .btn-primary.disabled {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}
.btn-outline-primary:hover, .btn-outline-primary:active, .btn-outline-primary.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* « Fantôme » du Portal : fond blanc, filet, texte encre */
.btn-outline-secondary, .btn-light {
    color: var(--ink);
    background: var(--paper);
    border-color: var(--line);
}
.btn-outline-secondary:hover, .btn-outline-secondary:active, .btn-outline-secondary.active,
.btn-light:hover {
    color: var(--ink);
    background: var(--paper);
    border-color: var(--ink);
}

.btn-secondary {
    color: #fff;
    background: var(--ink);
    border-color: var(--ink);
}
.btn-secondary:hover, .btn-secondary:active {
    background: #000;
    border-color: #000;
    color: #fff;
}

.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-outline-danger { color: var(--danger); border-color: #e7b3b0; }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-link { color: var(--primary); text-decoration: none; }

/* --- Formulaires ------------------------------------------------------------------ */
.form-label {
    color: var(--ink);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-text { color: var(--muted); }

.form-control, .form-select {
    border: 1.5px solid var(--field-line);
    border-radius: var(--radius-s);
    color: var(--ink);
    padding: 0.6rem 0.8rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control-sm, .form-select-sm {
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}
.form-select { padding-right: 2.25rem; }
.form-select-sm { padding-right: 2rem; }

.form-control::placeholder { color: #8a958f; }

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18);
}

.form-check-input {
    border: 1.5px solid var(--field-line);
}
.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18);
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.input-group-text {
    background: var(--mist);
    border: 1.5px solid var(--field-line);
    color: var(--muted);
}

.form-control-color { padding: 0.3rem; min-width: 3.25rem; }

.validation-message { color: var(--danger); font-size: 0.85rem; font-weight: 600; margin-top: 4px; }
.invalid, .form-control.invalid { border-color: var(--danger); }

/* --- Cartes, alertes, badges -------------------------------------------------------------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow);
    background: var(--paper);
    overflow: hidden;
}
.card-header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 1rem 1.25rem;
    font-weight: 600;
}
.card-header h5, .card-header h6 {
    font-size: 1.0625rem;
    letter-spacing: -0.015em;
}
.card-footer {
    background: var(--mist);
    border-top: 1px solid var(--line);
}
.card-body { padding: 1.25rem; }

.alert {
    border: 0;
    border-radius: var(--radius-s);
    font-weight: 550;
}
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: #7f1d1d; }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }

.badge {
    font-family: var(--font-body);
    font-weight: 650;
    border-radius: 999px;
    padding: 0.35em 0.75em;
    letter-spacing: 0;
}

.bg-label-primary { background: var(--primary-light) !important; color: var(--primary-dark) !important; }
.bg-label-success { background: var(--success-soft) !important; color: var(--success) !important; }
.bg-label-danger { background: var(--danger-soft) !important; color: #9b1c1c !important; }
.bg-label-warning { background: var(--warning-soft) !important; color: var(--warning) !important; }
.bg-label-info { background: var(--info-soft) !important; color: var(--info) !important; }
.bg-label-secondary { background: var(--mist) !important; color: var(--muted) !important; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

/* --- Tableaux, listes ------------------------------------------------------------------ */
.table {
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line);
    font-size: 0.9375rem;
}
.table > :not(caption) > * > * { padding: 0.7rem 0.85rem; }
.table th {
    font-family: var(--font-body);
    font-weight: 650;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    border-bottom-width: 1px;
}
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--mist); }
.cursor-pointer { cursor: pointer; }
.cursor-pointer:hover { background: var(--mist); }

.list-group-item { border-color: var(--line); }

.nav-tabs { border-bottom-color: var(--line); }
.nav-tabs .nav-link { color: var(--muted); font-weight: 600; border-radius: var(--radius-s) var(--radius-s) 0 0; }
.nav-tabs .nav-link.active { color: var(--ink); border-color: var(--line) var(--line) var(--paper); }

.modal-content {
    border: 0;
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-lg);
}
.modal-header, .modal-footer { border-color: var(--line); }

.dropdown-menu {
    border-color: var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.spinner-border { color: var(--primary); }
.spinner-border-sm { width: 1rem; height: 1rem; border-width: 0.15em; }

/* --- Pastille d'icône (accueil) --- */
.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* ==========================================================================
   BOUTIQUE
   ========================================================================== */
.public-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
}

.public-main { flex: 1; }

/* En-tête : blanc, filet, comme le Portal */
.boutique-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}

.boutique-header__bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 4.25rem;
}

.boutique-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}
.boutique-brand:hover { color: var(--ink); }

.boutique-brand__mark {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: var(--radius-s);
    background: var(--primary);
    color: #fff;
    font-size: 1.1rem;
}

.boutique-brand__name {
    overflow: hidden;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.boutique-header__bar > nav { margin-left: auto; }

.boutique-nav {
    display: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
/* « Commander » a déjà son bouton dans l'en-tête large. */
.boutique-nav li.boutique-nav__doublon { display: none; }

.boutique-nav a {
    display: block;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    color: var(--text);
    font-size: 0.9688rem;
    font-weight: 550;
    text-decoration: none;
    white-space: nowrap;
}
.boutique-nav a:hover { color: var(--ink); background: var(--mist); }
.boutique-nav a.active { color: var(--primary-dark); background: var(--primary-light); }

.boutique-header__cta { display: none; }

.boutique-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
    min-height: 2.75rem;
    padding: 0.4rem 0.95rem;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
}
.boutique-menu-toggle[aria-expanded="true"] { border-color: var(--ink); }

.boutique-menu {
    padding: 0.25rem 0 1.25rem;
    border-top: 1px solid var(--line);
}
.boutique-menu ul { margin: 0; padding: 0; list-style: none; }
.boutique-menu li a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-size: 1.0625rem;
    font-weight: 550;
    text-decoration: none;
}
.boutique-menu li a.active { color: var(--primary); }
.boutique-menu .btn { width: 100%; margin-top: 1rem; }

@media (min-width: 992px) {
    .boutique-nav { display: flex; }
    .boutique-header__cta { display: inline-flex; }
    .boutique-menu-toggle, .boutique-menu { display: none !important; }
}

/* Pied de page : « nuit », comme le Portal */
.boutique-footer {
    margin-top: 3rem;
    padding: 3rem 0 1.75rem;
    background: var(--mc-night);
    color: var(--mc-night-text);
    font-size: 0.9375rem;
}
.boutique-footer a { color: var(--mc-night-text); }
.boutique-footer a:hover { color: #fff; }

.boutique-footer__grid {
    display: grid;
    gap: 2rem;
}
.boutique-footer .boutique-brand,
.boutique-footer .boutique-brand:hover { color: #fff; }
.boutique-footer__brand p { margin: 0.9rem 0 0; max-width: 34ch; }

.boutique-footer__title {
    margin-bottom: 0.7rem;
    color: #fff;
    font: 600 1rem/1.3 var(--font-body);
    letter-spacing: 0;
}
.boutique-footer ul { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.boutique-footer li { display: flex; gap: 0.5rem; align-items: baseline; }
.boutique-footer li .bi { color: #93a79d; }

.boutique-footer__legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--mc-night-line);
    color: #93a79d;
    font-size: 0.875rem;
}
.boutique-footer__legal p { margin: 0; }

.propulse {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #93a79d !important;
    text-decoration: none;
}
.propulse strong { color: #fff; font-family: var(--font-display); font-weight: 650; }
.propulse .marque-mc { width: 1.15rem; height: 1.15rem; }

@media (min-width: 768px) {
    .boutique-footer__grid { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
}

/* Titres de page */
.page-head {
    padding: clamp(2rem, 1.4rem + 2.5vw, 3.5rem) 0 clamp(1.25rem, 1rem + 1vw, 2rem);
}
.page-head h1 {
    font-size: clamp(2rem, 1.6rem + 1.8vw, 3rem);
    margin: 0;
}
.page-head__lead {
    max-width: 60ch;
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 650;
}
.eyebrow--closed { background: var(--warning-soft); color: var(--warning); }

/* Accueil */
.hero-boutique {
    padding: clamp(2.5rem, 1.5rem + 4vw, 5rem) 0 clamp(2rem, 1.5rem + 2vw, 3.5rem);
    background: linear-gradient(180deg, var(--mist) 0%, var(--paper) 100%);
    border-bottom: 1px solid var(--line);
}
.hero-boutique__grid {
    display: grid;
    gap: 2rem;
    align-items: center;
}
.hero-boutique h1 {
    font-size: clamp(2.5rem, 1.7rem + 3.4vw, 4.25rem);
    margin: 0;
}
.hero-boutique__lead {
    max-width: 38rem;
    margin: 1.25rem 0 0;
    color: var(--muted);
    font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem);
}
.hero-boutique__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}
.hero-boutique__note { margin: 1rem 0 0; color: var(--muted); font-size: 0.9375rem; }

.retrait-panel {
    padding: clamp(1.25rem, 1rem + 1.2vw, 2rem);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    background: var(--paper);
    box-shadow: var(--shadow-lg);
}
.retrait-panel h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1rem;
    font-size: 1.375rem;
}
.retrait-panel ul { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.retrait-panel li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-s);
    background: var(--mist);
    color: var(--ink);
    font-weight: 600;
}
.retrait-panel li .bi { color: var(--primary); }
.retrait-panel__meta { display: grid; gap: 0.35rem; margin-top: 1.1rem; color: var(--muted); font-size: 0.9375rem; }
.retrait-panel__meta span { display: flex; gap: 0.5rem; align-items: baseline; }

@media (min-width: 992px) {
    .hero-boutique__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 4rem; }
}

.section-boutique { padding: clamp(2.5rem, 2rem + 2.5vw, 4.5rem) 0 0; }
.section-boutique__head { max-width: 44rem; margin-bottom: 1.75rem; }
.section-boutique__head h2 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem); margin: 0; }

.etapes {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: etape;
}
.etape {
    display: grid;
    align-content: start;
    gap: 0.6rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    background: var(--paper);
}
.etape h3 { margin: 0.35rem 0 0; font-size: 1.25rem; }
.etape p { margin: 0; color: var(--muted); }
.etape .btn { justify-self: start; margin-top: 0.5rem; }

@media (min-width: 768px) {
    .etapes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ==========================================================================
   CATALOGUE ET COMMANDE
   ========================================================================== */
.producteur-card > .card-header {
    background: var(--paper) !important;
    padding: 1.1rem 1.25rem;
}
.producteur-card > .card-header h5,
.producteur-card > .card-header h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    font-size: 1.25rem;
}
.producteur-card > .card-header .bi { color: var(--primary); }

.category-header {
    background: var(--mist);
    padding: 0.55rem 1.25rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.category-header h6 {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}
.category-header .bi { color: var(--primary); }

.product-row {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--line);
    transition: background 0.15s;
}
.product-row:hover { background: #f8faf8; }
.product-row.selected { background: var(--primary-light); }
.product-row:last-child { border-bottom: none; }

.product-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--radius-s);
    flex-shrink: 0;
    margin-right: 0.9rem;
}

.product-info { flex: 1; min-width: 0; }
.product-info small { display: block; }
.product-name {
    color: var(--ink);
    font-weight: 650;
    font-size: 1rem;
}
.product-price {
    display: inline-block;
    margin-top: 2px;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
}

/* Réordonnancement du catalogue au glisser-déposer (/admin/catalogue) */
.poignee-glisse { cursor: grab; }
.poignee-glisse:active { cursor: grabbing; }
tr.ligne-glissee { opacity: 0.45; background: var(--primary-light); }
/* Bootstrap peint le fond sur les cellules (--bs-table-bg) : c'est là qu'il faut le changer. */
tr.ligne-categorie > td { --bs-table-bg: var(--mist); }
tr.ligne-categorie > td .bi:not(.bi-grip-vertical) { color: var(--primary); }
tr.ligne-glissee > td { --bs-table-bg: var(--primary-light); }

/* Sélecteur de quantité */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    flex-shrink: 0;
}
.quantity-selector .btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
}
.quantity-value {
    width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.quantity-value.has-items { color: var(--primary); }

/* Récapitulatif flottant */
.floating-summary {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.8rem 0;
    background: var(--mc-night);
    color: #fff;
    box-shadow: 0 -12px 30px -18px rgba(20, 35, 28, 0.6);
}
.floating-summary .btn-light {
    color: var(--ink);
    border-color: #fff;
}

/* Étapes de la commande */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 520px;
    margin: 0 auto;
}
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.step-number {
    width: 2.25rem;
    height: 2.25rem;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.wizard-step.active .step-number {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.wizard-step.done .step-number {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: none;
}
.step-label {
    font-size: 0.8125rem;
    color: var(--muted);
    font-weight: 600;
}
.wizard-step.active .step-label { color: var(--ink); }
.wizard-connector {
    flex: 1;
    height: 2px;
    margin: 0 8px 22px;
    background: var(--line);
    transition: background 0.2s;
}
.wizard-connector.active { background: var(--primary); }

/* ==========================================================================
   BACK-OFFICE
   ========================================================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--mist);
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background: var(--mc-night);
    color: var(--mc-night-text);
    transition: transform 0.3s;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1.15rem 1.25rem;
    color: #fff;
}
.sidebar-header .marque-mc { width: 2rem; height: 2rem; flex: none; }
.sidebar-brand {
    white-space: nowrap;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-ferme {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0.75rem 0.5rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--mc-night-line);
    border-radius: var(--radius);
    color: #fff;
}
.sidebar-ferme__icone {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-s);
    background: var(--ferme);
    color: #fff;
}
.sidebar-ferme__texte { display: grid; min-width: 0; line-height: 1.25; }
.sidebar-ferme__nom { overflow: hidden; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-ferme__role { color: #93a79d; font-size: 0.8125rem; }

.sidebar-close {
    margin-left: auto;
    color: var(--mc-night-text);
    text-decoration: none;
    font-size: 1.2rem;
}
.sidebar-close:hover { color: #fff; }

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.5rem 0.75rem 1rem;
    overflow-y: auto;
}

.sidebar-section {
    margin: 0.9rem 0.6rem 0.3rem;
    color: #93a79d;
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-s);
    color: var(--mc-night-text);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 550;
    transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}
.sidebar-link.active {
    background: var(--mc-accent);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--mc-straw);
}
.sidebar-link .bi { width: 22px; font-size: 1.15rem; text-align: center; }
/* Lien sortant (Portal) : petite flèche en fin de ligne, moins appuyée que l'icône. */
.sidebar-link .sidebar-link-external { margin-left: auto; font-size: 0.75rem; width: auto; opacity: 0.6; }

.sidebar-divider {
    height: 1px;
    margin: 0.6rem 0.25rem;
    background: var(--mc-night-line);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(20, 35, 28, 0.55);
}

.admin-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.75rem;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(1.4) blur(10px);
}

.admin-user {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-left: auto;
    color: var(--muted);
    font-size: 0.9375rem;
    min-width: 0;
}
.admin-user__avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--mc-accent-soft);
    color: var(--mc-accent);
    font-weight: 700;
    text-transform: uppercase;
}
.admin-user__email { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.admin-main {
    flex: 1;
    padding: 1.75rem 1.75rem 3rem;
}
.admin-main > h4:first-child,
.admin-main .d-flex > h4:first-child {
    font-size: clamp(1.625rem, 1.4rem + 0.9vw, 2.125rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.sidebar-toggle:hover { color: var(--ink); border-color: var(--ink); }

/* Connexion au back-office */
.acces-admin {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: clamp(2rem, 1rem + 5vw, 5rem) 16px 2rem;
    background: var(--mist);
}
.acces-admin__marque {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 2rem;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.acces-admin__marque .marque-mc { width: 2.25rem; height: 2.25rem; }
.acces-admin__carte {
    width: 100%;
    max-width: 26rem;
    padding: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    background: var(--paper);
    box-shadow: var(--shadow-lg);
}
.acces-admin__carte h1 { font-size: 1.75rem; margin: 0; }
.acces-admin__ferme {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.6rem 0 1.5rem;
    color: var(--muted);
}
.acces-admin__ferme .bi { color: var(--ferme); }
.acces-admin__pied { margin-top: 1.5rem; color: var(--muted); font-size: 0.9375rem; text-align: center; }

.marque-mc { display: block; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 991px) {
    .admin-sidebar { transform: translateX(-100%); }
    .sidebar-open .admin-sidebar { transform: translateX(0); }
    .admin-content { margin-left: 0; }
    .admin-topbar { padding: 0.5rem 1rem; }
    .admin-main { padding: 1.25rem 0.75rem 2.5rem; }
}

@media (max-width: 575px) {
    .step-number { width: 2rem; height: 2rem; font-size: 0.8125rem; }
    .wizard-connector { margin: 0 4px 22px; }

    .product-row { padding: 0.7rem 1rem; }
    .quantity-selector { gap: 4px; }
    .quantity-selector .btn { width: 30px; height: 30px; }

    .floating-summary { padding: 0.65rem 0; font-size: 0.9375rem; }
    .card-body { padding: 1rem; }
}

/* Entrée en douceur des cartes */
.card { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

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

/* ==========================================================================
   PRÉSENTATION (Markdown, /admin/personnalisation, accueil)
   ========================================================================== */
.presentation-accueil { max-width: 820px; }
/* Avec photo : la photo à gauche, le texte à droite ; l'un sous l'autre sur écran étroit. */
.presentation-accueil.avec-photo {
    max-width: 1100px;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 2.5rem;
    align-items: start;
}
.presentation-photo {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-lg);
}
.presentation-accueil:not(.avec-photo) .presentation-photo {
    max-height: 420px;
    object-fit: cover;
}
@media (max-width: 767px) {
    .presentation-accueil.avec-photo {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.25rem;
    }
}
.presentation-miniature {
    width: 96px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-s);
    flex-shrink: 0;
}
.contenu-markdown { font-size: 1.0625rem; line-height: 1.7; }
.contenu-markdown > :first-child { margin-top: 0; }
.contenu-markdown > :last-child { margin-bottom: 0; }
.contenu-markdown h1,
.contenu-markdown h2,
.contenu-markdown h3,
.contenu-markdown h4 {
    color: var(--primary-dark);
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}
.contenu-markdown h1, .contenu-markdown h2 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem); }
.contenu-markdown a { color: var(--primary); }
.contenu-markdown img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}
.contenu-markdown blockquote {
    border-left: 4px solid var(--primary);
    background: var(--primary-light);
    padding: 0.6rem 1rem;
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
}
.contenu-markdown blockquote > :last-child { margin-bottom: 0; }
.contenu-markdown table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}
.contenu-markdown th,
.contenu-markdown td {
    border: 1px solid var(--line);
    padding: 0.4rem 0.6rem;
}
.zone-markdown {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    min-height: 320px;
}

/* Les boutons espacent déjà icône et texte : les marges Bootstrap des icônes s'y ajouteraient. */
.btn > .bi.me-1, .btn > .bi.me-2, .btn > .bi.ms-1, .btn > .bi.ms-2 { margin: 0 !important; }

.bg-light { background-color: var(--mist) !important; }

code {
    color: var(--ink);
    font-size: 0.875em;
    font-variant-numeric: tabular-nums;
}

.sidebar-close { padding: 0.25rem; }

@media (max-width: 575px) {
    .container, .container-fluid { --bs-gutter-x: 2rem; }
    .boutique-brand__name { font-size: 1.1rem; }
    .boutique-header__bar { gap: 0.75rem; }
}

/* ==========================================================================
   COMPOSANTS AJOUTÉS SUR MAIN (catalogue en tuiles, synthèse de commande,
   ordre des producteurs, bandeau d'erreur du circuit), aux couleurs de la charte
   ========================================================================== */

/* Modale « Ordre des producteurs » : liste réordonnée au glisser-déposer */
.liste-ordre .list-group-item { cursor: grab; user-select: none; }
.liste-ordre .list-group-item:active { cursor: grabbing; }
.liste-ordre .list-group-item.ligne-glissee { opacity: 0.45; background: var(--primary-light); }

/* Prix et unité en bout de ligne, l'un sous l'autre (/produits) */
.product-tarif {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    margin-left: 16px;
    line-height: 1.2;
    white-space: nowrap;
}
.product-tarif-prix {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.0625rem;
    font-variant-numeric: tabular-nums;
}
.product-tarif-unite,
.product-unite {
    color: var(--muted);
    font-size: 0.8125rem;
}

/* /produits : les produits d'une catégorie en tuiles. Colonnes de 320 px au moins, donc trois
   sur grand écran, deux sur tablette et une sur téléphone, sans point de rupture à entretenir. */
.grille-produits {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 12px;
    padding: 1rem 1.25rem 1.25rem;
}
.tuile-produit {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tuile-produit:hover {
    border-color: rgba(var(--primary-rgb), 0.45);
    box-shadow: var(--shadow-lg);
}
.tuile-produit .product-thumb,
.tuile-produit .product-tarif { margin: 0; }
.tuile-produit.tuile-indisponible { opacity: 0.65; }
/* Trois lignes au plus : le texte complet reste lisible au survol (attribut title). */
.tuile-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    margin-top: 2px;
    line-height: 1.35;
}

/* Synthèse de la commande (étape « Produits » de /commander, tiers de droite) */
@media (min-width: 992px) {
    /* Reste en vue pendant le défilement de la liste ; la colonne s'étire sur toute sa hauteur. */
    .synthese-commande { position: sticky; top: 5.5rem; }
    /* Au-delà d'une demi-hauteur d'écran, la liste défile seule : total et boutons restent visibles. */
    .synthese-lignes { max-height: 50vh; overflow-y: auto; }
}
.synthese-commande .min-w-0 { min-width: 0; }

/* Textes d'exemple : opacity 1 neutralise l'atténuation de Firefox. */
.form-control::placeholder { opacity: 1; }

/* Erreur non gérée du circuit Blazor (#blazor-error-ui, App.razor). Masqué par défaut : Blazor
   l'affiche lui-même (style display: block). Bandeau fixe en bas d'écran, au-dessus du récapitulatif. */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    padding: 0.85rem 3.25rem 0.85rem 1.25rem;
    border-top: 3px solid var(--mc-straw);
    background: var(--warning-soft);
    color: var(--warning);
    box-shadow: 0 -12px 30px -18px rgba(20, 35, 28, 0.6);
    font-size: 0.95rem;
    font-weight: 550;
}
#blazor-error-ui .reload {
    margin-left: 0.5rem;
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}
#blazor-error-ui .dismiss {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    padding: 0.25rem 0.5rem;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
