/* Modale générique
   Échelle z-index de l'application :
   header 200 < drawer mobile 900 < modales 1200 < toasts/popovers 9999+ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 16px;
}

.modal-content {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 18px 20px;
    margin: auto; /* s'assure que le contenu est bien centré dans le flex container */
}

.modal-content-wide {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    margin-top: 4px;
}

.close-btn {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

.close-btn:hover {
    background: rgba(148, 163, 184, 0.25);
    color: var(--color-text);
}

.devis-selector-list {
    display: grid;
    gap: 0.75rem;
}

.devis-selector-item {
    width: 100%;
}

.devis-selector-tile {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.75);
    border-radius: var(--radius-md);
    border: 1px solid rgba(31, 41, 55, 0.9);
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
}

.devis-selector-tile:hover {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.8);
    transform: translateY(-1px);
}

.devis-selector-main {
    flex: 1;
    min-width: 0;
}

.devis-selector-number {
    font-weight: 600;
    color: var(--color-accent);
    font-size: 14px;
}

.devis-selector-sub {
    font-size: 13px;
    color: var(--color-text);
    margin-top: 2px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.devis-selector-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.devis-selector-status {
    margin-left: 8px;
}

.devis-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: var(--color-text-muted);
}

.devis-status-select {
    display: inline-flex;
    align-items: center;
    padding: 2px 22px 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background-color: rgba(15, 23, 42, 0.9);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.16s ease;
    font-family: inherit;
    min-width: 80px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px 10px;
}

.devis-status-select:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.devis-status-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.status-draft {
    border-color: rgba(148, 163, 184, 0.7);
}

.status-sent {
    border-color: rgba(59, 130, 246, 0.9);
    color: #bfdbfe;
}

.status-accepted {
    border-color: rgba(22, 163, 74, 0.9);
    color: #bbf7d0;
}

.status-rejected {
    border-color: rgba(239, 68, 68, 0.9);
    color: #fecaca;
}

.status-expired {
    border-color: rgba(234, 179, 8, 0.9);
    color: #fef9c3;
}

/* Mode clair pour les statuts de devis */
:root[data-theme="light"] .devis-status {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(203, 213, 225, 0.8);
    color: var(--color-text);
}

:root[data-theme="light"] .status-draft {
    border-color: rgba(148, 163, 184, 0.7);
    color: #475569;
}

:root[data-theme="light"] .status-sent {
    border-color: rgba(59, 130, 246, 0.7);
    color: #1e40af;
    background: rgba(239, 246, 255, 0.95);
}

:root[data-theme="light"] .status-accepted {
    border-color: rgba(22, 163, 74, 0.7);
    color: #15803d;
    background: rgba(240, 253, 244, 0.95);
}

:root[data-theme="light"] .status-rejected {
    border-color: rgba(239, 68, 68, 0.7);
    color: #dc2626;
    background: rgba(254, 242, 242, 0.95);
}

:root[data-theme="light"] .status-expired {
    border-color: rgba(234, 179, 8, 0.7);
    color: #ca8a04;
    background: rgba(254, 249, 195, 0.95);
}

/* Styles pour le select de statut en mode clair */
:root[data-theme="light"] .devis-status-select {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(203, 213, 225, 0.8);
    color: var(--color-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px 10px;
}

:root[data-theme="light"] .devis-status-select.status-draft {
    border-color: rgba(148, 163, 184, 0.7);
    color: #475569;
}

:root[data-theme="light"] .devis-status-select.status-sent {
    border-color: rgba(59, 130, 246, 0.7);
    color: #1e40af;
    background-color: rgba(239, 246, 255, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e40af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .devis-status-select.status-accepted {
    border-color: rgba(22, 163, 74, 0.7);
    color: #15803d;
    background-color: rgba(240, 253, 244, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2315803d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .devis-status-select.status-rejected {
    border-color: rgba(239, 68, 68, 0.7);
    color: #dc2626;
    background-color: rgba(254, 242, 242, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23dc2626' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .devis-status-select.status-expired {
    border-color: rgba(234, 179, 8, 0.7);
    color: #ca8a04;
    background-color: rgba(254, 249, 195, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ca8a04' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Styles pour les statuts de commandes (similaires aux devis) */
.order-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: var(--color-text-muted);
}

.order-status-select {
    display: inline-flex;
    align-items: center;
    padding: 2px 22px 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background-color: rgba(15, 23, 42, 0.9);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.16s ease;
    font-family: inherit;
    min-width: 100px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px 10px;
}

.order-status-select:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.order-status-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.status-pending {
    border-color: rgba(245, 158, 11, 0.9);
    color: #fde68a;
}

.status-received {
    border-color: rgba(16, 185, 129, 0.9);
    color: #6ee7b7;
}

.status-paid {
    border-color: rgba(59, 130, 246, 0.9);
    color: #93c5fd;
}

.status-cancelled {
    border-color: rgba(239, 68, 68, 0.9);
    color: #fca5a5;
}

/* Mode clair pour les statuts de commandes */
:root[data-theme="light"] .order-status {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(203, 213, 225, 0.8);
    color: var(--color-text);
}

:root[data-theme="light"] .order-status-select {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(203, 213, 225, 0.8);
    color: var(--color-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px 10px;
}

:root[data-theme="light"] .order-status-select.status-pending {
    border-color: rgba(245, 158, 11, 0.7);
    color: #d97706;
    background-color: rgba(254, 243, 199, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d97706' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .order-status-select.status-received {
    border-color: rgba(16, 185, 129, 0.7);
    color: #059669;
    background-color: rgba(240, 253, 244, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23059669' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .order-status-select.status-paid {
    border-color: rgba(59, 130, 246, 0.7);
    color: #1e40af;
    background-color: rgba(239, 246, 255, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e40af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .order-status-select.status-cancelled {
    border-color: rgba(239, 68, 68, 0.7);
    color: #dc2626;
    background-color: rgba(254, 242, 242, 0.95);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23dc2626' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .modal {
    background: rgba(15, 23, 42, 0.35);
}

:root[data-theme="light"] .modal-content {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 0.9);
}

:root[data-theme="light"] .devis-selector-tile {
    background: rgba(248, 250, 252, 0.95);
    border-color: rgba(203, 213, 225, 0.9);
}

:root[data-theme="light"] .devis-selector-tile:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}
/* Style minimal et moderne pour PrixReviens */

:root {
    /* Mode sombre (par défaut) */
    /* color-scheme : les contrôles natifs (checkboxes non cochées, selects,
       scrollbars) se dessinent en variante sombre au lieu de blanc */
    color-scheme: dark;
    --color-bg: #050816;
    --color-bg-elevated: #0f172a;
    --color-accent: #22c55e;
    --color-accent-soft: rgba(34, 197, 94, 0.12);
    --color-text: #e5e7eb;
    --color-text-muted: #9ca3af;
    --color-border: #1f2937;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.85);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-pill: 999px;
}

/* Mode clair */
:root[data-theme="light"] {
    color-scheme: light;
    --color-bg: #f8fafc;
    --color-bg-elevated: #ffffff;
    --color-accent: #16a34a;
    --color-accent-soft: rgba(22, 163, 74, 0.12);
    --color-text: #0f172a;
    --color-text-muted: #475569;
    --color-border: #cbd5e1;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.08);
}

/* Cases à cocher et boutons radio : accent vert dans les deux thèmes
   (état coché), rendu sombre géré par color-scheme ci-dessus */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--color-accent);
}

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

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cg transform='translate(17.92,21.44)' fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='14.08' cy='6.16' r='5.28'/%3E%3Ccircle cx='7.04' cy='10.12' r='3.96'/%3E%3Ccircle cx='21.12' cy='10.12' r='3.96'/%3E%3Crect x='7.04' y='10.12' width='14.08' height='10.12'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at top left, #1e293b, #020617 55%);
    background-repeat: repeat, no-repeat;
    background-size: 64px 64px, cover;
    color: var(--color-text);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

:root[data-theme="light"] body {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cg transform='translate(17.92,21.44)' fill='%23334155' fill-opacity='0.025'%3E%3Ccircle cx='14.08' cy='6.16' r='5.28'/%3E%3Ccircle cx='7.04' cy='10.12' r='3.96'/%3E%3Ccircle cx='21.12' cy='10.12' r='3.96'/%3E%3Crect x='7.04' y='10.12' width='14.08' height='10.12'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at top left, #f1f5f9, #ffffff 55%);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.app-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.85));
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    transition: background 0.3s ease, border-color 0.3s ease;
    position: relative;
    z-index: 200;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.header-top-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

:root[data-theme="light"] .app-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-link:hover,
.brand-link:focus {
    text-decoration: none;
}

.brand-logo-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 18px;
    background: radial-gradient(circle at 20% 20%, #e5f3ff, #dbeafe 45%, #eff6ff 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.5);
    overflow: hidden;
}

.brand-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.toast {
    min-width: 260px;
    max-width: 360px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #e5e7eb;
    font-size: 14px;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px);
    animation: toast-in 0.18s ease-out forwards;
    pointer-events: auto;
}

.toast.toast-success {
    border-color: rgba(34, 197, 94, 0.8);
}

.toast.toast-error {
    border-color: rgba(248, 113, 113, 0.85);
}

.toast.toast-warning {
    border-color: rgba(234, 179, 8, 0.85);
}

.toast-icon {
    font-size: 16px;
    line-height: 1;
    margin-top: 2px;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    margin-left: 6px;
    font-size: 14px;
}

.toast-close:hover {
    color: #e5e7eb;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-weight: 650;
    font-size: 18px;
    letter-spacing: 0.04em;
    text-decoration: none;
    color: var(--color-text);
    transition: color 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    display: inline-block;
}

.brand-name:hover {
    color: var(--color-primary, #4f46e5);
    opacity: 0.9;
}

.brand-tagline {
    font-size: 12px;
    color: var(--color-text-muted);
    text-decoration: none;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* Burger, overlay et en-tête de drawer : réservés au mobile (≤ 768px) */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-toggle:hover,
.nav-toggle[aria-expanded="true"] {
    border-color: var(--color-accent);
}

/* Icône burger en SVG inline (stroke: currentColor) : rendu garanti
   quelles que soient les polices et robuste aux aléas de parsing CSS. */
.nav-toggle {
    color: var(--color-text);
}

.nav-toggle:hover,
.nav-toggle[aria-expanded="true"] {
    color: var(--color-accent);
}

.nav-toggle-svg {
    display: block;
    flex-shrink: 0;
}

/* Fermé : burger visible, croix cachée — ouvert : l'inverse */
.nav-toggle-svg-close,
.nav-toggle[aria-expanded="true"] .nav-toggle-svg-open {
    display: none;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-svg-close {
    display: block;
}

.nav-drawer-header {
    display: none;
}

.nav-drawer-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
}

.nav-close {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    min-width: 36px;
    height: 36px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-close:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 22, 0.6);
    backdrop-filter: blur(2px);
    z-index: 890;
}

/* Bloquer le défilement de la page quand le drawer est ouvert */
body.nav-locked {
    overflow: hidden;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.nav-link {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--color-text-muted);
    border: 1px solid rgba(30, 64, 175, 0.0);
    background: radial-gradient(circle at 0 0, rgba(30, 64, 175, 0.25), rgba(15, 23, 42, 0.9));
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.75);
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, background 0.15s ease-out;
}

.nav-link:hover {
    border-color: rgba(129, 140, 248, 0.7);
    color: var(--color-text);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(30, 64, 175, 0.55);
    background: radial-gradient(circle at 0 0, rgba(129, 140, 248, 0.35), rgba(15, 23, 42, 0.95));
}

.nav-link.active {
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #ecfdf5;
    border-color: rgba(129, 140, 248, 0.9);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.9);
}

/* Navigation par catégories avec dropdowns */
.nav-icon {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
    display: inline-block;
    line-height: 1;
}

.nav-link-primary {
    font-weight: 600;
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #ecfdf5;
    padding: 10px 16px;
    border-radius: var(--radius-md);
}

.nav-link-primary:hover {
    background: linear-gradient(135deg, #5b52f0, #2dd66f);
    color: #ecfdf5;
    transform: translateY(-1px);
}

.nav-link-primary.active {
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.9);
}

.nav-category {
    position: relative;
}

.nav-category-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--color-text-muted);
    border: 1px solid rgba(30, 64, 175, 0.0);
    background: radial-gradient(circle at 0 0, rgba(30, 64, 175, 0.25), rgba(15, 23, 42, 0.9));
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.75);
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, background 0.15s ease-out;
    cursor: pointer;
    font-family: inherit;
}

.nav-category-toggle:hover {
    border-color: rgba(129, 140, 248, 0.7);
    color: var(--color-text);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(30, 64, 175, 0.55);
    background: radial-gradient(circle at 0 0, rgba(129, 140, 248, 0.35), rgba(15, 23, 42, 0.95));
}

.nav-category-toggle[aria-expanded="true"],
.nav-category.has-active .nav-category-toggle {
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #ecfdf5;
    border-color: rgba(129, 140, 248, 0.9);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.9);
}

.nav-arrow {
    font-size: 0.7em;
    transition: transform 0.2s ease;
    margin-left: 4px;
}

.nav-category-toggle[aria-expanded="true"] .nav-arrow {
    transform: rotate(180deg);
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
    padding: 8px;
    backdrop-filter: blur(10px);
}

.nav-category-toggle[aria-expanded="true"] + .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
}

.nav-dropdown .nav-link:last-child {
    margin-bottom: 0;
}

.nav-dropdown .nav-link:hover {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.3);
    transform: translateX(4px);
}

.nav-dropdown .nav-link.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.3), rgba(34, 197, 94, 0.3));
    border-color: rgba(129, 140, 248, 0.5);
    color: var(--color-text);
}

