:root {
    color-scheme: light only;
    --primary-color: #0d47a1;
    --secondary-color: #d4af37;
    --accent-color: #e3f2fd;
    --text-dark: #2c3e50;
    --text-light: #f8f9fa;
    --bg-light: #fdfbf7;
    --chart-blue: #0d47a1;
    --chart-gold: #d4af37;
    --border-radius-card: 15px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================
   BASE
   ========================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
    /* Offset for sticky navbar */
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    font-size: clamp(0.95rem, 1.2vw, 1.05rem);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* overflow-x supprimé du body : il créait un stacking context qui
       interférait avec backdrop-filter et causait un voile sombre
       sur la page de connexion (ombrage bloquant l'accès). */
}

/* ==========================================================
   NAVBAR
   ========================================================== */
.navbar-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1565c0 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    padding: 0.55rem 0;
}

.navbar-custom .navbar-brand {
    color: white !important;
    font-weight: 700;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
}

.navbar-brand-name {
    font-size: 1.05rem;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

@media (max-width: 991.98px) {
    .navbar-brand-name {
        max-width: 180px;
        font-size: 0.9rem;
    }
}

.navbar-logo {
    flex-shrink: 0;
    transition: var(--transition);
}

.navbar-custom .navbar-toggler {
    border: none;
    outline: none;
    padding: 0.4rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
}

.navbar-custom .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-custom .navbar-toggler-icon {
    filter: brightness(0) invert(1);
}

.navbar-custom .nav-link {
    color: rgba(255, 255, 255, 0.88) !important;
    font-weight: 500;
    font-size: clamp(0.85rem, 1.1vw, 0.95rem);
    transition: var(--transition);
    border-radius: 8px;
    padding: 0.5rem 0.85rem !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--secondary-color) !important;
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.border-start-lg {
    border-left: none !important;
}

@media (min-width: 992px) {
    .border-start-lg {
        border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
    }
}

.navbar-nav .nav-item {
    margin-bottom: 2px;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 12px;
        padding: 1rem;
        margin-top: 0.5rem;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
    }
}

.navbar-custom .dropdown-menu {
    border: none;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    margin-top: 0.25rem;
}

.navbar-custom .dropdown-item {
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 0.45rem 0.85rem;
    transition: var(--transition);
    color: var(--text-dark);
}

.navbar-custom .dropdown-item:hover,
.navbar-custom .dropdown-item.active {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

.navbar-custom .dropdown-item i {
    width: 18px;
}

/* User dropdown */
.navbar-custom .nav-link.dropdown-toggle {
    gap: 0.4rem;
}

/* ==========================================================
   MAIN CONTAINER
   ========================================================== */
.container.mt-4.mb-5 {
    flex: 1;
}

/* ==========================================================
   CARDS
   ========================================================== */
.card-custom {
    border: none;
    border-radius: var(--border-radius-card);
    background: white;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-custom .card-body {
    padding: clamp(1rem, 2.5vw, 1.75rem) !important;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
}

.card-header-custom {
    background: white;
    border-bottom: 2px solid var(--accent-color);
    font-weight: 600;
    color: var(--primary-color);
    padding: 1.15rem 1.75rem;
    border-radius: var(--border-radius-card) var(--border-radius-card) 0 0;
}

/* ==========================================================
   STAT CARDS (Dashboard)
   ========================================================== */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-card) !important;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1) !important;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 180px;
    height: 180px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    pointer-events: none;
}

.stat-icon {
    font-size: 2.2rem;
    opacity: 0.85;
}

.x-small {
    font-size: 0.7rem;
}

.display-md-5 {
    font-size: 3rem;
}

/* ==========================================================
   BUTTONS — Surcharges minimales (Bootstrap 5 gère le reste)
   Tous les boutons utilisent btn-sm — taille compacte et uniforme
   ========================================================== */
.btn {
    font-weight: 500;
    transition: var(--transition);
    gap: 0.4rem;
}

