/**
 * Styles pour Système de Caisse - Amana Transport VIP
 * Design simple et professionnel
 */

/* Reset et variables */
:root {
    --primary-color: #004d4d;
    --primary-light: #006666;
    --primary-dark: #003333;
    --secondary-color: #ff6b35;
    --secondary-light: #ff8c5f;
    --secondary-dark: #e65520;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f5f7fa;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #dfe6e9;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);

    /* ====================================
       DESIGN SYSTEM — Phase 1 (additif uniquement)
       Alias sémantiques + échelles manquantes (spacing, radius, type).
       Ne remplace aucune variable existante ci-dessus : les deux
       cohabitent tant que chaque écran n'a pas été migré phase par
       phase (voir UX_REDESIGN_ROADMAP.md). Valeurs choisies pour NE
       RIEN changer visuellement à ce stade — --color-info reprend
       exactement la couleur déjà utilisée par .badge-info.
       ==================================== */
    --color-primary: var(--primary-color);
    --color-primary-light: var(--primary-light);
    --color-primary-dark: var(--primary-dark);
    --color-secondary: var(--secondary-color);
    --color-bg: var(--light-bg);
    --color-surface: var(--white);
    --color-border: var(--border-color);
    --color-text: var(--text-dark);
    --color-text-muted: var(--text-light);
    --color-success: var(--success-color);
    --color-warning: var(--warning-color);
    --color-danger: var(--danger-color);
    --color-info: #17a2b8;

    /* Spacing — échelle 8px */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 999px;

    /* Ombres — --shadow/--shadow-lg existants deviennent sm/lg, +md */
    --shadow-sm: var(--shadow);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* Typographie — échelle fermée à 6 rôles */
    --text-display: 1.75rem;
    --text-h1: 1.375rem;
    --text-h2: 1.125rem;
    --text-body: 0.95rem;
    --text-small: 0.85rem;
    --text-caption: 0.75rem;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecef 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Background spécial pour la page de login */
body.login-page {
    background: linear-gradient(135deg,
        var(--primary-color) 0%,
        var(--primary-light) 25%,
        var(--secondary-color) 75%,
        var(--secondary-light) 100%);
    position: relative;
    overflow: hidden;
}

body.login-page::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 107, 53, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 77, 77, 0.3) 0%, transparent 50%);
    animation: gradientMove 15s ease infinite;
    z-index: 0;
}

@keyframes gradientMove {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-5%, -5%);
    }
}

/* Navigation */
/* ====================================
   SIDEBAR + TOPBAR (navigation applicative)
   ==================================== */
:root {
    --sidebar-w: 220px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 60px;

    /* Palette propre à la sidebar : dégradé teal plus profond et moins
       saturé que --primary-color, pensé pour laisser l'orange de marque
       comme unique accent (état actif, pills). */
    --sidebar-bg-1: #0a2523;
    --sidebar-bg-2: #123534;
    --sidebar-bg-3: #17403c;
    --sidebar-text-muted: #82a8a3;
    --sidebar-text-muted-dim: #5f8985;
    --sidebar-hover: rgba(255, 255, 255, 0.055);
    --sidebar-active-bg: rgba(255, 107, 53, 0.16);
    --sidebar-active-icon: #ff8c5f;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(165deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-2) 55%, var(--sidebar-bg-3) 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 900;
    box-shadow: var(--shadow-lg);
    transition: width 0.22s cubic-bezier(.4,0,.2,1), transform 0.22s cubic-bezier(.4,0,.2,1);
}

.sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex: none;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--secondary-light), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.sidebar-brand-icon .icon {
    width: 18px;
    height: 18px;
    color: #fff;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    opacity: 1;
    transition: opacity 0.15s;
}

.sidebar-brand-text strong {
    font-size: 0.95rem;
}

.sidebar-brand-text small {
    font-size: 0.72rem;
    color: var(--sidebar-text-muted);
}

.sidebar.collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.7rem 0.6rem;
}

.sidebar-group {
    margin-bottom: 0.65rem;
}

.sidebar-group-label {
    font-size: 0.66rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--sidebar-text-muted-dim);
    padding: 0.7rem 0.6rem 0.35rem;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.sidebar.collapsed .sidebar-group-label {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.56rem 0.65rem;
    border-radius: 9px;
    color: #eaf5f4;
    text-decoration: none;
    font-size: 0.88rem;
    white-space: nowrap;
    position: relative;
    transition: background-color 0.15s;
}

.sidebar-item .icon {
    color: var(--sidebar-text-muted);
    transition: color 0.15s;
}

.sidebar-item .lbl {
    overflow: hidden;
    transition: opacity 0.12s;
}

.sidebar.collapsed .sidebar-item .lbl {
    opacity: 0;
    width: 0;
}

.sidebar-item:hover {
    background-color: var(--sidebar-hover);
}

.sidebar-item.is-active {
    background-color: var(--sidebar-active-bg);
    font-weight: 600;
}

.sidebar-item.is-active .icon {
    color: var(--sidebar-active-icon);
}

/* Repère flottant (plutôt qu'une bordure gauche collée au bord, peu
   visible sur le dégradé sombre) signalant l'item actif. */
