:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1b2437;
    --sidebar-link: #aab4cc;
    --sidebar-link-active: #ffffff;
    --content-bg: #f4f6fb;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--content-bg);
    font-size: 0.925rem;
}

/* ---------- Structure ---------- */

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

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, #1b2437 0%, #232f4b 100%);
    padding: 1rem 0.75rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.25rem 0.75rem 1rem;
}

.sidebar-brand i {
    color: #4d8bfd;
}

.sidebar-section {
    color: #6c7a99;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    padding: 0.75rem 0.75rem 0.25rem;
}

.sidebar .nav-link {
    color: var(--sidebar-link);
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: none;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-link-active);
    background-color: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-link.active {
    color: var(--sidebar-link-active);
    background-color: #0d6efd;
}

.main-area {
    min-width: 0;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e4e8f0;
    padding: 0.9rem 1.5rem;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
}

.content {
    padding: 1.5rem;
}

.section-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

/* ---------- Cartes KPI ---------- */

.card {
    border: none;
    box-shadow: 0 1px 3px rgba(27, 36, 55, 0.08);
    border-radius: 0.75rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef1f6;
    font-weight: 600;
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

.kpi-card {
    height: 100%;
}

.kpi-card .card-body {
    position: relative;
    padding: 1.1rem 1.25rem;
}

.kpi-label {
    color: #7a8499;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.3;
}

.kpi-value small {
    font-size: 0.85rem;
    color: #7a8499;
    font-weight: 500;
}

.kpi-sub {
    color: #7a8499;
    font-size: 0.8rem;
}

.kpi-icon {
    position: absolute;
    top: 1rem;
    right: 1.1rem;
    font-size: 1.6rem;
    opacity: 0.55;
}

.kpi-clickable {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.kpi-clickable:hover {
    box-shadow: 0 4px 12px rgba(27, 36, 55, 0.18);
    transform: translateY(-2px);
}

/* Le sous-tableau des lignes d'article ne doit pas hériter du survol de la ligne parente */
table.dataTable tbody tr.table-active + tr td {
    background-color: #fff;
}

/* ---------- Badges de statut ----------
   Le Bootstrap embarqué (5.1) ne fournit pas les classes text-bg-* (apparues en 5.2) :
   on les définit ici avec un contraste lisible (texte sombre sur fonds clairs). */

.text-bg-primary   { background-color: #0d6efd !important; color: #fff !important; }
.text-bg-secondary { background-color: #6c757d !important; color: #fff !important; }
.text-bg-success   { background-color: #198754 !important; color: #fff !important; }
.text-bg-danger    { background-color: #dc3545 !important; color: #fff !important; }
.text-bg-dark      { background-color: #212529 !important; color: #fff !important; }
.text-bg-warning   { background-color: #ffc107 !important; color: #212529 !important; }
.text-bg-info      { background-color: #0dcaf0 !important; color: #212529 !important; }
.text-bg-light     { background-color: #f8f9fa !important; color: #212529 !important; }

/* ---------- Tableaux ---------- */

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7a8499;
    border-bottom-width: 1px;
}

/* Ligne de filtres dans l'entête des colonnes */
.table thead tr.table-filters th {
    background-color: #f8f9fc;
    padding: 0.4rem 0.5rem;
    text-transform: none;
    letter-spacing: normal;
}

/* ---------- Page de connexion ---------- */

.auth-body {
    background: linear-gradient(135deg, #1b2437 0%, #2c3e63 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    border-radius: 1rem;
}

.auth-logo {
    font-size: 2.5rem;
    color: #0d6efd;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .sidebar {
        width: 64px;
        min-width: 64px;
        padding: 1rem 0.4rem;
    }

    .sidebar-brand span,
    .sidebar-section,
    .sidebar .nav-link {
        font-size: 0;
    }

    .sidebar .nav-link i {
        font-size: 1.2rem;
    }
}
