/* ========================================================= VARIABLES GLOBALES ========================================================= */
:root {
    --bg: #050708;
    --bg-card: #0a0c0b;
    --accent: #3fb47a;
    --accent-light: #8be3b3;
    --border: #24312b;
    --text: #f5f7f4;
    --muted: #9ba8a0;
    --danger: #ff5c5c;
    --warning: #ffb84d;
    --radius-lg: 18px;
}

/* RESET */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    background: #050708;
    color: var(--text);
    min-height: 100vh;
    scroll-behavior: smooth;
    /* Neutralise toute transformation héritée pour que les éléments en position:fixed
       restent ancrés au viewport, même si un script applique un transform sur <body>. */
    transform: none !important;
}

html {
    /* Même protection côté racine : aucune transformation ne doit créer un containing
       block pour #ui-header ou .floating-nav. */
    transform: none !important;
}

.hidden {
    display: none !important;
}

/* ========================================================= CANVAS VORTEX — FOND ========================================================= */
#vortexCanvas {
    position: fixed;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(circle at center, #020604 0%, #000000 100%);
}

/* ========================================================= INTRO BOOT SEQUENCE ========================================================= */
#introOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    z-index: 50;
}

/* BOOT BOX */
.boot-box {
    text-align: center;
    padding: 28px 36px;
    border-radius: 18px;
    background: rgba(10, 15, 12, 0.75);
    border: 1px solid rgba(65, 92, 79, 0.4);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), 0 14px 32px rgba(0, 0, 0, 0.85), 0 0 28px rgba(63, 180, 122, 0.18);
    opacity: 0;
    transform: translateY(12px);
    animation: bootPop 0.7s ease-out forwards;
}

@keyframes bootPop {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================= BOOT LINES ========================================================= */
.boot-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 22px;
}

.boot-line {
    font-size: 1rem;
    color: var(--accent-light);
    opacity: 0;
    transition: opacity 0.6s ease;
}

/* Loader */
.boot-loader {
    width: 90px;
    height: 4px;
    margin: 0 auto;
    background: rgba(139, 227, 179, 0.08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.boot-loader::before {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    background: var(--accent-light);
    border-radius: inherit;
    transform: translateX(-60%);
    animation: loaderSlide 1.1s infinite;
}

@keyframes loaderSlide {
    0% {
        transform: translateX(-60%);
    }

    100% {
        transform: translateX(200%);
    }
}

/* ========================================================= LOGIN OVERLAY - PORTAL EMERGENCE ========================================================= */
#loginOverlay {
    position: fixed;
    inset: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    perspective: 1500px;
}

#loginOverlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Portail CSS désactivé - effet vortex canvas uniquement */
#loginOverlay::before {
    display: none;
}

/* Anneau rotatif désactivé */
#loginOverlay::after {
    display: none;
}

@keyframes portalOpen {
    0% {
        width: 0px;
        height: 0px;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 800px;
        height: 800px;
        opacity: 0.6;
    }
}

@keyframes portalRing {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes portalRingAppear {
    0% {
        opacity: 0;
        width: 100px;
        height: 100px;
    }
    100% {
        opacity: 1;
        width: 450px;
        height: 450px;
    }
}

.login-card {
    width: 400px;
    padding: 40px 36px 32px;
    border-radius: 24px;
    background: rgba(8, 16, 12, 0.92);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(63, 180, 122, 0.3);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.8),
        0 25px 50px rgba(0, 0, 0, 0.7),
        0 0 100px rgba(63, 180, 122, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: scale(0) rotateX(90deg);
    opacity: 0;
    animation: holoMaterialize 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.1s;
    position: relative;
    overflow: hidden;
}

/* Ligne de scan holographique */
.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(63, 180, 122, 0.3) 20%,
        rgba(139, 227, 179, 0.9) 50%,
        rgba(63, 180, 122, 0.3) 80%,
        transparent 100%
    );
    box-shadow:
        0 0 20px rgba(63, 180, 122, 0.8),
        0 0 40px rgba(63, 180, 122, 0.4);
    animation: scanLine 1s ease-in-out forwards;
    animation-delay: 0.2s;
    opacity: 0;
    z-index: 10;
}

@keyframes scanLine {
    0% {
        opacity: 1;
        top: 0;
    }
    90% {
        opacity: 1;
        top: 100%;
    }
    100% {
        opacity: 0;
        top: 100%;
    }
}

@keyframes cardGlowPulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

/* Bordure subtile */
.login-card::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 25px;
    background: linear-gradient(135deg,
        rgba(63, 180, 122, 0.15) 0%,
        transparent 40%,
        transparent 60%,
        rgba(139, 227, 179, 0.1) 100%
    );
    z-index: -1;
}

/* Animation hologramme qui se matérialise */
@keyframes holoMaterialize {
    0% {
        opacity: 0;
        transform: scale(0) rotateX(90deg) translateY(50px);
        filter: blur(20px) brightness(3);
    }
    20% {
        opacity: 0.3;
        transform: scale(0.4) rotateX(60deg) translateY(30px);
        filter: blur(12px) brightness(2);
    }
    40% {
        opacity: 0.6;
        transform: scale(0.7) rotateX(30deg) translateY(15px);
        filter: blur(6px) brightness(1.5);
    }
    60% {
        opacity: 0.85;
        transform: scale(0.9) rotateX(10deg) translateY(5px);
        filter: blur(2px) brightness(1.2);
    }
    80% {
        opacity: 0.95;
        transform: scale(1.02) rotateX(-2deg) translateY(-2px);
        filter: blur(0) brightness(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotateX(0deg) translateY(0);
        filter: blur(0) brightness(1);
    }
}

/* Logo login - portal emergence effect */
.login-logo {
    width: 120px;
    height: 120px;
    margin: -20px auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Anneaux orbitaux autour du logo */
.login-logo::before,
.login-logo::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.login-logo::before {
    inset: -15px;
    border-top-color: rgba(63, 180, 122, 0.5);
    border-right-color: rgba(63, 180, 122, 0.2);
    animation: logoOrbit1 3s linear infinite;
}

.login-logo::after {
    inset: -25px;
    border-bottom-color: rgba(139, 227, 179, 0.4);
    border-left-color: rgba(139, 227, 179, 0.15);
    animation: logoOrbit2 4s linear infinite reverse;
}

@keyframes logoOrbit1 {
    to { transform: rotate(360deg); }
}

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

.login-logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    animation: logoPortalFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(63, 180, 122, 0.6))
            drop-shadow(0 0 60px rgba(80, 255, 150, 0.3));
    z-index: 1;
}