.sidebar-item.is-active::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--secondary-color);
}

.sidebar-pill {
    margin-left: auto;
    background: var(--secondary-color);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.08rem 0.42rem;
    border-radius: 999px;
    flex: none;
}

.sidebar.collapsed .sidebar-pill {
    display: none;
}

.sidebar.collapsed .sidebar-item {
    justify-content: center;
}

/* Tooltip JS (assets/js/script.js) plutôt que CSS ::after : .sidebar-nav
   défile verticalement (overflow-y:auto), ce qui aurait tronqué un
   tooltip positionné en absolute à l'intérieur. */
.sidebar-tooltip {
    position: fixed;
    background: var(--primary-dark);
    color: #fff;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
}

.sidebar-tooltip.show {
    opacity: 1;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 0.6rem;
    flex: none;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--sidebar-hover);
    border: none;
    color: #eaf5f4;
    padding: 0.55rem;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-icon {
    transition: transform 0.22s;
}

.sidebar.collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-toggle-label {
    display: none;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 850;
}

.sidebar-backdrop.show {
    display: block;
}

.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.22s cubic-bezier(.4,0,.2,1);
}

.sidebar.collapsed ~ .app-main {
    margin-left: var(--sidebar-w-collapsed);
}

.topbar {
    height: var(--topbar-h);
    flex: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 400;
}

.topbar-burger {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
    padding: 0.4rem;
    border-radius: 6px;
    flex: none;
}

.topbar-burger:hover {
    background: var(--light-bg);
}

.topbar-titles {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.topbar-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-crumb {
    font-size: 0.74rem;
    color: var(--text-light);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex: none;
}

.topbar-bell {
    position: relative;
    color: var(--text-dark);
    display: flex;
}

.topbar-bell .dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger-color);
    border: 2px solid var(--white);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--secondary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex: none;
}

.topbar-user-name {
    font-size: 0.88rem;
    color: var(--text-dark);
    font-weight: 500;
    white-space: nowrap;
}

.btn-logout {
    background-color: var(--danger-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    flex: none;
}

.btn-logout:hover {
    background-color: #c0392b;
}

@media (max-width: 767px) {
    .sidebar {
        width: var(--sidebar-w);
        transform: translateX(-100%);
        z-index: 1000;
    }

    .sidebar.collapsed {
        width: var(--sidebar-w);
    }

    .sidebar.collapsed .sidebar-brand-text,
    .sidebar.collapsed .sidebar-group-label,
    .sidebar.collapsed .sidebar-item .lbl {
        opacity: 1;
        width: auto;
        height: auto;
        padding-top: inherit;
        overflow: visible;
    }

    .sidebar.collapsed .sidebar-pill {
        display: inline-block;
    }

    .sidebar.collapsed .sidebar-item {
        justify-content: flex-start;
    }

    .sidebar.drawer-open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: none;
    }

    .app-main,
    .sidebar.collapsed ~ .app-main {
        margin-left: 0;
    }

    .topbar-burger {
        display: flex;
    }

    .topbar-user-name {
        display: none;
    }
}

/* ====================================
   TABLETTE (768px–1024px)
   Phase 11 de la refonte UX/UI (UX_UI_AUDIT.md §5) : jusqu'ici, cette
   plage n'avait aucune règle propre — la sidebar fixe (220px) + le
   padding cumulé de .main-content et .container pouvaient presser le
   contenu sur une tablette en portrait. Resserre les deux sans changer
   ni le desktop ni le mode mobile (drawer) déjà traité ci-dessus.
   ==================================== */
@media (min-width: 768px) and (max-width: 1024px) {
    :root {
        --sidebar-w: 190px;
    }

    .main-content {
        padding: 1.25rem;
    }

    .container {
        padding: 1.25rem;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* Container */
.container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
}

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

/* Titres */
h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary-color);
    position: relative;
    animation: slideInLeft 0.6s ease-out;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
}

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

h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Alertes */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* Toast (message flash flottant) */
.toast-wrap {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 2000;
    max-width: 380px;
    width: calc(100% - 2.5rem);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    animation: toast-in 0.3s ease-out;
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: #7f8c8d;
}

