/* ============================================
   CAISSE UFR-SEG — FCFA Banknote Premium
   Deep institutional green + monetary gold
   ============================================ */

/* --- Section 1: Variables and base --- */
:root {
    --primary: #1B4332;
    --primary-hover: #15372A;
    --primary-dark: #0F2921;
    --primary-light: #E8F0EC;
    --primary-border: #A7C4B5;
    --gold: #C8A951;
    --gold-hover: #B8993F;
    --gold-light: #FAF4E4;
    --gold-muted: #D4BC7A;
    --text-primary: #1A1A2E;
    --text-secondary: #3D4F5F;
    --text-muted: #7A8A97;
    --bg-page: #FAF9F6;
    --bg-card: #ffffff;
    --bg-hover: #F5F3EF;
    --bg-header: #F7F5F1;
    --border: #E0DDD6;
    --border-light: #EBE9E4;
    --success: #1B7A4A;
    --success-light: #DEF0E5;
    --warning: #B8860B;
    --warning-light: #FBF2DA;
    --danger: #C53030;
    --danger-light: #FDE8E8;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(26,26,46,0.05);
    --shadow: 0 2px 8px rgba(26,26,46,0.06), 0 1px 3px rgba(26,26,46,0.04);
    --shadow-lg: 0 8px 24px rgba(26,26,46,0.09);
    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
}
body {
    background-color: var(--bg-page);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

::selection { background: var(--primary); color: #fff; }
::-moz-selection { background: var(--primary); color: #fff; }

input, textarea { caret-color: var(--primary); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Section 2: App Layout (sidebar + topbar) --- */
.app-layout {
    display: flex; min-height: 100vh;
}

/* --- Sidebar --- */
.app-sidebar {
    width: 250px; background: var(--primary); color: #fff;
    display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; bottom: 0; z-index: 1040;
    transition: transform 0.25s ease;
    overflow-y: auto; overflow-x: hidden;
}
.app-sidebar::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--gold) 50%, transparent); border-radius: 3px; }
.app-sidebar::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--gold) 75%, transparent); }
.app-sidebar { scrollbar-color: color-mix(in srgb, var(--gold) 50%, transparent) transparent; scrollbar-width: thin; }

.sidebar-header {
    padding: 1.15rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff !important;
}
.sidebar-logo {
    width: 36px; height: 36px; border-radius: 8px; object-fit: cover;
    border: 1.5px solid rgba(200,169,81,0.3);
}
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name {
    font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
    letter-spacing: -0.01em; line-height: 1.2;
}
.sidebar-brand-sub { font-size: 0.62rem; color: rgba(255,255,255,0.4); font-weight: 500; letter-spacing: 0.3px; text-transform: uppercase; }

.sidebar-nav {
    flex: 1; padding: 0.5rem 0; overflow-y: auto;
}
.sidebar-section-label {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.8px; color: rgba(255,255,255,0.3);
    padding: 1rem 1.1rem 0.35rem; margin-top: 0.25rem;
}
.sidebar-section-label:first-child { margin-top: 0; }
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 0.45rem 1.1rem; margin: 1px 0.5rem;
    font-size: 0.82rem; font-weight: 500; border-radius: 8px;
    color: rgba(255,255,255,0.6); text-decoration: none;
    transition: all 0.15s ease;
}
.sidebar-link i { font-size: 0.9rem; width: 1.2em; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { color: rgba(255,255,255,0.95); background: rgba(255,255,255,0.08); }
.sidebar-link.active {
    color: var(--gold); background: rgba(200,169,81,0.12); font-weight: 600;
}

.sidebar-footer {
    padding: 0.85rem 1.1rem; border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(200,169,81,0.2); color: var(--gold);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
    border: 1.5px solid rgba(200,169,81,0.35);
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name {
    font-size: 0.78rem; font-weight: 600; color: rgba(255,255,255,0.9);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 0.6rem; margin-top: 1px; }

/* --- Topbar --- */
.app-main {
    flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh;
}
.app-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.65rem 1.5rem; background: var(--bg-card);
    border-bottom: 1px solid var(--border-light); position: sticky; top: 0; z-index: 1020;
    min-height: 48px;
}
.sidebar-toggle {
    background: none; border: none; font-size: 1.3rem; color: var(--text-secondary);
    padding: 0.25rem; cursor: pointer; margin-right: 0.5rem;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.topbar-greeting { font-size: 1.05rem; color: var(--text-secondary); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.topbar-user {
    display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-secondary) !important;
}
.topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
}
.app-content {
    flex: 1; padding: 1.25rem 1.5rem; max-width: 1320px; width: 100%;
}

/* --- Sidebar overlay (mobile) --- */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 1035;
}
.app-sidebar.open ~ .sidebar-overlay,
.app-sidebar.open + .app-main + .sidebar-overlay { display: block; }

/* --- Legacy navbar compat (kept for print hide) --- */
.navbar-app { display: none; }

/* --- Section 3: Page header, cards, stat cards --- */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding-bottom: 0; border-bottom: none;
}
.page-header h2 {
    font-family: var(--font-display); font-size: 1.35rem; font-weight: 700;
    color: var(--text-primary); margin: 0; letter-spacing: -0.02em;
}
.page-header .page-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.card { border: 1px solid var(--border-light); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); background: var(--bg-card); }
.card-header {
    background: var(--bg-card); border-bottom: 1px solid var(--border-light);
    font-weight: 600; font-size: 0.88rem; color: var(--text-primary); padding: 0.85rem 1.15rem;
}