@keyframes logoPortalFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 0 30px rgba(63, 180, 122, 0.6))
                drop-shadow(0 0 60px rgba(80, 255, 150, 0.3));
    }
    50% {
        transform: translateY(-8px) scale(1.02);
        filter: drop-shadow(0 0 40px rgba(63, 180, 122, 0.8))
                drop-shadow(0 0 80px rgba(80, 255, 150, 0.5));
    }
}

/* Animation digitale pour apparition progressive */
@keyframes digitalReveal {
    0% {
        opacity: 0;
        transform: translateX(-30px) scaleX(0.3);
        filter: blur(8px) brightness(2);
        clip-path: inset(0 100% 0 0);
    }
    30% {
        opacity: 0.5;
        transform: translateX(-10px) scaleX(0.8);
        filter: blur(4px) brightness(1.5);
        clip-path: inset(0 60% 0 0);
    }
    60% {
        opacity: 0.8;
        transform: translateX(5px) scaleX(1.02);
        filter: blur(1px) brightness(1.2);
        clip-path: inset(0 20% 0 0);
    }
    80% {
        transform: translateX(-2px) scaleX(1);
        clip-path: inset(0 5% 0 0);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scaleX(1);
        filter: blur(0) brightness(1);
        clip-path: inset(0 0 0 0);
    }
}

.login-card h1 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: digitalReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

.login-subtitle {
    text-align: center;
    font-size: 0.85rem;
    margin-bottom: 24px;
    color: var(--muted);
    animation: digitalReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.65s;
    opacity: 0;
}

/* Label */
.login-card label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 6px;
    display: block;
    opacity: 0;
    animation: digitalReveal 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Apparition séquentielle rapide */
.login-card label:nth-of-type(1) { animation-delay: 0.8s; }
.login-card label:nth-of-type(2) { animation-delay: 1.15s; }

/* Input */
.login-card input {
    width: 100%;
    padding: 12px 14px !important;
    background: rgba(10, 18, 14, 0.9);
    border: 1px solid rgba(63, 180, 122, 0.2);
    border-radius: 12px;
    color: var(--text);
    margin-bottom: 16px;
    opacity: 0;
    animation: digitalReveal 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.login-card input:nth-of-type(1) { animation-delay: 0.9s; }
.login-card input:nth-of-type(2) { animation-delay: 1.25s; }

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(63, 180, 122, 0.2);
}

/* ========================================================= BOUTON LOGIN ========================================================= */
.btn-primary {
    width: 100%;
    padding: 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    color: #02140a;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

/* Animation uniquement pour le bouton login */
.login-card .btn-primary {
    opacity: 0;
    animation: buttonMaterialize 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 1.4s;
}

@keyframes buttonMaterialize {
    0% {
        opacity: 0;
        transform: scaleX(0) translateY(20px);
        filter: blur(10px) brightness(2);
    }
    40% {
        opacity: 0.6;
        transform: scaleX(0.5) translateY(10px);
        filter: blur(4px) brightness(1.5);
    }
    70% {
        opacity: 0.9;
        transform: scaleX(1.05) translateY(-2px);
        filter: blur(1px) brightness(1.2);
    }
    100% {
        opacity: 1;
        transform: scaleX(1) translateY(0);
        filter: blur(0) brightness(1);
    }
}

.btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: buttonShine 2.5s ease-in-out infinite;
    animation-delay: 2s;
}

@keyframes buttonShine {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.5), 0 10px 30px rgba(0, 255, 65, 0.3);
}

.login-error {
    text-align: center;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--danger);
}

/* ========================================================= LE RESTE DU PANEL (inchangé) ========================================================= */
#app {
    position: relative;
    z-index: 5;
    min-height: 100vh;
    overflow: visible;
    padding: 0;
}

.view-area {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px 32px 48px;
}

.view {
    width: 100%;
    padding-bottom: 48px;
}

/* Les vues ne doivent jamais devenir des conteneurs de scroll : on force une hauteur
   automatique et aucun overflow pour que le défilement reste géré par le body. */
.view-area,
.view,
.container:not(.home),
.view:not(.home) .container {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    transform: none !important;
}

.view.home {
    padding-top: 20px;
}

.view:not(.home) {
    padding-top: 88px;
}

.container {
    width: 100%;
    margin: 0;
    padding: 0;
}

#app:not(.home-active) .container {
    width: 100%;
    max-width: none;
    padding: 0;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.title-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-badge {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: radial-gradient(circle at 20% 0, var(--accent-light), var(--accent));
    display: flex;
    justify-content: center;
    align-items: center;
    color: #02140a;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.title-block h1 {
    font-size: 1.3rem;
    font-weight: 650;
}

.title-block p {
    font-size: 0.8rem;
    color: var(--muted);
}

.pill {
    padding: 6px 10px;
    background: rgba(63, 180, 122, 0.12);
    border: 1px solid rgba(63, 180, 122, 0.3);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--accent-light);
}

.danger-pill {
    background: rgba(255, 92, 92, 0.12);
    border-color: rgba(255, 92, 92, 0.35);
    color: var(--danger);
}

.warning-pill {
    background: rgba(255, 184, 77, 0.12);
    border-color: rgba(255, 184, 77, 0.35);
    color: var(--warning);
}

.card {
    background: linear-gradient(145deg, #0d1310, #080a09);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.85), 0 18px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 255, 65, 0.08);
}

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

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card-header button {
    white-space: nowrap;
}

.card-header span {
    font-size: 0.8rem;
    color: var(--muted);
}

.subtitle {
    color: var(--muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 2.3fr 1.2fr 1.2fr 1.2fr;
    gap: 12px;
}

.stat-box {
    background: var(--bg-card);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 14px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    position: relative;
    outline: none;
}

.stat-box:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 20px rgba(0, 255, 65, 0.2);
}

.stat-box:focus-visible {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.3), 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 20px rgba(0, 255, 65, 0.2);
}

