/* =========================================================================
   Gestion des Marchés Publics — Système de Design UI/UX
   Thème Émeraude & Ambre moderne, professionnel et élégant
   ========================================================================= */

/* ---------- 1. Variables Globales & Tokens ---------- */
:root {
    /* Palette Principale (Vert Émeraude / Teal Foncé) */
    --gm-primary: #0d5c46;
    --gm-primary-hover: #094635;
    --gm-primary-active: #063327;
    --gm-primary-light: #e6f4f0;
    --gm-primary-rgb: 13, 92, 70;

    /* Palette d'Accent (Ambre / Doré) */
    --gm-accent: #d97706;
    --gm-accent-hover: #b45309;
    --gm-accent-light: #fef3c7;
    --gm-accent-rgb: 217, 119, 6;

    /* Alerte & Statuts Destructifs (Corail / Rouge discret) */
    --gm-danger: #e11d48;
    --gm-danger-hover: #be123c;
    --gm-danger-light: #ffe4e6;
    --gm-danger-rgb: 225, 29, 72;

    /* Statuts Positifs (Menthe / Émeraude vif) */
    --gm-success: #10b981;
    --gm-success-hover: #059669;
    --gm-success-light: #d1fae5;
    --gm-success-rgb: 16, 185, 129;

    /* Statuts d'Avertissement & Info */
    --gm-warning: #f59e0b;
    --gm-warning-light: #fef3c7;
    --gm-warning-rgb: 245, 158, 11;

    --gm-info: #0284c7;
    --gm-info-light: #e0f2fe;
    --gm-info-rgb: 2, 132, 199;

    /* Neutres & Fond */
    --gm-bg: #f8fafc;
    --gm-card-bg: #ffffff;
    --gm-text: #1e293b;
    --gm-text-muted: #64748b;
    --gm-border: #e2e8f0;
    --gm-border-light: #f1f5f9;

    /* Sidebar */
    --gm-sidebar-w: 256px;
    --gm-sidebar-bg: linear-gradient(180deg, #061914 0%, #0d2922 45%, #081d17 100%);
    --gm-sidebar-fg: #94a3b8;
    --gm-sidebar-active-bg: rgba(16, 185, 129, 0.14);
    --gm-sidebar-active-fg: #34d399;

    /* Rayons & Ombres */
    --gm-radius-sm: 6px;
    --gm-radius-md: 10px;
    --gm-radius-lg: 14px;
    --gm-radius-xl: 18px;
    --gm-radius-pill: 50rem;

    --gm-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --gm-shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --gm-shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);

    --gm-transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);

    /* Surcharges directes Bootstrap 5.3 root */
    --bs-primary: #0d5c46;
    --bs-primary-rgb: 13, 92, 70;
    --bs-link-color: #0d5c46;
    --bs-link-hover-color: #094635;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bs-body-bg: #f8fafc;
    --bs-body-color: #1e293b;
    --bs-border-color: #e2e8f0;
    --bs-border-radius: 10px;
}

/* ---------- 2. Normalisation & Typographie ---------- */
body {
    font-family: var(--bs-body-font-family);
    background-color: var(--gm-bg) !important;
    color: var(--gm-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.55;
}

a {
    color: var(--gm-primary);
    transition: var(--gm-transition);
}

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

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.015em;
}

h1, .h1 { font-size: 1.5rem; }
h2, .h2 { font-size: 1.25rem; }
h3, .h3 { font-size: 1.1rem; }

/* ---------- 3. Surcharges Composants Bootstrap ---------- */

/* --- Boutons --- */
.btn {
    font-weight: 500;
    border-radius: var(--gm-radius-md);
    padding: 0.48rem 1rem;
    font-size: 0.88rem;
    transition: var(--gm-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.btn-primary {
    --bs-btn-color: #ffffff;
    --bs-btn-bg: var(--gm-primary);
    --bs-btn-border-color: var(--gm-primary);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: var(--gm-primary-hover);
    --bs-btn-hover-border-color: var(--gm-primary-hover);
    --bs-btn-focus-shadow-rgb: var(--gm-primary-rgb);
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: var(--gm-primary-active);
    --bs-btn-active-border-color: var(--gm-primary-active);
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-hover) 100%) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(13, 92, 70, 0.25);
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: linear-gradient(135deg, var(--gm-primary-hover) 0%, #063327 100%) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 92, 70, 0.35);
}

.btn-outline-primary {
    --bs-btn-color: var(--gm-primary);
    --bs-btn-border-color: var(--gm-primary);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: var(--gm-primary);
    --bs-btn-hover-border-color: var(--gm-primary);
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: var(--gm-primary);
    --bs-btn-active-border-color: var(--gm-primary);
    color: var(--gm-primary) !important;
    border-color: var(--gm-primary) !important;
}

.btn-outline-primary:hover, .btn-outline-primary:active {
    background-color: var(--gm-primary) !important;
    border-color: var(--gm-primary) !important;
    color: #ffffff !important;
}

.btn-outline-secondary {
    border-color: var(--gm-border) !important;
    color: var(--gm-text-muted) !important;
}

.btn-outline-secondary:hover {
    background-color: #f1f5f9 !important;
    color: var(--gm-text) !important;
}

.btn-outline-success {
    color: #047857 !important;
    border-color: #10b981 !important;
}

.btn-outline-success:hover {
    background-color: #10b981 !important;
    color: #ffffff !important;
}

.btn-light {
    background-color: #ffffff !important;
    border-color: var(--gm-border) !important;
    color: var(--gm-text) !important;
    box-shadow: var(--gm-shadow-sm);
}

.btn-light:hover {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

/* --- Focus visible sur formulaires & boutons --- */
.btn:focus-visible, .form-control:focus, .form-select:focus {
    border-color: var(--gm-primary) !important;
    box-shadow: 0 0 0 3px rgba(13, 92, 70, 0.2) !important;
}

.form-control, .form-select {
    border-radius: var(--gm-radius-md);
    border: 1px solid var(--gm-border);
    padding: 0.52rem 0.85rem;
    font-size: 0.9rem;
    color: var(--gm-text);
    background-color: #ffffff;
    transition: var(--gm-transition);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #334155;
    margin-bottom: 0.35rem;
}

.form-check-input:checked {
    background-color: var(--gm-primary) !important;
    border-color: var(--gm-primary) !important;
}

/* --- Badges Sémantiques & Modernes (Pastels) --- */
.badge {
    font-weight: 600;
    padding: 0.38em 0.72em;
    font-size: 0.76rem;
    border-radius: var(--gm-radius-sm);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.text-bg-primary, .bg-primary {
    background-color: var(--gm-primary-light) !important;
    color: var(--gm-primary) !important;
    border: 1px solid rgba(13, 92, 70, 0.22);
}

.text-bg-success, .bg-success {
    background-color: var(--gm-success-light) !important;
    color: #065f46 !important;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.text-bg-danger, .bg-danger {
    background-color: var(--gm-danger-light) !important;
    color: #9f1239 !important;
    border: 1px solid rgba(225, 29, 72, 0.25);
}

.text-bg-warning, .bg-warning {
    background-color: var(--gm-warning-light) !important;
    color: #92400e !important;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.text-bg-info, .bg-info {
    background-color: var(--gm-info-light) !important;
    color: #075985 !important;
    border: 1px solid rgba(2, 132, 199, 0.25);
}

.text-bg-secondary, .bg-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid rgba(100, 116, 139, 0.25);
}

.text-bg-dark, .bg-dark {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
    border: 1px solid rgba(30, 41, 59, 0.25);
}

.text-bg-light, .bg-light {
    background-color: #f8fafc !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0;
}

.text-primary { color: var(--gm-primary) !important; }
.text-success { color: #059669 !important; }
.text-danger { color: var(--gm-danger) !important; }
.text-warning { color: var(--gm-accent) !important; }
.text-info { color: var(--gm-info) !important; }

/* --- Cartes (`.card`) --- */
.card {
    background-color: var(--gm-card-bg);
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-lg);
    box-shadow: var(--gm-shadow-sm);
    transition: var(--gm-transition);
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--gm-border-light);
    padding: 0.9rem 1.25rem;
    font-weight: 600;
    color: #0f172a;
    border-top-left-radius: var(--gm-radius-lg) !important;
    border-top-right-radius: var(--gm-radius-lg) !important;
}

.card-footer {
    background-color: #f8fafc;
    border-top: 1px solid var(--gm-border-light);
    padding: 0.85rem 1.25rem;
    border-bottom-left-radius: var(--gm-radius-lg) !important;
    border-bottom-right-radius: var(--gm-radius-lg) !important;
}

/* --- Alertes --- */
.alert {
    border-radius: var(--gm-radius-md);
    border: 1px solid transparent;
    padding: 0.85rem 1.1rem;
}

.alert-success {
    background-color: var(--gm-success-light);
    border-color: rgba(16, 185, 129, 0.3);
    color: #065f46;
}

.alert-danger {
    background-color: var(--gm-danger-light);
    border-color: rgba(225, 29, 72, 0.3);
    color: #9f1239;
}

.alert-warning {
    background-color: var(--gm-warning-light);
    border-color: rgba(245, 158, 11, 0.3);
    color: #92400e;
}

.alert-info {
    background-color: var(--gm-info-light);
    border-color: rgba(2, 132, 199, 0.3);
    color: #075985;
}

/* --- Tableaux --- */
.table {
    --bs-table-bg: transparent;
    color: var(--gm-text);
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.78rem 0.95rem;
    border-bottom-color: var(--gm-border-light);
    vertical-align: middle;
}

.table thead th, .table-light th {
    background-color: #f8fafc !important;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    border-bottom: 1px solid var(--gm-border);
}

.table-hover tbody tr {
    transition: var(--gm-transition);
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 92, 70, 0.025) !important;
}

