:root {
    --bg-color: #f5f5f5;
    --text-color: #111111;
    --hover-bg: #e5e5e5; /* L�ger grisement */
    --border-color: #111111;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

input, button, select, textarea {
    font-family: inherit;
}

/* On force la hauteur  100% de la fentre et on interdit le scroll */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
:root {
    --bg-color: #f5f5f5;
    --text-color: #111111;
    --hover-bg: #e5e5e5; /* Lger grisement */
    --border-color: #111111;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

input, button, select, textarea {
    font-family: inherit;
}

/* On force la hauteur  100% de la fentre et on interdit le scroll */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; overflow-y: auto; 
}

/* Barre du haut (Header) */
.top-bar, .topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 2rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    z-index: 9999;
    background-color: #ffffff;
    flex-shrink: 0; /* Empche le header de s'craser */
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.branch-selector select {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    border: 2px solid var(--border-color);
    background-color: #ffffff;
    color: var(--text-color);
    cursor: pointer;
    outline: none;
    transition: background-color 0.2s ease;
}

.branch-selector select:hover {
    background-color: var(--hover-bg);
}

/* Menu principal Grille compacte */
.main-menu {
    display: flex;
    flex-direction: column;
    flex: 1; 
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.menu-row {
    display: flex;
    flex: 1;
    border: 2px solid var(--border-color);
    border-bottom: none;
    background-color: #ffffff;
}

.menu-row:last-child {
    border-bottom: 2px solid var(--border-color);
}

.menu-item-text {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.1s ease;
}

.menu-item-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    text-decoration: none;
    color: var(--text-color);
    border-left: 2px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.suave-plus {
    width: 36px;
    height: 36px;
    /* Courbe de Bzier pour un effet lastique trs organique et suave */
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.menu-item-text:hover, .menu-item-add:hover {
    background-color: var(--hover-bg);
}

.menu-item-add:hover .suave-plus {
    transform: rotate(90deg) scale(1.2);
}

/* Responsive pour les petits crans */
@media (max-width: 768px) {
    .menu-item-text {
        font-size: 1.5rem;
        padding: 0 1rem;
    }
    .menu-item-add {
        width: 70px;
        font-size: 2.5rem;
    }
    .top-bar {
        padding: 1rem;
    }
}

/* Dashboard */
.dashboard-cards { display: flex; gap: 1rem; }
.metric-card { flex: 1; background: #ffffff; border: 2px solid var(--border-color); padding: 0.75rem 1rem; display: flex; flex-direction: column; box-shadow: 4px 4px 0px rgba(0,0,0,0.05); }
.metric-title { font-size: 0.9rem; text-transform: uppercase; font-weight: bold; color: #666; margin-bottom: 0.25rem; }
.metric-value { font-size: 2rem; font-weight: bold; }
.search-bar { width: 100%; padding: 1rem; font-size: 1.2rem; font-family: inherit; border: 2px solid var(--border-color); margin-bottom: 1rem; outline: none; box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05); }
.search-bar:focus { border-color: #000; }

/* Toggle Switch Suave */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 24px; }
.slider:before { position: absolute; content: ''; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 50%; }
input:checked + .slider { background-color: var(--text-color); }
input:checked + .slider:before { transform: translateX(26px); }


/* Badge de Statut d'Envoi */
.status-badge {
    display: inline-block;
    width: 110px;
    text-align: center;
    padding: 0.4rem 0;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    border: 2px solid var(--border-color);
    transition: transform 0.1s ease, filter 0.1s ease;
    user-select: none;
}
.status-badge.sent {
    background-color: #4ade80; /* vert suave */
    color: #000;
}
.status-badge.unsent {
    background-color: #ef4444; /* rouge suave */
    color: #fff;
}
.status-badge:active {
    transform: scale(0.95);
}
.status-badge:hover {
    filter: brightness(1.1);
}


/* Cache le texte aaaa-mm-jj quand le champ date est vide */
.date-no-placeholder:invalid::-webkit-datetime-edit {
    color: transparent;
}
.date-no-placeholder:focus::-webkit-datetime-edit {
    color: inherit;
}


#btn-archive-selection:hover {
    background-color: #333 !important;
}
#btn-archive-selection {
    transition: background-color 0.2s ease, transform 0.1s !important;
}


#logout-btn svg {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), stroke 0.3s ease;
}
#logout-btn:hover svg {
    transform: rotate(90deg) scale(1.2);
    stroke: #ff0000;
}


