/* ============================================================
   Scoliom Scolarité — feuille de style application
   Identité : violet Majorelle #6050DC → #a855f7
   Fonts : Plus Jakarta Sans (titres) + Inter (texte)
   © 2026 Scoliom — une marque d'ABC IT SARL AU
   ============================================================ */

/* ===== POLICES AUTO-HÉBERGÉES =====
   Plus Jakarta Sans + Inter (fontes variables, sous-ensembles latin et
   latin étendu) servies depuis assets/fonts/ — aucune requête vers un
   CDN tiers, aucune adresse IP transmise à un prestataire externe. */
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url(../fonts/plus-jakarta-sans-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url(../fonts/plus-jakarta-sans-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url(../fonts/plus-jakarta-sans-italic-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-weight: 700;
    font-display: swap;
    src: url(../fonts/plus-jakarta-sans-italic-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(../fonts/inter-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(../fonts/inter-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== RESET & VARIABLES ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --violet:        #6050DC;
    --violet-d:      #4a3cc0;
    --violet-l:      #8b7aff;
    --violet-xl:     #f0edff;
    --violet-xxl:    #f5f3ff;
    --violet-card:   #e8e4ff;
    --dark:          #1a1040;
    --dark-alt:      #0f0c2a;
    --white:         #ffffff;
    --off-white:     #fafafa;
    --text:          #1a1040;
    --text-muted:    #5a5a72;
    --success:       #16a34a;
    --error:         #b91c1c;
    --border:        rgba(96,80,220,.12);
    --sh-sm:         0 1px 4px rgba(96,80,220,.08);
    --sh-md:         0 4px 16px rgba(96,80,220,.13);
    --sh-lg:         0 12px 40px rgba(96,80,220,.18);
    --sh-xl:         0 24px 60px rgba(96,80,220,.22);
    --sh-violet:     0 8px 28px rgba(96,80,220,.35);
    --grad:          linear-gradient(135deg, #6050DC 0%, #8b6cff 60%, #a855f7 100%);
    /* Dégradé assombri : garantit un contraste ≥ 4.5:1 avec du texte blanc
       (WCAG AA) sur toute la plage — pour boutons et cartes à texte blanc */
    --grad-deep:     linear-gradient(135deg, #4a3cc0 0%, #6050DC 45%, #7c3aed 100%);
}

/* ===== BASE ===== */
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--off-white);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    line-height: 1.2;
    color: var(--dark);
}

h1 { font-size: 1.55rem; letter-spacing: -0.02em; }
h2 { font-size: 1.3rem;  letter-spacing: -0.015em; }
h3 { font-size: 1.1rem;  letter-spacing: -0.01em; }
h4 { font-size: 1rem; }

a { color: var(--violet); text-decoration: none; }
a:hover { color: var(--violet-d); }

img, svg { max-width: 100%; vertical-align: middle; }

/* ===== ACCESSIBILITÉ ===== */
:focus-visible {
    outline: 3px solid rgba(96,80,220,.55);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================================
   LAYOUT APPLICATION
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: linear-gradient(180deg, #6050DC 0%, #7a5ce8 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.1rem .9rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .35rem .55rem 1.1rem;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: #fff;
    letter-spacing: -0.02em;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand svg,
.sidebar-brand .logo-mark {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}
.sidebar-brand small {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: .68rem;
    opacity: .85;
    letter-spacing: 0;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding-top: .4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .85rem;
    border-radius: 10px;
    color: rgba(255,255,255,.88);
    font-size: .9rem;
    font-weight: 500;
    transition: background .18s ease, color .18s ease;
    white-space: nowrap;
}
.nav-item i {
    width: 20px;
    text-align: center;
    font-size: .95rem;
    opacity: .9;
}
.nav-item:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.nav-item.active {
    background: rgba(255,255,255,.18);
    color: #fff;
    font-weight: 700;
}
.nav-item.active i { opacity: 1; }

.sidebar-foot {
    padding: 1rem .55rem .25rem;
    font-size: .7rem;
    line-height: 1.45;
    opacity: .7;
    color: #fff;
}

/* ----- Zone principale ----- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border);
    padding: .8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: nowrap;
}

.topbar-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--dark);
    letter-spacing: -0.015em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.topbar-user strong {
    color: var(--dark);
    font-weight: 600;
}

.content {
    padding: clamp(1.25rem, 2.5vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ----- Chips (établissement, année scolaire…) ----- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .75rem;
    border-radius: 100px;
    background: var(--violet-xl);
    color: var(--violet-d);
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}
.chip i { font-size: .75rem; opacity: .85; }

/* ============================================================
   CARTES
   ============================================================ */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--sh-sm);
    padding: 1.25rem 1.4rem;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.card-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: .55rem;
    letter-spacing: -0.01em;
}
.card-title i { color: var(--violet); font-size: .95rem; }

/* ============================================================
   KPI
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.kpi {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--sh-sm);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .95rem;
    transition: box-shadow .2s ease, transform .2s ease;
}
.kpi:hover {
    box-shadow: var(--sh-md);
    transform: translateY(-2px);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: var(--violet-xl);
    color: var(--violet);
}

.kpi-value {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.9rem;
    line-height: 1.1;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.kpi-label {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: .1rem;
}

/* Variantes de teinte */
.kpi-violet .kpi-icon { background: var(--violet-xl); color: var(--violet); }
.kpi-green  .kpi-icon { background: #ecfdf5; color: #059669; }
.kpi-orange .kpi-icon { background: #fef3c7; color: #d97706; }
.kpi-red    .kpi-icon { background: #fef2f2; color: #dc2626; }

/* ============================================================
   TOOLBAR (recherche + filtres + actions)
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }

.search-input {
    flex: 1;
    min-width: 220px;
    max-width: 420px;
    padding: .55rem .9rem .55rem 2.4rem;
    border: 2px solid var(--violet-card);
    border-radius: 12px;
    font-family: inherit;
    font-size: .88rem;
    color: var(--text);
    background: var(--white) no-repeat .85rem center;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='14' height='14'%3E%3Cpath fill='%235a5a72' d='M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z'/%3E%3C/svg%3E");
    transition: border-color .18s ease, box-shadow .18s ease;
}
.search-input:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 4px rgba(96,80,220,.1);
}
.search-input::placeholder { color: var(--text-muted); opacity: .75; }

.filters {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.filters select { min-width: 150px; }

/* ============================================================
   TABLEAUX
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--white);
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

table.data th {
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    background: var(--violet-xxl);
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data td {
    padding: .6rem .9rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table.data tbody tr { transition: background .15s ease; }
table.data tbody tr:hover { background: var(--violet-xxl); }
table.data tbody tr:last-child td { border-bottom: none; }

.row-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    justify-content: flex-end;
    white-space: nowrap;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .7rem;
    border-radius: 100px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--violet-xl);
    color: var(--violet-d);
}
.badge-success { background: #ecfdf5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fef2f2; color: #991b1b; }
.badge-info    { background: var(--violet-xl); color: var(--violet-d); }
.badge-muted   { background: #f1f5f9; color: #475569; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .58rem 1.15rem;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease,
                color .15s ease, border-color .15s ease;
    -webkit-user-select: none;
    user-select: none;
}
.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: var(--grad-deep);
    color: #fff;
    box-shadow: var(--sh-violet);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(96,80,220,.45);
    color: #fff;
}

.btn-outlined {
    background: var(--white);
    color: var(--violet);
    border: 1.5px solid var(--violet);
}
.btn-outlined:hover:not(:disabled) {
    background: var(--violet-xxl);
    color: var(--violet-d);
    border-color: var(--violet-d);
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    box-shadow: 0 6px 20px rgba(220,38,38,.28);
}
.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    transform: translateY(-1px);
    color: #fff;
}

.btn-sm {
    padding: .38rem .8rem;
    font-size: .8rem;
    border-radius: 10px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    background: var(--violet-xl);
    color: var(--violet-d);
    font-size: .85rem;
}
.btn-icon:hover:not(:disabled) {
    background: var(--violet-card);
    color: var(--violet-d);
}
.btn-icon.btn-danger {
    background: #fef2f2;
    color: #991b1b;
    box-shadow: none;
}
.btn-icon.btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    color: #7f1d1d;
    transform: none;
}

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .9rem 1rem;
}
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.form-group label,
label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--dark);
}
.form-group label .req,
label .req { color: #dc2626; }
.form-group .hint {
    font-size: .72rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="tel"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: .55rem .85rem;
    border: 2px solid var(--violet-card);
    border-radius: 12px;
    font-family: inherit;
    font-size: .88rem;
    color: var(--text);
    background: var(--white);
    transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { resize: vertical; min-height: 90px; }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 4px rgba(96,80,220,.1);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
    background: var(--off-white);
    color: var(--text-muted);
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--violet);
    cursor: pointer;
}

::placeholder { color: var(--text-muted); opacity: .7; }

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,16,64,.55);
    display: none;
    z-index: 1000;
    padding: 1rem;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.modal-overlay.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--white);
    border-radius: 20px;
    width: min(640px, 94vw);
    max-height: 92vh;
    overflow: auto;
    box-shadow: var(--sh-xl);
    animation: modal-pop .22s ease;
}
.modal.modal-lg { width: min(940px, 94vw); }

@keyframes modal-pop {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.4rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 2;
    border-radius: 20px 20px 0 0;
}
.modal-head h3 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: .55rem;
}
.modal-head h3 i { color: var(--violet); }

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: var(--violet-xl);
    color: var(--violet-d);
    font-size: .95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}
.modal-close:hover { background: var(--violet-card); }

.modal-body { padding: 1.25rem 1.4rem; }

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem;
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--white);
    border-radius: 0 0 20px 20px;
}

/* ============================================================
   ALERTES
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .85rem 1.1rem;
    border-radius: 12px;
    font-size: .88rem;
    line-height: 1.5;
    border: 1px solid transparent;
}
.alert i { margin-top: .15rem; }

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: rgba(22,163,74,.25);
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: rgba(185,28,28,.25);
}
.alert-info {
    background: var(--violet-xl);
    color: var(--violet-d);
    border-color: var(--border);
}

/* ============================================================
   ÉTAT VIDE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 2.2rem;
    color: var(--violet-l);
    opacity: .6;
    margin-bottom: .75rem;
    display: block;
}
.empty-state h4 {
    color: var(--dark);
    margin-bottom: .3rem;
    font-weight: 700;
}
.empty-state p { font-size: .85rem; }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-wrap {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-width: min(380px, calc(100vw - 2rem));
}

.toast {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--sh-lg);
    border-left: 4px solid var(--violet);
    padding: .8rem 1.1rem;
    font-size: .87rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    animation: toast-in .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.error i { color: var(--error); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   GRAPHIQUES (Chart.js) — conteneur à HAUTEUR FIXE obligatoire :
   en mode responsive sans ratio, un canvas sans hauteur bornée
   grandit indéfiniment et étire la page verticalement.
   ============================================================ */
.chart-box {
    position: relative;
    height: 240px;
    width: 100%;
}
.chart-box canvas {
    position: absolute;
    inset: 0;
    max-height: 100%;
}
/* Listes/tableaux longs du tableau de bord : hauteur bornée + défilement interne */
.table-scroll {
    max-height: 320px;
    overflow-y: auto;
}

/* ============================================================
   BARRES DE PROGRESSION
   ============================================================ */
.progress {
    width: 100%;
    height: 8px;
    border-radius: 100px;
    background: var(--violet-xl);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 100px;
    background: var(--violet);
    transition: width .35s ease;
}
.progress-fill.warn { background: #f59e0b; }
.progress-fill.full { background: #dc2626; }

/* ============================================================
   ONGLETS PILULES
   ============================================================ */
.tabs-inline {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
}

.tab-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .42rem .95rem;
    border-radius: 100px;
    border: 1.5px solid var(--violet-card);
    background: var(--white);
    color: var(--text-muted);
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tab-pill:hover {
    border-color: var(--violet);
    color: var(--violet-d);
}
.tab-pill.active {
    background: var(--grad-deep);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--sh-violet);
}

/* ============================================================
   PIÈCES JUSTIFICATIVES (lignes de documents)
   ============================================================ */
.piece-row {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem .9rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    transition: background .15s ease, border-color .15s ease;
}
.piece-row:hover {
    background: var(--violet-xxl);
    border-color: var(--violet-card);
}
.piece-row + .piece-row { margin-top: .5rem; }
.piece-row .piece-name {
    flex: 1;
    min-width: 0;
    font-size: .88rem;
    font-weight: 600;
    color: var(--dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.piece-row .piece-meta {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.piece-row i.piece-icon {
    font-size: 1.1rem;
    color: var(--violet);
    width: 24px;
    text-align: center;
}

/* ============================================================
   PAGE DE CONNEXION
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(180deg, var(--violet-xxl), var(--white));
}

.login-card {
    width: 420px;
    max-width: 100%;
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--sh-xl);
    padding: 2.2rem 2rem;
}
.login-card .form-group { margin-bottom: .9rem; }

.login-card .logo,
.login-page .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--dark);
    letter-spacing: -0.02em;
    margin-bottom: .4rem;
}
.logo-mark {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.login-card .login-sub {
    text-align: center;
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.login-card .btn { width: 100%; }
.login-card .login-foot {
    margin-top: 1.4rem;
    text-align: center;
    font-size: .72rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============================================================
   UTILITAIRES LÉGERS
   ============================================================ */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; align-items: center; gap: .6rem; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .form-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .app-layout { flex-direction: column; }

    .sidebar {
        width: 100%;
        min-width: 0;
        height: auto;
        position: static;
        padding: .75rem .9rem;
    }
    .sidebar-brand { padding-bottom: .6rem; }
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: .35rem;
        padding: .2rem 0 .4rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .nav-item {
        flex: 0 0 auto;
        padding: .5rem .8rem;
        font-size: .82rem;
    }
    .sidebar-foot { display: none; }

    .topbar {
        flex-wrap: wrap;
        padding: .7rem 1rem;
        gap: .5rem;
    }
    .topbar-title { white-space: normal; }

    .form-grid.cols-2,
    .form-grid.cols-3 { grid-template-columns: 1fr; }

    .search-input { max-width: none; }

    .kpi-value { font-size: 1.6rem; }

    .modal,
    .modal.modal-lg { width: 96vw; }

    .toast-wrap { left: 1rem; right: 1rem; max-width: none; }
}

@media (max-width: 520px) {
    .content { padding: 1rem .8rem; }
    .card { padding: 1rem; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .row-actions { justify-content: flex-start; }
}

/* ============================================================
   IMPRESSION
   ============================================================ */
@media print {
    body { background: #fff; font-size: 12px; }
    .sidebar,
    .topbar,
    .toolbar,
    .toast-wrap,
    .modal-overlay,
    .btn,
    .row-actions,
    .tabs-inline {
        display: none !important;
    }
    .app-layout { display: block; }
    .main { display: block; }
    .content { padding: 0; }
    .card,
    .table-wrap {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
    table.data th { background: #f4f4f6; color: #333; }
    a { color: inherit; text-decoration: none; }
}