.alert-success.toast .toast-icon { background: var(--success-color); }
.alert-danger.toast .toast-icon { background: var(--danger-color); }
.alert-warning.toast .toast-icon { background: var(--warning-color); }
.alert-info.toast .toast-icon { background: #17a2b8; }

.toast-message {
    flex: 1;
    padding-top: 1px;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    padding: 0;
}

.toast-close:hover {
    opacity: 1;
}

.toast.toast-hide {
    animation: toast-out 0.4s ease-in forwards;
}

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

@keyframes toast-out {
    to { transform: translateX(20px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .toast { animation: none; }
    .toast.toast-hide { animation: none; opacity: 0; transition: opacity 0.4s ease; }
}

/* ====================================
   MODALE DE CONFIRMATION UNIFIÉE
   Phase 13 de la refonte UX/UI — remplace les confirm()/prompt() natifs
   mélangés (UX_UI_AUDIT.md §2/§8, DESIGN_SYSTEM_PROPOSAL.md). Une seule
   modale légère, sans dépendance, pour toute confirmation ou saisie de
   motif. Voir assets/js/script.js — AmanaUI.confirmModal()/promptModal().
   ==================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modal-backdrop-in 0.15s ease-out;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    animation: modal-in 0.18s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: var(--space-5) var(--space-5) 0;
}

.modal-header .icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.modal-title {
    font-size: var(--text-h2);
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.modal-body {
    padding: var(--space-4) var(--space-5);
    color: var(--color-text);
    line-height: 1.5;
    white-space: pre-line;
}

.modal-body input[type="text"] {
    width: 100%;
    margin-top: var(--space-3);
}

.modal-body .modal-error {
    color: var(--color-danger);
    font-size: var(--text-small);
    margin-top: var(--space-2);
    display: none;
}

.modal-body.has-error .modal-error {
    display: block;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: 0 var(--space-5) var(--space-5);
}

@keyframes modal-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .modal-backdrop, .modal {
        animation: none;
    }
}

@media (max-width: 480px) {
    .toast-wrap {
        left: 1.25rem;
        right: 1.25rem;
        max-width: none;
        width: auto;
    }
}

/* Squelette de chargement (rapports en AJAX) */
.skeleton-block {
    padding: 0.5rem 0 1rem;
}

.skeleton-line,
.skeleton-card {
    background: linear-gradient(90deg, #ecf0f1 25%, #e0e4e7 37%, #ecf0f1 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: 6px;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 0.9rem;
}

.skeleton-line-title {
    width: 35%;
    height: 20px;
}

.skeleton-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.skeleton-card {
    height: 80px;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-line,
    .skeleton-card {
        animation: none;
    }
}

/* Info Box */
.info-box {
    background-color: #e3f2fd;
    border-left: 4px solid var(--secondary-color);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.info-box strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Champ requis laissé invalide : ne s'affiche qu'une fois le champ touché
   (:not(:placeholder-shown)), pas dès le chargement d'un formulaire vierge */
.form-group input:invalid:not(:placeholder-shown),
.form-group textarea:invalid:not(:placeholder-shown),
.form-group select:invalid {
    border-color: var(--danger-color);
}

/* État de focus clavier, cohérent sur tous les contrôles interactifs (avant,
   seuls les champs de formulaire en avaient un). outline-offset négatif pour
   .sidebar-item : sa zone défilante (.sidebar-nav) est en overflow-x:hidden,
   un anneau vers l'extérieur y serait tronqué. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.sidebar-item:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: -2px;
}

/* Boutons */
button,
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: var(--white);
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, var(--secondary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(255, 107, 53, 0.3);
}

.btn-success {
    background-color: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background-color: #229954;
}

.btn-danger {
    background-color: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-secondary {
    background-color: #95a5a6;
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Tableaux */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table thead {
    background-color: var(--primary-color);
    color: var(--white);
}

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Montant financier — lisibilité garantie où qu'il apparaisse (chiffres
   alignés en colonnes même à largeur variable). Dans un tableau, en plus
   aligné à droite comme le reste de la colonne. Phase 1 refonte
   trésorerie : les nouveaux écrans (Recevoir des fonds, Transférer)
   affichent des montants hors tableau (résumés, relevés) et doivent
   avoir la même garantie de lisibilité que dans les listes existantes. */
.montant {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

table .montant {
    text-align: right;
}

/* Encart de formulaire secondaire (ex : "Créer une caisse" au-dessus du
   tableau existant) — remplace le style="background:#f8f9fa;padding:1rem;
   border-radius:5px;" répété identiquement dans plusieurs pages
   (Phase 5 de la refonte, application du design system). */
.form-panel {
    background: var(--color-bg);
    padding: var(--space-4);
    border-radius: var(--radius-sm);
}

/* Emplacement d'action sans objet (ex : "—" à la place d'un bouton
   Désactiver, pour la caisse historique qu'on ne peut pas désactiver). */
.text-disabled {
    color: #bdc3c7;
}

table .entree {
    color: var(--success-color);
}

table .sortie {
    color: var(--danger-color);
}

/* Même distinction entrée/sortie, utilisable hors tableau (résumés de
   confirmation, relevés) — Phase 1 refonte trésorerie. */
.entree {
    color: var(--success-color);
}

.sortie {
    color: var(--danger-color);
}

/* Cards Dashboard */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--secondary-color);
    animation: fadeIn 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card-primary {
    border-left-color: var(--secondary-color);
}

.card-success {
    border-left-color: var(--success-color);
}

.card-danger {
    border-left-color: var(--danger-color);
}

.card-warning {
    border-left-color: var(--warning-color);
}

.card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.card .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.solde-value {
    font-variant-numeric: tabular-nums;
}

/* ====================================
   RELEVÉ D'EXERCICE (pages/stock.php — module Magasin)
   Un exercice de consommation est un document financier (dette, crédit,
   solde), pas une métrique produit : pas de grille de cartes KPI ici.
   Convention empruntée à une facture — montants empilés, déductions
   visibles avec leur signe, total isolé par une double règle. Couleur
   réservée au seul total (--color-warning/--color-success/--color-text,
   mêmes jetons sémantiques que .card-warning/.card-success ailleurs
   dans l'app — pas une palette parallèle).
   ==================================== */
.statement {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 2rem;
}

.statement-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.statement-eyebrow {
    font-size: var(--text-caption);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.statement-ref {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text);
}

.statement-period {
    color: var(--color-text-muted);
    font-size: var(--text-small);
    margin-top: 0.15rem;
}

.ledger {
    border-top: 1px solid var(--color-border);
}

.ledger-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-body);
}

.ledger-row .label {
    color: var(--color-text-muted);
}

.ledger-row .val {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--color-text);
}

.ledger-row .val.deduct {
    color: var(--color-text-muted);
}

.ledger-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 1.1rem;
    margin-top: 0.3rem;
    border-top: 2px solid var(--color-text);
}

.ledger-total .label {
    font-size: var(--text-body);
    font-weight: 700;
    color: var(--color-text);
}

.ledger-total .val {
    font-size: 1.55rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.ledger-total .val.due { color: var(--color-warning); }
.ledger-total .val.good { color: var(--color-success); }
.ledger-total .val.neutral { color: var(--color-text); }

.ledger-note {
    font-size: var(--text-caption);
    color: var(--color-text-muted);
    margin-top: 0.4rem;
}

/* Ligne de relevé qui se déplie sur elle-même (ex : "Dépenses déjà
   prises en charge") — le comportement naturel est de cliquer la ligne
   dont on veut le détail, pas un lien "voir plus" séparé plus bas. */
.ledger-row-expand {
    border-bottom: 1px solid var(--color-border);
}

.ledger-row-expand summary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.65rem 0;
    font-size: var(--text-body);
    cursor: pointer;
    list-style: none;
}

.ledger-row-expand summary::-webkit-details-marker {
    display: none;
}

.ledger-row-expand summary .label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-text-muted);
}