/* Unification des styles de boutons de navigation */
.nav-link,
.nav-link-primary,
.nav-category-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid;
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

/* Style unifié pour le bouton Dashboard */
.nav-link-primary {
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #ecfdf5;
    border-color: rgba(129, 140, 248, 0.9);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-link-primary:hover {
    background: linear-gradient(135deg, #5b52f0, #2dd66f);
    color: #ecfdf5;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.nav-link-primary.active {
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.5);
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 18px;
    margin-bottom: 16px;
}

/* KPI Cards pour statistiques */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    border-left: 4px solid;
    transition: all 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.kpi-card.kpi-primary { border-left-color: #3b82f6; }
.kpi-card.kpi-success { border-left-color: #10b981; }
.kpi-card.kpi-info { border-left-color: #06b6d4; }
.kpi-card.kpi-warning { border-left-color: #f59e0b; }

.kpi-icon {
    font-size: 2.5em;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 0.85em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.kpi-trend {
    font-size: 0.8em;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Grille de graphiques */
.stats-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

/* Quick stats pour dashboard */
.quick-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.quick-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary, rgba(79, 70, 229, 0.5));
}

.quick-stat-icon {
    font-size: 2em;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.quick-stat-content {
    flex: 1;
}

.quick-stat-label {
    font-size: 0.85em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.quick-stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

@media (max-width: 768px) {
    .stats-charts-grid {
        grid-template-columns: 1fr;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .grid.grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Guide de démarrage (onboarding) */
.onboarding-card {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.step {
    display: flex;
    gap: 16px;
    align-items: start;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border, rgba(31, 41, 55, 0.2));
    transition: all 0.2s ease;
}

.step:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--color-primary, rgba(79, 70, 229, 0.4));
    transform: translateX(4px);
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 1.1em;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1.1em;
    color: var(--color-text);
}

:root[data-theme="light"] .step {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(203, 213, 225, 0.5);
}

:root[data-theme="light"] .step:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(22, 163, 74, 0.4);
}

:root[data-theme="light"] .step-number {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.card {
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.93));
    border: 1px solid rgba(31, 41, 55, 0.85);
    padding: 20px 22px;
    box-shadow: var(--shadow-soft);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-header {
    font-size: 14px;
    padding: 6px 12px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
}

.badge-pill {
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    background: var(--color-accent-soft);
    color: #bbf7d0;
    border: 1px solid rgba(34, 197, 94, 0.4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.grid {
    display: grid;
    gap: 16px;
}

/* Grille 4 colonnes (statistiques devis, etc.) */
@media (min-width: 768px) {
    .grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: 1.2fr 1fr;
    }
}

.stat-chip {
    border-radius: var(--radius-md);
    padding: 12px 14px;
    background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.07), rgba(15, 23, 42, 1));
    border: 1px solid rgba(31, 41, 55, 0.9);
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.stat-value {
    margin-top: 4px;
    font-size: 20px;
    font-weight: 600;
}

.stat-trend {
    margin-top: 2px;
    font-size: 12px;
    color: #bbf7d0;
}

/* Cartes de devis (liste des devis) */
.devis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.devis-card {
    border-radius: 14px;
    padding: 14px 16px;
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.1), rgba(15, 23, 42, 0.96));
    border: 1px solid rgba(30, 64, 175, 0.75);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.16s ease-out, box-shadow 0.16s ease-out, border-color 0.16s ease-out;
}

.devis-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.95);
    border-color: rgba(59, 130, 246, 0.9);
}

.devis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.devis-number {
    font-size: 14px;
    font-weight: 600;
    color: #bfdbfe;
}

.devis-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px 12px;
    font-size: 13px;
}

.devis-info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.devis-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.badge-soft {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    color: var(--color-text-muted);
    white-space: nowrap;
    display: inline-block;
}

:root[data-theme="light"] .devis-card {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(219, 234, 254, 0.98));
    border-color: rgba(191, 219, 254, 0.9);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

:root[data-theme="light"] .devis-number {
    color: #1d4ed8;
}

:root[data-theme="light"] .badge-soft {
    background: rgba(248, 250, 252, 0.98);
    border-color: rgba(148, 163, 184, 0.7);
}

.app-footer {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    padding: 10px 4px;
}

.muted {
    color: var(--color-text-muted);
    font-size: 13px;
}

.btn {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #ecfdf5;
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.45);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, filter 0.15s ease-out;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 12px 26px rgba(22, 163, 74, 0.65);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #0b1120, #020617);
    border-color: rgba(148, 163, 184, 0.4);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.8);
    color: var(--color-text);
}

.btn-secondary:hover {
    border-color: rgba(148, 163, 184, 0.85);
    filter: brightness(1.02);
}

.btn-danger {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(185, 28, 28, 0.1));
    border-color: rgba(220, 38, 38, 0.4);
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.3);
    color: #ef4444;
}

.btn-danger:hover {
    border-color: rgba(220, 38, 38, 0.85);
    filter: brightness(1.1);
    color: #f87171;
}

.btn-icon {
    font-size: 14px;
}

.pill {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(51, 65, 85, 0.7);
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pill:has(:checked) {
    background: rgba(22, 163, 74, 0.18);
    border-color: rgba(34, 197, 94, 0.7);
    color: #bbf7d0;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.pill:hover:not(:has(:checked)) {
    border-color: rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.95);
    color: #cbd5e1;
}

.pill input[type="checkbox"] {
    accent-color: var(--color-accent);
    width: 13px;
    height: 13px;
    margin: 0;
}

.form-grid {
    display: grid;
    gap: 10px;
}

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

@media (max-width: 767px) {
    .form-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Groupes de champs dans les devis : même comportement que field-group */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.field-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 6px;
}

