:root {
    --app-primary: #0d6efd;
    --app-secondary: #0a2540;
    --app-button: #0d6efd;
    --app-secondary-contrast: #ffffff;
    --app-primary-contrast: #ffffff;
    --app-button-contrast: #ffffff;
}

body {
    background-color: #f4f6f9;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ---------- Page d'accueil ---------- */
.home-hero {
    min-height: 100vh;
    min-height: 100svh; /* hauteur réelle de la fenêtre sur mobile (évite le décalage lié à la barre d'adresse) */
    display: flex;
    flex-direction: column;
    background-size: cover;
    background-position: center;
    background-color: var(--app-secondary, #0a2540);
    position: relative;
    overflow: hidden;
}

.home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 37, 64, 0.85), rgba(10, 37, 64, 0.92));
}

/* Bande décorative (motif discret) pour que le fond ne semble jamais "vide" */
.home-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.06) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
    z-index: 1;
}

.home-hero-top {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    padding: 1.25rem 1rem 0 1rem;
    min-height: 48px;
}
.home-hero-top .app-logo-small { max-height: 32px; opacity: 0.9; }

.home-hero-content {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--app-secondary-contrast, #ffffff);
    max-width: 560px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.home-hero-icon {
    font-size: 2.75rem;
    margin-bottom: 1rem;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
}

.home-hero-content img.app-logo {
    max-height: 90px;
    margin-bottom: 1.5rem;
}

.home-hero-content h1 {
    font-weight: 700;
    font-size: 2.1rem;
    margin-bottom: 0.5rem;
}

.home-hero-content p.slogan {
    opacity: 0.9;
    margin-bottom: 2rem;
}

.home-hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.btn-app-primary {
    background-color: var(--app-button, #0d6efd);
    border-color: var(--app-button, #0d6efd);
    color: var(--app-button-contrast, #ffffff);
    padding: 0.65rem 2.5rem;
    font-weight: 600;
    border-radius: 6px;
}

.btn-app-primary:hover {
    filter: brightness(1.1);
    color: var(--app-button-contrast, #ffffff);
}

.home-hero-bottom {
    position: relative;
    z-index: 2;
    padding: 0 1.5rem 1.25rem 1.5rem;
}

.home-features {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    padding-bottom: 1rem;
    color: var(--app-secondary-contrast, #ffffff);
}
.home-feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    opacity: 0.85;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.home-feature i { font-size: 1.3rem; }

.home-footer {
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: 1rem;
}

/* ---------- Login ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--app-secondary, #0a2540);
}

.login-card {
    background: #fff;
    border-radius: 10px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}

.login-card img.app-logo {
    max-height: 60px;
    display: block;
    margin: 0 auto 1rem auto;
}

.login-card h2 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: #1f2937; /* Toujours sombre et lisible sur la carte blanche, indépendamment des couleurs de marque */
}

/* ==========================================================================
   MENU LATÉRAL — implémentation maison (sans dépendance à Bootstrap JS)
   Mobile/tablette (< 992px) : tiroir coulissant en position fixe, masqué par
   défaut (transform), ouvert via la classe .is-open, avec fond assombri.
   Grand écran (>= 992px) : menu fixe, toujours visible, jamais de tiroir.
   ========================================================================== */

.mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--app-secondary, #0a2540) !important;
    color: var(--app-secondary-contrast, #ffffff) !important;
    padding: 0.6rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.mobile-topbar .btn-icon {
    color: var(--app-secondary-contrast, #ffffff) !important;
    background: transparent;
    border: none;
    font-size: 1.3rem;
    padding: 0.2rem 0.5rem;
    line-height: 1;
}
.mobile-topbar-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Fond assombri derrière le tiroir mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar-backdrop.is-visible {
    display: block;
    opacity: 1;
}

.app-sidebar {
    background-color: var(--app-secondary, #0a2540) !important;
    color: var(--app-secondary-contrast, #ffffff) !important;
    width: 270px;
    max-width: 82vw;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1045;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.25s ease-in-out;
    display: flex;
    flex-direction: column;
}
.app-sidebar.is-open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(128,128,128,0.25);
}
.sidebar-header .brand-name { color: var(--app-secondary-contrast, #ffffff); font-weight: 600; }

.app-sidebar .brand {
    text-align: center;
    padding: 1.25rem 1rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(128,128,128,0.2);
    margin-bottom: 0.5rem;
}
.app-sidebar .brand img { max-height: 40px; margin-bottom: 0.5rem; }
.app-sidebar .brand-name { font-size: 0.95rem; font-weight: 600; color: var(--app-secondary-contrast, #ffffff); }

.sidebar-nav {
    flex: 1 1 auto;
    padding-top: 0.5rem;
    padding-bottom: 1rem;
}
.sidebar-spacer { flex: 1 1 auto; }

.app-sidebar a.nav-link {
    color: var(--app-secondary-contrast, #ffffff);
    opacity: 0.85;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
}
.app-sidebar a.nav-link:hover,
.app-sidebar a.nav-link.active {
    background-color: rgba(128,128,128,0.15);
    opacity: 1;
    border-left: 3px solid var(--app-primary, #0d6efd);
}

/* Empêche le fond de défiler quand le tiroir mobile est ouvert */
body.sidebar-open-lock { overflow: hidden; }

.app-content {
    padding: 1rem;
    max-width: 100vw;
    overflow-x: hidden;
}

.app-topbar {
    background: #fff;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow-wrap: break-word;
}
.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937; /* Toujours sombre et lisible sur fond blanc, indépendamment des couleurs de marque */
    word-break: break-word;
}
.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* Grand écran : menu fixe et permanent, jamais de tiroir ni de fond assombri */
@media (min-width: 992px) {
    .mobile-topbar { display: none !important; }
    .sidebar-backdrop { display: none !important; }
    .sidebar-header { display: none !important; }

    .app-sidebar {
        width: 250px;
        max-width: 250px;
        transform: none !important;
        transition: none !important;
    }
    .app-content {
        margin-left: 250px;
        padding: 1.5rem 2rem;
    }
    .stat-card .stat-value { font-size: 1.8rem; }
    .app-topbar { padding: 0.9rem 1.5rem; }
    body.sidebar-open-lock { overflow: auto; }
}

/* Ajustements fins pour petits écrans (téléphones) */
@media (max-width: 575.98px) {
    .app-content { padding: 0.75rem; }
    .stat-card { padding: 0.9rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
    .app-topbar h5 { font-size: 1.05rem; }
    .table { font-size: 0.82rem; }
    .btn-group.w-100 .btn { padding: 0.5rem 0.25rem; font-size: 0.85rem; }

    /* Confort tactile "application mobile" : cibles plus grandes, texte plus lisible */
    .form-control, .form-select {
        min-height: 44px;
        font-size: 1rem;
    }
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }

    /* Les modales plein écran (modal-fullscreen-sm-down) n'ont plus besoin de marge */
    .modal-fullscreen-sm-down .modal-content { border-radius: 0; }
    .modal-fullscreen-sm-down .modal-header,
    .modal-fullscreen-sm-down .modal-footer { padding: 1rem; }
    .modal-fullscreen-sm-down .modal-footer .btn { flex: 1 1 auto; }
}

/* Tableaux : jamais de débordement horizontal de la page (le scroll reste dans .table-responsive) */
.table-responsive { -webkit-overflow-scrolling: touch; }
img, canvas { max-width: 100%; }

/* ---------- Bandeau Offline-First (page agent) ---------- */
.offline-status-bar {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    background: #fff; border-radius: 8px; padding: 0.6rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.offline-status-bar #connStatusBadge { font-size: 0.8rem; padding: 0.4rem 0.8rem; }
.offline-status-bar #connStatusBadge.status-online { background: #198754; color: #fff; }
.offline-status-bar #connStatusBadge.status-offline { background: #dc3545; color: #fff; }
.offline-status-bar #connStatusBadge.status-syncing { background: #ffc107; color: #212529; }
.offline-queue-info { font-size: 0.82rem; color: #6c757d; }

/* ---------- État vide (ex: compte non affecté à un poste) ----------
   Remplit intentionnellement l'espace disponible avec un contenu centré et
   soigné, plutôt que de laisser un grand vide gris sous un simple message. */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
    padding: 2rem 1.5rem;
    color: #4b5563;
}
.empty-state .empty-state-icon {
    font-size: 2.5rem;
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff8e6;
    color: #b45309;
    margin-bottom: 1.25rem;
}
.empty-state h6 {
    color: #1f2937;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.empty-state p {
    max-width: 420px;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .home-hero-content { padding: 1.25rem; }
    .home-hero-content h1 { font-size: 1.5rem; }
    .login-card { padding: 1.5rem; }
}