/* btn-sm: taille et aspect personnalisés */
.btn-sm {
    min-height: 34px;
    font-size: 0.83rem;
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
}

.btn-primary:hover {
    background-color: #0a3d91;
    border-color: #0a3d91;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(13, 71, 161, 0.25);
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #bfa030;
    border-color: #bfa030;
    color: white;
}

/* ==========================================================
   TABLES
   ========================================================== */
.table-custom th {
    background-color: var(--accent-color);
    color: var(--primary-color);
    font-weight: 600;
    border: none;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.table-custom td {
    vertical-align: middle;
    font-size: 1rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 71, 161, 0.04);
}

/* ==========================================================
   BADGES
   ========================================================== */
.badge-custom {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 500;
}

/* ==========================================================
   ANIMATIONS
   ========================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.55s ease-out forwards;
}

/* ==========================================================
   PAGE HEADER
   ========================================================== */
.page-header {
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--secondary-color);
    padding-left: 1rem;
}

.page-title {
    font-family: 'Cinzel', serif;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 4px;
    font-size: clamp(1.1rem, 3vw, 1.6rem);
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* ==========================================================
   LOGIN PAGE
   ========================================================== */
.login-bg {
    background: radial-gradient(circle at center, #1a5cad 0%, #082d5a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: #ffffff;
    /* backdrop-filter supprimé : combiné avec overflow-x:hidden sur body
       il provoquait un voile sombre (ombrage) recouvrant le formulaire. */
    border-radius: 18px;
    padding: 2rem 2rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
}

/* ==========================================================
   HIGHLIGHT BOX
   ========================================================== */
.highlight-box {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid var(--primary-color);
}

/* ==========================================================
   CARD ACTION NEEDED
   ========================================================== */
.card-action-needed {
    border: 2px solid #ffc107;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.2);
    position: relative;
    overflow: hidden;
}

.card-action-needed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: #ffc107;
}

/* ==========================================================
   TIMELINE
   ========================================================== */
.timeline-wrapper {
    position: relative;
    padding: 20px 0;
    margin-bottom: 30px;
}

.timeline-steps {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.timeline-steps .timeline-step {
    align-items: center;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0 1.5rem;
}

.timeline-steps .timeline-content {
    width: 100px;
    text-align: center;
}

.timeline-steps .timeline-content .inner-circle {
    border-radius: 50%;
    height: 3rem;
    width: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #e9ecef;
    color: #fff;
    border: 2px solid #e9ecef;
    transition: var(--transition);
    font-weight: bold;
}

.timeline-steps .timeline-content .inner-circle.active {
    background-color: #fff;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.timeline-steps .timeline-content .inner-circle.completed {
    background-color: #198754;
    border-color: #198754;
}

.timeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 1.5rem;
    right: -2.5rem;
    width: 3rem;
    height: 3px;
    background-color: #e9ecef;
    z-index: -1;
}

.timeline-step.completed:not(:last-child)::after {
    background-color: #198754;
}

/* ==========================================================
   DATATABLES — Custom Responsive Controls
   ========================================================== */
.dataTables_filter input,
.dt-search input,
.dt-input {
    padding: 0.45rem 1rem !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    max-width: 100% !important;
    width: auto !important;
    flex-grow: 1;
}

.dataTables_filter,
.dt-search {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    width: 100% !important;
    justify-content: flex-end;
}

@media (max-width: 767.98px) {

    .dataTables_filter,
    .dt-search {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .dt-container .row:first-child>div {
        text-align: left !important;
    }
}

/* Reset default circle style */
table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control:before,
table.dataTable.dtr-inline.collapsed>tbody>tr>th.dtr-control:before {
    top: 50% !important;
    left: 12px !important;
    height: 1.2rem !important;
    width: 1.2rem !important;
    margin-top: -0.6rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    background-color: var(--primary-color) !important;
    content: '+' !important;
    font-family: Arial, sans-serif !important;
    font-weight: bold !important;
    font-size: 13px !important;
    text-indent: 0 !important;
    line-height: 1 !important;
    transition: var(--transition) !important;
}

table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td.dtr-control:before,
table.dataTable.dtr-inline.collapsed>tbody>tr.parent>th.dtr-control:before {
    content: '-' !important;
    background-color: var(--secondary-color) !important;
    transform: rotate(180deg);
}

table.dataTable.dtr-inline.collapsed>tbody>tr>td.dtr-control,
table.dataTable.dtr-inline.collapsed>tbody>tr>th.dtr-control {
    padding-left: 38px !important;
}

/* ==========================================================
   MODALS
   ========================================================== */
.modal-content {
    border-radius: 15px !important;
    border: none !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.18) !important;
    font-size: 14px !important;
}

.modal-header {
    background-color: var(--accent-color);
    border-bottom: 2px solid rgba(13, 71, 161, 0.08);
    border-radius: 15px 15px 0 0 !important;
    padding: 1rem 1.5rem !important;
}

.modal-title {
    font-family: 'Cinzel', serif;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem !important;
}

.modal-footer {
    border-top: 1px solid #eee;
    padding: 0.85rem 1.5rem !important;
}

.modal .form-label {
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.35rem;
}

.modal .form-control,
.modal .form-select {
    font-size: 16px !important;
    /* Prevents auto-zoom on iOS */
    padding: 0.65rem 0.85rem;
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    transition: var(--transition);
}

.modal .form-control:focus,
.modal .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 71, 161, 0.1);
}