.ledger-row-expand summary:hover .label {
    color: var(--color-text);
}

.ledger-row-expand summary .val {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.ledger-chevron {
    width: 13px;
    height: 13px;
    flex: none;
    transition: transform 0.15s ease;
}

.ledger-row-expand[open] .ledger-chevron {
    transform: rotate(180deg);
}

.ledger-row-expand .ledger-detail {
    padding: 0 0 0.75rem;
}

/* Panneau sobre pour une action ponctuelle sérieuse (confirmer un
   règlement) — délibérément sans bordure colorée ni halo décoratif
   (.card), pour ne pas donner un ton "célébration" à un transfert
   d'argent. */
.settle-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.75rem;
}

.settle-panel h3,
.settle-panel h4 {
    margin-top: 0;
}

/* Login Page */
.login-container {
    max-width: 450px;
    margin: 5rem auto;
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: loginFadeIn 0.8s ease-out;
    position: relative;
    overflow: hidden;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-container::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.05) 0%, transparent 70%);
    border-radius: 50%;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
    font-weight: 700;
}

.login-header p {
    color: var(--secondary-color);
    font-size: 1rem;
    font-weight: 500;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-light);
}

.login-footer .developer-credit {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.login-footer .developer-credit strong {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Chart Container */
.chart-container {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.6s ease-out;
}

.chart-container h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.chart-container canvas {
    max-height: 300px;
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.footer-content p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
}

/* Formulaire de recherche */
.search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: flex-end;
}

.search-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* ====================================
   PANNEAU DE RECHERCHE AVANCÉE + LISTES
   (dépenses, approvisionnements — auparavant dupliqué dans un <style>
   local à chacune des deux pages, avec dérive entre les deux copies)
   ==================================== */
.search-panel {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.search-panel-header {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary-color);
    user-select: none;
    gap: 0.4rem;
}

.search-panel-header:hover {
    background: rgba(0, 77, 77, 0.04);
}

.search-toggle-icon {
    margin-left: auto;
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.search-toggle-icon.open {
    transform: rotate(180deg);
}

.search-form-body {
    padding: 0.25rem 1.1rem 1.1rem;
    border-top: 1px solid var(--border-color);
}

.search-form-body.collapsed {
    display: none;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    margin-top: 0.75rem;
}

.search-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-field input,
.search-field select {
    width: 100%;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9rem;
    background: white;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 77, 77, 0.12);
}

.search-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 77, 77, 0.07);
    border: 1px solid rgba(0, 77, 77, 0.2);
    color: var(--primary-color);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
    white-space: nowrap;
}

.resume-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-print {
    background: #5d6d7e;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
}

.btn-print:hover {
    background: #4a5568;
}

.cell-description {
    font-size: 0.92rem;
    color: #344;
    line-height: 1.5;
    max-width: 300px;
    word-break: break-word;
}