.card-stat {
    border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); transition: transform 0.2s ease, box-shadow 0.2s ease; background: var(--bg-card);
}
.card-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-stat .card-body { padding: 1.15rem 1.35rem; }
.card-stat .stat-icon {
    width: 38px; height: 38px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.card-stat .stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.card-stat .stat-icon.green { background: var(--success-light); color: var(--success); }
.card-stat .stat-icon.yellow { background: var(--gold-light); color: var(--warning); }
.card-stat .stat-label {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); margin-bottom: 0.3rem; font-weight: 500;
}
.card-stat .stat-value {
    font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.card-stat .stat-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* --- Section 4: Filter chips --- */
.filter-chips {
    display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; align-items: center;
}
.filter-form {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 1rem;
}
.filter-row {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end;
}
.filter-form .chip, .filter-chips .chip {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.4rem 0.8rem; font-size: 0.8rem; color: var(--text-secondary);
    display: inline-flex; align-items: center; gap: 4px;
}
.filter-form .chip.active, .filter-chips .chip.active {
    background: var(--primary-light); border-color: var(--primary-border);
    color: var(--primary); font-weight: 500;
}
.filter-form .chip .chip-close, .filter-chips .chip .chip-close { cursor: pointer; font-size: 0.7rem; margin-left: 4px; opacity: 0.7; }
.filter-form .chip .chip-close:hover, .filter-chips .chip .chip-close:hover { opacity: 1; }
.filter-form .search-chip, .filter-chips .search-chip { flex: 0 1 200px; }
.filter-form .search-chip input, .filter-chips .search-chip input {
    border: none; background: transparent; outline: none;
    font-size: 0.8rem; color: var(--text-primary); width: 100%;
}
.filter-form .search-chip input::placeholder, .filter-chips .search-chip input::placeholder { color: var(--text-muted); }
.filter-form .filter-group {
    display: flex; flex-direction: column; gap: 3px;
}
.filter-form .filter-label {
    font-size: 0.68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; padding-left: 4px;
}
.filter-form .result-count { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }
.filter-form .filter-group .select2-container { display: inline-flex !important; max-width: 100%; }
.filter-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.filter-actions {
    display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0;
}
.btn-filter-apply {
    background: var(--primary); color: #fff; border: none; border-radius: var(--radius);
    padding: 0.45rem 1.2rem; font-size: 0.8rem; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    transition: background 0.15s;
}
.btn-filter-apply:hover { background: var(--primary-hover); color: #fff; }
.btn-filter-reset {
    background: transparent; color: var(--text-muted); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.45rem 1rem; font-size: 0.78rem; font-weight: 500;
    cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
    text-decoration: none; transition: all 0.15s;
}
.btn-filter-reset:hover { color: var(--danger); border-color: var(--danger); background: rgba(197,48,48,0.04); }
.filter-input {
    background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.4rem 0.75rem; font-size: 0.82rem; color: var(--text-secondary);
    width: 100%; outline: none; transition: border-color 0.15s; min-height: 38px;
}
.filter-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(27,67,50,0.08); }
select.filter-input {
    cursor: pointer; -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%237A8A97' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 12px;
    padding-right: 1.8rem;
}
.search-input {
    display: flex; align-items: center; gap: 6px;
}
.search-input i { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }
.search-input input {
    border: none; background: transparent; outline: none;
    font-size: 0.82rem; color: var(--text-primary); width: 100%;
}
.search-input input::placeholder { color: var(--text-muted); font-style: italic; }
.filter-form .filter-group .select2-container .select2-selection {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius) !important;
    padding: 0; font-size: 0.8rem; color: var(--text-secondary);
    min-height: 30px !important; height: 30px !important;
    display: flex !important; align-items: center !important;
}

/* --- DataTables integration --- */
.dataTables_wrapper { padding: 0; }
.dataTables_wrapper .dataTables_filter input {
    border-radius: var(--radius); border: 1px solid var(--border); padding: 0.4rem 0.85rem;
    font-size: 0.85rem; background: var(--bg-card); transition: border-color 0.15s;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(27,67,50,0.08); outline: none; }
div.dataTables_wrapper div.dataTables_length select {
    width: 100px; display: inline-block;
    border-radius: var(--radius); border: 1px solid var(--border); padding: 0.3rem 0.5rem; font-size: 0.82rem;
}
.dataTables_wrapper .dataTables_info { font-size: 0.78rem; color: var(--text-muted); padding: 0.5rem 0; }
.dataTables_wrapper .dataTables_paginate { padding: 0; white-space: nowrap; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important; font-size: 0.8rem; padding: 0 !important;
    margin: 0 1px !important; border: none !important; display: inline !important;
}
.dataTables_wrapper .dataTables_paginate span { padding: 0 !important; margin: 0 !important; }
.dataTables_wrapper .dataTables_paginate span .paginate_button { display: inline !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important; border-color: transparent !important;
    color: #fff !important; box-shadow: none;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
    background: var(--primary-light) !important; border-color: transparent !important; color: var(--primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: 0.4; }
.dataTables_wrapper .dataTables_filter label, .dataTables_wrapper .dataTables_length label { font-size: 0.82rem; color: var(--text-secondary); }
.table-wrapper .dataTables_wrapper { padding: 0.75rem; }
.table-wrapper .dataTables_wrapper table.dataTable { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }
.table-wrapper .dataTables_wrapper table.dataTable thead th {
    background: var(--bg-header); font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.3px; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); color: var(--text-muted);
}
.table-wrapper .dataTables_wrapper table.dataTable tbody td {
    padding: 0.6rem 0.85rem; vertical-align: middle; border-color: var(--border-light); font-size: 0.83rem;
}
.table-wrapper .dataTables_wrapper table.dataTable tbody tr:hover { background: var(--bg-hover); }
table.dataTable.no-footer { border-bottom: none !important; }
.dataTables_wrapper .dataTables_filter { margin-bottom: 0; }
.dataTables_wrapper .dataTables_length { margin-bottom: 0; }

/* Global placeholder */
::placeholder { color: var(--text-muted) !important; font-style: italic; opacity: 1; }
input::placeholder, textarea::placeholder { color: var(--text-muted) !important; font-style: italic; }
.filter-chips .result-count { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; }
.filter-chips select.chip, .filter-form select.chip {
    cursor: pointer; -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%237A8A97' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 12px;
    padding-right: 1.8rem;
}

select.chip {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.35rem 1.8rem 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: #fff;
    line-height: 1.4;
    transition: none;
}
select.chip.select2-hidden-accessible { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; }