.field-input,
.field-select,
.field-textarea,
.form-input {
    border-radius: 10px;
    border: 1px solid rgba(31, 41, 55, 0.95);
    padding: 7px 10px;
    font-size: 13px;
    background: rgba(15, 23, 42, 0.98);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.16s ease-out, box-shadow 0.16s ease-out, background 0.16s ease-out;
}

/* Inputs numériques plus courts (quantités, taux, etc.) */
input[type="number"].field-input,
input[type="number"].form-input {
    max-width: 120px;
}

/* Normaliser l'apparence des flèches + / - des inputs numériques */
input[type="number"] {
    -moz-appearance: textfield; /* Firefox : enlever le style spinner natif */
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none; /* Chrome, Edge, Safari : enlever les flèches natives */
    margin: 0;
}

.field-input::placeholder,
.field-textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

/* Style pour les options de recettes intermédiaires dans les selects */
.field-select option {
    background: rgba(15, 23, 42, 0.98);
    color: var(--color-text);
}

.field-select option.recipe-option {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--color-text);
}

:root[data-theme="light"] .field-select option {
    background: rgba(255, 255, 255, 0.98);
    color: var(--color-text);
}

:root[data-theme="light"] .field-select option.recipe-option {
    background-color: rgba(22, 163, 74, 0.08);
    color: var(--color-text);
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus,
.form-input:focus {
    border-color: rgba(34, 197, 94, 0.8);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.5);
    background: #020617;
}

/* Textareas un peu plus compactes par défaut */
.field-textarea {
    min-height: 80px;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}

#rec-instructions {
    min-height: 300px;
    width: 100%;
}

.table-shell {
    border-radius: 14px;
    border: 1px solid rgba(31, 41, 55, 0.9);
    overflow: visible; /* Changé de hidden à visible pour les dropdowns */
    position: relative;
}

/* S'assurer que les éléments de table permettent aussi le débordement */
.table-shell table {
    border-collapse: separate;
    border-spacing: 0;
}

.table-shell tbody tr {
    position: relative;
}

.pagination-container {
    margin-top: 16px;
}

.search-suggestion-item:hover {
    background: rgba(59, 130, 246, 0.2) !important;
}

/* --- Devis : liste de recettes avec scrollbar --- */
.recipe-selection-grid {
    display: grid;
    gap: 10px;
    max-height: 420px;       /* limite la hauteur de la liste */
    overflow-y: auto;        /* scrollbar verticale si beaucoup de recettes */
    padding-right: 4px;      /* un peu d'air pour la scrollbar */
}

.recipe-selection-grid::-webkit-scrollbar {
    width: 6px;
}

.recipe-selection-grid::-webkit-scrollbar-track {
    background: transparent;
}

.recipe-selection-grid::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 999px;
}

/* Cartes recettes dans le devis */
.recipe-card {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 12px;
    border: 1px solid rgba(31, 41, 55, 0.9);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.recipe-card:hover {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.75);
    transform: translateY(-1px);
}

.recipe-card.selected {
    border-color: rgba(34, 197, 94, 0.95);
    background: radial-gradient(circle at top left, rgba(22, 163, 74, 0.14), rgba(15, 23, 42, 0.96));
}

.recipe-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.recipe-card-checkbox {
    width: 18px;
    height: 18px;
}

.recipe-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recipe-card-title {
    font-size: 14px;
    font-weight: 600;
}

.recipe-card-price {
    font-size: 12px;
    color: var(--color-text-muted);
}

.recipe-card-body {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed rgba(51, 65, 85, 0.8);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 12px;
}

.recipe-card-field label {
    font-size: 11px;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 2px;
}

.recipe-card-field .form-input:not([type="number"]) {
    width: 100%;
}

/* Variante claire pour les cartes recettes */
:root[data-theme="light"] .recipe-card {
    background: rgba(248, 250, 252, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.9);
}

:root[data-theme="light"] .recipe-card:hover {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

:root[data-theme="light"] .recipe-card.selected {
    border-color: rgba(22, 163, 74, 0.9);
    background: radial-gradient(circle at top left, rgba(22, 163, 74, 0.10), rgba(248, 250, 252, 0.98));
}

/* Devis - boutons de présélection TVA */
.tva-field-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tva-field-group .form-input[type="number"] {
    max-width: 90px;
}

.tva-preset {
    border-radius: 999px;
    border: 1px solid rgba(51, 65, 85, 0.9);
    background: rgba(15, 23, 42, 0.9);
    color: var(--color-text-muted);
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.tva-preset:hover {
    background: rgba(34, 197, 94, 0.12);
    color: var(--color-accent);
    border-color: rgba(34, 197, 94, 0.8);
}

/* Mode clair pour les boutons de présélection TVA */
:root[data-theme="light"] .tva-preset {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(203, 213, 225, 0.9);
    color: var(--color-text);
}

:root[data-theme="light"] .tva-preset:hover {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.6);
}

#search-suggestions {
    display: none;
    position: absolute;
    z-index: 1000;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(31, 41, 55, 0.9);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 13px;
}

:root[data-theme="light"] #search-suggestions {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(203, 213, 225, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#search-suggestions mark {
    background: rgba(59, 130, 246, 0.4);
    padding: 2px 0;
    color: inherit;
    font-weight: 500;
}

.search-suggestions-container {
    position: relative;
}

.search-input-wrapper {
    position: relative;
}

.search-input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(156, 163, 175, 0.8);
    pointer-events: none;
}

.search-input-full {
    width: 100%;
    padding: 10px 40px 10px 12px;
    font-size: 14px;
}

.legend-box {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    font-size: 13px;
}

:root[data-theme="light"] .legend-box {
    background: rgba(59, 130, 246, 0.08);
}

.legend-title {
    display: block;
    margin-bottom: 8px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.filters-box {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(31, 41, 55, 0.3);
    border-radius: 8px;
}

:root[data-theme="light"] .filters-box {
    background: rgba(241, 245, 249, 0.6);
}

.filters-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filters-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.filters-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-label {
    font-size: 13px;
    white-space: nowrap;
}

.filter-select {
    min-width: 200px;
    padding: 6px 10px;
    font-size: 13px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-full {
    padding: 4px 12px;
    font-size: 12px;
    width: 100%;
}

.export-count {
    margin-left: 6px;
    opacity: 0.8;
    font-size: 12px;
}

.search-suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(31, 41, 55, 0.3);
    transition: background 0.2s;
}

:root[data-theme="light"] .search-suggestion-item {
    border-bottom-color: rgba(203, 213, 225, 0.5);
}

.search-suggestion-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

:root[data-theme="light"] .search-suggestion-item:hover {
    background: rgba(59, 130, 246, 0.08);
}

.search-suggestion-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.search-suggestion-supplier {
    font-size: 12px;
}

.search-suggestions-footer {
    padding: 8px;
    text-align: center;
    border-top: 1px solid rgba(31, 41, 55, 0.3);
}

:root[data-theme="light"] .search-suggestions-footer {
    border-top-color: rgba(203, 213, 225, 0.5);
}

.search-suggestions-empty {
    padding: 12px;
    text-align: center;
}

.search-suggestions-content {
    padding: 8px;
}

.edit-mode-banner {
    margin-top: 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

:root[data-theme="light"] .edit-mode-banner {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.edit-mode-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-spacing {
    margin-top: 16px;
    margin-bottom: 18px;
}

.form-grid-spacing {
    margin-top: 8px;
}

.form-grid-spacing-sm {
    margin-top: 4px;
}

.field-group-spacing {
    margin-top: 18px;
}

.status-spacing {
    margin-top: 8px;
    min-height: 18px;
}

.actions-row {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.supplier-toggle-group {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.supplier-select {
    flex: 1;
}

.supplier-input {
    flex: 1;
    display: none;
}

.supplier-toggle {
    flex: 0 0 auto;
    padding: 8px 12px;
}

.allergens-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.allergen-checkbox {
    margin-right: 4px;
}

/* Logo entreprise dans la configuration */
.company-logo-wrapper {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.company-logo-preview {
    border-radius: 8px;
    border: 1px solid var(--color-border);
    padding: 6px;
    background: var(--color-bg-elevated);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.company-logo-preview img {
    max-height: 48px;
    max-width: 220px;
    object-fit: contain;
}

.company-logo-hint {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* Carte d'aperçu des informations entreprise - Format compact inline */
.company-preview-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 16px;
}

.company-info-preview {
    width: 100%;
}

.company-info-preview-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: start;
}

.company-info-preview-logo {
    width: 80px;
    height: 100%;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    overflow: hidden;
    align-self: stretch;
}

.company-info-preview-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.company-info-preview-logo-placeholder {
    font-size: 40px;
    opacity: 0.6;
}

.company-info-preview-content {
    min-width: 0;
}

.company-info-preview-content h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--color-text);
}

.company-info-preview-content p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    margin: 4px 0;
}

.company-info-preview-actions {
    flex-shrink: 0;
    margin-left: auto;
}

/* Styles pour le mode clair */
:root[data-theme="light"] .company-preview-card {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 0.8);
}

:root[data-theme="light"] .company-info-preview-logo {
    background: #f8fafc;
    border-color: rgba(226, 232, 240, 0.8);
}

/* Styles pour la modale d'édition */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    margin-top: 20px;
}

.card-spacing {
    margin-top: 16px;
}

.inline-form {
    display: inline-block;
    margin-left: 6px;
}

.category-toggle-group {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.category-select {
    flex: 1;
}

.category-input {
    flex: 1;
    display: none;
}

.category-toggle {
    flex: 0 0 auto;
    padding: 8px 12px;
}

.recipe-ingredients-list {
    margin-top: 8px;
}

.recipe-parse-result {
    margin-top: 8px;
    min-height: 18px;
}

.parsed-ingredients-preview {
    margin-top: 12px;
    display: none;
}

.parsed-steps-preview {
    margin-top: 12px;
    display: none;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.step-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(31, 41, 55, 0.2);
    border-radius: 8px;
    border-left: 3px solid var(--color-accent);
    transition: background 0.2s ease;
}

:root[data-theme="light"] .step-item {
    background: rgba(241, 245, 249, 0.6);
    border-left-color: var(--color-accent);
}

.step-item:hover {
    background: rgba(31, 41, 55, 0.3);
}

:root[data-theme="light"] .step-item:hover {
    background: rgba(241, 245, 249, 0.8);
}

.step-number {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--color-accent);
    color: #ffffff;
    border-radius: 50%;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
}

.step-text {
    flex: 1;
    line-height: 1.6;
    color: var(--color-text);
    font-size: 14px;
    padding-top: 2px;
}

:root[data-theme="light"] .step-text {
    color: var(--color-text);
}

.recipe-actions-row {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.recipe-parse-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}

.modal-field-group {
    margin-top: 8px;
}

.modal-field-group-spacing {
    margin-top: 12px;
}

.section-spacing {
    margin-top: 20px;
}

.section-title {
    font-size: 18px;
    margin-bottom: 12px;
}

.section-subtitle {
    margin-bottom: 16px;
}

.settings-card {
    margin-bottom: 20px;
    background: rgba(59, 130, 246, 0.05);
}

:root[data-theme="light"] .settings-card {
    background: rgba(59, 130, 246, 0.03);
}

.settings-form {
    margin-top: 8px;
}

.settings-help {
    margin-top: 4px;
    font-size: 12px;
}

.settings-submit {
    margin-top: 10px;
}

.category-form {
    margin-top: 8px;
}

.category-color-input {
    width: 60px;
    height: 38px;
    border-radius: 6px;
    border: 1px solid rgba(31, 41, 55, 0.6);
}

:root[data-theme="light"] .category-color-input {
    border-color: rgba(203, 213, 225, 0.8);
}

.category-color-text {
    flex: 1;
}

.category-color-group {
    display: flex;
    gap: 8px;
}

.category-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(31, 41, 55, 0.3);
}