/* --- Pagination --- */
.page-link {
    color: var(--gm-text);
    border-color: var(--gm-border);
    border-radius: var(--gm-radius-sm);
    margin: 0 2px;
    font-size: 0.85rem;
}

.page-link:hover {
    color: var(--gm-primary);
    background-color: var(--gm-primary-light);
    border-color: rgba(13, 92, 70, 0.2);
}

.page-item.active .page-link {
    background-color: var(--gm-primary) !important;
    border-color: var(--gm-primary) !important;
    color: #ffffff !important;
}

/* --- Dropdowns --- */
.dropdown-menu {
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-lg);
    box-shadow: var(--gm-shadow-lg);
    padding: 0.4rem;
}

.dropdown-item {
    border-radius: var(--gm-radius-sm);
    padding: 0.48rem 0.8rem;
    font-size: 0.88rem;
    color: var(--gm-text);
}

.dropdown-item:hover {
    background-color: var(--gm-primary-light);
    color: var(--gm-primary);
}

.dropdown-item.text-danger:hover {
    background-color: var(--gm-danger-light);
    color: var(--gm-danger);
}

/* ---------- 4. Structure & Layout Applicatif ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--gm-sidebar-w);
    background: var(--gm-sidebar-bg);
    color: var(--gm-sidebar-fg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
}

.sidebar-brand-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-brand-text {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-sub {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

.sidebar-logo-img {
    max-width: 44px;
    max-height: 44px;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
    padding: 2px;
}

.navbar-company-logo {
    max-width: 34px;
    max-height: 34px;
    object-fit: contain;
    border-radius: 6px;
}

.navbar-company-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #10b981 0%, #0d5c46 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10b981 0%, #0d5c46 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 0.65rem 1.5rem;
}

.sidebar-heading {
    padding: 1.1rem 0.85rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #52657a;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.58rem 0.85rem;
    margin-bottom: 3px;
    border-radius: var(--gm-radius-md);
    color: var(--gm-sidebar-fg);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--gm-transition);
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #f8fafc;
}

.sidebar-nav .nav-link.active {
    background: var(--gm-sidebar-active-bg);
    color: var(--gm-sidebar-active-fg);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--gm-sidebar-active-fg);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: var(--gm-sidebar-active-fg);
}

.sidebar-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    color: #64748b;
}

.app-main {
    flex: 1;
    margin-left: var(--gm-sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header Navbar sticky avec flou dépoli */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gm-border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.navbar-titre {
    font-weight: 600;
    font-size: 1.05rem;
    color: #0f172a;
}

.breadcrumb {
    font-size: 0.82rem;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--gm-text-muted);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--gm-primary);
}

.breadcrumb-item.active {
    color: #0f172a;
    font-weight: 600;
}

.app-content {
    padding: 1.75rem 1.5rem 3.5rem;
}

/* Avatars */
.avatar-initiales {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gm-primary) 0%, #10b981 100%);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(13, 92, 70, 0.25);
}

.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gm-primary-light);
    color: var(--gm-primary);
    font-weight: 700;
}

/* ---------- 5. Composants Métier Spécifiques ---------- */

/* Tuiles KPI */
.kpi-card {
    border: 1px solid var(--gm-border);
    box-shadow: var(--gm-shadow-sm);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--gm-shadow-md);
}

.kpi-card .kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.kpi-icon.text-bg-primary { background-color: var(--gm-primary-light) !important; color: var(--gm-primary) !important; }
.kpi-icon.text-bg-info { background-color: var(--gm-info-light) !important; color: var(--gm-info) !important; }
.kpi-icon.text-bg-success { background-color: var(--gm-success-light) !important; color: #059669 !important; }
.kpi-icon.text-bg-warning { background-color: var(--gm-warning-light) !important; color: var(--gm-accent) !important; }
.kpi-icon.text-bg-danger { background-color: var(--gm-danger-light) !important; color: var(--gm-danger) !important; }

.kpi-value {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.kpi-label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gm-text-muted);
}

/* Pipeline / Stepper */
.pipeline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pipeline-etape {
    flex: 1 1 0;
    min-width: 7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    padding-top: 0.25rem;
}

.pipeline-etape::before {
    content: "";
    position: absolute;
    top: 1.1rem;
    left: -50%;
    width: 100%;
    height: 3px;
    background: var(--gm-border);
    z-index: 0;
    transition: var(--gm-transition);
}

.pipeline-etape:first-child::before { display: none; }

.pipeline-pastille {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--gm-border);
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
    transition: var(--gm-transition);
}

.pipeline-libelle {
    font-size: 0.73rem;
    margin-top: 0.35rem;
    color: #64748b;
    font-weight: 500;
}

.pipeline-etape.is-fait .pipeline-pastille {
    background: linear-gradient(135deg, var(--gm-primary) 0%, #10b981 100%);
    border-color: var(--gm-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(13, 92, 70, 0.25);
}

.pipeline-etape.is-fait::before {
    background: var(--gm-primary);
}

.pipeline-etape.is-actuel .pipeline-pastille {
    border-color: var(--gm-primary);
    color: var(--gm-primary);
    box-shadow: 0 0 0 5px rgba(13, 92, 70, 0.15);
    background: #ffffff;
}

.pipeline-etape.is-actuel .pipeline-libelle {
    color: var(--gm-primary);
    font-weight: 700;
}

/* Kanban des Tâches */
.kanban {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.kanban-colonne {
    background: #f1f5f9;
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-lg);
    padding: 0.75rem;
    min-height: 10rem;
}

.kanban-entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.5rem 0.6rem;
    border-bottom: 2px solid var(--gm-border);
    margin-bottom: 0.65rem;
    font-weight: 600;
}

.kanban-liste {
    min-height: 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.kanban-liste.survol {
    outline: 2px dashed var(--gm-primary);
    outline-offset: 2px;
    border-radius: var(--gm-radius-md);
}

.kanban-carte {
    background: #ffffff;
    border: 1px solid var(--gm-border);
    border-radius: var(--gm-radius-md);
    padding: 0.75rem 0.85rem;
    box-shadow: var(--gm-shadow-sm);
    cursor: grab;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.kanban-carte:hover {
    transform: translateY(-2px);
    box-shadow: var(--gm-shadow-md);
}

.kanban-carte:active {
    cursor: grabbing;
}

.kanban-carte.en-deplacement {
    opacity: 0.45;
}

/* Import portail container */
#articles-import-preview {
    border-radius: var(--gm-radius-lg);
    overflow: hidden;
}

#articles-import-preview .card {
    border-color: rgba(13, 92, 70, 0.3);
    background-color: #f0fdf4;
}

/* ---------- 6. Écran d'authentification (`.page-auth`) ---------- */
.page-auth {
    display: block;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 14%, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0) 42%),
        radial-gradient(circle at 88% 20%, rgba(217, 119, 6, 0.14) 0%, rgba(217, 119, 6, 0) 40%),
        linear-gradient(158deg, #04130f 0%, #0b4635 42%, #0f766e 78%, #0d5c46 100%);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Fine grille de fond très discrète */
.page-auth::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    pointer-events: none;
    z-index: 0;
}

/* Halo décoratif ambre en haut à droite */
.page-auth::after {
    content: "";
    position: absolute;
    width: 720px;
    height: 720px;
    border-radius: 50%;
    top: -240px;
    right: -220px;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.10) 0%, rgba(255, 255, 255, 0) 72%);
    border: 1px solid rgba(217, 119, 6, 0.10);
    pointer-events: none;
    z-index: 1;
}

/* ---------- 6.1 Coquille générique des pages d'authent ---------- */
.auth-shell {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1.25rem 1rem 2rem;
}
.auth-shell .flash-stack {
    width: min(96%, 880px);
    margin: 0 auto 1.5rem;
}
.auth-shell .flash-stack:empty {
    display: none;
}
/* ---------- 6.2 Panneau partagé (écran de connexion) ---------- */
@media (min-width: 992px) {
    .auth-split {
        display: grid;
        grid-template-columns: 1.05fr 1fr;
        gap: 0;
        border-radius: var(--gm-radius-xl, 22px);
        overflow: hidden;
        box-shadow: 0 26px 60px -18px rgba(0, 0, 0, 0.45);
        max-width: 930px;
    }
}

.auth-split {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 930px;
    border-radius: var(--gm-radius-xl, 22px);
    overflow: hidden;
    box-shadow: 0 26px 60px -18px rgba(0, 0, 0, 0.45);
}

/* Panneau gauche : identité & promesse produit */
.auth-split .auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.4rem 2.4rem;
    background: linear-gradient(160deg, #0b4635 0%, #0f766e 60%, #115e59 100%);
    color: #ffffff;
    position: relative;
    overflow: hidden;
}
.auth-split .auth-brand::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    top: -120px;
    left: -100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}
.auth-split .auth-brand::after {
    content: "";
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    right: -110px;
    bottom: -90px;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.14) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}