.stat-main {
    background: radial-gradient(circle at top left, rgba(0, 255, 65, 0.1), #0d1310);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--muted);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-value.ok {
    color: var(--accent-light);
}

.stat-value.warning {
    color: var(--warning);
}

.stat-value.danger {
    color: var(--danger);
}

/* Tableau */
.table-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.gestion-toolbar {
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.search-input,
.category-select {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #0d1311;
    color: var(--text);
    font-size: 0.8rem;
}

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(37, 56, 46, 0.4);
    color: var(--text);
    cursor: pointer;
}

.filter-btn.active {
    background: rgba(63, 180, 122, 0.25);
    border-color: var(--accent);
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.stock-table thead {
    background: rgba(0, 255, 65, 0.05);
    border-bottom: 2px solid var(--border);
}

.stock-table th {
    padding: 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    letter-spacing: 1px;
}

.stock-table td {
    padding: 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.stock-table tr:hover {
    background: rgba(0, 255, 65, 0.05);
}

.stock-badge {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stock-badge.ok {
    background: rgba(0, 255, 65, 0.12);
    border: 1px solid var(--accent);
    color: var(--accent);
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.2);
}

.stock-badge.warning {
    background: rgba(255, 170, 0, 0.12);
    border: 1px solid var(--warning);
    color: var(--warning);
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.2);
}

.stock-badge.danger {
    background: rgba(255, 51, 51, 0.12);
    border: 1px solid var(--danger);
    color: var(--danger);
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.2);
}

.stock-badge.dispo {
    background: rgba(138, 180, 248, 0.15);
    border: 1px solid rgba(138, 180, 248, 0.3);
    color: #8ab4f8;
}

/* Panel latéral */
.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 90vw;
    height: 100vh;
    background: radial-gradient(circle at top, rgba(63, 180, 122, 0.12), #050807);
    border-left: 1px solid rgba(65, 92, 79, 0.7);
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    z-index: 30;
}

.detail-panel.open {
    transform: translateX(0);
}

.detail-inner {
    padding: 18px;
    height: 100%;
    overflow-y: auto;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.panel-close {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(5, 8, 7, 0.9);
    color: var(--muted);
    cursor: pointer;
}

.panel-close:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

/* Footer */
.footer-note {
    text-align: center;
    margin-top: 20px;
    font-size: 0.75rem;
    color: var(--muted);
}

/* =========================================================
   FIX LOGO PNJ — SUPPRESSION HALO
========================================================= */
.logo-badge {
    background: none !important;
    box-shadow: none !important;
    border: 1px solid var(--border);
}

/* =========================================================
   ZONES CLIQUABLES — CLARTÉ UX
========================================================= */
.js-open-stocks,
.stat-box.stat-main {
    cursor: pointer;
}

.stat-box:not(.js-open-stocks):not(.stat-main) {
    cursor: default;
}

/* =========================================================
   MINI TABLE — PRODUITS CRITIQUES (ACCUEIL)
========================================================= */
.mini-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}

.mini-table thead {
    background: rgba(37, 56, 46, 0.4);
}

.mini-table th {
    padding: 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
}

.mini-table td {
    padding: 10px 8px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(36, 49, 43, 0.5);
    vertical-align: middle;
}

.mini-table tr:hover {
    background: rgba(37, 56, 46, 0.25);
    cursor: pointer;
}

.mini-table td:last-child {
    text-align: right;
}

/* =========================================================
   ALIGNEMENT TABLE STOCKS (DÉTAIL)
========================================================= */
.stock-table th:nth-child(3),
.stock-table th:nth-child(4),
.stock-table th:nth-child(5),
.stock-table td:nth-child(3),
.stock-table td:nth-child(4),
.stock-table td:nth-child(5) {
    text-align: center;
}

.stock-table td:nth-child(2) {
    font-family: monospace;
    font-size: 0.8rem;
}

.journalier-table th:last-child,
.journalier-table td:last-child {
    text-align: center;
}

/* =========================================================
   BADGES — ALIGNEMENT PROPRE
========================================================= */
.stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
}

/* =========================================================
   TABLE CONTROLS — ALIGNEMENT
========================================================= */
.table-controls {
    gap: 12px;
}

.search-input {
    width: 260px;
}

/* =========================================================
   FOOTER — ESPACE RESPIRATION
========================================================= */
.footer-note {
    padding-bottom: 12px;
}

/* =========================================================
   PANEL PRODUIT — AFFICHAGE BAS (MODE BANDEAU)
========================================================= */
.product-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;

    max-height: 45vh;          /* ← AU LIEU DE height */
    padding: 16px 20px;

    background: rgba(5, 8, 7, 0.96);
    backdrop-filter: blur(6px);

    border-top: 1px solid rgba(65, 92, 79, 0.6);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.7);

    transform: translateY(100%);
    transition: transform 0.12s ease-out;

    z-index: 40;

    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;

    overflow-y: auto;          /* ← IMPORTANT */
}

.product-panel.open {
    transform: translateY(0);
}

/* =========================================================
   IMAGE PRODUIT — PANEL
========================================================= */
.panel-image {
    margin: 12px 0 16px;
    text-align: center;
}

#panelImage {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    padding: 6px;
    display: none;
}

/* =========================================================
   PANEL ACTIONS (Fermeture / Forcer fermeture)
========================================================= */
.panel-actions{
  display:flex;
  gap:10px;
  margin-top:10px;
}

.btn-secondary{
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(13, 19, 16, 0.8);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover{
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
}

.btn-ghost {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 14, 10, 0.9);
  color: var(--accent);
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.btn-ghost:hover {
  background: rgba(0, 255, 65, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(0, 255, 65, 0.25), 0 12px 24px rgba(0, 0, 0, 0.38);
}

.btn-ghost:active {
  transform: translateY(1px);
}

.btn-ghost:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-danger{
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 51, 51, 0.5);
  background: rgba(255, 51, 51, 0.1);
  color: var(--danger);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover{
  border-color: var(--danger);
  box-shadow: 0 0 12px rgba(255, 51, 51, 0.4);
}

.btn-secondary:disabled,
.btn-danger:disabled{
  opacity: .45;
  cursor: not-allowed;
}

.panel-hint{
  margin-top: 8px;
  font-size: .85rem;
  color: var(--muted);
}

/* =========================================================
   POPUP SIMPLE
========================================================= */
#mkModal{
  position: fixed;
  inset: 0;
  display:none;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.55);
  z-index: 999;
}