:root[data-theme="light"] .category-color-preview {
    border-color: rgba(203, 213, 225, 0.5);
}

.category-actions {
    display: flex;
    gap: 6px;
}

.recipe-view-spacing {
    margin-top: 12px;
}

.recipe-view-grid {
    margin-top: 8px;
    align-items: start;
}

.recipe-image-container {
    margin-bottom: 12px;
}

.recipe-image {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(31, 41, 55, 0.6);
}

:root[data-theme="light"] .recipe-image {
    border-color: rgba(203, 213, 225, 0.8);
}

.cost-card {
    margin-top: 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.recipe-view-grid > div:last-child > .cost-card:first-child {
    margin-top: 0;
}

:root[data-theme="light"] .cost-card {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.cost-title {
    font-size: 16px;
    margin-bottom: 8px;
}

.stat-chip-spacing {
    margin-top: 4px;
}

.stat-value-large {
    font-size: 18px;
    font-weight: bold;
    color: #3b82f6;
}

.stat-value-medium {
    font-size: 16px;
    color: #3b82f6;
}

.stat-value-margin {
    font-size: 16px;
}

.stats-grid-spacing {
    margin-bottom: 24px;
}

.recipe-section-title {
    margin-top: 16px;
    font-size: 16px;
}

.recipe-table-shell {
    margin-top: 8px;
}

.rationalize-controls {
    margin: 16px 0;
    padding: 16px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.rationalize-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text);
    user-select: none;
}

.rationalize-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-accent);
}

.rationalize-input-wrapper {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rationalize-input-wrapper label {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.rationalize-input {
    padding: 8px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 14px;
    width: 120px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.rationalize-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--color-bg-elevated);
}

.recipe-text {
    white-space: pre-line;
    margin-top: 6px;
}

.recipe-info-title {
    font-size: 16px;
}

.dashboard-spacing {
    margin-top: 16px;
}

.stat-value-small {
    font-size: 14px;
}

.error-text {
    color: #fca5a5;
}

:root[data-theme="light"] .error-text {
    color: #dc2626;
}

.modal-hidden {
    display: none;
}

.back-link-spacing {
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: rgba(15, 23, 42, 0.98);
}

th,
td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    text-align: left;
}

th {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 12px;
    position: relative;
    user-select: none;
}

th.sortable {
    cursor: pointer;
    padding-right: 24px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

th.sortable:hover {
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--color-text);
}

th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

th.sortable:hover::after {
    opacity: 0.7;
}

th.sortable.sort-asc::after {
    content: '↑';
    opacity: 0.8;
    color: var(--color-accent);
}

th.sortable.sort-desc::after {
    content: '↓';
    opacity: 0.8;
    color: var(--color-accent);
}

:root[data-theme="light"] th.sortable:hover {
    background-color: rgba(203, 213, 225, 0.3);
}

tbody tr:nth-child(odd) {
    background: rgba(15, 23, 42, 0.95);
}

tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.85);
}

tbody tr:hover {
    background: rgba(15, 23, 42, 1);
}

.badge-soft {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    background: rgba(15, 118, 110, 0.14);
    border: 1px solid rgba(45, 212, 191, 0.6);
    color: #a5f3fc;
}

.empty-state {
    padding: 16px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

.spinner-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.spinner-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-top-color: var(--color-accent);
    animation: pr-spin 0.7s linear infinite;
}

@keyframes pr-spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    /* Toujours au-dessus du header (200) et du drawer mobile (900) */
    z-index: 1200;
}

.modal-backdrop:not(.modal-hidden) {
    display: flex;
}

.modal-panel {
    background: rgba(15, 23, 42, 0.98);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(31, 41, 55, 0.9);
    box-shadow: var(--shadow-soft);
    max-width: 720px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header,
.modal-footer {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

.modal-footer {
    border-top: 1px solid rgba(31, 41, 55, 0.9);
    border-bottom: none;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--color-accent-soft);
    color: var(--color-text);
}

.modal-header {
    position: relative;
}

kbd {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 4px 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Styles de validation de formulaire */
.field-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.field-error {
    color: #ef4444;
    font-size: 0.85em;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-error::before {
    content: '⚠️';
    font-size: 0.9em;
}

.field-valid {
    border-color: #10b981 !important;
}

.field-group:has(.field-invalid) .field-label {
    color: #ef4444;
}

.field-group:has(.field-valid) .field-label {
    color: #10b981;
}

/* Accessibilité - Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Accessibilité - Focus visible */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Accessibilité - Skip to main content */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent);
    color: var(--color-bg);
    padding: 8px 16px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 0;
}

/* Accessibilité - Navigation clavier améliorée */
.nav-link:focus,
.btn:focus,
.theme-toggle:focus,
.global-search-input:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Accessibilité - États ARIA */
[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* NE PAS ajouter de règle [aria-hidden="true"] { display: none } :
   aria-hidden cache aux lecteurs d'écran, PAS à l'écran. Une telle règle
   masquait le burger, les emojis des onglets Réglages et les icônes de
   la recherche globale (supprimée le 2026-07-04). */

/* Accessibilité - Landmarks */
main[role="main"] {
    outline: none;
}

nav[role="navigation"] {
    outline: none;
}

/* Accessibilité - Contraste amélioré pour les liens */
a:not(.btn):not(.nav-link):not(.brand-link):not(.brand-name):not(.brand-tagline):not(.user-menu-item) {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:not(.btn):not(.nav-link):not(.brand-link):not(.brand-name):not(.brand-tagline):hover {
    
}

/* Grille améliorée pour les articles de commande */
.order-item-grid {
    display: grid;
    grid-template-columns: 2fr 120px 140px auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(31, 41, 55, 0.5);
    margin-bottom: 8px;
}

.order-item-row {
    margin-bottom: 0;
}

.order-item-ingredient {
    min-width: 0; /* Permet au select de se rétrécir si nécessaire */
}

.order-item-quantity {
    max-width: 120px;
}

.order-item-quantity .field-input {
    max-width: 100%;
}

.order-item-price {
    max-width: 140px;
}

.order-item-price .field-input {
    max-width: 100%;
}

.order-item-actions {
    display: flex;
    align-items: flex-end;
    padding-bottom: 0;
}

.order-item-actions .btn-remove-item {
    margin-bottom: 0;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive pour les petits écrans */
@media (max-width: 768px) {
    .order-item-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .order-item-quantity,
    .order-item-price {
        max-width: 100%;
    }
    
    .order-item-actions {
        justify-content: flex-end;
    }
}

/* Header right section */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--color-text);
    font-size: 18px;
    min-width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-accent);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Global search container */
.global-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.global-search-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-elevated);
    color: var(--color-text);
    font-size: 14px;
    width: 250px;
    transition: all 0.2s ease;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-soft);
}

.global-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

/* Accessibilité - Boutons avec icônes */
.btn-icon {
    display: inline-block;
    margin-right: 4px;
}

.btn-icon[aria-hidden="true"] {
    margin-right: 0;
}

/* Accessibilité - Formulaires */
fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 16px 0;
}

legend {
    padding: 0 8px;
    font-weight: 600;
    color: var(--color-text);
}

/* Accessibilité - Tableaux */
table[role="table"] {
    width: 100%;
}

th[scope="col"],
th[scope="row"] {
    font-weight: 600;
}

/* Accessibilité - Modals */
.modal-backdrop[role="dialog"] {
    outline: none;
}

.modal-panel[role="dialog"] {
    outline: none;
}

/* Accessibilité - Alerte visuelle pour les erreurs */
.field-error[role="alert"] {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.product-selection-item {
    transition: all 0.2s ease;
}

.product-selection-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .product-selection-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Bouton toggle thème */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--color-accent);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Recherche globale */

