/* =============================================================================
   StockMaster — feuille de style de l'application
   -----------------------------------------------------------------------------
   C'est LE fichier à modifier pour changer l'apparence de l'application.
   Il est chargé après Bootstrap 4 et le thème Lunoz, qu'il surcharge.

   1. Variables de thème  ← changer les couleurs, la police, les arrondis ici
   2. Base
   3. Structure (menu latéral, barre du haut, en-tête de page, pied de page)
   4. Composants (cartes, KPI, boutons, badges, tableaux, formulaires, modales…)
   5. Pages spécifiques (connexion, erreurs, profil, caisse, journal…)
   6. Utilitaires & impression
   ============================================================================= */


/* 1. VARIABLES DE THÈME ===================================================== */
:root {
    /* Couleurs de marque */
    --app-primary: #11757a;
    --app-primary-hover: #0d5e62;
    --app-primary-soft: #e3f2f2;
    --app-accent: #fd6603;
    --app-accent-hover: #e05a02;
    --app-accent-soft: #fff0e6;

    /* Couleurs d'état */
    --app-success: #16a34a;
    --app-success-soft: #e7f6ec;
    --app-warning: #d97706;
    --app-warning-soft: #fdf3e2;
    --app-danger: #dc2626;
    --app-danger-soft: #fdeaea;
    --app-info: #0284c7;
    --app-info-soft: #e5f3fa;
    --app-secondary: #64748b;
    --app-secondary-soft: #eef1f5;

    /* Neutres */
    --app-bg: #f4f6f9;
    --app-surface: #ffffff;
    --app-border: #e5e9f0;
    --app-text: #1f2937;
    --app-text-muted: #6b7280;
    --app-heading: #111827;

    /* Menu latéral */
    --app-sidebar-width: 250px;
    --app-sidebar-bg: #16232f;
    --app-sidebar-text: #a9b6c6;
    --app-sidebar-text-hover: #ffffff;
    --app-sidebar-title: #5f7286;
    --app-sidebar-active-bg: var(--app-primary);

    /* Barre du haut */
    --app-topbar-height: 68px;
    --app-topbar-bg: #ffffff;

    /* Formes */
    --app-radius: 12px;
    --app-radius-sm: 8px;
    --app-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --app-shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);

    /* Typographie */
    --app-font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --app-font-size: 14px;
}


/* 2. BASE ==================================================================== */
body {
    font-family: var(--app-font);
    font-size: var(--app-font-size);
    color: var(--app-text);
    background-color: var(--app-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--app-font);
    color: var(--app-heading);
    font-weight: 600;
}

a { color: var(--app-primary); }
a:hover { color: var(--app-primary-hover); }

.text-muted { color: var(--app-text-muted) !important; }
.text-primary { color: var(--app-primary) !important; }
.text-accent { color: var(--app-accent) !important; }
.text-success { color: var(--app-success) !important; }
.text-danger { color: var(--app-danger) !important; }
.text-warning { color: var(--app-warning) !important; }


/* 3. STRUCTURE =============================================================== */

/* — Menu latéral — */
.vertical-menu {
    width: var(--app-sidebar-width);
    background: var(--app-sidebar-bg);
    box-shadow: none;
}

.navbar-brand-box {
    height: var(--app-topbar-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.navbar-brand-box img {
    width: auto;
    height: auto;
    max-height: 40px;
    max-width: 100%;
    object-fit: contain;
}

#sidebar-menu { padding: 12px 0 30px; }

#sidebar-menu .menu-title {
    color: var(--app-sidebar-title);
    font-size: 11px;
    letter-spacing: .08em;
    padding: 18px 22px 6px !important;
}

#sidebar-menu ul li a {
    color: var(--app-sidebar-text);
    font-size: 13px;
    white-space: nowrap;
    padding: .55rem 1rem;
    margin: 2px 12px;
    border-radius: var(--app-radius-sm);
}