#mkModal .box{
  width: min(520px, 92vw);
  background: rgba(10, 15, 12, 0.92);
  border: 1px solid rgba(65, 92, 79, 0.45);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.8);
  padding: 16px 16px 14px;
}

#mkModal .title{
  font-weight: 700;
  margin-bottom: 6px;
}

#mkModal .text{
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.35;
}

#mkModal .actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

/* =========================================================
   POPUP ACTION STOCK
========================================================= */
.stock-action-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 7, 0.72);
  backdrop-filter: blur(6px);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.stock-action-modal.active {
  display: flex;
}

.stock-action-box {
  width: min(460px, 90vw);
  background: radial-gradient(circle at 10% -10%, rgba(53, 208, 138, 0.12), transparent 40%), rgba(12, 18, 15, 0.9);
  border: 1px solid rgba(65, 92, 79, 0.65);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.85), 0 0 32px rgba(53, 208, 138, 0.14);
  backdrop-filter: blur(10px);
  padding: 24px;
  animation: slideUp 0.3s ease;
}

.stock-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stock-action-header h3 {
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.stock-action-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s ease;
}

.stock-action-close:hover {
  color: var(--primary);
}

.stock-action-question {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.stock-action-buttons {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.stock-action-buttons button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stock-action-buttons .btn-primary {
  background: linear-gradient(135deg, rgba(53, 208, 138, 0.2), rgba(53, 208, 138, 0.1));
  border: 1px solid var(--primary);
  color: var(--primary);
}

.stock-action-buttons .btn-primary:hover {
  background: linear-gradient(135deg, rgba(53, 208, 138, 0.3), rgba(53, 208, 138, 0.2));
  box-shadow: 0 0 20px rgba(53, 208, 138, 0.3);
}

.stock-action-buttons .btn-secondary {
  background: rgba(20, 30, 25, 0.6);
  border: 1px solid rgba(65, 92, 79, 0.4);
  color: #bfffe0;
}

.stock-action-buttons .btn-secondary:hover {
  background: rgba(30, 45, 35, 0.8);
  border-color: rgba(65, 92, 79, 0.6);
}

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

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

/* ========================= HEADER & NAVIGATION ========================= */
#ui-header {

  /* ✅ comme ta photo 1 : PAS de hauteur fixe */
  height: auto; /* ou supprime carrément la ligne height */

  z-index: 9999;
  pointer-events: none;
  background: transparent;

  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.floating-nav {
  position: relative;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

body.home #ui-header {
  display: none;
}

.home-badge {
  position: relative;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(20, 60, 40, 0.45);
  border: 1px solid rgba(80, 255, 160, 0.35);
  backdrop-filter: blur(10px);
  cursor: pointer;
  color: #bfffe0;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.home-badge-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0.85;
}

.home-badge-text {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 0.2s ease, opacity 0.15s ease;
}

.home-badge:hover {
  background: rgba(40, 120, 80, 0.55);
  box-shadow: 0 0 14px rgba(80, 255, 160, 0.45);
}

.home-badge:hover .home-badge-text {
  max-width: 80px;
  opacity: 0.9;
}

.home-badge:active {
  transform: scale(0.97);
}

.home-badge.hidden {
  display: none;
}

.container.home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}

/* ========================= APP SHELL AFTER HOME ========================= */
#app .view-area,
#app .view {
  position: relative;
  z-index: 3;
  background: transparent;
}

#app .view-area {
  max-width: none;
}

#app:not(.home-active) .view-area,
#app:not(.home-active) .view {
  background: transparent;
}

#app:not(.home-active) .page-header,
#app:not(.home-active) .kpi-highlight,
#app:not(.home-active) .kpi-card,
#app:not(.home-active) .card,
#app:not(.home-active) .chart-shell {
  background: var(--bg-card);
  border: none;
  box-shadow: none;
  border-radius: 14px;
}

#app:not(.home-active) .page-header {
  padding: 24px 32px;
  min-height: auto;
  border-radius: 14px;
}

#app:not(.home-active) .reorderable {
  border: none;
}

.home-logo {
  width: 120px;
  margin-bottom: 20px;
}

.home-hero h1 {
  font-size: 32px;
  margin-bottom: 10px;
}

.home-subtitle {
  opacity: 0.7;
  margin-bottom: 30px;
}

.home-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.home-quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.home-action {
  padding: 11px 16px;
  min-width: 150px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 14, 10, 0.9);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.home-action:hover {
  background: rgba(0, 255, 65, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(0, 255, 65, 0.3), 0 12px 28px rgba(0, 0, 0, 0.4);
}

.home-action:active {
  transform: translateY(1px);
}

.home-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .home-action {
    flex: 1 1 calc(50% - 10px);
    text-align: center;
  }

  .home-quick-actions {
    max-width: 520px;
  }
}

/* ========================= DASHBOARD ========================= */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 24px;
  padding: 24px 30px;
  border-radius: 20px;
  background: radial-gradient(circle at 10% -10%, rgba(53, 208, 138, 0.12), transparent 40%), rgba(12, 18, 15, 0.8);
  border: 1px solid rgba(65, 92, 79, 0.65);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 32px rgba(53, 208, 138, 0.14);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(53, 208, 138, 0.4);
  background: rgba(12, 18, 15, 0.8);
  display: grid;
  place-items: center;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

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

.header-meta-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.month-pill {
  text-transform: capitalize;
}

.header-cta {
  padding: 10px 16px;
  border-radius: 12px;
  border-color: rgba(65, 92, 79, 0.8);
  background: rgba(13, 20, 16, 0.9);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}

.dashboard > .page-header:not(:first-of-type) {
  display: none;
}


.daily-profit-wrapper {
  width: 100%;
  margin: 0;
  padding: 0 18px;
  box-sizing: border-box;
}

.daily-profit-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(12, 20, 16, 0.9), rgba(6, 9, 8, 0.9));
  border: 1px solid rgba(65, 92, 79, 0.7);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(53, 208, 138, 0.15);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
}

.daily-profit-banner:hover {
  border-color: rgba(53, 208, 138, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.85), 0 0 28px rgba(53, 208, 138, 0.2);
}

.daily-profit-banner:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 4px;
}

.banner-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--accent-light);
  line-height: 1.1;
}