/* User menu dropdown */
.user-menu-container {
    position: relative;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--color-text-muted);
    border: 1px solid rgba(30, 64, 175, 0.0);
    background: radial-gradient(circle at 0 0, rgba(30, 64, 175, 0.25), rgba(15, 23, 42, 0.9));
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.75);
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, background 0.15s ease-out;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.user-menu-toggle:hover {
    border-color: rgba(129, 140, 248, 0.7);
    color: var(--color-text);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(30, 64, 175, 0.55);
    background: radial-gradient(circle at 0 0, rgba(129, 140, 248, 0.35), rgba(15, 23, 42, 0.95));
}

.user-menu-toggle:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.user-menu-toggle[aria-expanded="true"] {
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #ecfdf5;
    border-color: rgba(129, 140, 248, 0.9);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.9);
}

.user-name {
    font-weight: inherit;
    color: inherit;
}

.user-menu-arrow {
    font-size: 0.7em;
    color: inherit;
    transition: transform 0.2s ease;
    margin-left: 4px;
}

.user-menu-toggle[aria-expanded="true"] .user-menu-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 220px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.user-menu-impersonating {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #fbbf24;
    margin-bottom: 4px;
}

.user-menu-client-name {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.user-menu-item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.user-menu-item:hover {
    background: var(--color-bg);
}

.user-menu-item-danger {
    color: #ef4444;
}

.user-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.user-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

.global-search-container {
    position: relative;
    width: 280px;
}

.global-search-input {
    width: 100%;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.global-search-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.global-search-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

.global-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 500px;
    overflow-y: auto;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    z-index: 1000;
    display: none;
}

.search-section {
    padding: 8px 0;
}

.search-section-title {
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--color-border);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--color-accent-soft);
}

.search-result-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-more {
    display: block;
    padding: 8px 14px;
    text-align: center;
    font-size: 12px;
    color: var(--color-accent);
    text-decoration: none;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
}

.search-result-more:hover {
    background: var(--color-accent-soft);
}

.search-loading,
.search-no-results,
.search-error {
    padding: 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

.search-error {
    color: #ef4444;
}

:root[data-theme="light"] .global-search-input {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(203, 213, 225, 0.8);
}

:root[data-theme="light"] .global-search-input:focus {
    background: #ffffff;
    border-color: rgba(22, 163, 74, 0.6);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

:root[data-theme="light"] .global-search-results {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 0.8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .search-result-item:hover {
    background: rgba(22, 163, 74, 0.08);
}

/* Styles pour le mode clair - éléments principaux */
:root[data-theme="light"] .card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.93));
    border: 1px solid rgba(203, 213, 225, 0.6);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .field-input,
:root[data-theme="light"] .field-select,
:root[data-theme="light"] .field-textarea,
:root[data-theme="light"] .form-input {
    border: 1px solid rgba(203, 213, 225, 0.8);
    background: rgba(255, 255, 255, 0.98);
    color: var(--color-text);
}

:root[data-theme="light"] .field-input:focus,
:root[data-theme="light"] .field-select:focus,
:root[data-theme="light"] .field-textarea:focus,
:root[data-theme="light"] .form-input:focus {
    background: #ffffff;
    border-color: rgba(22, 163, 74, 0.6);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

:root[data-theme="light"] .table-shell {
    border: 1px solid rgba(203, 213, 225, 0.8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    background: #ffffff;
}

:root[data-theme="light"] thead {
    background: linear-gradient(to bottom, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.95));
}

:root[data-theme="light"] th {
    color: var(--color-text);
    font-weight: 600;
    background: transparent;
    border-bottom: 2px solid rgba(203, 213, 225, 0.9);
    padding: 12px 10px;
}

:root[data-theme="light"] th.sortable:hover {
    background: rgba(241, 245, 249, 0.8);
    color: var(--color-accent);
}

:root[data-theme="light"] th.sortable.sort-asc,
:root[data-theme="light"] th.sortable.sort-desc {
    background: rgba(220, 252, 231, 0.4);
    color: var(--color-accent);
    border-bottom-color: rgba(22, 163, 74, 0.4);
}

:root[data-theme="light"] th,
:root[data-theme="light"] td {
    border-color: rgba(226, 232, 240, 0.8);
}

:root[data-theme="light"] tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.5);
}

:root[data-theme="light"] tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.3);
}

:root[data-theme="light"] td {
    padding: 10px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

:root[data-theme="light"] tbody tr:hover {
    background: rgba(241, 245, 249, 0.8);
    box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.6);
    transform: scale(1.001);
    transition: all 0.15s ease;
}

:root[data-theme="light"] tbody tr:last-child td {
    border-bottom: none;
}

:root[data-theme="light"] .toast {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.6);
    color: var(--color-text);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] .modal-panel {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.7);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .modal-header {
    border-color: rgba(226, 232, 240, 0.8);
}

:root[data-theme="light"] .nav-link {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(203, 213, 225, 0.6);
    color: var(--color-text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(22, 163, 74, 0.4);
    color: var(--color-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .nav-link.active {
    background: linear-gradient(135deg, #16a34a, #22c55e) !important;
    color: #ffffff !important;
    border-color: rgba(22, 163, 74, 0.8) !important;
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.3) !important;
    font-weight: 600;
}

:root[data-theme="light"] .nav-link-primary {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #ffffff;
}

:root[data-theme="light"] .nav-link-primary:hover {
    background: linear-gradient(135deg, #22c55e, #2dd66f);
}

:root[data-theme="light"] .nav-category-toggle,
:root[data-theme="light"] .user-menu-toggle {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(203, 213, 225, 0.6);
    color: var(--color-text-muted);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(22, 163, 74, 0.4);
    color: var(--color-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .user-menu-toggle[aria-expanded="true"] {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #ffffff;
    border-color: rgba(22, 163, 74, 0.8);
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.3);
}

:root[data-theme="light"] .nav-category-toggle:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(22, 163, 74, 0.4);
    color: var(--color-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .nav-category-toggle[aria-expanded="true"],
:root[data-theme="light"] .nav-category.has-active .nav-category-toggle {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #ffffff;
    border-color: rgba(22, 163, 74, 0.8);
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.3);
}

:root[data-theme="light"] .nav-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .nav-dropdown .nav-link:hover {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
}

:root[data-theme="light"] .nav-dropdown .nav-link.active {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.2), rgba(34, 197, 94, 0.2)) !important;
    border-color: rgba(22, 163, 74, 0.5) !important;
    color: #15803d !important;
    font-weight: 600;
}

:root[data-theme="light"] .kpi-card {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.8);
}

:root[data-theme="light"] .kpi-icon {
    background: rgba(22, 163, 74, 0.1);
}

:root[data-theme="light"] .quick-stat {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.8);
}

:root[data-theme="light"] .quick-stat-icon {
    background: rgba(22, 163, 74, 0.1);
}

/* Grille nutritionnelle */
.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.nutrition-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border, rgba(31, 41, 55, 0.2));
}

.nutrition-label {
    font-size: 0.9em;
    color: var(--color-text-muted);
}

.nutrition-value {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-text);
}

:root[data-theme="light"] .nutrition-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(203, 213, 225, 0.5);
}

:root[data-theme="light"] .brand-logo-wrapper {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .btn {
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.3);
}

:root[data-theme="light"] .btn:hover {
    box-shadow: 0 12px 26px rgba(22, 163, 74, 0.4);
}

:root[data-theme="light"] .btn-secondary {
    background: rgba(248, 250, 252, 0.9);
    border-color: rgba(203, 213, 225, 0.7);
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(148, 163, 184, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .btn-danger {
    background: rgba(254, 242, 242, 0.9);
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

:root[data-theme="light"] .btn-danger:hover {
    background: rgba(254, 242, 242, 0.98);
    border-color: rgba(220, 38, 38, 0.5);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
    color: #b91c1c;
}

/* Styles pour la gestion des stocks */
.low-stock-row {
    background-color: rgba(239, 68, 68, 0.05);
}

:root[data-theme="light"] .low-stock-row {
    background-color: rgba(239, 68, 68, 0.08);
}

.low-stock-row:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

:root[data-theme="light"] .low-stock-row:hover {
    background-color: rgba(239, 68, 68, 0.15);
}

/* Badges évolution de prix dans la liste des ingrédients */
.evolution-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.evolution-up {
    color: #ef4444;
}

.evolution-down {
    color: #22c55e;
}

:root[data-theme="light"] .evolution-up {
    color: #dc2626;
}

:root[data-theme="light"] .evolution-down {
    color: #16a34a;
}

:root[data-theme="light"] .badge-pill {
    background: rgba(220, 252, 231, 0.8);
    color: #166534;
    border-color: rgba(22, 163, 74, 0.3);
}

:root[data-theme="light"] .badge-soft {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
    border-color: rgba(15, 118, 110, 0.3);
}

/* Mode clair — badges allergènes (.pill) */
:root[data-theme="light"] .pill {
    background: rgba(241, 245, 249, 0.95);
    border-color: rgba(203, 213, 225, 0.8);
    color: #475569;
}

:root[data-theme="light"] .pill:hover:not(:has(:checked)) {
    background: rgba(248, 250, 252, 1);
    border-color: rgba(148, 163, 184, 0.7);
    color: #334155;
}

:root[data-theme="light"] .pill:has(:checked) {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.6);
    color: #15803d;
    box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.2);
}

:root[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(203, 213, 225, 0.7);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(22, 163, 74, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .empty-state {
    color: var(--color-text-muted);
}

:root[data-theme="light"] .stat-chip {
    background: rgba(248, 250, 252, 0.8);
    border-color: rgba(203, 213, 225, 0.6);
    color: var(--color-text);
}

/* Éditeur de recette */
.recipe-editor-wrapper {
    position: relative;
}

.recipe-editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.recipe-editor-btn {
    min-width: auto;
    padding: 6px 12px;
}

.recipe-editor-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
}

.recipe-editor-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.recipe-editor-fullscreen-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
}

.recipe-editor-fullscreen-wrapper {
    display: flex;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.recipe-editor-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.recipe-editor-fullscreen-textarea {
    flex: 1;
    width: 100%;
    padding: 16px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.recipe-editor-fullscreen-textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.recipe-editor-preview-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow: auto;
}

.recipe-editor-preview {
    flex: 1;
    overflow: auto;
    line-height: 1.6;
    color: var(--color-text);
    word-wrap: break-word;
}

.recipe-editor-preview ul,
.recipe-editor-preview ol {
    margin: 12px 0;
    padding-left: 24px;
}

.recipe-editor-preview li {
    margin: 6px 0;
}

.recipe-editor-preview strong {
    font-weight: 600;
    color: var(--color-text);
}

.recipe-editor-preview em {
    font-style: italic;
}

.recipe-editor-preview p {
    margin: 8px 0;
}

.recipe-editor-preview p:first-child {
    margin-top: 0;
}

.recipe-editor-preview p:last-child {
    margin-bottom: 0;
}

:root[data-theme="light"] .recipe-editor-fullscreen-textarea {
    background: var(--color-bg-elevated);
    border-color: var(--color-border);
}

:root[data-theme="light"] .recipe-editor-fullscreen-textarea:focus {
    border-color: var(--color-accent);
}

/* Upload de fichier amélioré */
.file-upload-wrapper {
    position: relative;
}

.file-upload-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-bg-elevated);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-text);
}