#sidebar-menu span {
    text-transform: none;
    font-size: 13px;
}

/* Flèche des sous-menus : positionnée à droite sans jamais passer à la ligne */
#sidebar-menu .has-arrow { position: relative; padding-right: 2rem; }
#sidebar-menu .has-arrow:after { position: absolute; right: .75rem; top: 50%; margin-top: -.55rem; float: none; padding-top: 0; }

#sidebar-menu ul li a:hover { color: var(--app-sidebar-text-hover); background: rgba(255, 255, 255, .05); }
#sidebar-menu ul li a i { opacity: .9; }

#sidebar-menu ul li ul.sub-menu li a {
    padding: .4rem 1rem .4rem 3.1rem;
    font-size: 13px;
}

#sidebar-menu .mm-active > a,
#sidebar-menu ul li a.active {
    color: #fff !important;
    background: var(--app-sidebar-active-bg);
}

#sidebar-menu ul li ul.sub-menu li a.active {
    background: rgba(255, 255, 255, .08);
}

/* — Barre du haut — */
.navbar-header {
    height: var(--app-topbar-height);
    margin-left: var(--app-sidebar-width);
    background: var(--app-topbar-bg);
    box-shadow: 0 1px 0 var(--app-border);
}

.topbar .header-item { height: var(--app-topbar-height); display: flex; align-items: center; }
.topbar .header-profile-user { width: 36px; height: 36px; object-fit: cover; }
.topbar-user-name { font-weight: 600; color: var(--app-heading); line-height: 1.2; }
.topbar-user-role { font-size: 12px; color: var(--app-text-muted); }

.dropdown-menu {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow-lg);
    padding: 6px;
}

.dropdown-item {
    border-radius: 6px;
    padding: .5rem .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.dropdown-item i { font-size: 18px; color: var(--app-text-muted); }

/* — Contenu — */
.main-content { margin-left: var(--app-sidebar-width); }

.page-content {
    padding: calc(var(--app-topbar-height) + 24px) 12px 80px !important;
}

/* — En-tête de page — */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    margin: 0;
}

.page-subtitle {
    color: var(--app-text-muted);
    margin: 4px 0 0;
}

.page-header .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0 0 4px;
    font-size: 12.5px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* — Pied de page — */
.footer {
    left: var(--app-sidebar-width);
    background: transparent;
    color: var(--app-text-muted);
    border-top: 1px solid var(--app-border);
    font-size: 13px;
}

/* — Mobile — */
@media (max-width: 992px) {
    .main-content, .navbar-header { margin-left: 0; }
    .footer { left: 0; }
}


/* 4. COMPOSANTS ============================================================== */

/* — Cartes — */
.card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    margin-bottom: 24px;
    background: var(--app-surface);
}

.card-body { padding: 20px !important; }

.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: transparent;
    border-bottom: 1px solid var(--app-border);
}

.card-header:first-child { border-radius: var(--app-radius) var(--app-radius) 0 0; }

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--app-heading);
}

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

/* — Cartes KPI — */
.stat-card .card-body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

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

.stat-label {
    color: var(--app-text-muted);
    font-size: 12.5px;
    font-weight: 500;
    margin: 0 0 4px;
}

.stat-value {
    /* S'adapte à la largeur de l'écran pour que les montants tiennent sur une ligne */
    font-size: clamp(17px, 1.45vw, 22px);
    white-space: nowrap;
    font-weight: 700;
    color: var(--app-heading);
    margin: 0;
    line-height: 1.2;
}

.stat-hint {
    font-size: 12.5px;
    color: var(--app-text-muted);
    margin-top: 6px;
}

.stat-trend { font-weight: 600; margin-right: 4px; }