@media (max-width: 720px) {
  .daily-profit-banner {
    align-items: flex-start;
  }
}

.soft-pill {
  background: rgba(53, 208, 138, 0.12);
  border-color: rgba(53, 208, 138, 0.3);
  color: #e4f6ec;
}

.kpi-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 2px 4px;
}

.kpi-view-toggle .pill {
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
  cursor: pointer;
}

.kpi-view-toggle .pill:hover {
  border-color: rgba(53, 208, 138, 0.6);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.kpi-view-toggle .pill:active {
  transform: translateY(1px);
}

.kpi-view-toggle .pill.active {
  background: rgba(53, 208, 138, 0.28);
  border-color: rgba(53, 208, 138, 0.65);
  color: #e9fff3;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42), 0 0 12px rgba(53, 208, 138, 0.4);
}

.kpi-view-toggle .pill.danger-pill.active {
  background: rgba(255, 92, 92, 0.22);
  border-color: rgba(255, 92, 92, 0.55);
  color: #ffe0e0;
}

.kpi-view-toggle .pill.warning-pill.active {
  background: rgba(255, 184, 77, 0.22);
  border-color: rgba(255, 184, 77, 0.55);
  color: #fff1d9;
}

.kpi-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.kpi-highlight {
  position: relative;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(17, 27, 23, 0.95), rgba(5, 8, 7, 0.9));
  border: 1px solid rgba(65, 92, 79, 0.6);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.85), 0 0 26px rgba(53, 208, 138, 0.12);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
  outline: none;
}

.kpi-highlight[data-tone="negative"] .kpi-icon {
  background: rgba(255, 92, 92, 0.12);
  border-color: rgba(255, 92, 92, 0.32);
  color: var(--danger);
}

.kpi-highlight[data-tone="warning"] .kpi-icon {
  background: rgba(255, 184, 77, 0.12);
  border-color: rgba(255, 184, 77, 0.32);
  color: var(--warning);
}

.kpi-highlight[data-tone="positive"] .kpi-icon {
  color: var(--accent-light);
}

.kpi-highlight[data-tone="negative"] .pill {
  background: rgba(255, 92, 92, 0.12);
  border-color: rgba(255, 92, 92, 0.32);
  color: var(--danger);
}

.kpi-highlight[data-tone="warning"] .pill {
  background: rgba(255, 184, 77, 0.12);
  border-color: rgba(255, 184, 77, 0.32);
  color: var(--warning);
}

.kpi-highlight::after {
  content: "";
  position: absolute;
  inset: -20% 40% 10% -10%;
  background: radial-gradient(circle at 30% 30%, rgba(53, 208, 138, 0.12), transparent 45%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.kpi-highlight.kpi-clickable {
  cursor: pointer;
}

.kpi-highlight.kpi-clickable:hover {
  transform: translateY(-4px);
  border-color: rgba(53, 208, 138, 0.65);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.85), 0 0 32px rgba(53, 208, 138, 0.18);
}

.kpi-highlight.kpi-clickable:hover::after {
  opacity: 1;
}

.kpi-highlight.kpi-clickable:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(53, 208, 138, 0.7);
  box-shadow: 0 0 0 2px rgba(63, 180, 122, 0.32), 0 22px 56px rgba(0, 0, 0, 0.85), 0 0 32px rgba(53, 208, 138, 0.18);
}

.kpi-highlight-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(53, 208, 138, 0.12);
  border: 1px solid rgba(53, 208, 138, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.kpi-highlight-label {
  color: #c7e5d6;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.kpi-highlight-value {
  font-size: 30px;
  font-weight: 700;
  color: #e4f6ec;
  line-height: 1.05;
}

.kpi-trend {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kpi-trend.trend-up {
  color: var(--accent-light);
}

.kpi-trend.trend-down {
  color: var(--danger);
}

.kpi-trend.trend-steady {
  color: var(--muted);
}

.kpi-trend.steady::before,
.kpi-trend.up::before,
.kpi-trend.trend-up::before,
.kpi-trend.trend-steady::before,
.kpi-trend.trend-down::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.kpi-positive {
  color: var(--accent-light) !important;
}

.kpi-negative {
  color: var(--danger) !important;
}

.kpi-neutral {
  color: var(--muted) !important;
}

.kpi-warning {
  color: var(--warning) !important;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 2px 0 6px;
}

.summary-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.data-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(65, 92, 79, 0.6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.data-item strong {
  font-size: 1.05rem;
  display: block;
  margin-top: 4px;
}

.kpi-card {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(12, 18, 15, 0.85), rgba(5, 8, 7, 0.8));
  border: 1px solid rgba(65, 92, 79, 0.6);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 16px 44px rgba(0,0,0,0.85), 0 0 26px rgba(53, 208, 138, 0.12);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  outline: none;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: -20% 40% 10% -10%;
  background: radial-gradient(circle at 30% 30%, rgba(53, 208, 138, 0.12), transparent 45%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.kpi-card:hover {
  border-color: rgba(53, 208, 138, 0.65);
  transform: translateY(-4px);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.85), 0 0 32px rgba(53, 208, 138, 0.18);
}

.kpi-card:focus-visible {
  border-color: rgba(53, 208, 138, 0.65);
  transform: translateY(-4px);
  box-shadow: 0 0 0 2px rgba(63, 180, 122, 0.32), 0 22px 56px rgba(0, 0, 0, 0.85), 0 0 32px rgba(53, 208, 138, 0.18);
}

.kpi-card:hover::after,
.kpi-card:focus-visible::after {
  opacity: 1;
}

.kpi-card:active {
  transform: translateY(0);
}

.kpi-primary {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(53, 208, 138, 0.12), rgba(12, 18, 15, 0.75));
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.drag-handle {
  opacity: 0.5;
  font-size: 0.9rem;
}

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.reorderable {
  border-style: dashed;
}

.chart-shell {
  position: relative;
  background: radial-gradient(circle at 20% 10%, rgba(53, 208, 138, 0.08), transparent 40%), rgba(12, 18, 15, 0.7);
  border: 1px solid rgba(65, 92, 79, 0.6);
  border-radius: 16px;
  padding: 18px;
  margin: 0 auto;
  max-width: 1400px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), 0 20px 44px rgba(0,0,0,0.65);
}

#stockChart {
  width: 100%;
  min-height: 240px;
  height: 35vh;
  max-height: 35vh;
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(65, 92, 79, 0.6);
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(53, 208, 138, 0.6);
}

.legend-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legend-text {
  font-size: 0.9rem;
}

.legend-message {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.2;
  display: none;
}

@media (max-width: 1024px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-meta {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .kpi-highlight,
  .kpi-card,
  .chart-shell,
  .card {
    margin-bottom: 6px;
  }

  .view-area {
    padding-inline: 18px;
  }

  #app:not(.home-active) .view-area {
    padding-top: 110px;
  }

  #app.home-active .view-area {
    padding-top: 20px;
  }
}

