:root {
    --odg-navy: #1F3A5F;
    --odg-steel: #2E5C8A;
    --odg-sidebar-w: 250px;
}

body { background: #f4f6f9; }

/* ------- App shell ------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--odg-sidebar-w);
    background: var(--odg-navy);
    color: #dbe4f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.25rem;
    font-weight: 600; font-size: 1.05rem; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .bi { font-size: 1.4rem; }
.sidebar-nav { padding: .75rem .5rem; overflow-y: auto; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .7rem;
    color: #b9c7db; padding: .6rem .85rem; border-radius: .5rem;
    font-size: .93rem; margin-bottom: .15rem;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--odg-steel); color: #fff; }
.sidebar-nav .nav-link .bi { width: 1.2rem; text-align: center; }

/* Navigation groupée (menus repliables) */
.sidebar-nav .nav-group { margin-bottom: .1rem; }
.sidebar-nav .nav-group-toggle {
    width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.sidebar-nav .nav-group-toggle .nav-caret {
    margin-left: auto; font-size: .8rem; transition: transform .15s ease;
}
.sidebar-nav .nav-group-toggle.collapsed .nav-caret { transform: rotate(-90deg); }
.sidebar-nav .nav-sub {
    padding-left: 2.1rem; font-size: .9rem;
}
.sidebar-nav .nav-sub .bi { font-size: .85rem; }

/* Éditeur de modèle de contrat (contenteditable) */
.tpl-editor {
    min-height: 340px; border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: .5rem; padding: 1rem 1.15rem; background: var(--bs-body-bg, #fff);
    overflow-y: auto; line-height: 1.6;
}
.tpl-editor:focus { outline: 2px solid var(--odg-steel, #4a6fa5); outline-offset: 1px; }
.tpl-editor h2 { font-size: 1.35rem; }
.tpl-editor h3 { font-size: 1.15rem; }
.tpl-editor:empty::before {
    content: "Rédigez votre modèle ici…"; color: #9aa5b1;
}

/* Suivi de dossier : frise / stepper */
.dossier-pipeline { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.dossier-pipeline .dp-step { display: flex; align-items: center; gap: .5rem; padding: .15rem .3rem; border-radius: .5rem; }
.dossier-pipeline .dp-step.current { background: rgba(74,111,165,.10); }
.dossier-pipeline .dp-icon {
    width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex;
    align-items: center; justify-content: center; font-size: .95rem; flex: 0 0 auto;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.dossier-pipeline .dp-step.current .dp-icon { outline: 3px solid rgba(74,111,165,.35); }
.dossier-pipeline .dp-label { font-size: .8rem; font-weight: 600; line-height: 1.1; }
.dossier-pipeline .dp-state { font-size: .72rem; line-height: 1.1; }
.dossier-pipeline .dp-sep { flex: 1 1 20px; min-width: 20px; height: 3px; border-radius: 3px; background: var(--bs-border-color, #dee2e6); }
.dossier-pipeline .dp-sep.done { background: #198754; }
.dossier-pipeline.compact .dp-icon { width: 1.5rem; height: 1.5rem; font-size: .72rem; }
.dossier-pipeline.compact .dp-text { display: none; }
.dossier-pipeline.compact .dp-sep { min-width: 12px; flex-basis: 12px; }

/* Encart vertical (fiche abonnement) */
.dp-vert { list-style: none; margin: 0; padding: 0; position: relative; }
.dp-vert .dp-vstep { position: relative; display: flex; gap: .75rem; padding: .35rem 0 1rem .1rem; }
.dp-vert .dp-vstep:last-child { padding-bottom: 0; }
.dp-vert .dp-vstep::before {
    content: ""; position: absolute; left: 15px; top: 2.1rem; bottom: -.35rem;
    width: 2px; background: var(--bs-border-color, #dee2e6);
}
.dp-vert .dp-vstep:last-child::before { display: none; }
.dp-vert .dp-vstep.done::before { background: #198754; }
.dp-vicon {
    width: 32px; height: 32px; border-radius: 50%; display: inline-flex; flex: 0 0 auto;
    align-items: center; justify-content: center; font-size: .9rem; z-index: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.dp-vert .dp-vstep.current .dp-vicon { outline: 3px solid rgba(74,111,165,.35); }
.dp-vbody { display: flex; flex-direction: column; gap: .15rem; padding-top: .15rem; }
.dp-vbody .dp-label { font-size: .85rem; font-weight: 600; line-height: 1; }
.dp-vbody .badge { align-self: flex-start; font-weight: 500; }

/* Pointage des factures : case validée (double-clic) */
input.tracking-ok {
    background-color: #198754 !important;
    color: #fff !important;
    font-weight: 700;
    border-color: #198754 !important;
}

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

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 1.25rem; background: #fff;
    border-bottom: 1px solid #e3e8ef; position: sticky; top: 0; z-index: 1020;
}
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.user-chip { font-size: .9rem; color: #445; }

.content { padding: 1.5rem; flex: 1; }
.page-header { margin-bottom: 1.25rem; }

/* ------- Cards & stats ------- */
.card { border: 1px solid #e6eaf0; border-radius: .7rem; }
.stat-card .stat-icon { font-size: 2rem; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .85rem; }

/* ------- Auth pages ------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--odg-navy), var(--odg-steel));
    padding: 1rem;
}
.auth-card { width: 100%; max-width: 420px; border: none; border-radius: 1rem; }
.auth-logo { font-size: 2.6rem; color: var(--odg-steel); }

/* ------- Responsive ------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}

/* ------- Dark mode ------- */
[data-bs-theme="dark"] body { background: #12171f; }
[data-bs-theme="dark"] .topbar { background: #1a212b; border-color: #263041; }
[data-bs-theme="dark"] .card { background: #1a212b; border-color: #263041; }