/* --- Section 4b: Select2 integration --- */
.filter-chips .select2-container, .filter-form .select2-container { display: inline-flex !important; }
.filter-chips .select2-container .select2-selection, .filter-form .select2-container .select2-selection {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius) !important;
    padding: 0; font-size: 0.8rem; color: var(--text-secondary);
    min-height: 30px !important; height: 30px !important;
    display: flex !important; align-items: center !important;
}
.filter-chips .select2-container .select2-selection .select2-selection__rendered, .filter-form .select2-container .select2-selection .select2-selection__rendered {
    padding: 0.25rem 2.5rem 0.25rem 0.5rem; line-height: 1.4; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.select2-container--bootstrap-5 .select2-selection--single {
    display: flex !important; align-items: center !important;
    min-height: 38px !important; padding: 0.4rem 0.75rem !important;
    border-radius: var(--radius) !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-top: 0; padding-bottom: 0; line-height: normal;
}
.filter-chips .select2-container .select2-selection .select2-selection__clear, .filter-form .select2-container .select2-selection .select2-selection__clear {
    position: relative; top: 0; margin-right: 0.25rem; font-size: 1rem; font-weight: 400;
    line-height: 1; height: auto; width: auto; padding: 0;
}
.filter-chips .select2-container .select2-selection .select2-selection__arrow, .filter-form .select2-container .select2-selection .select2-selection__arrow { height: 100%; top: 0; }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
    position: absolute; right: 2rem; top: 50%; transform: translateY(-50%);
    font-size: 1rem; padding: 0 0.25rem; height: auto; width: auto;
}
.select2-container--bootstrap-5 .select2-dropdown { font-size: 0.85rem; border-color: var(--border); border-radius: var(--radius); }
.select2-container--bootstrap-5 .select2-results__option--highlighted { background: var(--primary) !important; }
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    font-size: 0.85rem; border-radius: var(--radius);
}
.select2-container--bootstrap-5 .select2-results__group {
    font-weight: 700; font-size: 0.78rem; color: var(--text-muted);
    background: none; padding: 0.4rem 0.75rem;
    border-top: 1px solid var(--border-light); margin-top: 0.15rem;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.select2-container--bootstrap-5 .select2-results__option--group {
    padding-left: 1.2rem; font-size: 0.82rem;
}

/* --- Section 5: Tables --- */
.table-wrapper {
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: visible;
}
.table-wrapper .table { margin: 0; font-size: 0.83rem; }
.table-wrapper .table thead th {
    background: var(--bg-header); color: var(--text-muted);
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.4px; padding: 0.7rem 0.85rem; border: none;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-wrapper .table thead th.sortable { cursor: pointer; user-select: none; }
.table-wrapper .table thead th.sortable:hover { color: var(--primary); }
.table-wrapper .table thead th .sort-icon { font-size: 0.65rem; margin-left: 3px; opacity: 0.4; }
.table-wrapper .table thead th.sorted .sort-icon { opacity: 1; color: var(--primary); }
.table-wrapper .table tbody td {
    padding: 0.65rem 0.85rem; vertical-align: middle;
    border-color: var(--border-light); color: var(--text-secondary);
}
.table-wrapper .table tbody tr:hover { background: var(--bg-hover); }
.table-wrapper .table-responsive { overflow: visible; }
.table-wrapper .dropdown-menu { z-index: 1050; }
.table-wrapper .table code {
    font-size: 0.78rem; color: var(--primary); background: var(--primary-light);
    padding: 0.15rem 0.5rem; border-radius: 4px;
}
.table-wrapper .montant {
    font-weight: 700; color: var(--gold-hover); white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.table-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.7rem 1rem; border-top: 1px solid var(--border-light);
    background: var(--bg-header); font-size: 0.8rem;
}
.table-footer .showing-info { color: var(--text-muted); font-size: 0.78rem; }
.table-footer .total-info { font-size: 0.85rem; color: var(--text-secondary); }
.table-footer .total-info strong {
    color: var(--gold-hover); font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

/* --- Section 6: Pagination --- */
.pagination .page-link {
    font-size: 0.8rem; color: var(--text-secondary); border-color: var(--border);
    padding: 0.3rem 0.65rem; border-radius: 4px; margin: 0 1px;
}
.pagination .page-item.active .page-link {
    background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
.pagination .page-item.disabled .page-link { color: var(--text-muted); }

/* --- Section 7: Buttons, forms, badges --- */
.btn-primary {
    background: var(--primary); border: none; border-radius: var(--radius);
    font-weight: 600; font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(27,67,50,0.2);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 6px rgba(27,67,50,0.25); }
.btn-outline-secondary { border-color: var(--border); color: var(--text-secondary); border-radius: var(--radius); font-size: 0.85rem; }
.btn-action {
    width: 30px; height: 30px; padding: 0; display: inline-flex;
    align-items: center; justify-content: center; border-radius: 6px; font-size: 0.8rem;
}
.btn-action.btn-outline-primary { background: var(--primary-light); border-color: transparent; color: var(--primary); }
.btn-action.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-action.btn-outline-danger { background: var(--danger-light); border-color: transparent; color: var(--danger); }
.btn-action.btn-outline-danger:hover { background: var(--danger); color: #fff; }

.form-control, .form-select {
    border-color: var(--border); border-radius: var(--radius); font-size: 0.88rem;
    background-color: #fff; color: var(--text-primary); color-scheme: light;
    min-height: 38px; padding: 0.4rem 0.75rem;
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(27,67,50,0.08); }
.form-label { font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.3rem; }

.badge-role { font-size: 0.7rem; padding: 0.25rem 0.55rem; font-weight: 600; border-radius: 4px; letter-spacing: 0.02em; }
.badge-caissier { background: var(--primary-light); color: var(--primary); }
.badge-super_caissier { background: var(--gold-light); color: #7A6520; }
.badge-admin { background: #F3E8F9; color: #6B21A8; }
.badge-directeur { background: #E8EEF9; color: #1E3A6B; }
.badge-gestionnaire_candidatures { background: #E0F0E6; color: #1B5E3A; }
.badge-status { font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 4px; }
.badge-actif { background: var(--success-light); color: var(--success); }
.badge-inactif { background: var(--border-light); color: var(--text-muted); }

/* --- Section 7b: Form polish --- */

/* Custom radio buttons — pill toggle group */
.form-check-input[type="radio"] {
    border-color: var(--border); width: 1.1em; height: 1.1em; margin-top: 0.19em;
    cursor: pointer;
}
.form-check-input[type="radio"]:checked {
    background-color: var(--primary); border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(27,67,50,0.12);
}
.form-check-input[type="radio"]:focus { box-shadow: 0 0 0 2px rgba(27,67,50,0.15); }
.form-check-label { cursor: pointer; font-size: 0.85rem; color: var(--text-secondary); }
.form-check-label i { color: var(--text-muted); margin-right: 1px; }
.form-check-input:checked + .form-check-label { color: var(--primary); font-weight: 600; }
.form-check-input:checked + .form-check-label i { color: var(--primary); }

/* Custom checkboxes */
.form-check-input[type="checkbox"] {
    border-color: var(--border); border-radius: 4px; width: 1.1em; height: 1.1em;
    cursor: pointer;
}
.form-check-input[type="checkbox"]:checked {
    background-color: var(--primary); border-color: var(--primary);
}
.form-check-input[type="checkbox"]:focus { box-shadow: 0 0 0 2px rgba(27,67,50,0.15); }

/* Switch */
.form-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* Form sections — better hr dividers */
form hr, .card-body hr {
    border-color: var(--border-light); opacity: 0.6; margin: 1.25rem 0;
}

/* Input group polish */
.input-group .form-control {
    border-color: var(--border);
}
.input-group .form-control:focus {
    z-index: 2; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(27,67,50,0.08);
}
.input-group .btn-primary {
    border-top-left-radius: 0; border-bottom-left-radius: 0;
}

/* Info box — theme-compatible callout */
.info-box, [style*="background:#f0f9ff"], [style*="background:#eff6ff"] {
    background: var(--primary-light) !important; border-color: var(--primary-border) !important;
}

/* Form card body refinements */
.card > .card-body > form .form-label {
    font-weight: 600; font-size: 0.82rem; color: var(--text-secondary);
    display: flex; align-items: center; gap: 4px;
}
.card > .card-body > form .form-label i { color: var(--text-muted); font-size: 0.85em; }
.card > .card-body > form .form-label small { font-weight: 400; }

/* Better form-control sizing for forms */
.card > .card-body > form .form-control,
.card > .card-body > form .form-select {
    padding: 0.4rem 0.75rem; font-size: 0.88rem; min-height: 38px;
    border-color: var(--border); transition: border-color 0.15s, box-shadow 0.15s;
}

/* Submit area */
.card > .card-body > form .btn-primary.w-100 {
    padding: 0.65rem; font-size: 0.92rem; font-weight: 700; letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(27,67,50,0.2);
}
.card > .card-body > form .btn-primary.w-100:hover {
    box-shadow: 0 4px 12px rgba(27,67,50,0.28); transform: translateY(-1px);
}
.card > .card-body > form .btn-outline-secondary.w-100 {
    font-size: 0.85rem; color: var(--text-muted); border-color: var(--border);
}

/* --- Section 7c: List & table polish --- */

/* Progress bars — theme colors */
.progress {
    height: 6px; border-radius: 3px; background: var(--border-light);
    overflow: hidden;
}
.progress-bar {
    background: var(--primary) !important; border-radius: 3px;
    transition: width 0.4s ease;
}
.progress-bar.bg-success { background: var(--success) !important; }
.progress-bar.bg-warning { background: var(--gold) !important; }
.progress-bar.bg-danger { background: var(--danger) !important; }

/* Scolarite progress text */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

/* Status select inline (in table rows) */
.table .form-select-sm, .table-wrapper .form-select-sm {
    font-size: 0.78rem; padding: 0.2rem 1.8rem 0.2rem 0.5rem;
    border-color: var(--border); border-radius: 6px;
    background-color: var(--bg-page); color: var(--text-secondary);
    min-width: 80px; cursor: pointer;
}
.table .form-select-sm:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(27,67,50,0.08); }

/* Action buttons in tables — refined */
.table .btn-action, .table-wrapper .btn-action {
    width: 30px; height: 30px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; font-size: 0.82rem; transition: all 0.15s;
}
.btn-action.btn-outline-info,
.btn-action.btn-outline-secondary {
    background: var(--bg-page); color: var(--text-muted); border: 1px solid var(--border-light);
}
.btn-action.btn-outline-info:hover,
.btn-action.btn-outline-secondary:hover {
    background: var(--primary-light); color: var(--primary); border-color: var(--primary-border);
}

/* Dropdown toggle dots button in tables */
.table .dropdown-toggle::after { display: none; }
.table .dropdown-menu {
    font-size: 0.82rem; border-color: var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 0.35rem 0;
}
.table .dropdown-item {
    font-size: 0.82rem; padding: 0.4rem 0.85rem; color: var(--text-secondary);
}
.table .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.table .dropdown-item i { width: 1.2em; text-align: center; margin-right: 6px; }
.table .dropdown-item.text-danger:hover { background: var(--danger-light); color: var(--danger); }

/* Student name in table — bolder */
.table tbody td strong, .table-wrapper .table tbody td strong {
    color: var(--text-primary); font-weight: 600;
}
.table tbody td small, .table-wrapper .table tbody td small {
    color: var(--text-muted); font-size: 0.75rem;
}

/* Empty state */
.empty-state {
    text-align: center; padding: 3rem 1.5rem; color: var(--text-muted);
}
.empty-state i {
    font-size: 2.5rem; color: var(--border); margin-bottom: 0.75rem; display: block;
}
.empty-state p {
    font-size: 0.9rem; margin: 0; color: var(--text-muted);
}
.empty-state .btn { margin-top: 1rem; }

/* --- Section 8: Modals --- */
.modal-content { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-backdrop.show { opacity: 0.35; }
.modal-header { background: var(--bg-card); border-bottom: 1px solid var(--border-light); padding: 0.85rem 1.15rem; }
.modal-title {
    font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
    color: var(--text-primary); letter-spacing: -0.01em;
}
.modal-body { padding: 1.15rem; }
.modal-body .form-label { font-size: 0.8rem; }
.modal-body .form-control, .modal-body .form-select { font-size: 0.85rem; }
.modal-footer { background: var(--bg-card); border-top: 1px solid var(--border-light); padding: 0.75rem 1.15rem; }

/* --- Section 9: Login --- */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: stretch;
    background: var(--primary);
    position: relative; overflow: hidden;
}
.login-panel {
    flex: 1; display: flex; align-items: center; justify-content: center;
    position: relative; z-index: 1;
    background: url('../images/campus_login.png') center/cover no-repeat;
}
.login-panel::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(15,41,33,0.4) 0%, rgba(27,67,50,0.35) 50%, rgba(15,41,33,0.45) 100%);
}
.login-panel-content { text-align: center; color: #fff; max-width: 360px; padding: 2rem; position: relative; z-index: 1; }
.login-panel-logo {
    width: 100px; height: auto; border-radius: 12px; object-fit: contain;
    margin-bottom: 1.5rem; border: 2px solid rgba(200,169,81,0.3);
}
.login-panel-title {
    font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
    margin: 0 0 0.3rem; letter-spacing: -0.02em;
}
.login-panel-sub {
    font-size: 0.85rem; color: rgba(255,255,255,0.6); margin: 0 0 1.5rem;
}
.login-panel-divider {
    width: 60px; height: 2px; background: var(--gold); margin: 0 auto 1.5rem; border-radius: 1px;
}
.login-panel-desc {
    font-size: 0.82rem; color: rgba(255,255,255,0.45); line-height: 1.6; margin: 0;
}
.login-wrapper::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(200,169,81,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(200,169,81,0.05) 0%, transparent 50%);
}
.login-wrapper::after {
    content: ''; position: absolute; inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 40px,
        rgba(255,255,255,0.015) 40px,
        rgba(255,255,255,0.015) 41px
    );
}
.login-badge {
    width: 52px; height: 52px; border-radius: 14px;
    background: var(--primary); color: var(--gold);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.4rem; margin-bottom: 0.75rem;
}
.login-card {
    background: #fff; border-radius: 0;
    box-shadow: -8px 0 40px rgba(0,0,0,0.15);
    width: 100%; max-width: 520px; padding: 3rem 3.5rem;
    position: relative; z-index: 1;
    display: flex; flex-direction: column; justify-content: center;
    min-height: 100vh;
}
.login-card .logo-section { text-align: center; margin-bottom: 2rem; }
.login-card .logo-section .login-logo {
    width: 72px; height: auto; border-radius: 0; object-fit: contain;
    margin-bottom: 0.75rem;
}
.login-card .logo-section .brand-icon {
    background: var(--primary); color: var(--gold); width: 48px; height: 48px;
    border-radius: 10px; display: inline-flex; align-items: center;
    justify-content: center; font-size: 20px; font-weight: 700; margin-bottom: 0.75rem;
}
.login-card .logo-section h4 {
    font-family: var(--font-display); color: var(--text-primary);
    font-weight: 700; font-size: 1.25rem; margin: 0; letter-spacing: -0.02em;
}
.login-card .logo-section .login-subtitle { color: var(--text-muted); font-size: 0.82rem; display: block; margin-top: 0.25rem; }
.login-card .form-label { font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); }
.login-card .form-control {
    border-radius: 8px; border: 1px solid var(--border); padding: 0.6rem 0.85rem;
    font-size: 0.9rem; transition: border-color 0.15s;
}
.login-card .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(27,67,50,0.08); }
.login-card .btn-primary {
    background: var(--primary); border: none;
    padding: 0.7rem; font-weight: 700; border-radius: 8px; font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(27,67,50,0.25); transition: all 0.15s;
}
.login-card .btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(27,67,50,0.3); transform: translateY(-1px); }
.login-card .login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.72rem; color: var(--text-muted); }

@media (max-width: 767.98px) {
    .login-panel { display: none; }
    .login-card {
        max-width: 100%; border-radius: 0; min-height: 100vh;
        padding: 2rem 1.5rem; box-shadow: none;
    }
}

/* --- Section 10: Student search, charts, perf bars, recent items, alerts --- */
.student-search-results {
    position: absolute; z-index: 1000; width: 100%; max-height: 250px;
    overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); display: none;
}
.student-search-results .list-group-item {
    cursor: pointer; font-size: 0.85rem; padding: 0.55rem 0.85rem; border-color: var(--border-light);
}
.student-search-results .list-group-item:hover { background: var(--primary-light); }