.muted-pill {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-color: var(--border);
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px;
  min-height: 150px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: radial-gradient(circle at 16% -18%, rgba(53, 208, 138, 0.12), transparent 40%), rgba(12, 18, 15, 0.82);
  border: 1px solid rgba(65, 92, 79, 0.6);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7), 0 0 28px rgba(53, 208, 138, 0.12);
  backdrop-filter: blur(8px);
}

.page-intro h2 {
  margin: 6px 0;
}

.table-wrapper {
  overflow: auto;
}

/* ========================= TOP VARIÉTÉS ========================= */
.top-varietes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.top-variete-row {
  width: 100%;
}

.top-variete-entry {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(12, 18, 15, 0.85), rgba(5, 8, 7, 0.8));
  border: 1px solid rgba(65, 92, 79, 0.55);
  color: inherit;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.top-variete-entry:hover,
.top-variete-entry:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(53, 208, 138, 0.65);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 18px rgba(53, 208, 138, 0.18);
  outline: none;
}

.top-variete-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.top-variete-rank {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(53, 208, 138, 0.16);
  border: 1px solid rgba(53, 208, 138, 0.35);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #e4f6ec;
}

.top-variete-visual {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(65, 92, 79, 0.5);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.top-variete-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-variete-fallback {
  font-weight: 700;
  color: var(--accent-light);
}

.top-variete-labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.top-variete-name {
  font-weight: 650;
  color: #e4f6ec;
}

.top-variete-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.top-variete-benef {
  font-weight: 750;
  color: var(--accent-light);
}


/* ========================================================= JOURNALIER =============================================== */
.badge-soft {
    background: rgba(63, 180, 122, 0.14);
    color: var(--accent-light);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid rgba(63, 180, 122, 0.25);
}

.journalier-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.journalier-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0d1311;
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
    outline: 1px solid var(--accent);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.journalier-output {
    background: rgba(12, 18, 15, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    min-width: 90px;
    text-align: center;
}

.status-chip[data-state="success"] {
    border-color: rgba(63, 180, 122, 0.55);
    color: var(--accent-light);
}

.status-chip[data-state="reject"],
.status-chip[data-state="error"] {
    border-color: rgba(255, 92, 92, 0.6);
    color: #ff8c8c;
}

.output-raw {
    background: rgba(6, 8, 7, 0.5);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 12px;
    color: var(--text);
    min-height: 120px;
    overflow: auto;
}

/* Toggle Group - Boutons style moderne */
.toggle-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toggle-btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(13, 19, 17, 0.8);
    color: var(--muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.toggle-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(63, 180, 122, 0.1);
}

.toggle-btn.active {
    border-color: var(--accent);
    background: rgba(63, 180, 122, 0.2);
    color: var(--accent-light);
    box-shadow: 0 0 12px rgba(63, 180, 122, 0.15);
}

/* Extras Group - Boutons optionnels journalier */
.extras-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.extra-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(13, 19, 17, 0.6);
}

.extra-label {
    font-size: 0.9rem;
    color: var(--text);
}

.extra-toggle {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 92, 92, 0.15);
    color: #ff8c8c;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.extra-toggle[data-active="true"] {
    background: rgba(63, 180, 122, 0.2);
    border-color: var(--accent);
    color: var(--accent-light);
}

.extra-counter {
    display: flex;
    align-items: center;
    gap: 4px;
}

.counter-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(13, 19, 17, 0.8);
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(63, 180, 122, 0.1);
}

.counter-value {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    color: var(--text);
}

/* Additional Lines - Multi-ventes */
.additional-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.additional-line {
    display: grid;
    grid-template-columns: 1fr 80px 80px auto;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    border: 1px dashed var(--border);
    background: rgba(13, 19, 17, 0.4);
    align-items: center;
}

.additional-line input,
.additional-line select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #0d1311;
    color: var(--text);
    font-size: 0.9rem;
}

.remove-line-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 92, 92, 0.4);
    background: rgba(255, 92, 92, 0.1);
    color: #ff8c8c;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-line-btn:hover {
    background: rgba(255, 92, 92, 0.25);
    border-color: rgba(255, 92, 92, 0.6);
}

/* Improved Output Section */
.output-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.output-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(6, 8, 7, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.output-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.output-value {
    color: var(--text);
    font-weight: 500;
}

.output-details {
    margin-top: 8px;
}

.output-details summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.output-details summary:hover {
    color: var(--accent-light);
}

.output-details[open] summary {
    color: var(--accent-light);
    margin-bottom: 8px;
}

.meta-info {
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .journalier-layout {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   USER BADGE - Indicateur utilisateur connecté
========================================================= */
.user-badge {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    background: rgba(10, 15, 12, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(63, 180, 122, 0.3);
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(63, 180, 122, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    animation: userBadgeIn 0.5s ease forwards;
    animation-delay: 0.3s;
}

.user-badge-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
    50% { opacity: 0.6; box-shadow: 0 0 15px var(--accent); }
}

@keyframes userBadgeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#userBadgeName {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-light);
    text-transform: capitalize;
}

/* =========================================================
   LOADING OVERLAY - Animation post-login
========================================================= */
#loadingOverlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(5, 15, 10, 0.95) 0%, rgba(2, 5, 3, 0.98) 100%);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 45;
    opacity: 0;
    animation: loadingFadeIn 0.6s ease forwards;
}

@keyframes loadingFadeIn {
    to { opacity: 1; }
}

.loading-container {
    text-align: center;
    position: relative;
    padding: 40px;
}

/* Logo wrapper avec anneaux */
.loading-logo-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    position: relative;
    z-index: 3;
    animation: logoPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(63, 180, 122, 0.5));
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(63, 180, 122, 0.5));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 35px rgba(63, 180, 122, 0.8));
    }
}