.file-upload-label:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.file-upload-label:active {
    transform: scale(0.98);
}

.file-upload-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.file-upload-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-upload-text-main {
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text);
}

.file-upload-text-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    opacity: 0.7;
}

.file-upload-filename {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Aperçu d'image de recette */
.recipe-image-preview-container {
    margin-bottom: 12px;
}

.recipe-image-preview-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
}

.recipe-image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: block;
    object-fit: cover;
}

.recipe-image-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.recipe-image-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.5);
}

.recipe-image-delete-btn:active {
    transform: scale(0.95);
}

.recipe-image-delete-btn span {
    line-height: 1;
}

.recipe-image-help {
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

:root[data-theme="light"] .file-upload-label {
    background: var(--color-bg-elevated);
    border-color: var(--color-border);
}

:root[data-theme="light"] .file-upload-label:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

:root[data-theme="light"] .file-upload-filename {
    background: var(--color-bg-elevated);
    border-color: var(--color-border);
}

/* Amélioration des inputs number */
/* Contrôle +/- compact pour les nombres */
.number-input-wrapper {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    width: auto;
    max-width: 150px; /* évite de prendre toute la largeur de la colonne */
    justify-self: flex-start; /* dans les grilles, ne pas s'étirer sur toute la colonne */
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    transition: border-color 0.2s ease;
}

.number-input-wrapper:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent-soft);
}

.number-input-wrapper input[type="number"] {
    flex: 0 0 auto;
    width: 70px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--color-text);
    text-align: center;
    padding: 8px 4px;
}

.number-input-wrapper input[type="number"]:focus {
    outline: none;
    box-shadow: none;
    background: transparent;
}

.number-input-wrapper input[type="number"]::-webkit-inner-spin-button,
.number-input-wrapper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-input-wrapper input[type="number"] {
    -moz-appearance: textfield;
}

.number-input-btn {
    width: 36px;
    min-width: 36px;
    box-sizing: border-box;
    border: none;
    background: var(--color-bg-elevated);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    font-family: monospace; /* Assure la même largeur visuelle pour "+" et "−" */
    transition: all 0.2s ease;
    user-select: none;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
}

.number-input-decrease {
    border-left: none;
    border-right: 1px solid var(--color-border);
}

.number-input-increase {
    border-right: none;
    border-left: 1px solid var(--color-border);
}

.number-input-btn:hover:not(:disabled) {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.number-input-btn:active:not(:disabled) {
    background: var(--color-accent);
    color: white;
    transform: scale(0.95);
}

.number-input-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

:root[data-theme="light"] .number-input-wrapper {
    border-color: var(--color-border);
    background: var(--color-bg-elevated);
}

:root[data-theme="light"] .number-input-wrapper:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

:root[data-theme="light"] .number-input-btn {
    background: var(--color-bg-elevated);
    border-color: var(--color-border);
}

:root[data-theme="light"] .number-input-btn:hover:not(:disabled) {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

/* Récapitulatif financier */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(31, 41, 55, 0.6);
    border-radius: var(--radius-md);
    transition: border-color 0.18s ease, background 0.18s ease;
}

.summary-item:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(15, 23, 42, 0.7);
}

.summary-item span {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.summary-item strong {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.summary-item.total {
    background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.15), rgba(15, 23, 42, 0.7));
    border-color: rgba(34, 197, 94, 0.5);
    grid-column: span 2;
}

.summary-item.total strong {
    font-size: 24px;
    color: #bbf7d0;
    font-weight: 700;
}

.summary-item.total span {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

/* Mode clair pour le récapitulatif */
:root[data-theme="light"] .summary-item {
    background: rgba(248, 250, 252, 0.8);
    border-color: rgba(203, 213, 225, 0.6);
}

:root[data-theme="light"] .summary-item:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(248, 250, 252, 0.95);
}

:root[data-theme="light"] .summary-item.total {
    background: radial-gradient(circle at top left, rgba(22, 163, 74, 0.12), rgba(248, 250, 252, 0.95));
    border-color: rgba(22, 163, 74, 0.5);
}

:root[data-theme="light"] .summary-item.total strong {
    color: #15803d;
}

/* ============================================
   ALERTES D'ABONNEMENT ET MESSAGES FLASH
   ============================================ */

/* Base pour toutes les alertes */
.alert-subscription,
.alert-flash {
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 2px solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alert-subscription__icon,
.alert-flash__icon {
    font-size: 20px;
    line-height: 1;
    margin-top: 2px;
    flex-shrink: 0;
}

.alert-subscription__content,
.alert-flash__content {
    flex: 1;
    text-align: left;
}

.alert-subscription__title,
.alert-flash__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
}

.alert-subscription__text,
.alert-flash__text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 4px;
}

.alert-subscription__action {
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

/* Alertes d'abonnement expiré - Plus visible */
.alert-subscription--expired {
    background: rgba(127, 29, 29, 0.25);
    border-color: rgba(248, 113, 113, 0.8);
    color: #fecaca;
    padding: 24px;
    border-width: 3px;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.2);
}

.alert-subscription--expired .alert-subscription__title {
    font-size: 18px;
    margin-bottom: 10px;
}

.alert-subscription--expired .alert-subscription__text {
    font-size: 15px;
    margin-bottom: 8px;
}

.alert-subscription--expired .alert-subscription__action {
    font-size: 14px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    display: inline-block;
    margin-top: 10px;
}

/* Alertes de paiement en attente */
.alert-subscription--past-due {
    background: rgba(120, 53, 15, 0.25);
    border-color: rgba(245, 158, 11, 0.7);
    color: #fed7aa;
}

/* Alertes d'abonnement suspendu */
.alert-subscription--suspended {
    background: rgba(120, 53, 15, 0.25);
    border-color: rgba(245, 158, 11, 0.7);
    color: #fed7aa;
}

/* Alertes d'abonnement annulé */
.alert-subscription--cancelled {
    background: rgba(30, 64, 118, 0.22);
    border-color: rgba(148, 163, 184, 0.7);
    color: #e5e7eb;
}

/* Messages flash - Erreur */
.alert-flash--error {
    background: rgba(127, 29, 29, 0.18);
    border-color: rgba(248, 113, 113, 0.6);
    color: #fecaca;
}

/* Messages flash - Succès */
.alert-flash--success {
    background: rgba(6, 95, 70, 0.22);
    border-color: rgba(34, 197, 94, 0.7);
    color: #bbf7d0;
}