.chart-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.15rem; border: 1px solid var(--border-light); box-shadow: var(--shadow-sm); }
.chart-card .chart-title {
    font-family: var(--font-display); font-size: 0.9rem; font-weight: 600;
    color: var(--text-primary); margin-bottom: 1rem;
}
.chart-card .chart-toggle { display: flex; gap: 4px; }
.chart-card .chart-toggle .toggle-btn {
    font-size: 0.72rem; padding: 0.25rem 0.6rem; border-radius: 4px;
    cursor: pointer; color: var(--text-muted); border: none; background: none;
}
.chart-card .chart-toggle .toggle-btn.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }

.perf-item { margin-bottom: 0.65rem; }
.perf-item .perf-header { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 0.25rem; }
.perf-item .perf-header .perf-name { color: var(--text-primary); }
.perf-item .perf-header .perf-amount { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.perf-bar { height: 6px; background: var(--border-light); border-radius: 3px; overflow: hidden; }
.perf-bar .perf-fill { height: 100%; border-radius: 3px; }

.recent-item { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border-light); }
.recent-item:last-child { border-bottom: none; }
.recent-item .recent-name { font-size: 0.83rem; color: var(--text-primary); font-weight: 500; }
.recent-item .recent-time { font-size: 0.72rem; color: var(--text-muted); }
.recent-item .recent-amount { font-size: 0.83rem; font-weight: 600; color: var(--gold-hover); font-variant-numeric: tabular-nums; }