.auth-split .auth-brand .auth-kicker {
    align-self: flex-start;
    display: inline-block;
    background: rgba(255, 255, 255, 0.12);
    color: #d7fbe8;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    margin-bottom: 1.75rem;
}
.auth-split .auth-brand .logo-mark.logo-mark-lg {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    font-size: 1.35rem;
    background: linear-gradient(135deg, #34d399 0%, #10b981 45%, #0d5c46 100%);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}
.auth-split .auth-brand .auth-title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.15;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.01em;
}
.auth-split .auth-brand .auth-subtitle {
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.82);
    margin: 0.7rem 0 0;
    max-width: 34ch;
}
.auth-split .auth-brand .auth-features {
    list-style: none;
    padding: 0;
    margin: 2rem 0 0;
    display: grid;
    gap: 0.9rem;
}
.auth-split .auth-brand .auth-features li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.9);
}
.auth-split .auth-brand .auth-features li::before {
    content: "—";
    color: rgba(251, 191, 36, 0.9);
    font-weight: 700;
    flex-shrink: 0;
}
.auth-split .auth-brand .auth-brand-foot {
    margin-top: 1.5rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
}

/* Panneau droit : formulaire carte claire */
.auth-split .auth-panel {
    background: rgba(255, 255, 255, 0.985);
    backdrop-filter: blur(10px);
    padding: 2.1rem 2.35rem;
    display: flex;
    flex-direction: column;
}
.auth-split .auth-panel .auth-panel-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gm-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
}
.auth-split .auth-panel .auth-panel-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gm-text, #1e293b);
    margin: 0.25rem 0 0.15rem;
    text-align: center;
}
.auth-split .auth-panel .auth-panel-sub {
    font-size: 0.92rem;
    color: var(--gm-text-muted, #64748b);
    margin: 0 0 1.15rem;
    text-align: center;
}

/* ---------- 6.3 Formulaires d'authentification ---------- */
.auth-form .field {
    margin-bottom: 1rem;
}
.auth-form .form-label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--gm-text, #1e293b);
    margin-bottom: 0.4rem;
}
.auth-form .input-icon {
    position: relative;
}
.auth-form .input-icon .icon-left {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gm-text-muted, #64748b);
    display: inline-flex;
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.auth-form .input-icon input {
    padding-left: 2.6rem;
}
.auth-form .input-icon .icon-right {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--gm-text-muted, #64748b);
    cursor: pointer;
    padding: 0.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.auth-form .form-control {
    border-color: var(--gm-border, #e2e8f0);
    border-radius: var(--gm-radius-md, 10px);
    padding-top: 0.62rem;
    padding-bottom: 0.62rem;
    box-shadow: none;
}
.auth-form .form-control:focus {
    border-color: var(--gm-primary, #0d5c46);
    box-shadow: 0 0 0 0.16rem rgba(var(--gm-primary-rgb, 13, 92, 70), 0.18);
}

/* Ligne rappel / oubli */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}
.auth-row .form-check {
    font-size: 0.85rem;
    color: var(--gm-text-muted, #64748b);
}
.auth-row .auth-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gm-primary, #0d5c46);
    text-decoration: none;
}
.auth-row .auth-link:hover {
    color: var(--gm-primary-hover, #094635);
    text-decoration: underline;
}

/* Bouton de connexion */
.auth-form .btn-submit {
    width: 100%;
    padding: 0.72rem 1rem;
    border: none;
    border-radius: var(--gm-radius-md, 10px);
    background: linear-gradient(135deg, #0d5c46 0%, #10b981 100%);
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 22px -8px rgba(16, 185, 129, 0.5);
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.auth-form .btn-submit:hover {
    background: linear-gradient(135deg, #094635 0%, #0b5c49 100%);
    transform: translateY(-1px);
    box-shadow: 0 14px 26px -8px rgba(16, 185, 129, 0.6);
}
.auth-form .btn-submit:active {
    transform: translateY(1px);
}

.auth-form .auth-hint {
    margin-top: 1.35rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--gm-text-muted, #64748b);
}
.auth-form .auth-hint a {
    color: var(--gm-primary, #0d5c46);
    font-weight: 600;
    text-decoration: none;
}
.auth-form .auth-hint a:hover {
    text-decoration: underline;
}

/* ---------- 6.4 Variante écran simple (oubli / réinitialisation) ---------- */
.auth-form-page {
    align-self: center;
    width: min(100%, 430px);
}
.auth-form-page .auth-form-page-brand {
    text-align: center;
    margin-bottom: 1.6rem;
}
.auth-form-page .auth-form-page-brand .logo-mark {
    width: 56px;
    height: 56px;
    border-radius: 15px;
    font-size: 1.3rem;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.42);
}
.auth-form-page .auth-form-page-brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0.6rem 0 0;
}
.auth-form-page .auth-form-page-brand p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    margin: 0.2rem 0 0;
}
.auth-form-page .auth-panel {
    background: rgba(255, 255, 255, 0.985);
    backdrop-filter: blur(10px);
    border-radius: var(--gm-radius-xl, 20px);
    padding: 2.1rem 1.9rem;
    box-shadow: 0 22px 46px -14px rgba(0, 0, 0, 0.4);
}
.auth-form-page .auth-panel h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gm-text, #1e293b);
    margin-bottom: 0.4rem;
}
.auth-form-page .auth-panel .auth-panel-sub {
    font-size: 0.9rem;
    color: var(--gm-text-muted, #64748b);
    margin-bottom: 1.3rem;
}

/* ---------- 6.5 Responsive des écrans d'authent ---------- */
@media (max-width: 991.98px) {
    .auth-split .auth-brand {
        padding: 1.6rem 1.5rem;
    }
    .auth-split .auth-brand .auth-kicker,
    .auth-split .auth-brand .auth-features,
    .auth-split .auth-brand .auth-brand-foot,
    .auth-split .auth-brand .auth-subtitle {
        display: none;
    }
    .auth-split .auth-brand .auth-title {
        font-size: 1.3rem;
    }
    .auth-split .auth-brand .logo-mark.logo-mark-lg {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    .auth-split .auth-panel {
        padding: 2rem 1.5rem;
    }
}
/* Champ "motif de perte" pré-rempli : couleur distincte + pleine largeur */
.form-control.motif-filled {
    background-color: var(--gm-danger-light, #ffe4e6);
    border-color: var(--gm-danger, #e11d48);
    color: #991b1b;
    font-weight: 600;
}
.form-control.motif-filled:focus {
    border-color: var(--gm-danger, #e11d48);
    box-shadow: 0 0 0 0.16rem rgba(var(--gm-danger-rgb, 225, 29, 72), 0.18);
}
/* ---------- 7. Responsive Mobile ---------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 20, 16, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

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

    .app-main {
        margin-left: 0;
    }

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

    .kanban {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   8. THÈME ADMINISTRATIF COMPACT (2026-11)
   Bleu marine / gris ardoise, densité élevée, sans effets décoratifs.
   Placé en fin de fichier : surcharge les sections 1 à 7.
   ========================================================================= */
:root {
    --gm-primary: #1f3a5f;
    --gm-primary-hover: #182f4d;
    --gm-primary-active: #11243b;
    --gm-primary-light: #e9eef5;
    --gm-primary-rgb: 31, 58, 95;

    --gm-accent: #b7791f;
    --gm-accent-hover: #975a16;
    --gm-accent-light: #fdf3e1;

    --gm-bg: #f2f4f7;
    --gm-text: #1f2937;
    --gm-text-muted: #6b7280;
    --gm-border: #d9dee6;
    --gm-border-light: #e8ebf0;

    --gm-sidebar-w: 224px;
    --gm-sidebar-bg: #14243a;
    --gm-sidebar-fg: #aab6c6;
    --gm-sidebar-active-bg: rgba(255, 255, 255, 0.08);
    --gm-sidebar-active-fg: #ffffff;

    --gm-radius-sm: 3px;
    --gm-radius-md: 4px;
    --gm-radius-lg: 6px;
    --gm-radius-xl: 8px;

    --gm-shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
    --gm-shadow-md: 0 2px 6px rgba(17, 24, 39, 0.07);
    --gm-shadow-lg: 0 6px 18px rgba(17, 24, 39, 0.12);
    --gm-transition: background-color .12s ease, border-color .12s ease, color .12s ease;

    --bs-primary: #1f3a5f;
    --bs-primary-rgb: 31, 58, 95;
    --bs-link-color: #1f3a5f;
    --bs-link-color-rgb: 31, 58, 95;
    --bs-link-hover-color: #182f4d;
    --bs-body-bg: #f2f4f7;
    --bs-body-color: #1f2937;
    --bs-border-color: #d9dee6;
    --bs-border-radius: 4px;
    --bs-border-radius-sm: 3px;
    --bs-border-radius-lg: 6px;
    --bs-body-font-size: 0.93rem;
}

/* --- Densité globale : toutes les tailles Bootstrap en rem rétrécissent --- */
html { font-size: 14px; }
body { line-height: 1.45; font-size: 0.93rem; }

h1, .h1 { font-size: 1.3rem; }
h2, .h2 { font-size: 1.15rem; }
h3, .h3 { font-size: 1.1rem; }
h4, .h4 { font-size: 1.02rem; }
h5, .h5 { font-size: .96rem; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 600; letter-spacing: 0; color: #111827; }

/* --- Boutons : sobres, plats --- */
.btn {
    border-radius: var(--gm-radius-md);
    padding: .34rem .75rem;
    font-size: .88rem;
    gap: .3rem;
    box-shadow: none !important;
    transform: none !important;
}
.btn-sm { padding: .2rem .55rem; font-size: .82rem; }
.btn-lg { padding: .45rem 1rem; font-size: .95rem; }
.btn-primary,
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--gm-primary) !important;
    border: 1px solid var(--gm-primary) !important;
}
.btn-primary:hover, .btn-primary:focus { background: var(--gm-primary-hover) !important; border-color: var(--gm-primary-hover) !important; }
.btn-success { --bs-btn-bg: #2f6f4f; --bs-btn-border-color: #2f6f4f; --bs-btn-hover-bg: #255a40; --bs-btn-hover-border-color: #255a40; }
.btn-outline-success { color: #2f6f4f !important; border-color: #8fb8a2 !important; }
.btn-outline-success:hover { background-color: #2f6f4f !important; border-color: #2f6f4f !important; color: #fff !important; }
.btn-light { box-shadow: none; }

/* --- Formulaires --- */
.form-control, .form-select {
    border-radius: var(--gm-radius-md);
    padding: .3rem .6rem;
    font-size: .9rem;
    min-height: calc(1.45em + .6rem + 2px);
}
.form-select { padding-right: 2rem; background-position: right .55rem center; }
.form-control-sm, .form-select-sm { padding: .2rem .5rem; font-size: .84rem; min-height: calc(1.4em + .4rem + 2px); }
.form-select-sm { padding-right: 1.8rem; }
.form-label { font-size: .82rem; font-weight: 600; color: #374151; margin-bottom: .2rem; }
.form-text { font-size: .78rem; margin-top: .15rem; }
.input-group-text { padding: .3rem .6rem; font-size: .88rem; background: #f6f7f9; }
.btn:focus-visible, .form-control:focus, .form-select:focus {
    border-color: var(--gm-primary) !important;
    box-shadow: 0 0 0 2px rgba(31, 58, 95, .15) !important;
}
textarea.form-control { min-height: auto; }

/* --- Badges : rectangulaires, discrets --- */
.badge { padding: .22em .5em; font-size: .74rem; font-weight: 600; border-radius: var(--gm-radius-sm); letter-spacing: 0; }
.text-bg-primary, .bg-primary { background-color: var(--gm-primary-light) !important; color: var(--gm-primary) !important; border-color: rgba(31, 58, 95, .2) !important; }
.text-primary { color: var(--gm-primary) !important; }

/* --- Cartes : bord fin, ombre minimale --- */
.card { border-radius: var(--gm-radius-lg); box-shadow: none; border-color: var(--gm-border); }
.card.shadow-sm, .shadow-sm { box-shadow: var(--gm-shadow-sm) !important; }
.shadow { box-shadow: var(--gm-shadow-md) !important; }
.card-header {
    padding: .5rem .8rem;
    font-size: .9rem;
    background-color: #f8f9fb;
    border-bottom: 1px solid var(--gm-border);
    border-top-left-radius: var(--gm-radius-lg) !important;
    border-top-right-radius: var(--gm-radius-lg) !important;
}
.card-header.bg-white { background-color: #f8f9fb !important; }
.card-body { padding: .8rem .9rem; }
.card-footer { padding: .5rem .8rem; background-color: #f8f9fb; border-top-color: var(--gm-border); }
.card-title { font-size: .95rem; margin-bottom: .4rem; }

/* --- Alertes --- */
.alert { padding: .5rem .8rem; border-radius: var(--gm-radius-md); font-size: .88rem; margin-bottom: .75rem; }

/* --- Tableaux : denses, lisibles --- */
.table > :not(caption) > * > * { padding: .38rem .6rem; border-bottom-color: var(--gm-border-light); }
.table-sm > :not(caption) > * > * { padding: .26rem .5rem; }
.table thead th, .table-light th {
    background-color: #eef1f5 !important;
    font-size: .74rem;
    letter-spacing: .03em;
    color: #4b5563;
    border-bottom: 1px solid var(--gm-border);
    white-space: nowrap;
}
.table { --bs-table-hover-bg: #eef3fa; --bs-table-hover-color: inherit; }
/* Zébrage à spécificité nulle : les lignes .table-danger / .table-warning restent prioritaires */
:where(.table > tbody > tr:nth-of-type(even)) { --bs-table-bg: #fafbfc; }
.table td .btn-sm { padding: .12rem .4rem; }

/* --- Pagination, dropdowns, modales, onglets --- */
.page-link { padding: .2rem .55rem; font-size: .84rem; margin: 0 1px; }
.page-item.active .page-link { background-color: var(--gm-primary) !important; border-color: var(--gm-primary) !important; }
.dropdown-menu { border-radius: var(--gm-radius-lg); padding: .25rem; font-size: .9rem; }
.dropdown-item { padding: .3rem .65rem; font-size: .88rem; border-radius: var(--gm-radius-sm); }
.modal-content { border-radius: var(--gm-radius-lg); border: 1px solid var(--gm-border); }
.modal-header, .modal-footer { padding: .55rem .9rem; background: #f8f9fb; }
.modal-body { padding: .8rem .9rem; }
.modal-title { font-size: 1rem; }
.nav-tabs .nav-link { padding: .4rem .8rem; font-size: .88rem; }
.list-group-item { padding: .45rem .75rem; }

/* --- Barre latérale : marine uni, compacte --- */
.app-sidebar { box-shadow: none; border-right: 1px solid #0d1a2b; }
.sidebar-brand { padding: .6rem .8rem; gap: .55rem; min-height: 52px; }
.sidebar-brand-text { font-size: .86rem; }
.sidebar-brand-sub { font-size: .66rem; color: #7f8ea3; }
.sidebar-logo-img { max-width: 32px; max-height: 32px; border-radius: 4px; }
.logo-mark {
    width: 32px; height: 32px; border-radius: 4px; font-size: .82rem;
    background: #2c4a73; box-shadow: none;
}
.sidebar-nav { padding: .35rem .45rem 1rem; }
.sidebar-heading { padding: .7rem .6rem .2rem; font-size: .66rem; letter-spacing: .08em; color: #6f8098; }
.sidebar-nav .nav-link {
    padding: .32rem .6rem;
    margin-bottom: 1px;
    gap: .55rem;
    font-size: .86rem;
    border-radius: var(--gm-radius-md);
}
.sidebar-nav .nav-link i { font-size: .98rem; width: 1.1rem; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sidebar-nav .nav-link.active {
    background: var(--gm-sidebar-active-bg);
    color: #fff;
    box-shadow: inset 3px 0 0 #6ea8e8;
}
.sidebar-nav .nav-link.active i { color: #9cc4f0; }
.sidebar-footer { padding: .5rem .9rem; font-size: .7rem; color: #6f8098; }

/* --- Barre supérieure --- */
.app-navbar {
    padding: .35rem 1rem;
    gap: .6rem;
    min-height: 48px;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}
.navbar-titre { font-size: .98rem; }
.breadcrumb { font-size: .84rem; }
.avatar-initiales { width: 28px; height: 28px; font-size: .72rem; background: var(--gm-primary); box-shadow: none; }
.navbar-company-mark { width: 28px; height: 28px; border-radius: 4px; background: #2c4a73; font-size: .74rem; }

/* --- Contenu --- */
.app-content { padding: .9rem 1.1rem 2.5rem; }
.app-content > .d-flex.mb-3:first-child,
.app-content > .d-flex.mb-4:first-child { margin-bottom: .75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.g-4, .gx-4 { --bs-gutter-x: 1rem; }
.g-4, .gy-4 { --bs-gutter-y: 1rem; }

/* --- Composants métier --- */
.kpi-card:hover { transform: none; box-shadow: var(--gm-shadow-sm); }
.kpi-card .kpi-icon { width: 36px; height: 36px; border-radius: 4px; font-size: 1.05rem; }
.kpi-value { font-size: 1.3rem; letter-spacing: 0; }
.kpi-label { font-size: .68rem; }
.pipeline-etape { font-size: .82rem; margin-bottom: .6rem; }
.kanban-carte { border-radius: var(--gm-radius-md); }
.kanban-carte:hover { transform: none; }

/* --- Écran de connexion : mêmes couleurs institutionnelles --- */

.auth-form .btn-submit { background: var(--gm-primary) !important; box-shadow: none !important; border-radius: var(--gm-radius-md); }

/* --- Impression écran (Ctrl+P) : contenu seul --- */
@media print {
    .app-sidebar, .app-navbar, .sidebar-backdrop, .btn, form[data-confirm] { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    .card { border: 1px solid #999 !important; }
}

/* =========================================================================
   9. HARMONISATION DES PAGES (styles déclarés localement dans les vues)
   Préfixe .app-content : spécificité supérieure aux <style> des vues.
   ========================================================================= */
/* Tuiles KPI des listes */
.app-content .kpi-grid { gap: .5rem; margin-bottom: .65rem; }
.app-content .kpi-card,
.app-content .kpi-card-col {
    padding: .45rem .7rem;
    gap: .6rem;
    border-radius: var(--gm-radius-lg);
    border-color: var(--gm-border);
    box-shadow: none;
    transform: none;
}
.app-content .kpi-card:hover,
.app-content .kpi-card-col:hover { transform: none; box-shadow: var(--gm-shadow-sm); border-color: #b9c3d1; }
.app-content .kpi-card-col { border-left-width: 3px !important; }
.app-content .kpi-icon,
.app-content .kpi-icon-col { width: 30px; height: 30px; border-radius: 4px; font-size: .95rem; }
.app-content .kpi-val { font-size: 1.15rem; font-weight: 700; }
.app-content .kpi-lbl { font-size: .66rem; letter-spacing: .03em; margin-top: 0; }

/* Filtres rapides par statut (pastilles) */
.app-content .mod-nav,
.app-content .opp-nav { gap: .3rem; margin-bottom: .55rem; }
.app-content .mod-nav-btn,
.app-content .opp-nav-pill {
    padding: .18rem .6rem;
    font-size: .8rem;
    border-radius: var(--gm-radius-md);
    border-width: 1px;
    box-shadow: none;
    transform: none;
}
.app-content .mod-nav-btn.active,
.app-content .opp-nav-pill.active { background: var(--gm-primary); border-color: var(--gm-primary); box-shadow: none; }

/* Barre de filtres */
.app-content .filter-bar { padding: .4rem .6rem; margin-bottom: .55rem; border-radius: var(--gm-radius-lg); box-shadow: none; }

/* Tableaux déclarés dans les vues */
.app-content .tbl-compact th, .app-content .tbl-compact td,
.app-content .table-opp th, .app-content .table-opp td { padding: .3rem .55rem; font-size: .84rem; }
.app-content .table-opp th, .app-content .tbl-compact th { font-size: .74rem; border-bottom-width: 1px; background: #eef1f5; }
.app-content .table-opp tbody tr:hover { background-color: #eef3fa !important; }
.app-content .ref-badge { padding: .05rem .35rem; font-size: .8rem; border-color: rgba(31, 58, 95, .2); border-radius: var(--gm-radius-sm); }
.app-content .urgence-badge { animation: none; }

/* Onglets des fiches (opportunité / marché) */
.app-content .opp-tab, .app-content .marche-tab { padding: .38rem .7rem; font-size: .86rem; }
.app-content .meta-chip, .app-content .marche-meta-item { padding: .12rem .5rem; font-size: .8rem; border-radius: var(--gm-radius-md); }
.app-content .pipe-step { font-size: .78rem; }

/* Écrans d'authentification : bandeau institutionnel marine */
.page-auth { background: #0e1b2c !important; }
.page-auth::before, .page-auth::after { display: none !important; }
.auth-split { border-radius: var(--gm-radius-lg) !important; box-shadow: var(--gm-shadow-lg) !important; }
.auth-split .auth-brand { background: #14243a !important; }
.auth-split .auth-brand::before, .auth-split .auth-brand::after { display: none !important; }
.auth-split .auth-brand .logo-mark.logo-mark-lg, .auth-form-page .logo-mark { background: #2c4a73 !important; box-shadow: none !important; border-radius: 4px; }
.auth-form .btn-submit, .auth-form .btn-submit:hover { background: var(--gm-primary) !important; transform: none !important; }
.auth-form .form-control { border-radius: var(--gm-radius-md) !important; }

/* ---------- Fond animé de l'écran de connexion ---------- */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(160deg, #0b1626 0%, #14243a 48%, #1b3352 100%);
}
/* Halos lumineux qui dérivent lentement */
.auth-bg-halo {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .55;
    will-change: transform;
}
.auth-bg-halo.h1 { width: 520px; height: 520px; top: -140px; left: -120px; background: #2c5d93; animation: authDerive1 22s ease-in-out infinite alternate; }
.auth-bg-halo.h2 { width: 440px; height: 440px; bottom: -160px; right: -100px; background: #3a6ea8; opacity: .45; animation: authDerive2 26s ease-in-out infinite alternate; }
.auth-bg-halo.h3 { width: 300px; height: 300px; top: 45%; left: 55%; background: #b7791f; opacity: .16; animation: authDerive3 30s ease-in-out infinite alternate; }

@keyframes authDerive1 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(18vw, 14vh) scale(1.15); } }
@keyframes authDerive2 { 0% { transform: translate(0, 0) scale(1.05); } 100% { transform: translate(-16vw, -18vh) scale(.9); } }
@keyframes authDerive3 { 0% { transform: translate(-50%, -50%) scale(.9); } 100% { transform: translate(-90%, -20%) scale(1.2); } }

/* Grille fine qui défile (évoque le quadrillage des plans / bordereaux) */
.auth-bg-grille {
    position: absolute;
    inset: -60px;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
            mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    animation: authGrille 18s linear infinite;
}
@keyframes authGrille { to { transform: translate(48px, 48px); } }

/* Points lumineux qui montent */
.auth-bg-points i {
    position: absolute;
    bottom: -12px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(173, 205, 240, .7);
    box-shadow: 0 0 8px rgba(173, 205, 240, .6);
    animation: authMonte 16s linear infinite;
    opacity: 0;
}
.auth-bg-points i:nth-child(1)  { left: 6%;  animation-delay: 0s;   animation-duration: 15s; }
.auth-bg-points i:nth-child(2)  { left: 14%; animation-delay: 4s;   animation-duration: 19s; width: 3px; height: 3px; }
.auth-bg-points i:nth-child(3)  { left: 23%; animation-delay: 8s;   animation-duration: 14s; }
.auth-bg-points i:nth-child(4)  { left: 31%; animation-delay: 2s;   animation-duration: 21s; width: 2px; height: 2px; }
.auth-bg-points i:nth-child(5)  { left: 42%; animation-delay: 11s;  animation-duration: 17s; }
.auth-bg-points i:nth-child(6)  { left: 51%; animation-delay: 6s;   animation-duration: 23s; width: 3px; height: 3px; }
.auth-bg-points i:nth-child(7)  { left: 60%; animation-delay: 1s;   animation-duration: 16s; }
.auth-bg-points i:nth-child(8)  { left: 68%; animation-delay: 9s;   animation-duration: 20s; width: 2px; height: 2px; }
.auth-bg-points i:nth-child(9)  { left: 77%; animation-delay: 5s;   animation-duration: 15s; }
.auth-bg-points i:nth-child(10) { left: 85%; animation-delay: 13s;  animation-duration: 22s; width: 3px; height: 3px; }
.auth-bg-points i:nth-child(11) { left: 92%; animation-delay: 3s;   animation-duration: 18s; }
.auth-bg-points i:nth-child(12) { left: 97%; animation-delay: 10s;  animation-duration: 24s; width: 2px; height: 2px; }
@keyframes authMonte {
    0%   { transform: translateY(0);      opacity: 0; }
    10%  { opacity: 1; }
    85%  { opacity: .8; }
    100% { transform: translateY(-105vh); opacity: 0; }
}

/* La carte de connexion au-dessus du fond, légèrement détachée */
.page-auth .auth-shell { position: relative; z-index: 2; }
.page-auth .auth-split,
.page-auth .auth-form-page .auth-panel { box-shadow: 0 18px 50px rgba(0, 0, 0, .45) !important; }
.page-auth .auth-split .auth-brand { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.page-auth .auth-form-page .auth-form-page-brand h1,
.page-auth .auth-form-page .auth-form-page-brand p { color: #e5ecf5 !important; }

/* Accessibilité : aucune animation si l'utilisateur la refuse */
@media (prefers-reduced-motion: reduce) {
    .auth-bg-halo, .auth-bg-grille, .auth-bg-points i { animation: none !important; }
    .auth-bg-points { display: none; }
}

/* =========================================================================
   10. AIDE CONTEXTUELLE (bandeau + panneau « Comment utiliser cette page »)
   ========================================================================= */
.aide-bandeau {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .6rem;
    margin-bottom: .7rem;
    background: #f4f7fb;
    border: 1px solid #d6e0ec;
    border-left: 3px solid var(--gm-primary);
    border-radius: var(--gm-radius-md);
    font-size: .84rem;
    color: #374151;
}
.aide-bandeau-ico { color: var(--gm-primary); font-size: 1rem; flex-shrink: 0; }
.aide-bandeau-texte { flex: 1; min-width: 0; line-height: 1.35; }
.aide-bandeau-texte strong { color: var(--gm-primary); }
.aide-bandeau-onglet { display: block; color: #6b7280; font-size: .8rem; margin-top: 1px; }
.aide-bandeau-btn { white-space: nowrap; flex-shrink: 0; }
.aide-bandeau-fermer { font-size: .6rem; flex-shrink: 0; }
@media (max-width: 767.98px) {
    .aide-bandeau { flex-wrap: wrap; }
    .aide-bandeau-btn { order: 3; width: 100%; }
}

.aide-panneau { --bs-offcanvas-width: 440px; }
.aide-panneau .offcanvas-header { background: var(--gm-primary); color: #fff; padding: .7rem 1rem; }
.aide-panneau .offcanvas-title { font-size: 1rem; color: #fff; }
.aide-panneau .offcanvas-header .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.aide-panneau .offcanvas-body { padding: .8rem 1rem 1.5rem; font-size: .88rem; }
.aide-section { margin-bottom: 1rem; }
.aide-section h6 {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gm-primary);
    border-bottom: 1px solid var(--gm-border);
    padding-bottom: .25rem;
    margin-bottom: .5rem;
}
.aide-section h6 i { margin-right: .3rem; }
.aide-etapes { padding-left: 0; padding-inline-start: 1.2rem; margin: 0; }
.aide-etapes li { margin-bottom: .35rem; }
.aide-etapes li::marker { color: var(--gm-primary); font-weight: 700; }
.aide-liste { margin: 0; }
.aide-liste > div { padding: .35rem .5rem; border-left: 0; border-inline-start: 2px solid var(--gm-border); margin-bottom: .35rem; }
.aide-liste > div.aide-actif { border-inline-start-color: var(--gm-primary); background: var(--gm-primary-light); }
.aide-liste dt { font-weight: 600; color: #111827; font-size: .86rem; }
.aide-liste dd { margin: .1rem 0 0; color: #4b5563; }
.aide-astuces { padding-left: 0; padding-inline-start: 1.1rem; margin: 0; color: #4b5563; }
.aide-astuces li { margin-bottom: .25rem; }
.aide-pied { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--gm-border); padding-top: .6rem; font-size: .82rem; }
@media print { .aide-bandeau { display: none !important; } }

/* --- Aide bilingue FR / AR --- */
.aide-racine[data-langue="fr"] .aide-ar,
.aide-racine[data-langue="ar"] .aide-fr { display: none !important; }
.aide-langues .btn { padding: .1rem .45rem; font-size: .76rem; border: 1px solid var(--gm-border); background: #fff; color: #4b5563; }
.aide-langues .btn.active { background: var(--gm-primary); border-color: var(--gm-primary); color: #fff; }
.aide-panneau .offcanvas-header .aide-langues { margin-inline-start: auto; margin-inline-end: .6rem; }
.aide-panneau .offcanvas-header .aide-langues .btn { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.aide-panneau .offcanvas-header .aide-langues .btn.active { background: #fff; color: var(--gm-primary); }
[lang="ar"] {
    font-family: 'Noto Sans Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, sans-serif;
}
.aide-ar[dir="rtl"] { text-align: right; line-height: 1.75; }
.aide-panneau .aide-ar .aide-section h6 { letter-spacing: 0; text-transform: none; font-size: .86rem; }
.aide-panneau .aide-ar { font-size: .95rem; }
.aide-bandeau .aide-ar { font-size: .9rem; line-height: 1.6; }

/* --- Sélecteur d'articles du catalogue --- */
.article-picker-liste { position: absolute; top: 100%; left: 0; right: 0; max-height: 300px; overflow-y: auto; z-index: 1060; margin-top: 2px; }
.article-picker-liste .dropdown-item { white-space: normal; }
.article-picker-badge { font-size: .72rem; color: var(--gm-primary); min-height: 0; }
.article-picker-badge:empty { display: none; }

/* =========================================================================
   11. THÈME « MARINE & LAITON » — tableau de bord d'administration compact
   Sobre, dense, couleur réservée au sens (statuts, alertes, montants ±).
   Dernière couche : surcharge les sections précédentes.
   ========================================================================= */
:root {
    --mx-bg: #f2f4f7;
    --mx-carte: #ffffff;
    --mx-texte: #16233f;
    --mx-gris: #64748b;
    --mx-bord: #e5e9f0;
    --mx-doux: #f6f8fb;
    --mx-champ: #d6dce5;
    --mx-marine: #1a2e5a;
    --mx-marine-2: #142446;
    --mx-laiton: #b08d57;
    --mx-laiton-clair: #d4b07a;
    --mx-ok: #15803d;
    --mx-alerte: #b45309;
    --mx-ko: #b91c1c;

    --gm-primary: #1a2e5a;
    --gm-primary-hover: #142446;
    --gm-primary-active: #0f1b33;
    --gm-primary-light: #e9edf5;
    --gm-primary-rgb: 26, 46, 90;
    --gm-accent: #b08d57;
    --gm-bg: #f2f4f7;
    --gm-text: #16233f;
    --gm-text-muted: #64748b;
    --gm-border: #e5e9f0;
    --gm-border-light: #edf0f5;
    --gm-sidebar-w: 260px;
    --gm-radius-sm: 5px;
    --gm-radius-md: 7px;
    --gm-radius-lg: 10px;

    --bs-primary: #1a2e5a;
    --bs-primary-rgb: 26, 46, 90;
    --bs-link-color: #1a2e5a;
    --bs-link-color-rgb: 26, 46, 90;
    --bs-link-hover-color: #b08d57;
    --bs-body-bg: #f2f4f7;
    --bs-body-color: #16233f;
    --bs-secondary-color: #64748b;
    --bs-border-color: #e5e9f0;
    --bs-border-radius: 7px;
    --bs-border-radius-lg: 10px;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* --- Typographie --- */
html { font-size: 13.5px; }
body {
    font-family: var(--bs-body-font-family);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--mx-texte);
    background: var(--mx-bg) !important;
    font-feature-settings: "cv11", "ss01";
}
.table, .kpi-val, .kpi-valeur, .text-end, td.r, .montant, input[type="number"], .badge, .page-link {
    font-variant-numeric: tabular-nums;
}
h1, .h1, h2, .h2, h3, .h3 { color: var(--mx-texte); }
.app-content h1.h3, .app-content h1.h4, .app-content > h1, .page-titre { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.text-muted, .text-secondary { color: var(--mx-gris) !important; }
a { color: var(--mx-marine); }
a:hover { color: var(--mx-laiton); }

/* --- En-tête de page --- */
.page-entete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .6rem; margin-bottom: 12px; }
.page-entete h1 { font-size: 1.3rem; font-weight: 700; margin: 0; }
.page-entete .page-sous-titre, .app-content h1 + p.text-muted, .app-content h1 + .text-muted { font-size: .8rem; color: var(--mx-gris); margin: 2px 0 0; }

/* --- Cartes : blanches, filet fin, sans ombre ni mouvement --- */
.card, .app-content .kpi-card, .app-content .kpi-card-col {
    background: var(--mx-carte);
    border: 1px solid var(--mx-bord) !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
}
.app-content .kpi-card-col { border-left-width: 1px !important; }
.card:hover, .app-content .kpi-card:hover, .app-content .kpi-card-col:hover { box-shadow: none !important; transform: none !important; }
.card.shadow-sm, .shadow-sm, .shadow { box-shadow: none !important; }
.card-header, .card-header.bg-white {
    background: var(--mx-carte) !important;
    padding: 10px 14px;
    border-bottom: 1px solid var(--mx-bord);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mx-gris);
    border-top-left-radius: 10px !important;
    border-top-right-radius: 10px !important;
}
.card-header strong, .card-header .fw-semibold, .card-header .fw-bold { font-weight: 600; color: var(--mx-gris); }
.card-header .btn, .card-header .badge, .card-header a, .card-header input, .card-header select, .card-header small, .card-header .fw-normal {
    text-transform: none; letter-spacing: 0;
}
.card-body { padding: 12px 14px; }
.card-footer { background: var(--mx-doux); border-top: 1px solid var(--mx-bord); padding: 8px 14px; }
.row.g-3, .row.g-4 { --bs-gutter-x: 12px; --bs-gutter-y: 12px; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 14px !important; }

/* --- Cartes KPI --- */
.kpi-rang { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: #fff; border: 1px solid var(--mx-bord); border-radius: 10px; padding: 12px 14px; color: inherit; text-decoration: none; display: block; }
a.kpi:hover { background: var(--mx-doux); color: inherit; }
.kpi-lib { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mx-gris); font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.kpi-lib i { color: var(--mx-laiton); font-size: .85rem; }
.kpi-valeur { font-size: 1.45rem; font-weight: 700; color: var(--mx-marine); line-height: 1.15; margin-top: 4px; white-space: nowrap; }
.kpi-unite { font-size: .74rem; font-weight: 500; color: var(--mx-gris); margin-left: 2px; }
.kpi-detail { font-size: .74rem; color: var(--mx-gris); margin-top: 2px; }
.kpi-barre { height: 4px; background: var(--mx-bord); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.kpi-barre > span { display: block; height: 100%; background: var(--mx-marine); border-radius: 4px; }
.kpi-barre.laiton > span { background: var(--mx-laiton); }

/* --- Liste « À traiter » --- */
.todo { list-style: none; margin: 0; padding: 4px 0; }
.todo li a { display: flex; align-items: center; gap: 10px; padding: 7px 14px; color: var(--mx-texte); text-decoration: none; }
.todo li a:hover { background: var(--mx-doux); }
.todo-ico { width: 28px; height: 28px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.todo-lib { flex: 1; min-width: 0; font-size: .84rem; }
.todo-lib small { display: block; color: var(--mx-gris); font-size: .72rem; }
.todo-nb { min-width: 28px; text-align: center; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #fef3c7; color: var(--mx-alerte); }
.todo li.zero a { opacity: .45; }
.todo li.zero .todo-nb { background: var(--mx-doux); color: var(--mx-gris); }

/* --- Tableaux --- */
.table { font-size: .8rem; color: var(--mx-texte); --bs-table-hover-bg: #f6f8fb; --bs-table-striped-bg: transparent; }
.table > :not(caption) > * > * { padding: 7px 14px; border-bottom: 1px solid var(--mx-bord); background-color: transparent; }
.table-sm > :not(caption) > * > * { padding: 5px 10px; }
.table thead th, .table thead.table-light th, .table-light th, .table > thead > tr > th {
    background: #fff !important;
    color: var(--mx-gris) !important;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--mx-bord);
}
.table thead th a { color: var(--mx-gris) !important; }
:where(.table > tbody > tr:nth-of-type(even)) { --bs-table-bg: transparent; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f6f8fb; background-color: #f6f8fb; }
.table tfoot td, .table tfoot th, .table tr.table-light td, tr.total td, .table tr.tot td { background: var(--mx-doux) !important; font-weight: 700; }
.app-content .tbl-compact th, .app-content .tbl-compact td, .app-content .table-opp th, .app-content .table-opp td { padding: 7px 14px; font-size: .8rem; }
.app-content .table-opp th, .app-content .tbl-compact th { background: #fff; font-size: .68rem; }

/* --- Pastilles de statut --- */
.badge {
    border-radius: 20px;
    font-size: .68rem;
    font-weight: 600;
    padding: .25em .65em;
    letter-spacing: .01em;
    border: 0 !important;
}
.text-bg-primary, .bg-primary { background: #e9edf5 !important; color: var(--mx-marine) !important; }
.text-bg-success, .bg-success { background: #dcfce7 !important; color: var(--mx-ok) !important; }
.text-bg-warning, .bg-warning { background: #fef3c7 !important; color: var(--mx-alerte) !important; }
.text-bg-danger, .bg-danger   { background: #fee2e2 !important; color: var(--mx-ko) !important; }
.text-bg-info, .bg-info       { background: #e0f2fe !important; color: #075985 !important; }
.text-bg-secondary, .bg-secondary { background: #eef1f5 !important; color: #475569 !important; }
.text-bg-dark, .bg-dark       { background: #e2e8f0 !important; color: #1e293b !important; }
.text-bg-light, .bg-light     { background: var(--mx-doux) !important; color: #475569 !important; }
.badge.bg-white { background: #fff !important; color: var(--mx-marine) !important; }
.text-success { color: var(--mx-ok) !important; }
.text-warning { color: var(--mx-alerte) !important; }
.text-danger  { color: var(--mx-ko) !important; }
.text-primary { color: var(--mx-marine) !important; }

/* --- Boutons --- */
.btn { border-radius: 7px; padding: .3rem .75rem; font-size: .82rem; font-weight: 500; box-shadow: none !important; transform: none !important; }
.btn-sm { padding: .2rem .6rem; font-size: .78rem; border-radius: 6px; }
.btn-primary, .btn-primary:focus, .btn-primary:active {
    background: var(--mx-marine) !important; border: 1px solid var(--mx-marine) !important; color: #fff !important;
}
.btn-primary:hover { background: var(--mx-marine-2) !important; border-color: var(--mx-marine-2) !important; }
.btn-outline-primary, .btn-outline-secondary, .btn-light {
    background: #fff !important; border: 1px solid var(--mx-champ) !important; color: var(--mx-texte) !important;
}
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-light:hover { background: var(--mx-doux) !important; border-color: #c3cbd8 !important; color: var(--mx-marine) !important; }
.btn-outline-primary.active, .btn-outline-secondary.active { background: var(--mx-marine) !important; border-color: var(--mx-marine) !important; color: #fff !important; }
.btn-success, .btn-success:focus { background: var(--mx-ok) !important; border: 1px solid var(--mx-ok) !important; color: #fff !important; }
.btn-success:hover { background: #166534 !important; }
.btn-outline-success { background: #fff !important; border: 1px solid #bbf7d0 !important; color: var(--mx-ok) !important; }
.btn-outline-success:hover { background: #f0fdf4 !important; }
.btn-outline-danger { background: #fff !important; border: 1px solid #fecaca !important; color: var(--mx-ko) !important; }
.btn-outline-danger:hover { background: #fef2f2 !important; color: var(--mx-ko) !important; }
.btn-danger { background: var(--mx-ko) !important; border-color: var(--mx-ko) !important; }
.btn-outline-warning { background: #fff !important; border: 1px solid #fde68a !important; color: var(--mx-alerte) !important; }
.btn-link { color: var(--mx-marine); }

/* --- Formulaires --- */
.form-control, .form-select {
    background-color: #fff;
    border: 1px solid var(--mx-champ);
    border-radius: 7px;
    font-size: .84rem;
    padding: .32rem .6rem;
    color: var(--mx-texte);
}
.form-control-sm, .form-select-sm { font-size: .8rem; padding: .22rem .5rem; border-radius: 6px; }
.form-control:focus, .form-select:focus { border-color: var(--mx-marine) !important; box-shadow: 0 0 0 3px rgba(26, 46, 90, .1) !important; }
.form-label { font-size: .75rem; font-weight: 600; color: var(--mx-gris); margin-bottom: .2rem; }
.form-check-input:checked { background-color: var(--mx-marine) !important; border-color: var(--mx-marine) !important; }
.input-group-text { background: var(--mx-doux); border-color: var(--mx-champ); font-size: .82rem; }

/* --- Pastilles de filtre & barres de filtres des listes --- */
.app-content .mod-nav-btn, .app-content .opp-nav-pill { border-radius: 20px; border: 1px solid var(--mx-bord); background: #fff; color: var(--mx-texte); font-size: .76rem; }
.app-content .mod-nav-btn:hover, .app-content .opp-nav-pill:hover { background: var(--mx-doux); border-color: var(--mx-champ); color: var(--mx-marine); }
.app-content .mod-nav-btn.active, .app-content .opp-nav-pill.active { background: var(--mx-marine); border-color: var(--mx-marine); color: #fff !important; }
.app-content .filter-bar { border: 1px solid var(--mx-bord); border-radius: 10px; }
.app-content .kpi-val { color: var(--mx-marine); }

/* --- Alertes --- */
.alert { border-radius: 8px; font-size: .82rem; padding: .5rem .8rem; border: 1px solid; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--mx-ok); }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: var(--mx-alerte); }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: var(--mx-ko); }
.alert-info    { background: #f0f7ff; border-color: #cfe0f5; color: #1e3a8a; }
.alert-light   { background: #fff; border-color: var(--mx-bord); color: var(--mx-texte); }

/* --- Aucune animation d'apparition --- */
.fade:not(.modal):not(.offcanvas):not(.toast) { transition: none !important; }
.urgence-badge, .app-content [class*="animate"] { animation: none !important; }

/* =========================================================================
   Barre latérale marine
   ========================================================================= */
.app-sidebar {
    width: var(--gm-sidebar-w);
    background: linear-gradient(180deg, #0f1b33 0%, #142446 100%);
    color: #c3cbdb;
    border-right: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}
.app-main { margin-left: var(--gm-sidebar-w); }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; color: #fff; }
.sb-brand-logo { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 7px; padding: 2px; }
.sb-brand-mark { width: 34px; height: 34px; border-radius: 8px; background: rgba(212, 176, 122, .16); color: #d4b07a; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; letter-spacing: .04em; border: 1px solid rgba(212, 176, 122, .35); flex-shrink: 0; }
.sb-brand-info { display: flex; flex-direction: column; min-width: 0; }
.sb-brand-nom { font-size: .86rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-brand-sub { font-size: .66rem; color: #7d8aa5; text-transform: uppercase; letter-spacing: .06em; }

.sb-recherche { position: relative; margin: 4px 14px 8px; }
.sb-recherche i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #7d8aa5; font-size: .8rem; }
.sb-recherche input {
    width: 100%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); border-radius: 7px;
    color: #e2e8f0; font-size: .8rem; padding: 6px 10px 6px 30px; outline: none;
}
.sb-recherche input::placeholder { color: #7d8aa5; }
.sb-recherche input:focus { border-color: rgba(212, 176, 122, .55); background: rgba(255, 255, 255, .09); }

.sb-nav { flex: 1; overflow-y: auto; padding: 2px 10px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sb-cat { margin-bottom: 2px; }
.sb-cat-btn {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; background: transparent;
    color: #c3cbdb; border-radius: 8px; font-size: .82rem; font-weight: 600; text-align: left; cursor: pointer;
}
.sb-cat-btn:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sb-tuile {
    width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-size: .82rem; color: var(--tuile); background: color-mix(in srgb, var(--tuile) 16%, transparent);
}
.sb-cat-lib { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-chevron { font-size: .7rem; color: #7d8aa5; transition: transform .15s; }
.sb-cat.ouverte .sb-chevron { transform: rotate(180deg); }
.sb-cat.ouverte > .sb-cat-btn { color: #fff; }
.sb-badge { min-width: 18px; padding: 1px 6px; border-radius: 10px; background: #f59e0b; color: #1f1300; font-size: .64rem; font-weight: 700; text-align: center; line-height: 1.45; }
.sb-liens { display: none; padding: 2px 0 6px; }
.sb-cat.ouverte .sb-liens, .sb-nav.en-recherche .sb-liens { display: block; }
.sb-lien {
    display: flex; align-items: center; gap: 9px; padding: 6px 10px 6px 18px; margin: 1px 0; border-radius: 7px;
    color: #c3cbdb; font-size: .8rem; text-decoration: none; position: relative;
}
.sb-lien i { font-size: .85rem; color: #7d8aa5; width: 16px; text-align: center; }
.sb-lien span:not(.sb-badge) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-lien:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sb-lien.active { background: color-mix(in srgb, var(--tuile) 13%, transparent); color: #fff; font-weight: 600; }
.sb-lien.active::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--tuile); }
.sb-lien.active i { color: var(--tuile); }
.sb-vide { color: #7d8aa5; font-size: .78rem; padding: 8px 10px; margin: 0; }

.sb-profil { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sb-avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(212, 176, 122, .18); color: #d4b07a; display: inline-flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 700; flex-shrink: 0; }
.sb-profil-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sb-profil-nom { color: #fff; font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-profil-role { color: #7d8aa5; font-size: .7rem; }
.sb-deconnexion { background: transparent; border: 1px solid rgba(255, 255, 255, .1); color: #c3cbdb; border-radius: 7px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
.sb-deconnexion:hover { color: #fca5a5; border-color: rgba(252, 165, 165, .4); background: rgba(185, 28, 28, .12); }

/* =========================================================================
   Barre supérieure blanche
   ========================================================================= */
.app-navbar { background: #fff !important; border-bottom: 1px solid var(--mx-bord); padding: 8px 18px; min-height: 52px; box-shadow: none; backdrop-filter: none; }
.tb-titre { line-height: 1.2; }
.tb-page { font-size: .98rem; font-weight: 700; color: var(--mx-texte); }
.app-navbar .breadcrumb { font-size: .72rem; margin-top: 1px; --bs-breadcrumb-divider-color: #94a3b8; }
.app-navbar .breadcrumb-item a { color: var(--mx-gris); }
.app-navbar .breadcrumb-item.active { color: var(--mx-gris); font-weight: 500; }
.app-navbar .btn-light { border-color: var(--mx-bord) !important; }
.avatar-initiales { background: var(--mx-marine) !important; color: #fff; }
.app-content { padding: 14px 18px 32px; }

/* --- Aide contextuelle & panneaux aux couleurs du thème --- */
.aide-bandeau { background: #fff; border: 1px solid var(--mx-bord); border-left: 3px solid var(--mx-laiton); border-radius: 8px; }
.aide-bandeau-ico, .aide-bandeau-texte strong { color: var(--mx-marine); }
.aide-panneau .offcanvas-header { background: var(--mx-marine); }
.aide-section h6 { color: var(--mx-marine); }
.aide-liste > div.aide-actif { border-inline-start-color: var(--mx-laiton); background: #faf6ef; }

/* --- Mobile : menu coulissant, cartes en une colonne --- */
@media (max-width: 991.98px) {
    .app-main { margin-left: 0; }
    .app-sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
    .app-sidebar.open { transform: translateX(0); }
}
@media (max-width: 575.98px) {
    .kpi-rang { grid-template-columns: 1fr; }
    .app-content { padding: 12px; }
}

/* --- Registre des documents --- */
.app-content .mod-nav-btn, .app-content .mod-nav-btn:hover { text-decoration: none !important; }
.reg-txt { max-width: 15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reg-objet { max-width: 22rem; }

/* =========================================================================
   12. ÉDITEUR DE DOCUMENT (fenêtre séparée) — feuille A4 façon PDF
   ========================================================================= */
.page-fenetre { background: #e7ebf1 !important; min-height: 100vh; }
.ed-barre {
    position: sticky; top: 0; z-index: 50; display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: 8px 18px; background: linear-gradient(180deg, #0f1b33, #142446); color: #c3cbdb;
}
.ed-barre-titre { color: #fff; font-weight: 700; font-size: .9rem; margin-right: .4rem; }
.ed-barre .btn-outline-light { background: transparent !important; color: #c3cbdb !important; border: 1px solid rgba(255,255,255,.22) !important; }
.ed-barre .btn-outline-light:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }
.ed-barre .btn-light.active { background: #fff !important; color: var(--mx-marine) !important; border-color: #fff !important; font-weight: 600; }
.ed-btn-laiton { background: #b08d57 !important; border: 1px solid #b08d57 !important; color: #fff !important; font-weight: 600; }
.ed-btn-laiton:hover { background: #9a7a48 !important; }
.ed-erreur { max-width: 21cm; margin: 12px auto 0; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 8px; padding: 8px 12px; font-size: .84rem; }

.ed-feuille {
    max-width: 21cm; min-height: 27cm; margin: 16px auto 40px; background: #fff; padding: 1.1cm 1.2cm 1cm;
    box-shadow: 0 6px 24px rgba(15, 27, 51, .14); border-radius: 2px; color: #1e293b; font-size: .86rem;
    display: flex; flex-direction: column;
}
.ed-entete { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--mx-marine); padding-bottom: 10px; margin-bottom: 16px; }
.ed-entete-logo img { max-height: 2.4cm; max-width: 5cm; object-fit: contain; }
.ed-entete-info { text-align: right; font-size: .78rem; color: #334155; line-height: 1.45; }
.ed-raison { font-size: 1.05rem; font-weight: 700; color: var(--mx-marine); }

.ed-bloc-titre { border: 1.5px solid var(--mx-marine); background: #f4f6fb; border-radius: 6px; padding: 10px 12px; height: 100%; }
.ed-titre-doc { font-size: 1.15rem; font-weight: 800; color: var(--mx-marine); letter-spacing: .03em; margin-bottom: 6px; }
.ed-champ-ligne { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.ed-champ-ligne label { font-weight: 600; white-space: nowrap; min-width: 7.5rem; font-size: .8rem; }
.ed-bloc-dest { border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 6px; padding: 10px 12px; height: 100%; }
.ed-dest-label { font-size: .7rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.ed-dest-nom { font-weight: 700; font-size: .95rem; color: #0f172a; }
.ed-dest-info { font-size: .82rem; line-height: 1.45; }
.ed-bloc-objet { border: 1px solid #e2e8f0; border-left: 4px solid var(--mx-marine); border-radius: 4px; padding: 7px 10px; margin-bottom: 12px; }
.ed-ref { font-size: .8rem; font-weight: 700; color: var(--mx-marine); }

/* Champs intégrés à la page : apparence de texte, cadre au survol / focus */
.ed-input {
    border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 3px 6px; width: 100%;
    font: inherit; color: inherit; outline: none; resize: none;
}
.ed-input:hover { border-color: #d6dce5; background: #fff; }
.ed-input:focus { border-color: var(--mx-marine); background: #fff; box-shadow: 0 0 0 3px rgba(26, 46, 90, .1); }
.ed-input[readonly] { cursor: default; }
.ed-input[readonly]:hover { border-color: transparent; background: transparent; }

.ed-lignes { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.ed-lignes thead th { background: var(--mx-marine); color: #fff; font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: 6px 6px; border: 1px solid var(--mx-marine); }
.ed-lignes tbody td { border: 1px solid #e2e8f0; padding: 2px 4px; vertical-align: middle; }
.ed-lignes tbody tr:nth-child(even) td { background: #fafbfc; }
.ed-num { text-align: center; color: #64748b; font-size: .78rem; }
.ed-total-ligne { font-variant-numeric: tabular-nums; padding-right: 8px !important; }
.ed-reliquat { color: #b45309; font-variant-numeric: tabular-nums; padding-right: 8px !important; }
.ed-col-action { width: 28px; text-align: center; background: #fff !important; border-color: #fff !important; }
.ed-lignes thead .ed-col-action { background: #fff; border-color: #fff; }
.ed-actions-lignes { margin-bottom: 8px; }
.ed-totaux { width: 100%; border-collapse: collapse; }
.ed-totaux td { padding: 5px 8px; border-bottom: 1px solid #e2e8f0; font-variant-numeric: tabular-nums; }
.ed-totaux .ed-ttc td { font-size: 1rem; font-weight: 800; color: var(--mx-marine); background: #f4f6fb; border-top: 2px solid var(--mx-marine); border-bottom: 2px solid var(--mx-marine); }
.ed-tva { width: 100%; font-size: .76rem; border-collapse: collapse; }
.ed-tva th { background: #f1f5f9; padding: 3px 6px; text-align: right; border: 1px solid #e2e8f0; }
.ed-tva td { padding: 3px 6px; text-align: right; border: 1px solid #e2e8f0; font-variant-numeric: tabular-nums; }
.ed-lettres { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 4px; padding: 7px 10px; margin: 10px 0; font-size: .82rem; }
.ed-lettres em { display: block; color: var(--mx-marine); font-weight: 700; font-style: italic; }
.ed-notes { font-size: .8rem; }
.ed-notes label { font-weight: 700; }
.ed-signature { border: 1px dashed #94a3b8; border-radius: 6px; height: 2.8cm; padding: 8px; font-size: .74rem; display: flex; flex-direction: column; }
.ed-signature strong { color: var(--mx-marine); }
.ed-signature span { color: #64748b; }
.ed-reception { border: 1.5px solid #d97706; background: #fffbeb; }
.ed-reception strong { color: #b45309; }
.ed-pied { margin-top: auto; padding-top: 12px; border-top: 1px solid #cbd5e1; font-size: .68rem; color: #64748b; text-align: center; line-height: 1.5; }

.ed-ok { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.ed-ok-carte { background: #fff; border: 1px solid var(--mx-bord); border-radius: 12px; padding: 28px 32px; text-align: center; max-width: 560px; }
.ed-ok-ico { width: 54px; height: 54px; border-radius: 50%; background: #dcfce7; color: #15803d; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; margin-bottom: 10px; }
.ed-ok h1 { font-size: 1.25rem; font-weight: 700; }

@media print {
    .ed-barre, .ed-actions-lignes, .ed-col-action, .ed-erreur { display: none !important; }
    .page-fenetre { background: #fff !important; }
    .ed-feuille { box-shadow: none; margin: 0; max-width: none; }
}
@media (max-width: 767.98px) { .ed-feuille { padding: 14px; margin: 8px; } }
/* Éditeur : champs numériques sans flèches, libellé objet sur une ligne */
.ed-input[type="number"] { -moz-appearance: textfield; appearance: textfield; padding-left: 2px; padding-right: 4px; }
.ed-input[type="number"]::-webkit-outer-spin-button, .ed-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ed-bloc-objet strong { white-space: nowrap; }
.ed-lignes td:has(> .ed-input) { padding: 2px 2px; }
/* Page d'impression (PDF plein écran) */
.imp-barre { position: fixed; top: 0; left: 0; right: 0; height: 46px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .8rem;
    padding: 0 16px; background: linear-gradient(180deg, #0f1b33, #142446); color: #c3cbdb; }
.imp-barre .btn-outline-light { background: transparent !important; color: #c3cbdb !important; border: 1px solid rgba(255,255,255,.22) !important; }
.imp-titre { color: #fff; font-weight: 700; font-size: .88rem; }
.imp-etat { font-size: .78rem; color: #d4b07a; flex: 1; }
.imp-cadre { position: fixed; top: 46px; left: 0; width: 100%; height: calc(100vh - 46px); border: 0; background: #525659; }

/* --- Marque société sur les écrans d'authentification (logo + raison sociale) --- */
.page-auth .auth-split .auth-brand { display: flex; align-items: center; justify-content: center; padding: 1.6rem 1.5rem !important; min-height: 0; }
.auth-marque { display: flex; flex-direction: column; align-items: center; gap: .7rem; text-align: center; }
.auth-marque-logo { background: #fff; border-radius: 10px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.auth-marque-logo img { max-height: 64px; max-width: 220px; object-fit: contain; display: block; }
.auth-marque-nom { font-size: 1.2rem; font-weight: 700; letter-spacing: .02em; color: #fff; line-height: 1.25; }
.auth-marque-page .auth-marque-nom { color: #e5ecf5; font-size: 1.25rem; }
.auth-marque-page { margin-bottom: .4rem; }