.modal .btn {
    font-size: 14px !important;
    padding: 0.45rem 1.4rem;
    font-weight: 500;
}

/* ==========================================================
   ALERTS
   ========================================================== */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.9rem;
}

/* ==========================================================
   FOOTER
   ========================================================== */
footer {
    margin-top: auto;
}

/* ==========================================================
   RESPONSIVE — MOBILE (< 576px)
   ========================================================== */
@media (max-width: 575.98px) {
    .navbar-custom {
        padding: 0.45rem 0;
    }

    .navbar-logo {
        width: 38px !important;
        height: 38px !important;
    }

    .login-card {
        padding: 1.5rem 1.25rem;
        border-radius: 14px;
    }

    .stat-card {
        padding: 0.85rem !important;
    }

    .stat-card h2.display-6 {
        font-size: 1.5rem !important;
    }

    .stat-card .card-body {
        padding: 1.25rem !important;
    }

    .stat-icon,
    .stat-card .fs-3 {
        font-size: 1.6rem !important;
    }

    .stat-card .p-3.rounded-circle {
        padding: 0.6rem !important;
    }

    .page-header {
        margin-bottom: 1rem;
    }

    .card-custom .card-body {
        padding: 1rem !important;
    }

    .card-header-custom {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .table-custom th,
    .table-custom td {
        font-size: 0.78rem;
        padding: 0.45rem 0.5rem;
    }

    .btn-sm {
        padding: 0.3rem 0.55rem;
        font-size: 0.78rem;
    }

    .page-title {
        font-size: 1.1rem;
    }

    h2.page-title {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1rem !important;
    }

    .dataTables_filter input {
        min-width: 100% !important;
    }
}

/* ==========================================================
   RESPONSIVE — SMALL (576px – 767px)
   ========================================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .login-card {
        padding: 1.75rem 1.5rem;
    }

    .stat-card h2.display-6 {
        font-size: 1.75rem !important;
    }
}

/* ==========================================================
   RESPONSIVE — MEDIUM (768px – 991px)
   ========================================================== */
@media (min-width: 768px) and (max-width: 991.98px) {

    .dataTables_filter input,
    .dt-search input,
    .dt-input {
        min-width: 400px !important;
        width: 100% !important;
    }
}

/* ==========================================================
   RESPONSIVE — LARGE & UP (≥ 992px)
   ========================================================== */
@media (min-width: 992px) {

    .dataTables_filter input,
    .dt-search input,
    .dt-input {
        min-width: 550px !important;
        width: 100% !important;
    }
}

/* ==========================================================
   BACK TO TOP & JUMP NAV
   ========================================================== */
.jump-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.jump-link {
    font-size: 0.8rem;
    color: var(--primary-color);
    background: white;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(13, 71, 161, 0.1);
    font-weight: 500;
}

.jump-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.jump-link i {
    font-size: 0.9rem;
}

/* ==========================================================
   RESPONSIVE PRO — CONTAINER ADAPTATIF
   ========================================================== */
.container.mt-4.mb-5 {
    padding-left: clamp(0.75rem, 3vw, 1.5rem);
    padding-right: clamp(0.75rem, 3vw, 1.5rem);
}

/* ==========================================================
   RESPONSIVE PRO — PAGE HEADER ACTIONS (flex wrap)
   ========================================================== */
.page-actions-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.page-actions-bar .btn-group-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 575.98px) {
    .page-actions-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions-bar .btn-group-actions {
        width: 100%;
    }

    .page-actions-bar .btn-group-actions .btn {
        flex: 1 1 auto;
        min-width: 120px;
        font-size: 0.82rem;
        padding: 0.45rem 0.75rem;
    }

    /* Boutons d'action en haut de vue (d-flex flex-wrap gap-2) */
    .d-flex.flex-wrap.gap-2>.btn,
    .d-flex.flex-wrap.gap-2>a.btn {
        font-size: 0.82rem;
        padding: 0.4rem 0.7rem;
    }
}