/* Messages flash - Info */
.alert-flash--info {
    background: rgba(30, 64, 175, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
    color: #bfdbfe;
}

/* Alerte période d'essai */
.trial-alert {
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 32px;
    border: 2px solid;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.trial-alert--normal {
    border-color: rgba(250, 204, 21, 0.7);
    background: rgba(113, 63, 18, 0.22);
    color: #fef3c7;
}

.trial-alert--urgent {
    border-color: rgba(239, 68, 68, 0.8);
    background: rgba(127, 29, 29, 0.25);
    color: #fecaca;
    border-width: 3px;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.2);
}

.trial-alert__icon {
    font-size: 24px;
    line-height: 1;
    margin-top: 2px;
    flex-shrink: 0;
}

.trial-alert__content {
    flex: 1;
    text-align: left;
}

.trial-alert__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trial-alert__badge {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(250, 204, 21, 0.3);
}

.trial-alert--urgent .trial-alert__badge {
    background: rgba(239, 68, 68, 0.3);
}

.trial-alert__text {
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.trial-alert__hint {
    font-size: 13px;
    margin-bottom: 12px;
    opacity: 0.9;
    line-height: 1.5;
}

.trial-alert__urgent-notice {
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

/* Statut d'abonnement actif */
.subscription-status {
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 32px;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.subscription-status--active {
    border-color: rgba(34, 197, 94, 0.7);
    background: rgba(6, 95, 70, 0.22);
    color: #bbf7d0;
}

.subscription-status__icon {
    font-size: 20px;
    line-height: 1;
    margin-top: 2px;
}

.subscription-status__content {
    flex: 1;
    text-align: left;
}

.subscription-status__title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.subscription-status__text {
    font-size: 14px;
    margin-bottom: 10px;
}

.subscription-status__button {
    display: inline-block;
    padding: 8px 16px;
    background: #10b981;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
}

.subscription-status__button:hover {
    background: #059669;
}

/* ============================================
   MODE CLAIR - ALERTES
   ============================================ */

:root[data-theme="light"] .alert-subscription--expired {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.15);
}

:root[data-theme="light"] .alert-subscription--expired .alert-subscription__action {
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

:root[data-theme="light"] .alert-subscription--past-due,
:root[data-theme="light"] .alert-subscription--suspended {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #78350f;
}

:root[data-theme="light"] .alert-subscription--cancelled {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #475569;
}

:root[data-theme="light"] .alert-flash--error {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

:root[data-theme="light"] .alert-flash--success {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

:root[data-theme="light"] .alert-flash--info {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

:root[data-theme="light"] .trial-alert--normal {
    border-color: #fbbf24;
    background: #fef3c7;
    color: #78350f;
}

:root[data-theme="light"] .trial-alert--urgent {
    border-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.15);
}

:root[data-theme="light"] .trial-alert__badge {
    background: rgba(250, 204, 21, 0.2);
}

:root[data-theme="light"] .trial-alert--urgent .trial-alert__badge {
    background: rgba(239, 68, 68, 0.2);
}

:root[data-theme="light"] .trial-alert__urgent-notice {
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
}

:root[data-theme="light"] .subscription-status--active {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

/* Alerte d'abonnement dans le layout (barre en haut) */
.subscription-alert {
    padding: 12px 20px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-left: 4px solid;
}

.subscription-alert__content-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.subscription-alert__icon {
    font-size: 18px;
    flex-shrink: 0;
}

.subscription-alert__message {
    font-size: 14px;
    font-weight: 500;
}

.subscription-alert__button {
    padding: 6px 16px;
    background: #f59e0b;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.2s;
}

.subscription-alert__button:hover {
    background: #d97706;
}

.subscription-alert--expired {
    background: rgba(127, 29, 29, 0.2);
    border-left-color: #ef4444;
    color: #fecaca;
}

.subscription-alert--past-due {
    background: rgba(120, 53, 15, 0.2);
    border-left-color: #f59e0b;
    color: #fed7aa;
}

.subscription-alert--suspended {
    background: rgba(245, 158, 11, 0.15);
    border-left-color: #f59e0b;
    color: var(--color-text, #f1f5f9);
}

/* Mode clair pour les alertes du layout */
:root[data-theme="light"] .subscription-alert--expired {
    background: #fee2e2;
    border-left-color: #ef4444;
    color: #7f1d1d;
}

:root[data-theme="light"] .subscription-alert--past-due,
:root[data-theme="light"] .subscription-alert--suspended {
    background: #fef3c7;
    border-left-color: #f59e0b;
    color: #78350f;
}

/* Styles pour les boutons de pricing */
.pricing-button {
    width: 100%;
    padding: 12px;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
}

.pricing-button--primary {
    background: #3b82f6;
}

.pricing-button--primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    text-decoration: none;
}

.pricing-button--disabled {
    background: #64748b;
    cursor: not-allowed;
    opacity: 0.7;
}

.pricing-button--danger {
    background: #ef4444;
}

.pricing-button--danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.pricing-button--warning {
    background: #f59e0b;
}

.pricing-button--warning:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Support thème clair pour pricing-card */
:root[data-theme="light"] .pricing-card {
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

:root[data-theme="light"] .pricing-card:hover {
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

:root[data-theme="light"] .pricing-card h2 {
    color: #1e293b;
}

:root[data-theme="light"] .pricing-card .pricing-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ============================================
   STYLES POUR PAGES PUBLIQUES (HOME/PRICING)
   ============================================ */

/* Container principal */
.landing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 80px 20px;
    color: #f1f5f9;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

:root[data-theme="light"] .hero-title {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    border-radius: 16px;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: #94a3b8;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 60px;
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.btn-hero {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.btn-hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-hero:hover::before {
    width: 300px;
    height: 300px;
}

.btn-hero:hover {
    text-decoration: none !important;
}

.btn-hero:active {
    transform: scale(0.98);
}

.btn-hero-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-hero-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.4);
    text-decoration: none !important;
}

.btn-hero-secondary {
    background: transparent;
    color: #f1f5f9;
    border: 2px solid #3b82f6;
}

.btn-hero-secondary:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #2563eb;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
    text-decoration: none !important;
}

/* Features Section */
.features-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 80px;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 0.8s both;
}

.feature-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(31, 41, 55, 0.3);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    animation: fadeInUp 0.6s ease-out both;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:nth-child(4) { animation-delay: 0.4s; }
.feature-card:nth-child(5) { animation-delay: 0.5s; }
.feature-card:nth-child(6) { animation-delay: 0.6s; }

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(30, 41, 59, 0.7);
}

.feature-card:active {
    transform: translateY(-4px) scale(1.01);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.feature-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 12px;
}

.feature-description {
    color: #94a3b8;
    line-height: 1.7;
}

/* Pricing Section */
.pricing-section {
    padding: 80px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-top: 80px;
    border-radius: 24px;
    animation: fadeIn 0.8s ease-out 1s both;
}

.pricing-title {
    text-align: center;
    color: white;
    font-size: 36px;
    margin-bottom: 16px;
    font-weight: bold;
}

.pricing-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    margin-bottom: 48px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.pricing-card {
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease-out both;
}

.pricing-card:nth-child(1) { animation-delay: 1.2s; }
.pricing-card:nth-child(2) { animation-delay: 1.4s; }

.pricing-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(255, 255, 255, 0.98);
}

.pricing-card:active {
    transform: translateY(-4px) scale(1.01);
}

/* Mode sombre pour les pricing-card */
:root:not([data-theme="light"]) .pricing-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(31, 41, 55, 0.5);
    color: #f1f5f9;
}

:root:not([data-theme="light"]) .pricing-card:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.3);
}

/* Styles pour les éléments des pricing-card */
.pricing-card-title {
    color: #1e293b;
    margin-top: 0;
}

.pricing-price {
    color: #1e293b;
}

.pricing-period {
    color: #64748b;
}

.pricing-feature {
    color: #475569;
}

.pricing-feature-check {
    color: #10b981;
}

/* Mode sombre pour les éléments des pricing-card */
:root:not([data-theme="light"]) .pricing-card-title,
:root:not([data-theme="light"]) .pricing-card h2,
:root:not([data-theme="light"]) .pricing-card h3 {
    color: #f1f5f9;
}

:root:not([data-theme="light"]) .pricing-price {
    color: #f1f5f9;
}

:root:not([data-theme="light"]) .pricing-period {
    color: #94a3b8;
}

:root:not([data-theme="light"]) .pricing-feature {
    color: #cbd5e1;
    border-color: rgba(51, 65, 85, 0.5);
}

:root:not([data-theme="light"]) .pricing-feature-check {
    color: #10b981;
}

.pricing-badge {
    position: absolute;
    top: -12px;
    right: 24px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Focus visible amélioré */
.btn-hero:focus-visible,
.btn-submit:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
        flex-direction: column;
        gap: 12px;
    }
    .hero-logo {
        width: 60px;
        height: 60px;
        border-radius: 12px;
    }
    .hero-subtitle {
        font-size: 1.2rem;
    }
    .cta-buttons {
        flex-direction: column;
        gap: 12px;
    }
    .btn-hero {
        width: 100%;
        padding: 14px 24px;
    }
    .features-section {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 60px;
    }
    .feature-card {
        padding: 24px;
    }
    .pricing-section {
        padding: 60px 20px;
        border-radius: 16px;
    }
    .pricing-title {
        font-size: 28px;
    }
    .pricing-subtitle {
        font-size: 16px;
    }
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Support thème clair */
:root[data-theme="light"] .feature-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(226, 232, 240, 0.8);
}

:root[data-theme="light"] .feature-title {
    color: #1e293b;
}

:root[data-theme="light"] .feature-description {
    color: #64748b;
}

:root[data-theme="light"] .hero-subtitle {
    color: #64748b;
}

:root[data-theme="light"] .btn-hero-secondary {
    color: #1e293b;
    border-color: #3b82f6;
}

:root[data-theme="light"] .btn-hero-secondary::before {
    background: rgba(59, 130, 246, 0.15);
}

:root[data-theme="light"] .btn-hero-secondary:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: #2563eb;
    color: #1e293b !important;
}

/* Styles pour la section cibles (boulangeries, pâtisseries, restaurants) */
.targets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

.target-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(31, 41, 55, 0.3);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.target-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(30, 41, 59, 0.7);
}

.target-card:active {
    transform: translateY(-4px) scale(1.01);
}

.target-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.target-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text, #f1f5f9);
    margin-bottom: 12px;
}

.target-description {
    color: var(--color-text-muted, #94a3b8);
    line-height: 1.6;
    margin: 0;
}

/* Mode clair pour les target-card */
:root[data-theme="light"] .target-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(226, 232, 240, 0.8);
}

:root[data-theme="light"] .target-card:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(59, 130, 246, 0.5);
}

:root[data-theme="light"] .target-title {
    color: #1e293b;
}

:root[data-theme="light"] .target-description {
    color: #64748b;
}