/* Anneaux tournants */
.loading-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    animation: ringRotate 1.5s linear infinite;
}

.loading-ring:nth-child(2) {
    width: 100px;
    height: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-top-color: var(--accent);
    border-right-color: rgba(63, 180, 122, 0.3);
    animation-duration: 1.5s;
}

.loading-ring-2 {
    width: 120px;
    height: 120px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-top-color: var(--accent-light) !important;
    border-left-color: rgba(139, 227, 179, 0.2) !important;
    animation-duration: 2s !important;
    animation-direction: reverse !important;
}

.loading-ring-3 {
    width: 140px;
    height: 140px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-top-color: rgba(63, 180, 122, 0.5) !important;
    border-bottom-color: rgba(63, 180, 122, 0.2) !important;
    animation-duration: 2.5s !important;
}

@keyframes ringRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Titre bienvenue */
.loading-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 30px;
    opacity: 0;
    animation: titleFadeIn 0.8s ease forwards;
    animation-delay: 0.3s;
}

.loading-title span,
.loading-highlight {
    color: var(--accent-light);
    font-weight: 700;
    text-shadow: 0 0 20px rgba(63, 180, 122, 0.5);
}

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

/* Status messages */
.loading-status {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 35px;
}

.loading-step {
    font-size: 0.9rem;
    color: var(--muted);
    opacity: 0;
    transform: translateX(-20px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.4s ease;
}

.loading-step.active {
    color: var(--accent-light);
    opacity: 1;
    transform: translateX(0);
}

.loading-step.completed {
    color: var(--accent);
    opacity: 0.7;
    transform: translateX(0);
}

.step-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.loading-step.active .step-icon {
    animation: iconSpin 1s linear infinite;
}

.loading-step.completed .step-icon {
    color: var(--accent);
}

@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Barre de progression */
.loading-progress {
    width: 280px;
    height: 4px;
    background: rgba(63, 180, 122, 0.1);
    border-radius: 10px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.loading-progress-glow {
    position: absolute;
    top: -2px;
    right: 0;
    width: 40px;
    height: 8px;
    background: radial-gradient(ellipse, var(--accent-light) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    animation: glowMove 2s ease-in-out infinite;
}

@keyframes glowMove {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Particules décoratives */
.loading-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.loading-particles span {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 4s ease-in-out infinite;
}

.loading-particles span:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.loading-particles span:nth-child(2) { left: 20%; top: 80%; animation-delay: 0.5s; }
.loading-particles span:nth-child(3) { left: 80%; top: 30%; animation-delay: 1s; }
.loading-particles span:nth-child(4) { left: 90%; top: 70%; animation-delay: 1.5s; }
.loading-particles span:nth-child(5) { left: 50%; top: 10%; animation-delay: 2s; }
.loading-particles span:nth-child(6) { left: 30%; top: 90%; animation-delay: 2.5s; }
.loading-particles span:nth-child(7) { left: 70%; top: 85%; animation-delay: 3s; }
.loading-particles span:nth-child(8) { left: 15%; top: 50%; animation-delay: 3.5s; }

@keyframes particleFloat {
    0%, 100% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    25% {
        opacity: 0.8;
        transform: translateY(-30px) scale(1);
    }
    50% {
        opacity: 0.4;
        transform: translateY(-60px) scale(0.8);
    }
    75% {
        opacity: 0.2;
        transform: translateY(-90px) scale(0.5);
    }
}

/* Animation de sortie du loader */
#loadingOverlay.fade-out {
    animation: loadingFadeOut 0.6s ease forwards;
}

@keyframes loadingFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(1.05);
    }
}

/* ========================================================= JOURNALIER STEPS & TERMINAL ========================================================= */
.request-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--muted);
    transition: color 0.2s ease;
}

.step-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.2s ease;
}

.step-label {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Step states */
.step[data-state="active"] {
    color: var(--accent);
}

.step[data-state="active"] .step-icon {
    background: var(--accent);
    color: var(--bg);
    animation: stepPulse 1s ease infinite;
}

.step[data-state="done"] {
    color: var(--accent);
}

.step[data-state="done"] .step-icon {
    background: var(--accent);
    color: var(--bg);
}

.step[data-state="error"] {
    color: var(--danger);
}

.step[data-state="error"] .step-icon {
    background: var(--danger);
    color: white;
}

@keyframes stepPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(63, 180, 122, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(63, 180, 122, 0);
    }
}

/* Terminal chat style */
.response-chat {
    margin-top: 0.5rem;
}

.chat-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.chat-terminal {
    background: #0d1210;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: 3rem;
}

.terminal-prompt {
    color: var(--accent);
    font-weight: bold;
    flex-shrink: 0;
}

.terminal-text {
    color: var(--accent-light);
    word-break: break-word;
    line-height: 1.5;
}

/* Status chip enhancements for journalier */
.journalier-output .status-chip[data-state="success"] {
    background: rgba(63, 180, 122, 0.15);
    color: var(--accent);
}

.journalier-output .status-chip[data-state="reject"] {
    background: rgba(255, 92, 92, 0.15);
    color: var(--danger);
}

/* =========================================================
   BOUTON ACTUALISER
========================================================= */
.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(0, 255, 65, 0.08);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: rgba(0, 255, 65, 0.15);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-refresh .refresh-icon {
    font-size: 1.1rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.btn-refresh:hover .refresh-icon {
    transform: rotate(90deg);
}

.btn-refresh.refreshing {
    pointer-events: none;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =========================================================
   MODAL AMÉLIORÉ
========================================================= */
#mkModal .box {
    animation: modalSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    backdrop-filter: blur(12px);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#mkModal .title {
    color: var(--accent-light);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

#mkModal .title::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 50%;
    color: #02140a;
    font-size: 0.85rem;
    font-weight: 700;
}

#mkModal .text {
    white-space: pre-line;
    padding-left: 32px;
}

#mkModal .actions button {
    padding: 10px 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    color: #02140a;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#mkModal .actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(63, 180, 122, 0.4);
}

#mkModal .actions button:active {
    transform: scale(0.97);
}