/* ==========================================================
   RESPONSIVE PRO — FORMULAIRES (create/edit couples)
   ========================================================== */
@media (max-width: 767.98px) {

    /* Réduire les sections fieldset / card de formulaire */
    .card-custom .card-body .row>[class*="col-md"] {
        margin-bottom: 0.25rem;
    }

    /* Labels plus compacts dans les formulaires */
    .form-label {
        font-size: 0.82rem;
        margin-bottom: 0.25rem;
    }

    /* Champs de formulaire touch-friendly */
    .form-control,
    .form-select {
        font-size: 16px !important;
        /* Empêche le zoom iOS */
        min-height: 44px;
        padding: 0.55rem 0.85rem;
    }

    /* Input groups compacts */
    .input-group .input-group-text {
        padding: 0.45rem 0.65rem;
    }

    /* Sections de formulaire (tabs, steps) */
    .nav-tabs .nav-link {
        padding: 0.5rem 0.65rem;
        font-size: 0.82rem;
    }
}

@media (max-width: 575.98px) {

    /* Forcer les colonnes de formulaire sur mobile à pleine largeur */
    .row>.col-md-6,
    .row>.col-md-4,
    .row>.col-md-3,
    .row>.col-lg-4,
    .row>.col-lg-3 {
        /* On n'override pas Bootstrap — on améliore juste le padding */
        padding-bottom: 0.1rem;
    }

    /* Upload de fichier */
    input[type="file"].form-control {
        font-size: 0.82rem;
    }

    /* Textarea plus courtes sur mobile */
    textarea.form-control {
        min-height: 80px;
    }
}

/* ==========================================================
   RESPONSIVE PRO — TABLEAUX (thead caché sur mobile, cards)
   ========================================================== */
@media (max-width: 575.98px) {

    /* DataTables controls */
    .dt-layout-row {
        flex-direction: column !important;
        gap: 0.5rem;
    }

    .dt-layout-cell {
        width: 100% !important;
        text-align: left !important;
    }

    /* Info + pagination full width */
    .dt-info,
    .dt-paging {
        width: 100%;
        text-align: center !important;
    }

    /* Réduction boutons d'action dans les tableaux */
    .table .btn-group .btn-sm {
        padding: 0.3rem 0.45rem;
        font-size: 0.78rem;
    }

    /* Pagination DataTables compacte */
    .pagination .page-link {
        padding: 0.35rem 0.6rem;
        font-size: 0.82rem;
    }
}

/* ==========================================================
   RESPONSIVE PRO — SHOW DOSSIER (sections cards empilées)
   ========================================================== */