.badge-cat {
    display: inline-block;
    background: rgba(0, 77, 77, 0.08);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-cat-green {
    background: rgba(39, 174, 96, 0.1);
    color: #1a7a42;
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
    border-radius: 5px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-disabled {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}

.print-header {
    display: none;
}

.print-only {
    display: none;
}

/* Totaux */
.totaux-box {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
}

.totaux-box p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.totaux-box strong {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .search-form {
        flex-direction: column;
    }

    table {
        font-size: 0.9rem;
    }

    table th,
    table td {
        padding: 0.5rem;
    }
}

/* Loader / Spinner */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 77, 77, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    color: var(--white);
    margin-top: 1rem;
    font-size: 1.1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Animations pour les tableaux */
table tbody tr {
    animation: tableRowFadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

table tbody tr:nth-child(1) { animation-delay: 0.05s; }
table tbody tr:nth-child(2) { animation-delay: 0.1s; }
table tbody tr:nth-child(3) { animation-delay: 0.15s; }
table tbody tr:nth-child(4) { animation-delay: 0.2s; }
table tbody tr:nth-child(5) { animation-delay: 0.25s; }

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

/* Ligne mise en avant juste après sa création */
.row-highlight {
    animation: tableRowFadeIn 0.5s ease-out, row-flash 2s ease-out 0.4s;
    animation-fill-mode: both;
}

@keyframes row-flash {
    0% { background-color: rgba(39, 174, 96, 0.28); }
    100% { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .row-highlight {
        animation: none;
        background-color: rgba(39, 174, 96, 0.28);
    }
}

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

/* Ripple au clic pour les boutons (assets/js/script.js), positionné sous le
   curseur — seul effet de vague conservé, l'ancien ::before qui gonflait
   au survol depuis le centre du bouton faisait doublon. */
.btn-ripple-host {
    position: relative;
    overflow: hidden;
}

.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    width: 20px;
    height: 20px;
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(20);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-ripple {
        display: none;
    }
}

/* ====================================
   CHAMP DE FORMULAIRE RÉVÉLÉ CONDITIONNELLEMENT
   (ex : source/destination sur mouvements.php, apparaissent selon le
   type de mouvement choisi). Remplace un display:none/block abrupt par
   une ouverture progressive — Phase 4 de la refonte UX/UI, voir
   UX_UI_AUDIT.md §2 ("formulaires à champs conditionnels sans transition").
   ==================================== */
.field-reveal {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.25s ease, opacity 0.2s ease;
}

.field-reveal.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
}

.field-reveal > div {
    overflow: hidden;
    min-height: 0;
}

.field-reveal .form-group {
    padding-top: var(--space-1);
}

@media (prefers-reduced-motion: reduce) {
    .field-reveal {
        transition: none;
    }
}

/* Suffixe FCFA sur les champs montant (assets/js/script.js) */
.montant-input-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}

.montant-input {
    padding-right: 60px;
}

.montant-input-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 0.9em;
    font-weight: 500;
    pointer-events: none;
    display: none;
}

.montant-input-suffix.show {
    display: block;
}

/* ====================================
   MISSION FORM EXPERIENCE — Zone de dépôt de fichier habillée
   Remplace l'<input type="file"> nu ("Choose File / No file chosen").
   L'input reste dans le DOM et pleinement fonctionnel (clavier, lecteur
   d'écran) — seul son rendu natif est masqué au profit du <label> qui
   l'accompagne (voir assets/js/script.js, enhanceFileInputs()).
   ==================================== */
.file-drop-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-drop-zone {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop-zone[hidden],
.file-drop-selected[hidden] {
    display: none;
}

.file-drop-zone:hover {
    border-color: var(--color-primary-light);
}

.file-drop-zone.is-dragover {
    border-color: var(--color-primary);
    background: rgba(0, 77, 77, 0.05);
}

.file-drop-input:focus-visible + .file-drop-zone {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.file-drop-zone .icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: var(--color-text-muted);
}

.file-drop-text strong {
    display: block;
    font-size: var(--text-body);
    color: var(--color-text);
}

.file-drop-text small {
    color: var(--color-text-muted);
    font-size: var(--text-small);
}

.file-drop-selected {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.file-drop-selected .icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--color-success);
}

.file-drop-selected-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-drop-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    line-height: 1;
    padding: var(--space-1);
}

.file-drop-remove:hover {
    color: var(--color-danger);
}

/* ====================================
   MISSION FORM EXPERIENCE — Blocs de formulaire (Essentiel / Détails /
   Justificatif). Sépare visuellement un formulaire en sections d'intention
   plutôt qu'une liste plate de champs à poids égal (FORM_UX_UI_AUDIT.md §7).
   ==================================== */
.form-section + .form-section {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

.form-section-label {
    display: block;
    text-transform: uppercase;
    font-size: var(--text-caption);
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.form-essential .form-group > label {
    font-size: var(--text-h2);
    font-weight: 700;
    color: var(--color-text);
}

.form-essential .form-group input,
.form-essential .form-group select {
    font-size: 1.05rem;
    padding: 0.85rem 1rem;
}

/* Onglets génériques (assets/js/script.js) — une seule section visible à la
   fois pour désencombrer un écran qui empile plusieurs blocs volumineux
   (ex : pages/stock.php). Réutilisable ailleurs : voir la structure
   .tabs > .tabs-nav > .tab-btn + .tabs > .tab-panel[data-tab-panel]. */
.tabs-nav {
    display: flex;
    gap: var(--space-2);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
    overflow-x: auto;
}

.tab-btn {
    flex-shrink: 0;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font: inherit;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Vue "fiche" en maître-détail — une liste à gauche, la fiche de
   l'élément sélectionné à droite. Réutilisée par pages/stock.php
   (pièces) et pages/caisses.php (caisses). */
.master-detail-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--space-5);
    align-items: start;
}

.master-detail-search {
    margin-bottom: var(--space-3);
}

.master-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    margin-bottom: 2px;
    border-left: 3px solid transparent;
}