/* Couleurs des icônes KPI et des fonds doux */
.tone-primary   { background: var(--app-primary-soft);   color: var(--app-primary); }
.tone-accent    { background: var(--app-accent-soft);    color: var(--app-accent); }
.tone-success   { background: var(--app-success-soft);   color: var(--app-success); }
.tone-warning   { background: var(--app-warning-soft);   color: var(--app-warning); }
.tone-danger    { background: var(--app-danger-soft);    color: var(--app-danger); }
.tone-info      { background: var(--app-info-soft);      color: var(--app-info); }
.tone-secondary { background: var(--app-secondary-soft); color: var(--app-secondary); }

/* — Boutons — */
.btn {
    border-radius: var(--app-radius-sm);
    font-weight: 500;
    font-size: 13.5px;
    padding: .45rem .95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    box-shadow: none !important;
}

.btn i { font-size: 1.1em; }
.btn-sm { padding: .3rem .65rem; font-size: 12.5px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }

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

.btn-accent { background: var(--app-accent); border-color: var(--app-accent); color: #fff; }
.btn-accent:hover, .btn-accent:focus { background: var(--app-accent-hover); border-color: var(--app-accent-hover); color: #fff; }

.btn-light {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-text);
}

.btn-light:hover { background: var(--app-bg); border-color: var(--app-border); }

.btn-outline-primary { color: var(--app-primary); border-color: var(--app-primary); }
.btn-outline-primary:hover { background: var(--app-primary); border-color: var(--app-primary); }

/* Boutons d'action « doux » dans les tableaux */
.btn-soft-primary { background: var(--app-primary-soft); color: var(--app-primary); border: 0; }
.btn-soft-success { background: var(--app-success-soft); color: var(--app-success); border: 0; }
.btn-soft-danger  { background: var(--app-danger-soft);  color: var(--app-danger);  border: 0; }
.btn-soft-warning { background: var(--app-warning-soft); color: var(--app-warning); border: 0; }
.btn-soft-info    { background: var(--app-info-soft);    color: var(--app-info);    border: 0; }
.btn-soft-primary:hover { background: var(--app-primary); color: #fff; }
.btn-soft-success:hover { background: var(--app-success); color: #fff; }
.btn-soft-danger:hover  { background: var(--app-danger);  color: #fff; }
.btn-soft-warning:hover { background: var(--app-warning); color: #fff; }
.btn-soft-info:hover    { background: var(--app-info);    color: #fff; }

.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }

/* — Badges — */
.badge {
    font-weight: 600;
    font-size: 11.5px;
    padding: .35em .7em;
    border-radius: 999px;
}

.badge-soft-primary   { background: var(--app-primary-soft);   color: var(--app-primary); }
.badge-soft-success   { background: var(--app-success-soft);   color: var(--app-success); }
.badge-soft-warning   { background: var(--app-warning-soft);   color: var(--app-warning); }
.badge-soft-danger    { background: var(--app-danger-soft);    color: var(--app-danger); }
.badge-soft-info      { background: var(--app-info-soft);      color: var(--app-info); }
.badge-soft-secondary { background: var(--app-secondary-soft); color: var(--app-secondary); }
.badge-soft-accent    { background: var(--app-accent-soft);    color: var(--app-accent); }

/* — Tableaux — */
.app-table { margin: 0; }

.app-table thead th {
    background: var(--app-bg);
    color: var(--app-text-muted);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-top: 0;
    border-bottom: 1px solid var(--app-border);
    white-space: nowrap;
    padding: .75rem 1rem;
}

.app-table td, .app-table tbody th {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--app-border);
}

.app-table tbody tr:hover { background: #fafbfc; }
.app-table .cell-strong { font-weight: 600; color: var(--app-heading); }
.app-table .cell-sub { display: block; font-size: 12px; color: var(--app-text-muted); }
.app-table tfoot td { font-weight: 700; background: var(--app-bg); }

.card .table-responsive { border-radius: 0 0 var(--app-radius) var(--app-radius); }

/* DataTables 2 (classes dt-*) */
.dt-container .dt-layout-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin: 0; }
.dt-container .dt-layout-row.dt-layout-table { padding: 0; }
.dt-container .dt-layout-table > .dt-layout-cell { width: 100%; }
.dt-container .dt-search input,
.dt-container .dt-length select {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    padding: .35rem .7rem;
    min-height: 36px;
    margin-left: .4rem;
}
.dt-container .dt-search input:focus { border-color: var(--app-primary); outline: 0; box-shadow: 0 0 0 3px var(--app-primary-soft); }
.dt-container .dt-length label, .dt-container .dt-search label { font-weight: 400; color: var(--app-text-muted); margin: 0; }
.dt-container .dt-info { color: var(--app-text-muted); font-size: 12.5px; }
.dt-container .dt-paging .dt-paging-button {
    border: 0 !important;
    border-radius: var(--app-radius-sm) !important;
    min-width: 32px;
    padding: .3rem .6rem !important;
    color: var(--app-text) !important;
    background: transparent !important;
}
.dt-container .dt-paging .dt-paging-button:hover:not(.disabled) { background: var(--app-bg) !important; }
.dt-container .dt-paging .dt-paging-button.current { background: var(--app-primary) !important; color: #fff !important; }
.dt-container .dt-paging .dt-paging-button.disabled { opacity: .4; }
/* DataTables aligne à droite les colonnes qu'il juge numériques (dates triées par horodatage…) :
   on garde l'alignement à gauche, sauf pour les colonnes marquées .text-right (montants, quantités) */
table.dataTable th.dt-type-numeric:not(.text-right), table.dataTable th.dt-type-date:not(.text-right),
table.dataTable td.dt-type-numeric:not(.text-right), table.dataTable td.dt-type-date:not(.text-right) { text-align: left; }
table.dataTable th.dt-type-numeric:not(.text-right) div.dt-column-header,
table.dataTable th.dt-type-date:not(.text-right) div.dt-column-header { flex-direction: row; }
table.dataTable thead > tr > th.dt-orderable-asc:hover,
table.dataTable thead > tr > th.dt-orderable-desc:hover { outline: 0; color: var(--app-heading); }
.page-item.active .page-link { background: var(--app-primary); border-color: var(--app-primary); }
.page-link { color: var(--app-primary); border-color: var(--app-border); }

/* — Formulaires — */
.form-control, .custom-select {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    min-height: 40px;
    font-size: 14px;
    color: var(--app-text);
}

.form-control:focus, .custom-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px var(--app-primary-soft);
}

textarea.form-control { min-height: 96px; }
select[multiple].form-control { min-height: 120px; }

label, .form-label {
    font-weight: 500;
    font-size: 13px;
    color: var(--app-heading);
    margin-bottom: 6px;
}

.form-group .required-mark { color: var(--app-danger); margin-left: 2px; }
.form-text { font-size: 12px; color: var(--app-text-muted); }
.invalid-feedback { display: block; font-size: 12.5px; }
.errorlist { list-style: none; padding: 0; margin: 0; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--app-border);
}

.custom-control-input:checked ~ .custom-control-label::before {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

/* Barre de filtres */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.filter-bar .form-group { margin: 0; min-width: 170px; flex: 1 1 170px; }
.filter-bar .filter-actions { display: flex; gap: 8px; }

/* Select2 accordé aux champs */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    min-height: 40px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 38px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--app-primary); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--app-primary); }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--app-primary-soft);
    border: 0;
    color: var(--app-primary);
    border-radius: 6px;
}