.alert { font-size: 0.85rem; border-radius: var(--radius); border: none; padding: 0.65rem 2.5rem 0.65rem 1rem; }
.alert .btn-close { padding: 0.75rem; font-size: 0.65rem; top: 50%; transform: translateY(-50%); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); }
.alert-warning { background: var(--warning-light); color: #7A5200; }

/* --- Section 10b: Dashboard --- */
.dash-figures {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 0.85fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.dash-fig {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
    min-width: 0;
}
.dash-fig-label {
    font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 0.4rem;
}
.dash-fig-value {
    font-size: 1.15rem; font-weight: 800; color: var(--text-primary);
    font-variant-numeric: tabular-nums; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-fig-unit {
    font-size: 0.55em; font-weight: 500; color: var(--text-muted); margin-left: 1px;
}
.dash-fig-sub {
    font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem;
}
.dash-fig--lead .dash-fig-value {
    font-size: 1.65rem; color: var(--gold-hover);
}
.dash-fig--lead .dash-fig-unit { color: var(--gold-muted); }

.dash-var {
    display: inline-flex; align-items: center; gap: 2px;
    font-size: 0.72rem; font-weight: 600;
    padding: 0.1rem 0.4rem; border-radius: 4px; margin-top: 0.3rem;
}
.dash-var--up { color: var(--success); background: var(--success-light); }
.dash-var--down { color: var(--danger); background: var(--danger-light); }
.dash-var--flat { color: var(--text-muted); background: var(--bg-header); }

.dash-notices {
    display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.dash-notice {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.85rem; border-radius: var(--radius);
    font-size: 0.78rem; font-weight: 600; text-decoration: none;
    transition: opacity 0.15s; flex: 1; min-width: 160px;
}
.dash-notice:hover { opacity: 0.85; }
.dash-notice--warning { background: var(--gold-light); color: var(--warning); border: 1px solid rgba(200,169,81,0.3); }
.dash-notice--danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(197,48,48,0.15); }
.dash-notice--info { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.dash-notice i { font-size: 0.9rem; }
.dash-notice-count { font-size: 1.05rem; font-weight: 800; }

.dash-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
}
.row .dash-panel { height: 100%; }
.dash-panel-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem;
}
.dash-panel-title {
    font-weight: 700; font-size: 0.85rem; color: var(--text-primary);
    display: flex; align-items: center; gap: 0.4rem;
}
.dash-panel-title i { color: var(--text-muted); font-size: 0.85rem; }
.dash-panel-link {
    font-size: 0.72rem; color: var(--primary); text-decoration: none;
    font-weight: 500; display: flex; align-items: center; gap: 3px;
}
.dash-panel-link:hover { color: var(--primary-hover); }

.dash-pipeline {
    display: flex; margin-bottom: 1rem; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
}
.dash-pipe-step {
    flex: 1; text-align: center; padding: 0.75rem 0.5rem; min-width: 0;
}
.dash-pipe-step + .dash-pipe-step { border-left: 1px solid var(--border-light); }
.dash-pipe-value {
    font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2;
}
.dash-pipe-label {
    font-size: 0.6rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.3px; margin-top: 0.15rem;
}
.dash-pipe-bar {
    height: 3px; background: var(--border-light); border-radius: 1.5px;
    margin-top: 0.4rem; overflow: hidden;
}
.dash-pipe-fill {
    height: 100%; border-radius: 1.5px; transition: width 0.6s ease;
}

.dash-recovery {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem; margin-bottom: 0.75rem; text-align: center;
}
.dash-recovery-label {
    font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.3px; color: var(--text-muted);
}
.dash-recovery-value {
    font-size: 1.1rem; font-weight: 800; color: var(--text-primary);
    font-variant-numeric: tabular-nums; margin-top: 0.15rem;
}
.dash-progress {
    height: 8px; background: var(--bg-header); border-radius: 4px; overflow: hidden;
}
.dash-progress-fill {
    height: 100%; border-radius: 4px; transition: width 0.8s ease;
}

.dash-activity-item {
    display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0;
}
.dash-activity-item + .dash-activity-item { border-top: 1px solid var(--border-light); }
.dash-activity-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.dash-activity-info { flex: 1; min-width: 0; }
.dash-activity-name {
    font-weight: 600; font-size: 0.82rem; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-activity-meta { font-size: 0.68rem; color: var(--text-muted); }
.dash-activity-amount {
    font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}

.dash-perf-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.75rem;
}
.dash-perf-item {
    background: var(--bg-header); border-radius: var(--radius); padding: 0.65rem 0.85rem;
}
.dash-perf-head {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem;
}
.dash-perf-name { font-weight: 600; font-size: 0.82rem; color: var(--text-primary); }
.dash-perf-amount { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.dash-perf-bar {
    height: 5px; background: var(--border); border-radius: 2.5px; overflow: hidden;
}
.dash-perf-fill { height: 100%; border-radius: 2.5px; transition: width 0.5s ease; }
.dash-perf-sub { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.2rem; }

.dash-empty {
    text-align: center; padding: 2rem 1rem; color: var(--text-muted);
}
.dash-empty i { font-size: 1.5rem; color: var(--border); display: block; margin-bottom: 0.5rem; }
.dash-empty span { font-size: 0.82rem; }

.dash-legend-item {
    display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; margin-bottom: 0.25rem;
}
.dash-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dash-legend-label { flex: 1; color: var(--text-secondary); }
.dash-legend-pct { font-weight: 600; color: var(--text-primary); }

.dash-mode-badge {
    display: inline-flex; align-items: center;
    padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.68rem;
}

.dash-table { font-size: 0.8rem; }
.dash-table thead th {
    font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.3px; color: var(--text-muted); padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border); background: none; border-top: none;
}
.dash-table tbody td {
    padding: 0.5rem 0.65rem; vertical-align: middle;
    border-color: var(--border-light); color: var(--text-secondary);
}
.dash-table tbody tr:hover { background: var(--bg-hover); }
.dash-table .montant { font-weight: 700; color: var(--gold-hover); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-table .dash-student { font-weight: 600; font-size: 0.78rem; color: var(--text-primary); }

/* --- Section 11: Mobile responsive --- */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
    .app-main { margin-left: 0; }
    .app-content { padding: 1rem; }
    .dash-figures { grid-template-columns: 1fr 1fr; }
    .dash-pipeline { flex-wrap: wrap; }
    .dash-pipe-step { flex: 1 1 calc(33% - 1px); }
}
@media (max-width: 767.98px) {
    body { font-size: 0.85rem; }
    .container-fluid { padding: 0.75rem !important; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-bottom: 1rem; }
    .page-header h2 { font-size: 1.15rem; }
    .page-header .btn, .page-header .d-flex { width: 100%; }
    .page-header .d-flex { flex-wrap: wrap; }
    .dash-figures { grid-template-columns: 1fr; }
    .dash-fig--lead .dash-fig-value { font-size: 1.35rem; }
    .dash-notices { flex-direction: column; }
    .dash-notice { min-width: unset; }
    .dash-pipeline { flex-wrap: wrap; }
    .dash-pipe-step { flex: 1 1 calc(50% - 1px); }
    .dash-pipe-step + .dash-pipe-step { border-left: none; border-top: 1px solid var(--border-light); }
    .dash-recovery { grid-template-columns: 1fr; gap: 0.5rem; }

    .filter-chips, .filter-form { gap: 6px; }
    .filter-chips .chip, .filter-form .chip { font-size: 0.75rem; padding: 0.3rem 0.6rem; }
    .filter-chips .search-chip, .filter-form .search-chip { flex: 1 1 100%; }
    .filter-chips select.chip, .filter-form select.chip { flex: 1 1 calc(50% - 6px); }
    .filter-chips .result-count, .filter-form .result-count { width: 100%; text-align: right; margin-left: 0; }
    .filter-row { gap: 6px; }

    .table-wrapper { border-radius: var(--radius); }
    .table-wrapper .table thead th { font-size: 0.65rem; padding: 0.5rem 0.5rem; letter-spacing: 0; }
    .table-wrapper .table tbody td { font-size: 0.78rem; padding: 0.5rem 0.5rem; }
    .table-wrapper .table-responsive { -webkit-overflow-scrolling: touch; }

    .btn-action { width: 28px; height: 28px; font-size: 0.75rem; }
    .btn-sm { font-size: 0.78rem; padding: 0.3rem 0.6rem; }

    .modal-dialog { margin: 0.5rem; }
    .modal-body { padding: 0.85rem; }
    .modal-body .row > div { margin-bottom: 0.25rem; }

    .card-stat .card-body { padding: 0.85rem; }
    .card-stat .stat-value { font-size: 1.2rem; }
    .card-stat .stat-label { font-size: 0.65rem; }

    .chart-card { padding: 0.85rem; }

    .pagination .page-link { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
    .dataTables_wrapper .dataTables_paginate .paginate_button { font-size: 0.75rem; }

    .row.g-2 > .col, .row.g-2 > [class*="col-"],
    .row.g-3 > .col, .row.g-3 > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
}
@media (max-width: 575.98px) {
    .container-fluid { padding: 0.5rem !important; }
    .page-header h2 { font-size: 1rem; }
    .table-wrapper .table thead th { font-size: 0.6rem; padding: 0.4rem; }
    .table-wrapper .table tbody td { font-size: 0.75rem; padding: 0.4rem; }
    .filter-chips select.chip, .filter-form select.chip { flex: 1 1 100%; }
    .hide-xs { display: none !important; }
}

/* ============ Print point button ============ */
.btn-print-point {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.25rem 0.5rem; font-size: 0.875rem; font-weight: 600;
    color: #fff; background: var(--primary);
    border: none; border-radius: 8px; cursor: pointer;
    box-shadow: 0 1px 4px rgba(27,67,50,0.25);
    transition: all 0.15s;
}
.btn-print-point:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(27,67,50,0.3);
    transform: translateY(-1px); color: #fff;
}
.btn-print-point:active {
    transform: translateY(0); box-shadow: 0 1px 2px rgba(27,67,50,0.2);
}
.btn-print-point i { font-size: 0.9rem; }

/* ============ Bilan financier (screen) ============ */
.bilan-print-header,
.bilan-print-signature { display: none; }

.bilan-summary {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; margin-bottom: 1.25rem;
}
.bilan-card {
    background: var(--bg-page); border-radius: 8px; padding: 0.85rem 1rem; text-align: center;
    border: 1px solid var(--border-light);
}
.bilan-card-paye { background: var(--gold-light); border-color: var(--gold-muted); }
.bilan-card-danger { background: var(--danger-light); border-color: #F5B4B4; }
.bilan-card-success { background: var(--success-light); border-color: #A3D9BA; }
.bilan-card-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.15rem; text-transform: uppercase; letter-spacing: 0.3px; }
.bilan-card-value { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.bilan-card-paye .bilan-card-value { color: var(--gold-hover); }
.bilan-card-danger .bilan-card-value { color: var(--danger); }
.bilan-card-success .bilan-card-value { color: var(--success); }

.bilan-table { font-size: 0.85rem; }
.bilan-tfoot td {
    background: var(--bg-header); border-top: 2px solid var(--border) !important; font-size: 0.85rem;
}

/* ============ Screen-only: hide print elements ============ */
.print-header,
.print-tfoot,
.print-signature,
.col-print-num { display: none; }

@media print {
    /* ---- Base reset ---- */
    @page { margin: 8mm 10mm; size: A4 landscape; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    body { background: #fff !important; color: #000 !important; font-size: 11px !important; }
    a[href]:after { content: none !important; }

    /* ---- Hide non-print elements ---- */
    .no-print, .navbar-app, .app-sidebar, .app-topbar, .sidebar-overlay, .alert, .filter-chips, .filter-form, .filter-bar,
    .daily-recap, .page-header, .col-actions,
    .pagination, .modal, .modal-backdrop,
    #app-loader { display: none !important; }
    #candidatures-panel { background: none !important; border: none !important; padding: 0 !important; border-radius: 0 !important; }

    /* ---- Container full width ---- */
    .container-fluid { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; max-width: 100% !important; }

    /* ---- Print header (official document) ---- */
    .print-header { display: block !important; margin-bottom: 0.5rem; }
    .print-header-top {
        display: flex; justify-content: space-between; align-items: center;
        border-bottom: 2px solid #000; padding-bottom: 0.5rem; margin-bottom: 0.4rem;
    }
    .print-header-left, .print-header-right {
        font-size: 0.72rem; text-align: center; line-height: 1.4; flex: 1;
    }
    .print-header-center { flex: 0 0 70px; text-align: center; }
    .print-logo { width: 55px; height: auto; }
    .print-title {
        text-align: center; font-size: 1rem; font-weight: 700;
        text-decoration: underline; text-transform: uppercase;
        margin: 0.4rem 0 0.25rem;
    }
    .print-meta {
        text-align: center; font-size: 0.75rem; color: #333;
        margin-bottom: 0.5rem; line-height: 1.5;
    }
    .print-filters { font-weight: 600; margin-bottom: 0.15rem; }

    /* ---- Numbering column ---- */
    .col-print-num { display: table-cell !important; width: 30px; text-align: center; }

    /* ---- Table ---- */
    .table-wrapper {
        box-shadow: none !important; border-radius: 0 !important;
        border: none !important; overflow: visible !important;
    }
    .table-responsive { overflow: visible !important; }
    .table {
        border-collapse: collapse !important; width: 100% !important;
        font-size: 0.75rem !important; margin: 0 !important;
    }
    .table thead th {
        background: #e9ecef !important; border: 1px solid #000 !important;
        padding: 0.3rem 0.4rem !important; font-weight: 700 !important;
        font-size: 0.73rem !important; white-space: nowrap;
    }
    .table tbody td {
        border: 1px solid #999 !important; padding: 0.25rem 0.4rem !important;
        vertical-align: middle !important; font-size: 0.73rem !important;
        color: #000 !important;
    }
    .table tbody tr:nth-child(even) td { background: #f5f5f5 !important; }
    .table .sort-icon { display: none !important; }
    .table .montant { font-weight: 600 !important; white-space: nowrap; }
    .table code { font-size: 0.68rem !important; color: #000 !important; background: none !important; }
    .table .badge { font-size: 0.6rem !important; padding: 0.15rem 0.35rem !important; }

    /* ---- Table footer (total) ---- */
    .print-tfoot { display: table-footer-group !important; }
    .print-tfoot td {
        border: 1px solid #000 !important; border-top: 2px solid #000 !important;
        padding: 0.35rem 0.4rem !important; font-size: 0.8rem !important;
        background: #e9ecef !important;
    }
    .table-footer { display: none !important; }

    /* ---- Signature block ---- */
    .print-signature {
        display: flex !important; justify-content: flex-end;
        margin-top: 1.5rem; padding-right: 1rem;
    }
    .print-signature-block { text-align: center; }
    .print-signature-label { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; }
    .print-signature-space {
        width: 180px; height: 70px; border: 1px solid #000;
        margin: 0 auto;
    }

    /* ---- Modal print (bilan financier) ---- */
    body.printing-modal > *:not(.printing-target) { display: none !important; }
    body.printing-modal .modal-backdrop { display: none !important; }
    body.printing-modal .printing-target {
        display: block !important;
        position: static !important; width: 100% !important;
        overflow: visible !important; background: #fff !important;
        height: auto !important; padding: 0 !important;
    }
    body.printing-modal .printing-target .modal-dialog {
        display: block !important;
        max-width: 100% !important; margin: 0 !important;
        height: auto !important; padding: 0 !important;
    }
    body.printing-modal .printing-target .modal-content {
        display: block !important;
        border: none !important; box-shadow: none !important;
        height: auto !important; padding: 0 !important;
    }
    body.printing-modal .printing-target .modal-body {
        display: block !important;
        padding: 0 !important; height: auto !important; overflow: visible !important;
    }
    body.printing-modal .printing-target .modal-header { display: none !important; }
    body.printing-modal .printing-target .modal-footer { display: none !important; }
    body.printing-modal #bilan-loading { display: none !important; }

    body.printing-modal .bilan-print-header {
        display: block !important; margin-bottom: 0.5rem;
    }
    body.printing-modal .bilan-print-header .print-header-top {
        display: flex; justify-content: space-between; align-items: center;
        border-bottom: 2px solid #000; padding-bottom: 0.5rem; margin-bottom: 0.4rem;
    }
    body.printing-modal .bilan-print-header .print-header-left,
    body.printing-modal .bilan-print-header .print-header-right {
        font-size: 0.72rem; text-align: center; line-height: 1.4; flex: 1;
    }
    body.printing-modal .bilan-print-header .print-header-center { flex: 0 0 70px; text-align: center; }
    body.printing-modal .bilan-print-header .print-logo { width: 55px; height: auto; }
    body.printing-modal .bilan-print-header .print-title {
        text-align: center; font-size: 1rem; font-weight: 700;
        text-decoration: underline; text-transform: uppercase; margin: 0.4rem 0 0.25rem;
    }
    body.printing-modal .bilan-print-header .print-meta {
        text-align: center; font-size: 0.75rem; color: #333; margin-bottom: 0.5rem; line-height: 1.5;
    }
    body.printing-modal .bilan-print-signature {
        display: flex !important; justify-content: flex-end;
        margin-top: 2rem; padding-right: 1rem;
    }
    body.printing-modal .bilan-sig-block { text-align: center; }
    body.printing-modal .bilan-sig-label { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; }
    body.printing-modal .bilan-sig-space { width: 180px; height: 70px; border: 1px solid #000; margin: 0 auto; }

    body.printing-modal .bilan-summary {
        display: flex !important; gap: 1rem; margin-bottom: 1rem;
    }
    body.printing-modal .bilan-card {
        flex: 1; display: block !important; border: 1px solid #000; border-radius: 0;
        padding: 0.5rem; text-align: center;
    }
    body.printing-modal .bilan-card-label { font-size: 0.7rem; }
    body.printing-modal .bilan-card-value { font-size: 0.9rem; font-weight: 700; }

    body.printing-modal .bilan-table {
        display: table !important;
        border-collapse: collapse !important; width: 100% !important; font-size: 0.8rem !important;
    }
    body.printing-modal .bilan-table thead { display: table-header-group !important; }
    body.printing-modal .bilan-table tbody { display: table-row-group !important; }
    body.printing-modal .bilan-table tfoot { display: table-footer-group !important; }
    body.printing-modal .bilan-table tr { display: table-row !important; }
    body.printing-modal .bilan-table th,
    body.printing-modal .bilan-table td { display: table-cell !important; }
    body.printing-modal .bilan-table thead th {
        background: #e9ecef !important; border: 1px solid #000 !important;
        padding: 0.3rem 0.5rem !important; font-weight: 700 !important; font-size: 0.78rem !important;
    }
    body.printing-modal .bilan-table tbody td {
        border: 1px solid #999 !important; padding: 0.25rem 0.5rem !important;
        color: #000 !important; font-size: 0.78rem !important;
    }
    body.printing-modal .bilan-table tbody tr:nth-child(even) td { background: #f5f5f5 !important; }
    body.printing-modal .bilan-tfoot td {
        border: 1px solid #000 !important; border-top: 2px solid #000 !important;
        background: #e9ecef !important; font-size: 0.8rem !important; padding: 0.35rem 0.5rem !important;
    }
    body.printing-modal .bilan-table .badge {
        display: inline-block !important;
    }

    body.printing-modal .print-header { display: none !important; }
    body.printing-modal .print-signature { display: none !important; }
}