.master-detail-item:hover {
    background: var(--color-bg);
}

.master-detail-item.selected {
    background: rgba(0, 77, 77, 0.08);
    border-left-color: var(--color-primary);
}

.master-detail-item-name {
    font-size: var(--text-small);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.master-detail-item-badge {
    flex-shrink: 0;
    font-size: var(--text-caption);
    color: var(--color-text-muted);
}

/* Petite étiquette ronde (ex : "Historique", "Inactive" à côté d'un nom,
   ou la source d'une ligne d'activité — "Dépenses", "Mouvement"...). */
.tag-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
}

.tag-pill.tag-info { background: rgba(23, 162, 184, 0.14); color: var(--color-info); }
.tag-pill.tag-muted { background: var(--color-bg); color: var(--color-text-muted); }
.tag-pill.tag-success { background: rgba(39, 174, 96, 0.14); color: var(--color-success); }
.tag-pill.tag-warning { background: rgba(243, 156, 18, 0.16); color: var(--color-warning); }
.tag-pill.tag-danger { background: rgba(231, 76, 60, 0.14); color: var(--color-danger); }

/* Petite statistique inline (ex : "Solde actuel" dans l'en-tête de fiche
   caisses.php/stock.php) — libellé discret au-dessus d'une valeur bien
   posée, cohérent avec .card .value sans reprendre son style de tuile. */
.kpi-item .kpi-label {
    font-size: var(--text-caption);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 700;
}

.kpi-item .kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-text);
    margin-top: 2px;
}

/* Bouton "creux" (fond clair, bordure) — pour une action secondaire qui
   ne doit pas avoir le poids visuel d'un .btn-danger plein (ex :
   Désactiver une caisse, à côté d'une action principale). */
.btn-outline {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-outline:hover {
    background: var(--color-bg);
}

.fiche-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

/* Petit intitulé de section discret, au-dessus d'un bloc de fiche (ex :
   "Activité récente", "Historique de cette pièce") — partagé entre
   caisses.php et stock.php pour rester identique si retouché un jour. */
.fiche-section-title {
    margin-top: 0;
    color: var(--color-text-muted);
    font-size: var(--text-caption);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Chronologie d'activité générique — pièce (stock.php) ou caisse
   (caisses.php) partagent le même composant : un point coloré par sens
   (in/out), neutre (ajustement) ou par statut (pending/rejected). */
.activity-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-small);
}

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

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-dot.out { background: var(--color-danger); }
.activity-dot.in { background: var(--color-success); }
.activity-dot.neutral { background: var(--color-info); }
.activity-dot.pending { background: var(--color-warning); }
.activity-dot.rejected { background: var(--color-text-muted); }

.activity-qty.out { color: var(--color-danger); font-weight: 700; }
.activity-qty.in { color: var(--color-success); font-weight: 700; }
.activity-qty.neutral { color: var(--color-info); font-weight: 700; }
.activity-qty.pending { color: var(--color-warning); font-weight: 700; }
.activity-qty.rejected { color: var(--color-text-muted); font-weight: 700; text-decoration: line-through; }

.activity-meta {
    color: var(--color-text-muted);
    font-size: var(--text-caption);
    margin-top: 2px;
}

.activity-badge {
    font-size: var(--text-caption);
    font-weight: 700;
    text-transform: uppercase;
    margin-left: var(--space-2);
}

.activity-badge.pending { color: var(--color-warning); }
.activity-badge.rejected { color: var(--color-text-muted); }

@media (max-width: 820px) {
    .master-detail-layout {
        grid-template-columns: 1fr;
    }
    .fiche-columns {
        grid-template-columns: 1fr;
    }
}

/* Cartes de statistiques — jeton d'icône coloré et couleur de valeur par
   sens (dashboard.php, et toute page réutilisant .card-primary/-success/
   -danger/-warning/-info, ex : "Situation" de stock.php/caisses.php).
   Corrige au passage .card-info, qui n'avait jusqu'ici aucune couleur
   propre et retombait silencieusement sur celle de .card-primary. */
.card-info {
    border-left-color: var(--color-info);
}

.card-success .value { color: var(--success-color); }
.card-danger .value { color: var(--danger-color); }
.card-warning .value { color: var(--warning-color); }
.card-info .value { color: var(--color-info); }

.card-icon-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.05rem;
    flex-shrink: 0;
    margin-right: var(--space-2);
}