/* Lignes de formset (ventes, factures) */
.formset-row {
    position: relative;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    padding: 14px 14px 0;
    margin-bottom: 12px;
}

.formset-row .formset-remove {
    position: absolute;
    top: 8px;
    right: 8px;
}

.formset-row.is-removed { display: none; }

.order-total {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 0;
    font-size: 15px;
    color: var(--app-text-muted);
}

.order-total strong { font-size: 24px; color: var(--app-heading); }

.form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--app-heading);
    margin: 4px 0 14px;
}

.form-section-title i { font-size: 20px; color: var(--app-primary); }

/* — Modales — */
.modal-content {
    border: 0;
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-lg);
}

.modal-header { border-bottom: 1px solid var(--app-border); padding: 16px 20px; }
.modal-title { font-size: 16px; }
.modal-body { padding: 20px; }

/* — Notifications (messages Django) — */
.toast-stack {
    position: fixed;
    top: calc(var(--app-topbar-height) + 16px);
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 360px;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}

.app-toast {
    --toast-color: var(--app-info);
    --toast-soft: var(--app-info-soft);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 40px 16px 14px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-lg);
    overflow: hidden;
    pointer-events: auto;
    animation: toast-in .4s cubic-bezier(.21, 1.02, .73, 1) both;
}

.app-toast.tone-success { --toast-color: var(--app-success); --toast-soft: var(--app-success-soft); }
.app-toast.tone-danger  { --toast-color: var(--app-danger);  --toast-soft: var(--app-danger-soft); }
.app-toast.tone-warning { --toast-color: var(--app-warning); --toast-soft: var(--app-warning-soft); }
.app-toast.tone-info    { --toast-color: var(--app-info);    --toast-soft: var(--app-info-soft); }