@page { size: auto;  margin: 0mm; }


.nav-dropdown-container { position: absolute; left: 50%; transform: translateX(-50%); z-index: 1000; }
.nav-dropdown-content { display: none; position: absolute; background-color: #fff; border: 2px solid #000; min-width: 260px; width: max-content; top: 100%; left: 50%; transform: translateX(-50%); flex-direction: column; margin-top: 2px; }

.nav-dropdown-container:hover .nav-dropdown-content { display: flex; }

.nav-dropdown-content > a { color: black; padding: 12px 16px; text-decoration: none; border-bottom: 2px solid #000; font-weight: bold; text-align: center; }
.nav-dropdown-content > a:hover { background-color: var(--hover-bg); }
.nav-dropdown-content a:last-child { border-bottom: none; }

/* Caisse in main menu (index.html) */
.main-menu .caisse-menu-item { background: black !important; color: white !important; text-transform: uppercase; }
.main-menu .caisse-menu-item a { color: white !important; }
.main-menu .caisse-menu-item:hover { background: #333 !important; }

/* Caisse in dropdown menu (top bar) */
.dropdown-menu-row.caisse-menu-item { background: white !important; color: black !important; }
.dropdown-menu-row.caisse-menu-item a { color: black !important; text-transform: uppercase; }
.dropdown-menu-row.caisse-menu-item:hover { background: var(--hover-bg) !important; }

.dropdown-menu-row { display: flex; border-bottom: 2px solid #000; }
.dropdown-menu-row:last-child { border-bottom: none; }
.dropdown-menu-item-text { flex: 1; padding: 12px 16px; font-weight: bold; text-align: left; text-decoration: none; color: black; display: flex; align-items: center; }
.dropdown-menu-item-text:hover { background-color: var(--hover-bg); }
.dropdown-menu-item-add { padding: 0 16px; border-left: 2px solid #000; display: flex; align-items: center; justify-content: center; color: black; text-decoration: none; transition: background-color 0.2s, color 0.2s; }

.dropdown-menu-item-add:hover { background-color: var(--hover-bg); color: black; }
.dropdown-menu-item-add:hover .suave-plus { transform: rotate(90deg) scale(1.1); }

.suave-plus-dropdown { width: 20px; height: 20px; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.dropdown-menu-item-add:hover .suave-plus-dropdown { transform: rotate(90deg) scale(1.1); }

.logout-btn-link { text-decoration: none; color: inherit; cursor: pointer; display: flex; align-items: center; }
.logout-text { font-weight: bold; transition: color 0.2s; }
.logout-btn-link:hover .logout-text { color: red; }


.nav-dropdown-content::before {
    content: '';
    position: absolute;
    top: -40px;
    left: -20px;
    right: -20px;
    height: 40px;
    background: transparent;
}

/* Brutalist Tooltip */
.brutalist-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 2px dashed #000;
}

.brutalist-tooltip .tooltip-content {
    visibility: hidden;
    width: max-content;
    background-color: #fff;
    color: #000;
    text-align: left;
    border: 2px solid #000;
    box-shadow: 4px 4px 0px #000;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    font-size: 0.9rem;
    font-weight: bold;
}

.brutalist-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

#btn-caisse-menu { color: white !important; }

@media screen {
/* Toggle Switch Suave */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 24px; }
.slider:before { position: absolute; content: ''; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 50%; }
input:checked + .slider { background-color: var(--text-color); }
input:checked + .slider:before { transform: translateX(26px); }


/* Badge de Statut d'Envoi */
.status-badge {
    display: inline-block;
    width: 110px;
    text-align: center;
    padding: 0.4rem 0;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    border: 2px solid var(--border-color);
    transition: transform 0.1s ease, filter 0.1s ease;
    user-select: none;
}
.status-badge.sent {
    background-color: #4ade80; /* vert suave */
    color: #000;
}
.status-badge.unsent {
    background-color: #ef4444; /* rouge suave */
    color: #fff;
}
.status-badge.pending {
    background-color: #ef4444; /* red */
    color: #fff;
}
.status-badge.ready {
    background-color: #eab308; /* yellow */
    color: #000;
}
.status-badge.delivered {
    background-color: #4ade80; /* green */
    color: #000;
}
.status-badge:active {
    transform: scale(0.95);
}
.status-badge:hover {
    filter: brightness(1.1);
}


/* Cache le texte aaaa-mm-jj quand le champ date est vide */
.date-no-placeholder:invalid::-webkit-datetime-edit {
    color: transparent;
}
.date-no-placeholder:focus::-webkit-datetime-edit {
    color: inherit;
}


#btn-archive-selection:hover {
    background-color: #333 !important;
}
#btn-archive-selection {
    transition: background-color 0.2s ease, transform 0.1s !important;
}


#logout-btn svg {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), stroke 0.3s ease;
}
#logout-btn:hover svg {
    transform: rotate(90deg) scale(1.2);
    stroke: #ff0000;
}


@page { size: auto;  margin: 0mm; }


.nav-dropdown-container { position: absolute; left: 50%; transform: translateX(-50%); z-index: 1000; }
.nav-dropdown-content { display: none; position: absolute; background-color: #fff; border: 2px solid #000; min-width: 260px; width: max-content; top: 100%; left: 50%; transform: translateX(-50%); flex-direction: column; box-shadow: 0px 4px 0px rgba(0,0,0,1); margin-top: 2px; }

.nav-dropdown-container:hover .nav-dropdown-content { display: flex; }

.nav-dropdown-content > a { color: black; padding: 12px 16px; text-decoration: none; border-bottom: 2px solid #000; font-weight: bold; text-align: center; }
.nav-dropdown-content > a:hover { background-color: var(--hover-bg); }
.nav-dropdown-content a:last-child { border-bottom: none; }

/* Caisse in main menu (index.html) */
.main-menu .caisse-menu-item { background: black !important; color: white !important; text-transform: uppercase; }
.main-menu .caisse-menu-item a { color: white !important; }
.main-menu .caisse-menu-item:hover { background: #333 !important; }

/* Caisse in dropdown menu (top bar) */
.dropdown-menu-row.caisse-menu-item { background: white !important; color: black !important; }
.dropdown-menu-row.caisse-menu-item a { color: black !important; text-transform: uppercase; }
.dropdown-menu-row.caisse-menu-item:hover { background: var(--hover-bg) !important; }

.dropdown-menu-row { display: flex; border-bottom: 2px solid #000; }
.dropdown-menu-row:last-child { border-bottom: none; }
.dropdown-menu-item-text { flex: 1; padding: 12px 16px; font-weight: bold; text-align: left; text-decoration: none; color: black; display: flex; align-items: center; }
.dropdown-menu-item-text:hover { background-color: var(--hover-bg); }
.dropdown-menu-item-add { padding: 0 16px; border-left: 2px solid #000; display: flex; align-items: center; justify-content: center; color: black; text-decoration: none; transition: background-color 0.2s, color 0.2s; }

.dropdown-menu-item-add:hover { background-color: var(--hover-bg); color: black; }
.dropdown-menu-item-add:hover .suave-plus { transform: rotate(90deg) scale(1.1); }

.suave-plus-dropdown { width: 20px; height: 20px; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.dropdown-menu-item-add:hover .suave-plus-dropdown { transform: rotate(90deg) scale(1.1); }

.logout-btn-link { text-decoration: none; color: inherit; cursor: pointer; display: flex; align-items: center; }
.logout-text { font-weight: bold; transition: color 0.2s; }
.logout-btn-link:hover .logout-text { color: red; }


.nav-dropdown-content::before {
    content: '';
    position: absolute;
    top: -40px;
    left: -20px;
    right: -20px;
    height: 40px;
    background: transparent;
}

/* Brutalist Tooltip */
.brutalist-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 2px dashed #000;
}

.brutalist-tooltip .tooltip-content {
    visibility: hidden;
    width: max-content;
    background-color: #fff;
    color: #000;
    text-align: left;
    border: 2px solid #000;
    box-shadow: 4px 4px 0px #000;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    font-size: 0.9rem;
    font-weight: bold;
}

.brutalist-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

#btn-caisse-menu { color: white !important; }

@media screen {
    #printable-area {
        zoom: 0.8;
    }
}

/* --- RESTORED FROM CAISSE.HTML --- */
.caisse-container {
    max-width: 1200px;
    width: 100%;
    margin: auto;
    flex-grow: 1;
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 2rem;
    padding: 2rem;
    box-sizing: border-box;
}

@media(max-width: 900px) {
    .caisse-container { grid-template-columns: 1fr; overflow-y: auto; }
}
.form-section { background: #fff; padding: 1.25rem; border: 2px solid var(--border-color); display: flex; flex-direction: column; min-height: 0; }
.grid-denominations { flex-grow: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.5rem; min-height: 0; }
.grid-denominations > div { display: flex; flex-direction: column; justify-content: space-evenly; }
.denom-group { display: flex; justify-content: space-between; align-items: center; padding: 0.2rem 0.5rem; border-bottom: 1px solid #eee; }
.denom-group label { font-weight: bold; font-size: 1.1rem; }
.denom-group input { width: 80px; padding: 0.25rem 0.5rem; font-size: 1.1rem; text-align: right; border: 1px solid var(--border-color); }
.total-box { margin-top: 0.5rem; padding: 0.75rem; background: #f8f8f8; border: 2px solid var(--text-color); text-align: center; font-size: 1.8rem; font-weight: bold; flex-shrink: 0; }
.reglement-alert { color: red; font-weight: bold; font-size: 1.5rem; text-align: center; margin-top: 0.5rem; text-transform: uppercase; animation: pulse 1.5s infinite; display: none; flex-shrink: 0; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

#btn-submit { width: 100%; margin-top: 0.5rem; padding: 0.75rem; font-size: 1.2rem; font-weight: bold; text-transform: uppercase; background: var(--text-color); color: #fff; border: none; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
#btn-submit:hover { background: #333; }
.history-section { background: #fff; padding: 1.25rem; border: 2px solid var(--border-color); display: flex; flex-direction: column; min-height: 0; }
.history-table-container { flex-grow: 1; overflow-y: auto; margin-top: 0.5rem; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { padding: 0.75rem 0.5rem; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #ccc; text-align: left; }
.history-table th:last-child, .history-table td:last-child { border-right: none; }
#invoices-list-table th, #invoices-list-table td { padding: 0.75rem 0.5rem; border-right: 1px solid #e8e8e8; border-bottom: 1px solid #ccc; text-align: left; }
#invoices-list-table th:last-child, #invoices-list-table td:last-child { border-right: none; }
.history-table th, #invoices-list-table th { background: #eee; position: sticky; top: 0; z-index: 10; }

/* --- RESTORED FROM NODES.HTML --- */
#cy { width: 100%; height: calc(100vh - 100px); background-color: #fafafa; border: 2px solid var(--border-color); }
.modal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; padding: 2rem; border: 4px solid var(--border-color); box-shadow: 10px 10px 0px rgba(0,0,0,0.2); z-index: 1000; width: 400px; }
.modal-backdrop { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; }

/* --- RESTORED FROM ETIQUETTE.HTML --- */
.label { width: 40mm; height: 30mm; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px dashed #ccc; padding: 2mm; box-sizing: border-box; }
.label img { max-width: 100%; max-height: 15mm; }
.label h1 { font-size: 10px; margin: 2px 0; }
.label p { font-size: 8px; margin: 0; }
@media print { .label { border: none; } body { background: none; } #print-btn { display: none; } }

/* --- GLOBAL TABLES --- */
.brutalist-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    border: 2px solid #000;
}
.brutalist-table th, .brutalist-table td {
    border: 2px solid #000;
    padding: 0.75rem;
    text-align: left;
}
.brutalist-table th {
    background-color: #f1f1f1;
    font-weight: bold;
    text-transform: uppercase;
}

/* Action Buttons in tables */
.table-action-btn {
    color: var(--text-color) !important;
    text-decoration: none;
}
.table-action-btn:hover {
    color: #666666 !important;
}

/* Bulk Selection Buttons */
.btn-selection-print {
    padding: 0.5rem 1rem;
    background: #007aff;
    color: #fff;
    border: 2px solid #0056b3;
    font-size: 1rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-selection-print:hover { background: #0056b3; }

.btn-selection-delete {
    padding: 0.5rem 1rem;
    background: #e74c3c;
    color: #fff;
    border: 2px solid #c0392b;
    font-size: 1rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-selection-delete:hover { background: #c0392b; }

.btn-selection-archive {
    padding: 0.5rem 1rem;
    background: var(--text-color);
    color: #fff;
    border: 2px solid var(--text-color);
    font-size: 1rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-selection-archive:hover { background: #333333; }

#Cluster-select { min-width: 250px; }