.card-icon-chip.chip-primary { background: rgba(0, 77, 77, 0.1); color: var(--primary-color); }
.card-icon-chip.chip-success { background: rgba(39, 174, 96, 0.14); color: var(--success-color); }
.card-icon-chip.chip-danger { background: rgba(231, 76, 60, 0.14); color: var(--danger-color); }
.card-icon-chip.chip-warning { background: rgba(243, 156, 18, 0.16); color: var(--warning-color); }
.card-icon-chip.chip-info { background: rgba(23, 162, 184, 0.14); color: var(--color-info); }

/* Uniquement pour un <h3> qui contient un .card-icon-chip — ne touche pas
   les innombrables autres <h3> de cartes (icône inline + texte en flux
   normal, inchangés ailleurs dans l'appli). */
.card h3:has(.card-icon-chip) {
    display: flex;
    align-items: center;
}

/* Bannière "Solde actuel" — sort du lot au lieu d'être une carte parmi
   d'autres, puisque c'est le chiffre le plus regardé du tableau de bord. */
.hero-stat {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 65%, var(--primary-light) 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-6);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
    box-shadow: var(--shadow-md);
}

.hero-stat .hero-label {
    font-size: var(--text-caption);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.85;
    font-weight: 700;
}

.hero-stat .hero-value {
    font-size: 2.1rem;
    font-weight: 800;
    margin-top: 0.25rem;
    letter-spacing: -0.01em;
}

.hero-stat .card-icon-chip {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    margin-right: 0;
}