.app-toast-icon {
    flex: 0 0 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--toast-soft);
    color: var(--toast-color);
    font-size: 20px;
}

.app-toast-body { min-width: 0; padding-top: 1px; }
.app-toast-title { margin: 0 0 2px; font-weight: 600; font-size: 14px; color: var(--app-heading); }
.app-toast-text { margin: 0; font-size: 13px; line-height: 1.45; color: var(--app-text-muted); overflow-wrap: anywhere; }

.app-toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.app-toast-close:hover,
.app-toast-close:focus-visible { background: var(--app-secondary-soft); color: var(--app-heading); outline: none; }

/* Barre de temps restant ; mise en pause au survol */
.app-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--toast-color);
    opacity: .8;
    transform-origin: left;
    animation: toast-progress var(--toast-duration, 6000ms) linear forwards;
}

.app-toast:hover .app-toast-progress,
.app-toast:focus-within .app-toast-progress { animation-play-state: paused; }

.app-toast.is-leaving { animation: toast-out .3s ease-in forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(calc(100% + 24px)); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateX(calc(100% + 24px)); }
}

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@media (max-width: 575.98px) {
    .toast-stack { top: calc(var(--app-topbar-height) + 8px); right: 16px; left: 16px; width: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .app-toast, .app-toast.is-leaving { animation-duration: .01s; }
}

/* Alertes classiques dans la page */
.alert { border-radius: var(--app-radius-sm); border: 0; }
.alert-danger  { background: var(--app-danger-soft);  color: var(--app-danger); }
.alert-success { background: var(--app-success-soft); color: var(--app-success); }
.alert-warning { background: var(--app-warning-soft); color: var(--app-warning); }
.alert-info    { background: var(--app-info-soft);    color: var(--app-info); }

/* — État vide — */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--app-text-muted);
}

.empty-state i {
    font-size: 44px;
    color: var(--app-border);
    display: block;
    margin-bottom: 8px;
}

/* — Listes d'opérations (journal, caisse, historique) — */
.entry-list { list-style: none; margin: 0; padding: 0; }

.entry-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--app-border);
    border-left: 3px solid transparent;
}

.entry-list li:first-child { border-top: 0; }
.entry-list li.is-in  { border-left-color: var(--app-success); }
.entry-list li.is-out { border-left-color: var(--app-danger); }
.entry-list .entry-title { font-weight: 600; color: var(--app-heading); }
.entry-list .entry-meta { font-size: 12px; color: var(--app-text-muted); }
.entry-list .entry-amount { font-weight: 700; white-space: nowrap; }

/* — Liste de détails (clé / valeur) — */
.detail-list { margin: 0; }