.section-card {
    border-radius: var(--border-radius-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.section-card .section-card-header {
    background: var(--accent-color);
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(13, 71, 161, 0.08);
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-card .section-card-body {
    padding: clamp(0.85rem, 2vw, 1.5rem);
}

@media (max-width: 767.98px) {

    /* Labels/valeurs empilés en colonne sur mobile */
    .info-row {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        margin-bottom: 0.75rem;
    }

    .info-label {
        font-size: 0.72rem;
        text-transform: uppercase;
        color: #6c757d;
        font-weight: 600;
        letter-spacing: 0.3px;
    }

    .info-value {
        font-size: 0.92rem;
        color: var(--text-dark);
    }

    /* Boutons d'action du dossier show en colonne */
    .show-actions-panel {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .show-actions-panel .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================
   RESPONSIVE PRO — TIMELINE (étapes dossier)
   ========================================================== */
@media (max-width: 767.98px) {
    .timeline-steps {
        flex-direction: row;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        gap: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .timeline-step {
        margin: 0 0.75rem;
        min-width: 70px;
    }

    .timeline-step:not(:last-child)::after {
        right: -1.75rem;
        width: 2rem;
    }

    .timeline-steps .timeline-content {
        width: 70px;
    }

    .timeline-steps .timeline-content .inner-circle {
        height: 2.4rem;
        width: 2.4rem;
        font-size: 0.8rem;
    }

    .timeline-steps .timeline-content p.text-muted {
        font-size: 0.68rem;
        margin-top: 0.25rem;
    }
}

/* ==========================================================
   RESPONSIVE PRO — MODAUX (plein écran sur mobile)
   ========================================================== */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }

    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl {
        margin: 0.25rem;
        max-width: calc(100vw - 0.5rem);
    }

    .modal-content {
        border-radius: 12px !important;
    }

    .modal-body {
        padding: 1rem !important;
        max-height: 70vh;
        overflow-y: auto;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 1rem !important;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ==========================================================
   RESPONSIVE PRO — CARDS DASHBOARD (stat cards)
   ========================================================== */
@media (max-width: 575.98px) {

    /* Grille 2 colonnes pour stat cards — Bootstrap gère le col-6 automatiquement */

    .stat-card .card-body {
        padding: 1rem !important;
    }

    .stat-card h2 {
        font-size: 1.5rem !important;
    }

    .stat-card p.text-white-50 {
        font-size: 0.75rem;
    }

    /* Charts et graphiques */
    canvas {
        max-height: 220px !important;
    }
}

/* ==========================================================
   RESPONSIVE PRO — NAVIGATION COLLAPSED (menu mobile)
   ========================================================== */
@media (max-width: 991.98px) {

    /* Nom paroisse dans navbar: tronquer */
    .navbar-brand-name {
        max-width: 160px;
        font-size: 0.85rem;
    }

    /* Dropdown dans navbar collapsed: inline */
    .navbar-collapse .dropdown-menu {
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border-radius: 8px !important;
        padding: 0.25rem 0.5rem !important;
        margin-top: 0.25rem !important;
    }

    .navbar-collapse .dropdown-item {
        color: rgba(255, 255, 255, 0.85) !important;
        border-radius: 6px;
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .navbar-collapse .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.12) !important;
        color: var(--secondary-color) !important;
    }

    .navbar-collapse .dropdown-item-text {
        color: rgba(255, 255, 255, 0.55) !important;
    }

    /* Séparateur invisible en mobile */
    .navbar-collapse hr.dropdown-divider {
        border-color: rgba(255, 255, 255, 0.15) !important;
    }
}

@media (max-width: 575.98px) {

    /* Navbar encore plus compacte sur petit écran */
    .navbar-collapse {
        margin-top: 0.35rem;
        padding: 0.6rem 0.75rem;
    }

    .navbar-logo {
        width: 36px !important;
        height: 36px !important;
    }
}

/* ==========================================================
   RESPONSIVE PRO — BANS (publications hebdomadaires)
   ========================================================== */
@media (max-width: 767.98px) {

    /* Colonnes publication 1/2/3 masquées sur mobile → DataTables responsive */
    .table-responsive {
        border-radius: 8px;
    }

    /* Filtres bans empilés */
    #banStatusFilter,
    #banProvenanceFilter {
        font-size: 0.85rem;
    }
}

/* ==========================================================
   RESPONSIVE PRO — REGISTRE & COMPTABILITÉ
   ========================================================== */
@media (max-width: 575.98px) {

    /* Header registre */
    .registre-header-bar {
        flex-direction: column;
        align-items: stretch;
    }

    /* Stats comptabilité en ligne */
    .comptabilite-stats .col-md-3 {
        margin-bottom: 0.5rem;
    }
}

/* ==========================================================
   RESPONSIVE PRO — IMPRIMER (print-friendly)
   ========================================================== */
@media print {

    .navbar-custom,
    .jump-nav,
    #backToTop,
    .btn-group,
    .modal,
    footer {
        display: none !important;
    }

    .container.mt-4.mb-5 {
        padding: 0 !important;
        margin: 0 !important;
    }

    .card-custom {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }

    .table-custom th {
        background-color: #f0f4ff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==========================================================
   RESPONSIVE PRO — TOUCH TARGETS (accessibilité mobile)
   ========================================================== */
@media (max-width: 767.98px) {

    /* Tout bouton/lien cliquable ≥ 44px (WCAG 2.1) */
    .btn,
    .nav-link,
    .dropdown-item,
    select.form-select,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
    }

    input[type="checkbox"],
    input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
        cursor: pointer;
    }

    /* Boutons sm dans les tableaux: zone de clic agrandie */
    .btn-sm {
        min-height: 36px;
        min-width: 36px;
        padding: 0.35rem 0.6rem;
    }

    /* Éviter le zoom sur focus iOS */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ==========================================================
   RESPONSIVE PRO — UTILITAIRES MOBILES
   ========================================================== */
/* Texte raccourci avec ellipsis */
.text-truncate-mobile {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Scroll horizontal doux */
.scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Cacher sur mobile uniquement */
@media (max-width: 575.98px) {
    .d-none-xs {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .d-none-sm {
        display: none !important;
    }
}

/* Afficher uniquement sur mobile */
@media (min-width: 576px) {
    .d-xs-only {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .d-sm-only {
        display: none !important;
    }
}

/* ==========================================================
   RESPONSIVE PRO — CORRECTIONS `show.php` COUPLES
   ========================================================== */
@media (max-width: 991.98px) {

    /* Sticky sidebar: désactivée, empilée */
    .sticky-top.show-sidebar {
        position: static !important;
        top: auto !important;
    }
}

@media (max-width: 767.98px) {

    /* Onglets du dossier (tabs) scrollables */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
        border-bottom-width: 1px;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs .nav-item {
        flex-shrink: 0;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    /* Boutons génération PDF dans show.php */
    .pdf-actions-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .pdf-actions-grid .btn {
        font-size: 0.78rem;
        padding: 0.4rem 0.5rem;
    }
}

/* ==========================================================
   SELECT2 B5 THEME TWEAKS
   ========================================================== */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 42px;
    /* Pour matcher form-control et touch target */
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #8bb4e7;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding-top: 0.45rem;
}

.select2-dropdown {
    z-index: 1060;
    /* Assure d'être au dessus des modaux bs5 (1055) */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.select2-results__option {
    padding: 0.5rem 1rem;
}

@media (max-width: 767.98px) {

    /* Sur mobile, on renforce le touch target pour Select2 */
    .select2-container--bootstrap-5 .select2-selection {
        min-height: 48px;
    }

    .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
        padding-top: 0.65rem;
        font-size: 16px;
        /* Prévenir zoom iOS */
    }

    .select2-results__option {
        padding: 0.75rem 1rem;
        /* Options plus hautes pour toucher large */
    }
}

@media (max-width: 575.98px) {
    .pdf-actions-grid {
        grid-template-columns: 1fr;
    }
}