/* Styles pour la section CTA "Prêt à commencer ?" */
.cta-section {
    text-align: center;
    margin-top: 80px;
    padding: 60px 20px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 24px;
    border: 1px solid rgba(31, 41, 55, 0.3);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.cta-section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cta-section-text {
    font-size: 1.2rem;
    color: #94a3b8;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Mode clair pour la section CTA */
:root[data-theme="light"] .cta-section {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(226, 232, 240, 0.8);
}

:root[data-theme="light"] .cta-section-title {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

:root[data-theme="light"] .cta-section-text {
    color: #64748b;
}

/* ==========================================================
   INLINE CONFIRM POPOVER
   ========================================================== */

.confirm-popover {
    position: fixed;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a2e4a;
    border: 1px solid rgba(99, 179, 237, 0.25);
    border-radius: 8px;
    padding: 7px 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    font-size: 13px;
    color: #e2e8f0;
    animation: confirmFadeIn 0.12s ease;
    pointer-events: auto;
}

@keyframes confirmFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.confirm-popover-msg {
    font-weight: 500;
    color: #cbd5e1;
}

.confirm-popover-yes {
    padding: 3px 11px;
    border-radius: 5px;
    border: 1px solid rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.confirm-popover-yes:hover {
    background: rgba(239, 68, 68, 0.4);
    color: #fff;
}

.confirm-popover-no {
    padding: 3px 11px;
    border-radius: 5px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.confirm-popover-no:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
}

:root[data-theme="light"] .confirm-popover {
    background: #1e3a5f;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ==========================================================
   MENU RECIPE ROW — ligne ingrédient/recette en formulaire
   ========================================================== */

.menu-recipe-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.menu-recipe-row .menu-recipe-select {
    flex: 1;
    min-width: 0;
}

.menu-recipe-row .menu-qty-group {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.menu-recipe-row .menu-qty-group label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 0;
}

.menu-recipe-row .menu-qty-input {
    width: 72px;
}

.btn-remove-recipe {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 12px;
}

/* ==========================================================
   ACTION BUTTON GROUP (icônes dans les tableaux)
   ========================================================== */

.btn-group-actions {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    text-decoration: none !important;
    line-height: 1;
    padding: 0;
    font-family: inherit;
}

.btn-icon:hover {
    transform: translateY(-1px);
    text-decoration: none !important;
}

.btn-icon-edit:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
    color: #3b82f6;
}

.btn-icon-stock:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.5);
    color: #22c55e;
}

.btn-icon-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

:root[data-theme="light"] .btn-icon {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 0.8);
    color: #64748b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ==========================================================
   RESPONSIVE — MOBILE & TABLET
   ========================================================== */

/* --- Tablette (≤ 900px) --- */
@media (max-width: 900px) {
    /* Table scroll horizontal pour éviter la compression des colonnes */
    .table-shell {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-shell table {
        min-width: 700px;
    }

    /* Les valeurs (prix, quantités, marges) et leurs en-têtes ne se coupent
       pas sur plusieurs lignes : le tableau défile horizontalement à la place.
       La 1re colonne (nom) garde son retour à la ligne naturel. */
    .table-shell th:not(:first-child),
    .table-shell td:not(:first-child) {
        white-space: nowrap;
    }

    /* Réduire l'espace latéral */
    .app-shell {
        padding: 10px;
    }
}

/* --- Mobile (≤ 768px) --- */
@media (max-width: 768px) {
    .app-shell {
        padding: 8px;
    }

    /* Cacher le tagline pour gagner de la place */
    .brand-tagline {
        display: none;
    }

    /* Réduire la barre de recherche */
    .global-search-container {
        width: 180px;
    }

    /* Bouton burger visible */
    .nav-toggle {
        display: flex;
    }

    /* IMPORTANT : backdrop-filter crée un "containing block" qui empêcherait
       le drawer (position: fixed) de se positionner par rapport au viewport */
    .app-header {
        backdrop-filter: none;
    }

    /* Nav : drawer latéral coulissant depuis la droite */
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        height: 100dvh;
        width: min(85vw, 320px);
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 4px;
        padding: 12px;
        margin: 0;
        background: var(--color-bg-elevated);
        border-left: 1px solid var(--color-border);
        box-shadow: -18px 0 45px rgba(0, 0, 0, 0.45);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 900;
    }
    .main-nav.nav-open {
        transform: translateX(0);
    }

    /* En-tête du drawer (titre + bouton fermer) */
    .nav-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 4px 12px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--color-border);
    }

    /* Overlay derrière le drawer */
    .nav-overlay.nav-overlay-visible {
        display: block;
    }

    /* Boutons du drawer : pleine largeur, cibles tactiles ≥ 44px */
    .main-nav .nav-link,
    .main-nav .nav-category-toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 44px;
        padding: 10px 14px;
        font-size: 14px;
        border-radius: var(--radius-md);
        text-align: left;
        background: transparent;
        box-shadow: none;
        border: 1px solid transparent;
    }
    .main-nav .nav-category-toggle .nav-arrow {
        margin-left: auto;
    }
    .main-nav .nav-link.active {
        background: linear-gradient(135deg, #4f46e5, #22c55e);
        color: #ecfdf5;
    }

    /* Dropdowns → accordéons dans le drawer */
    .nav-category {
        width: 100%;
    }
    .nav-dropdown {
        position: static;
        transform: none;
        opacity: 1;
        visibility: hidden;
        height: 0;
        overflow: hidden;
        min-width: 0;
        padding: 0;
        margin: 0;
        border: none;
        box-shadow: none;
        background: transparent;
        backdrop-filter: none;
    }
    .nav-category-toggle[aria-expanded="true"] + .nav-dropdown {
        visibility: visible;
        height: auto;
        padding: 2px 0 6px 18px;
        transform: none;
    }
}

/* --- Petit mobile (≤ 480px) --- */
@media (max-width: 480px) {
    /* Cacher la barre de recherche — remplacée par la recherche dans les pages */
    .global-search-container {
        display: none;
    }

    /* Réduire le brand */
    .brand-logo-wrapper {
        width: 34px;
        height: 34px;
    }
    .brand-logo-img {
        width: 30px;
        height: 30px;
    }
    .brand-name {
        font-size: 15px;
    }

    /* Cacher le nom dans le bouton user pour gagner de la place */
    .user-name {
        display: none;
    }
    .user-menu-arrow {
        margin-left: 0;
    }

    /* Réduire le padding header */
    .app-header {
        padding: 10px 12px;
        gap: 10px;
    }
    .header-top {
        gap: 8px;
    }

    /* Table plus compacte */
    .table-shell table {
        min-width: 600px;
        font-size: 12px;
    }

    /* Filtres en colonne */
    .filters-row {
        flex-direction: column;
        gap: 8px;
    }
    .filters-group {
        width: 100%;
    }
    .filters-group select,
    .filters-group input {
        width: 100%;
    }
}


/* ============================================
   Alertes de calcul de coûts (pertes, conversions)
   ============================================ */
.cost-warnings {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.10);
    color: var(--color-text);
    font-size: 0.92em;
    line-height: 1.5;
}

.cost-warnings ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.cost-warnings li {
    margin-bottom: 4px;
    overflow-wrap: break-word;
}

.ingredient-loss-input {
    min-width: 0;
}

/* Fiche recette : décomposition du coût de revient */
.cost-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.cost-breakdown-item {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    min-width: 0;
}

.cost-breakdown-item .label {
    font-size: 0.82em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.cost-breakdown-item .value {
    font-size: 1.15em;
    font-weight: 600;
    overflow-wrap: break-word;
}

.cost-breakdown-item.highlight {
    border-color: rgba(34, 197, 94, 0.5);
    background: var(--color-accent-soft);
}

@media (max-width: 480px) {
    .cost-breakdown-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Lignes d'ingrédients du formulaire recette : rendu mobile propre.
   Les enfants portent des styles flex inline (JS), d'où les !important ciblés. */
@media (max-width: 640px) {
    .ingredient-row {
        row-gap: 8px;
    }
    /* Sélecteur d'ingrédient : pleine largeur */
    .ingredient-row > div:nth-of-type(1) {
        flex: 1 1 100% !important;
    }
    /* Quantité, unité, perte : se partagent la ligne suivante */
    .ingredient-row > div:nth-of-type(2),
    .ingredient-row > div:nth-of-type(3) {
        flex: 1 1 30% !important;
        min-width: 90px;
    }
    .ingredient-row > div:nth-of-type(4) {
        flex: 1 1 20% !important;
        min-width: 80px;
    }
}

/* ============================================
   Fiche recette : allergènes & indicateurs
   ============================================ */
.allergen-card {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.35);
}

.allergen-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.allergen-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.85em;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fbbf24;
    white-space: nowrap;
}

:root[data-theme="light"] .allergen-badge {
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
    border-color: rgba(180, 83, 9, 0.4);
}

/* Sous-libellé explicatif sous la valeur d'un indicateur */
.stat-sublabel {
    font-size: 0.75em;
    color: var(--color-text-muted);
    margin-top: 2px;
    line-height: 1.35;
}

/* Marqueur d'aide (tooltip au survol via l'attribut title) */
.stat-hint {
    opacity: 0.55;
    font-size: 0.85em;
    cursor: help;
}

/* ============================================
   Page Configuration : onglets
   ============================================ */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin: 4px 0 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    min-height: 40px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

.settings-tab:hover {
    color: var(--color-text);
    background: var(--color-accent-soft);
}

.settings-tab.settings-tab-active {
    color: #ecfdf5;
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    border-color: rgba(129, 140, 248, 0.6);
    font-weight: 600;
}

:root[data-theme="light"] .settings-tab.settings-tab-active {
    color: #ffffff;
}

.settings-tab.settings-tab-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Panneaux : tous visibles sans JS ; en mode onglets, seul l'actif s'affiche */
.settings-tabs-enabled .settings-panel {
    display: none;
}

.settings-tabs-enabled .settings-panel.settings-panel-active {
    display: block;
    animation: settingsPanelFadeIn 0.18s ease-out;
}

@keyframes settingsPanelFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Zone dangereuse (suppression de compte) */
.danger-zone {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

.danger-zone-title,
.danger-text {
    color: #ef4444;
}

.danger-zone-list {
    margin: 0 0 12px;
    padding-left: 20px;
}

.danger-zone-list li {
    margin-bottom: 4px;
}

@media (max-width: 480px) {
    .settings-tab {
        padding: 8px 12px;
        font-size: 12.5px;
    }
}