.detail-list .detail-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--app-border);
}

.detail-list .detail-row:last-child { border-bottom: 0; }
.detail-list dt { font-weight: 500; color: var(--app-text-muted); margin: 0; }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; color: var(--app-heading); }

/* — Graphiques — */
.chart-box { position: relative; height: 300px; }
.chart-box.chart-box-sm { height: 220px; }

/* — Raccourcis du tableau de bord — */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.quick-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    color: var(--app-heading);
    font-weight: 500;
    transition: border-color .15s, box-shadow .15s;
}

.quick-action:hover { border-color: var(--app-primary); box-shadow: var(--app-shadow); color: var(--app-primary); text-decoration: none; }
.quick-action i { font-size: 20px; color: var(--app-primary); }

/* — Bandeau d'accueil — */
.welcome-banner {
    background: linear-gradient(120deg, var(--app-primary) 0%, var(--app-primary-hover) 100%);
    color: #fff;
    border: 0;
}

.welcome-banner h2 { color: #fff; font-size: 20px; margin: 0 0 4px; }
.welcome-banner p { color: rgba(255, 255, 255, .85); margin: 0; }

/* — Vidéos de documentation — */
.video-card .embed-responsive { border-radius: var(--app-radius-sm); }
.video-card h3 { font-size: 14px; margin: 12px 0 4px; }
.video-card p { color: var(--app-text-muted); font-size: 13px; margin: 0; }


/* 5. PAGES SPÉCIFIQUES ======================================================= */

/* — Connexion, mot de passe oublié, pages d'erreur — */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(17, 117, 122, .18), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(253, 102, 3, .12), transparent 45%),
        var(--app-sidebar-bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border: 0;
    box-shadow: var(--app-shadow-lg);
}

.auth-card .card-body { padding: 32px !important; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { max-height: 64px; max-width: 220px; }
.auth-title { text-align: center; font-size: 20px; margin-bottom: 6px; }
.auth-subtitle { text-align: center; color: var(--app-text-muted); margin-bottom: 24px; }
.auth-footer { text-align: center; margin-top: 18px; color: var(--app-text-muted); font-size: 13px; }
.auth-icon { font-size: 56px; text-align: center; margin-bottom: 12px; }
.error-code { font-size: 64px; font-weight: 800; text-align: center; color: var(--app-primary); line-height: 1; }

/* — Profil — */
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--app-primary-soft);
}

.nav-tabs { border-bottom: 1px solid var(--app-border); }
.nav-tabs .nav-link { border: 0; color: var(--app-text-muted); font-weight: 500; padding: .75rem 1rem; }
.nav-tabs .nav-link.active { color: var(--app-primary); background: transparent; border-bottom: 2px solid var(--app-primary); }

/* — Caisses — */
.cash-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.cash-card:hover { border-color: var(--app-primary); transform: translateY(-2px); }
.cash-card.is-selected { border-color: var(--app-primary); box-shadow: 0 0 0 3px var(--app-primary-soft); }
.cash-card img { width: 72px; height: 72px; }

/* — Facture / détail de commande — */
.invoice-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.invoice-totals { max-width: 320px; margin-left: auto; }

/* — QR codes employés — */
.qr-thumb { width: 56px; height: 56px; border-radius: 6px; border: 1px solid var(--app-border); }


/* 6. UTILITAIRES & IMPRESSION =============================================== */
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }
.fw-semibold { font-weight: 600; }
.min-w-0 { min-width: 0; }
.cursor-pointer, [data-href] { cursor: pointer; }

@media print {
    body { background: #fff; }
    .vertical-menu, #page-topbar, .footer, .page-actions, .toast-stack, .d-print-none { display: none !important; }
    .main-content { margin-left: 0; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none; border: 0; }
}

/* — Facturation : avancement du paiement d'un bon de commande — */
.pay-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--app-secondary-soft);
    overflow: hidden;
}

.pay-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--app-success);
}