/* =========================================================
   MESSAGE INFO DÉLAI PROMOTIONS
========================================================= */
.promo-info-delay {
    font-size: 0.8rem;
    color: var(--accent-light);
    background: rgba(63, 180, 122, 0.1);
    border: 1px solid rgba(63, 180, 122, 0.25);
    border-radius: 8px;
    padding: 8px 14px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.promo-info-delay::before {
    content: "⏱";
    font-size: 1rem;
}

/* Bouton Actualiser dans les lignes de tableau */
.btn-refresh-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-refresh-row:hover {
    background: rgba(0, 255, 65, 0.2);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.btn-refresh-row .refresh-icon {
    font-size: 0.9rem;
}

/* =========================================================
   FACTURATION ALEX - Calendrier mensuel
========================================================= */
.facturation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.facturation-header .title-block h1 {
    margin: 0;
    font-size: 1.5rem;
}

.facturation-header .title-block .eyebrow {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.facturation-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.facturation-nav .current-month {
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 160px;
    text-align: center;
}

.facturation-nav button {
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.facturation-nav button:hover {
    border-color: var(--accent);
    background: rgba(63, 180, 122, 0.1);
}

.facturation-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(63, 180, 122, 0.1);
    border: 1px solid rgba(63, 180, 122, 0.25);
    border-radius: 8px;
    margin-bottom: 10px;
}

.facturation-info .amount-per-day {
    font-weight: 600;
    color: var(--accent);
}

/* Grille calendrier */
.facturation-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.facturation-day-header {
    text-align: center;
    font-size: 0.7rem;
    color: var(--muted);
    padding: 4px 0;
    font-weight: 600;
    text-transform: uppercase;
}

.facturation-day {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    cursor: default;
}

.facturation-day.empty {
    background: transparent;
    border: 1px dashed var(--border);
    opacity: 0.3;
}

.facturation-day.clickable {
    cursor: pointer;
}

.facturation-day.clickable:hover {
    border-color: var(--accent);
    background: rgba(63, 180, 122, 0.05);
}

.facturation-day .day-number {
    font-size: 0.95rem;
    font-weight: 600;
}

.facturation-day .day-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    background: transparent;
}

.facturation-day.validated .day-check {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.facturation-day.validated {
    border-color: var(--accent);
    background: rgba(63, 180, 122, 0.08);
}

/* Dimanches - grisés et non cliquables */
.facturation-day.dimanche {
    background: rgba(100, 100, 100, 0.1);
    border-color: rgba(100, 100, 100, 0.3);
    opacity: 0.5;
    cursor: not-allowed;
}

.facturation-day.dimanche .day-number {
    color: var(--muted);
}

.facturation-day.dimanche .day-check {
    color: var(--muted);
    border-color: rgba(100, 100, 100, 0.3);
}

/* Footer avec total */
.facturation-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 12px;
}

.facturation-total {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.facturation-total .label {
    font-size: 0.85rem;
    color: var(--muted);
}

.facturation-total .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.facturation-total .value .max {
    font-size: 1rem;
    color: var(--muted);
    font-weight: 400;
}

.btn-relance {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    background: rgba(255, 180, 77, 0.15);
    border: 1px solid rgba(255, 180, 77, 0.4);
    color: #ffb84d;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-relance:hover {
    background: rgba(255, 180, 77, 0.25);
    transform: translateY(-1px);
}

.btn-relance:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .facturation-calendar {
        grid-template-columns: repeat(7, 1fr);
        gap: 6px;
    }

    .facturation-day {
        padding: 8px;
        min-height: 60px;
    }

    .facturation-day .day-number {
        font-size: 0.9rem;
    }

    .facturation-day .day-check {
        width: 22px;
        height: 22px;
        font-size: 0.8rem;
    }
}

/* =========================================================
   GUIDE — Page d'aide (Accordéon)
========================================================= */
.guide-page {
    max-width: 800px;
    margin: 0 auto;
}

.guide-header {
    margin-bottom: 20px;
}

.guide-header .eyebrow {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.guide-header h1 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
}

.guide-subtitle {
    color: var(--muted);
    margin: 0;
}

/* Accordéon - 2 colonnes */
.guide-accordion {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: start;
}

@media (max-width: 900px) {
    .guide-accordion {
        grid-template-columns: 1fr;
    }
}

.guide-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.guide-item summary {
    padding: 14px 18px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    transition: background 0.2s ease;
}

.guide-item summary::-webkit-details-marker {
    display: none;
}

.guide-item summary::after {
    content: "+";
    font-size: 1.2rem;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.guide-item[open] summary::after {
    content: "−";
}

.guide-item summary:hover {
    background: rgba(63, 180, 122, 0.05);
}

.guide-item[open] summary {
    border-bottom: 1px solid var(--border);
    background: rgba(63, 180, 122, 0.03);
}

.guide-item-content {
    padding: 14px 18px;
}

.guide-item-content p {
    margin: 0 0 8px 0;
    color: var(--muted);
    line-height: 1.5;
}

.guide-item-content p:last-child {
    margin-bottom: 0;
}

.guide-item-content ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    color: var(--muted);
}

.guide-item-content li {
    margin-bottom: 6px;
    line-height: 1.4;
}

.guide-item-content li:last-child {
    margin-bottom: 0;
}

.guide-item-content strong {
    color: var(--text);
}

/* Item important (conseils) */
.guide-item.guide-important {
    border-color: var(--accent);
    background: rgba(63, 180, 122, 0.05);
}

.guide-item.guide-important summary {
    color: var(--accent);
}

/* =========================================================
   POPUP RELANCE avec explosion de particules
========================================================= */
.relance-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.relance-popup-overlay.visible {
    opacity: 1;
}

.relance-popup {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 400px;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(63, 180, 122, 0.2);
}

.relance-popup-overlay.visible .relance-popup {
    transform: scale(1);
}

.relance-popup.closing {
    transform: scale(0.8);
    opacity: 0;
}

.relance-popup-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.relance-popup-message {
    margin-bottom: 24px;
}

.relance-popup-message p {
    margin: 0 0 8px 0;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.5;
}

.relance-popup-message p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.relance-popup-btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 12px 40px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.relance-popup-btn:hover {
    background: #2ecc71;
    transform: scale(1.05);
}

/* Particules d'explosion - Points fins plein écran */
.explosion-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10001;
    animation: explode var(--duration, 1s) linear forwards;
}

@keyframes explode {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    70% {
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