/* Impression */
@media print {
    /* Masquer les éléments non nécessaires */
    .sidebar,
    .sidebar-backdrop,
    .topbar,
    .btn,
    .footer,
    .loader-overlay,
    .search-form,
    .info-box,
    .no-print {
        display: none !important;
    }

    /* À l'impression, un écran à onglets doit tout montrer plutôt que de
       perdre silencieusement le contenu des onglets non actifs. */
    .tabs-nav {
        display: none !important;
    }
    .tab-panel {
        display: block !important;
    }

    /* Reset page styles */
    body {
        background: white !important;
        margin: 0;
        padding: 0;
    }

    body.login-page::before {
        display: none;
    }

    .app-main,
    .sidebar.collapsed ~ .app-main {
        margin-left: 0 !important;
    }

    .main-content {
        margin: 0;
        padding: 1cm;
        max-width: 100%;
    }

    .container {
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        page-break-inside: avoid;
    }

    /* En-tête du rapport */
    .container h2 {
        text-align: center;
        color: var(--primary-color);
        font-size: 24pt;
        margin-bottom: 1cm;
        padding-bottom: 0.5cm;
        border-bottom: 3px solid var(--secondary-color);
        page-break-after: avoid;
    }

    .container h3 {
        font-size: 14pt;
        margin-top: 0.5cm;
        margin-bottom: 0.3cm;
        color: var(--primary-color);
        page-break-after: avoid;
    }

    /* Informations d'en-tête */
    .print-header {
        display: block !important;
        text-align: center;
        margin-bottom: 1cm;
        padding-bottom: 0.5cm;
        border-bottom: 2px solid #ddd;
    }

    .print-header h1 {
        font-size: 20pt;
        color: var(--primary-color);
        margin-bottom: 0.2cm;
    }

    .print-header p {
        font-size: 12pt;
        color: var(--text-light);
        margin: 0;
    }

    /* Cards dashboard en mode impression */
    .dashboard-cards {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5cm;
        margin-bottom: 1cm;
        page-break-inside: avoid;
    }

    .card {
        border: 2px solid #ddd !important;
        padding: 0.5cm !important;
        border-radius: 4px;
        box-shadow: none !important;
        page-break-inside: avoid;
        background: white !important;
    }

    .card h3 {
        font-size: 10pt !important;
        margin-bottom: 0.3cm;
        color: var(--text-dark) !important;
    }

    .card .value {
        font-size: 16pt !important;
        color: var(--primary-color) !important;
    }

    /* Tableaux */
    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 0.5cm;
        margin-bottom: 1cm;
        font-size: 10pt;
        page-break-inside: auto;
    }

    table thead {
        background-color: var(--primary-color) !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table th {
        padding: 0.3cm;
        border: 1px solid #333;
        font-weight: bold;
        text-align: left;
    }

    table td {
        padding: 0.3cm;
        border: 1px solid #ddd;
    }

    table tbody tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    table tbody tr:nth-child(even) {
        background-color: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table .montant {
        text-align: right;
        font-weight: bold;
    }

    table .entree {
        color: #27ae60 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table .sortie {
        color: #e74c3c !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .montant.entree {
        color: #1a7a42 !important;
        font-weight: bold;
    }

    .montant.sortie {
        color: #c0392b !important;
        font-weight: bold;
    }

    /* En-tête imprimé des listes (dépenses, approvisionnements) */
    .print-only {
        display: table-row-group !important;
    }

    .print-title-block {
        text-align: center;
        border-bottom: 2px solid #333;
        padding-bottom: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .print-title-block h2 {
        margin: 0;
        font-size: 16pt;
    }

    .print-title-block h3 {
        margin: 0.2rem 0;
        font-size: 12pt;
    }

    .print-title-block p {
        margin: 0.2rem 0;
        font-size: 8pt;
        color: #555;
    }

    .print-filters {
        font-size: 8.5pt;
        background: #f5f5f5;
        padding: 3px 8px;
        margin-bottom: 0.5rem;
        border-radius: 4px;
    }

    .print-summary {
        font-size: 10pt;
        margin-bottom: 0.75rem;
    }

    .resume-bar {
        border: 1px solid #ccc;
        padding: 4px 8px;
        margin-bottom: 0.5rem;
        font-size: 9pt;
        display: flex !important;
    }

    .badge-cat {
        background: none !important;
        border: 1px solid #555;
        padding: 1px 4px;
        border-radius: 3px;
        font-size: 8pt;
    }

    .badge-cat-green {
        color: #1a7a42 !important;
    }

    /* Totaux */
    .totaux-box {
        background-color: #f5f7fa !important;
        border: 2px solid var(--primary-color);
        padding: 0.5cm;
        margin-top: 0.5cm;
        border-radius: 4px;
        page-break-inside: avoid;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .totaux-box p {
        margin: 0.2cm 0;
        font-size: 11pt;
    }

    .totaux-box strong {
        color: var(--primary-color) !important;
    }

    /* Pied de page d'impression */
    @page {
        margin: 1.5cm 1cm;
        size: A4;

        @bottom-right {
            content: "Page " counter(page) " sur " counter(pages);
            font-size: 9pt;
            color: #7f8c8d;
        }

        @bottom-left {
            content: "Généré le " date;
            font-size: 9pt;
            color: #7f8c8d;
        }

        @bottom-center {
            content: "Amana Transport VIP - Système de Caisse";
            font-size: 9pt;
            color: var(--primary-color);
            font-weight: bold;
        }
    }

    /* Footer personnalisé pour l'impression */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 9pt;
        color: #7f8c8d;
        padding: 0.3cm;
        border-top: 1px solid #ddd;
        background: white;
    }

    .print-footer p {
        margin: 0.1cm 0;
    }

    /* Éviter les sauts de page */
    h2, h3 {
        page-break-after: avoid;
    }

    /* Forcer les sauts de page si nécessaire */
    .page-break {
        page-break-after: always;
    }
}

/* Jeu d'icônes maison (assets/icons/icons.svg), à la place des émoji */
.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.15em;
    flex-shrink: 0;
    color: currentColor;
}

.icon-lg {
    width: 1.3em;
    height: 1.3em;
    vertical-align: -0.2em;
}

h2 .icon,
h3 .icon {
    vertical-align: -0.1em;
}

.btn .icon,
.btn-sm .icon {
    margin-right: 0.15em;
}

/* ====================================
   BADGES DE STATUT
   ==================================== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    border-radius: 10px;
    margin-left: 5px;
}

.badge-danger {
    background-color: #dc3545;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
}

.badge-success {
    background-color: #28a745;
}

/* ====================================
   IMPORT EXCEL
   ==================================== */
table .badge {
    border-radius: 4px;
    min-width: 60px;
}

.progress-bar {
    width: 100%;
    height: 22px;
    background-color: #ecf0f1;
    border-radius: 11px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, #004d4d 0%, #006666 100%);
    transition: width 0.3s ease;
}

/* ====================================
   NOTIFICATIONS
   (auparavant dans un <style> local à pages/notifications.php ; l'accent
   "non lu" utilisait un bleu #007bff hors charte, remplacé par le teal
   de la marque, et la carte se soulevait au survol sans être cliquable)
   ==================================== */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.notification-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.notification-card.unread {
    background: #e7f0ef;
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.notification-card.read {
    border-left-color: var(--text-light);
    opacity: 0.8;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.notification-type {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.notification-date {
    font-size: 12px;
    color: var(--text-light);
}

.notification-body {
    margin-bottom: 10px;
}

.notification-body p {
    margin: 0 0 10px 0;
    color: var(--text-dark);
    line-height: 1.5;
}

.notification-footer {
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.notification-footer small {
    color: var(--text-light);
    font-style: italic;
}

/* ====================================
   HISTORIQUE DES MODIFICATIONS (timeline)
   (auparavant dans un <style> local à pages/historique_operation.php)
   ==================================== */
.timeline {
    position: relative;
    padding-left: 40px;
    margin: 1.5rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #dee2e6;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
    background: white;
    border-radius: 10px;
    padding: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--warning-color);
}

.timeline-item.timeline-danger {
    border-left-color: var(--danger-color);
}

.timeline-marker {
    position: absolute;
    left: -34px;
    top: 1.2rem;
    width: 30px;
    height: 30px;
    background: white;
    border: 3px solid #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 1;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.timeline-type {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

.timeline-author {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.changes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.changes-table th {
    background: var(--light-bg);
    padding: 8px 10px;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-dark);
    border-bottom: 2px solid #dee2e6;
}

.changes-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.old-value {
    color: var(--danger-color);
    text-decoration: line-through;
    background: #fff5f5;
}

.new-value {
    color: var(--success-color);
    font-weight: 600;
    background: #f0fff4;
}

@media (max-width: 768px) {
    .timeline {
        padding-left: 25px;
    }

    .timeline-marker {
        left: -22px;
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .changes-table {
        font-size: 0.8rem;
    }
}