.next-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--app-radius-sm);
    background: var(--app-primary-soft);
    color: var(--app-heading);
}

.next-step i { font-size: 20px; color: var(--app-primary); }

/* — Journal d'activité : détail des champs modifiés — */
.change-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.change-list li + li { margin-top: 2px; }
.change-list .change-label { color: var(--app-text-muted); }
.change-list del { color: var(--app-danger); }
.activity-table details summary { cursor: pointer; color: var(--app-primary); font-size: 12px; }

/* — Exports Excel — */
.export-card .stat-icon { flex: 0 0 44px; }
.export-shortcuts { flex-wrap: wrap; align-self: flex-end; }

/* — Inventaire : saisie des quantités comptées — */
.inventory-table .count-input { width: 110px; margin-left: auto; text-align: right; }
@media (max-width: 575.98px) {
    .inventory-table .count-input { width: 76px; }
}
@media print {
    .inventory-table .count-input { border: 1px solid #999; background: transparent; }
}

/* — Commandes fournisseurs : quantités reçues — */
.receive-input { width: 96px; margin-left: auto; text-align: right; }

/* — Alertes : cloche de la barre du haut — */
.alerts-bell { position: relative; font-size: 22px; color: var(--app-text-muted); padding: 6px 10px; }
.alerts-bell:hover { color: var(--app-heading); }
.alerts-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--app-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.alerts-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; border-radius: var(--app-radius); }
.alerts-menu-header { padding: 12px 16px; font-weight: 600; color: var(--app-heading); border-bottom: 1px solid var(--app-border); }
.alerts-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--app-border);
    color: var(--app-text);
}
.alerts-item:last-child { border-bottom: 0; }
.alerts-item:hover { background: var(--app-bg); text-decoration: none; color: var(--app-text); }
.alerts-icon { flex: 0 0 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.alerts-title { display: block; font-weight: 600; color: var(--app-heading); font-size: 13px; }
.alerts-detail { display: block; font-size: 12px; color: var(--app-text-muted); white-space: normal; }
.alerts-empty { padding: 20px 16px; color: var(--app-text-muted); text-align: center; }
.alerts-empty i { color: var(--app-success); font-size: 18px; vertical-align: middle; }

/* — Pointage : borne (écran du bureau) et scanner du téléphone — */
.kiosk {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 32px 16px;
    background: var(--app-bg);
    text-align: center;
}
.kiosk-header { display: flex; align-items: center; gap: 16px; }
.kiosk-logo { max-height: 64px; }
.kiosk-title { margin: 0; font-size: 2rem; font-weight: 700; color: var(--app-text); }
.kiosk-clock { margin: 0; font-size: 1.25rem; color: var(--app-secondary); font-variant-numeric: tabular-nums; }
.kiosk-qr {
    width: min(70vmin, 520px);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .08);
}
.kiosk-qr svg { width: 100%; height: 100%; }
.kiosk-help { max-width: 520px; margin: 0; font-size: 1.15rem; color: var(--app-text); }
.kiosk-progress { width: min(70vmin, 520px); height: 6px; background: var(--app-border); border-radius: 3px; overflow: hidden; }
.kiosk-progress span { display: block; height: 100%; width: 100%; background: var(--app-primary); }
.kiosk-error { margin: 0; color: var(--app-danger); }

.pointage-icon { width: 64px; height: 64px; font-size: 32px; }
.scanner { position: relative; overflow: hidden; border-radius: 12px; background: #0f172a; aspect-ratio: 1; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame {
    position: absolute;
    inset: 15%;
    border: 3px solid rgba(255, 255, 255, .85);
    border-radius: 16px;
    box-shadow: 0 0 0 999px rgba(15, 23, 42, .35);
}

/* — Application installée (PWA) — */
.pwa-install[hidden] { display: none !important; }
@media (display-mode: standalone) {
    body { -webkit-user-select: none; user-select: none; }
    input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }
}
