/* =====================================================================
   ACADEMIA — Feuille de style principale
   100% auto-hébergée · responsive · animations fluides
   ===================================================================== */

/* ============ RESET & VARIABLES ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    background: #f5f7fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

:root {
    /* Palette */
    --color-navy-900: #0a2540;
    --color-navy-800: #0f2f56;
    --color-navy-700: #1e3a8a;
    --color-navy-600: #2c4a9e;
    --color-navy-500: #3b5bca;
    --color-navy-400: #6b7bd6;
    --color-navy-100: #dbeafe;
    --color-navy-50:  #eff6ff;

    --color-cyan-500: #06b6d4;
    --color-cyan-400: #22d3ee;
    --color-cyan-300: #67e8f9;

    --color-gold-500: #f59e0b;
    --color-gold-400: #fbbf24;

    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error:   #ef4444;
    --color-info:    #3b82f6;

    --color-gray-50:  #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;
    --color-white:    #ffffff;

    /* Typographie */
    --font-mono: 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

    /* Espacement (échelle 4px) */
    --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
    --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;

    /* Border radius */
    --radius-sm: 4px;  --radius: 6px;  --radius-md: 8px;
    --radius-lg: 12px; --radius-xl: 16px;

    /* Ombres */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.10), 0 10px 10px rgba(0,0,0,0.04);

    /* Mesures sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;

    /* Animation */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ ICÔNES SVG ============ */
.icon {
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
    color: inherit;
}

/* ============ LAYOUT GLOBAL ============ */
.layout {
    min-height: 100vh;
    display: block;
}

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--color-navy-900) 0%, var(--color-navy-800) 100%);
    color: var(--color-gray-300);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.layout--collapsed .sidebar { width: var(--sidebar-collapsed-width); }

/* Brand */
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: var(--topbar-height);
    padding: 0 var(--space-4);
    color: var(--color-white);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar__logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-cyan-500), var(--color-navy-500));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}
.sidebar__brand-text { overflow: hidden; transition: opacity var(--transition); }
.sidebar__brand-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--color-white);
}
.sidebar__brand-tag {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.layout--collapsed .sidebar__brand-text { opacity: 0; pointer-events: none; }

/* Navigation */
.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-3) 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
}

.sidebar__group { margin-bottom: var(--space-3); }
.sidebar__group-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
    padding: var(--space-2) var(--space-5);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}
.layout--collapsed .sidebar__group-title {
    opacity: 0;
    height: 8px;
    padding-top: 0;
    padding-bottom: 0;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-4);
    margin: 1px var(--space-2);
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}
.sidebar__link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--color-white);
}
.sidebar__link--active {
    background: linear-gradient(90deg,
                rgba(6, 182, 212, 0.15) 0%,
                rgba(6, 182, 212, 0.05) 100%);
    color: var(--color-white);
}
.sidebar__link--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--color-cyan-400);
    border-radius: 0 3px 3px 0;
}
.sidebar__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}
.sidebar__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.88rem;
    transition: opacity var(--transition);
}
.layout--collapsed .sidebar__label { opacity: 0; pointer-events: none; }
.layout--collapsed .sidebar__link { justify-content: center; padding: 10px; }
.layout--collapsed .sidebar__link::before { display: none; }

/* Tooltip pour mode collapsed (texte au survol) */
.layout--collapsed .sidebar__link::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-navy-900);
    color: var(--color-white);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s 0.3s;
    z-index: 1000;
}
.layout--collapsed .sidebar__link:hover::after { opacity: 1; }

/* Pied de sidebar */
.sidebar__footer {
    padding: var(--space-3);
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar__user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.sidebar__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-cyan-500), var(--color-navy-500));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.sidebar__user-info { overflow: hidden; transition: opacity var(--transition); }
.sidebar__user-name {
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.sidebar__user-role {
    color: rgba(255,255,255,0.55);
    font-size: 0.7rem;
    text-transform: capitalize;
    white-space: nowrap;
}
.layout--collapsed .sidebar__user-info { opacity: 0; pointer-events: none; }
.layout--collapsed .sidebar__user { justify-content: center; }

.sidebar__logout { margin-top: var(--space-2); }
.sidebar__logout-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: 10px var(--space-3);
    background: rgba(255,255,255,0.04);
    border: 0;
    color: rgba(255,255,255,0.7);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}
.sidebar__logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-white);
}
.layout--collapsed .sidebar__logout-btn { justify-content: center; padding: 10px; }

/* Backdrop mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.5);
    backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.25s;
}
.layout--mobile-open .sidebar-backdrop {
    display: block;
    opacity: 1;
}

/* ============ MAIN + TOPBAR ============ */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
}
.layout--collapsed .main { margin-left: var(--sidebar-collapsed-width); }

/* Topbar fixe */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-gray-200);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-5);
    z-index: 50;
    transition: box-shadow 0.2s;
}
.topbar--scrolled { box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

.topbar__toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 0;
    color: var(--color-gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.topbar__toggle:hover {
    background: var(--color-gray-100);
    color: var(--color-navy-900);
}

.topbar__page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-navy-900);
    display: none;
}

.topbar__spacer { flex: 1; }

.topbar__icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 0;
    color: var(--color-gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}
.topbar__icon-btn:hover {
    background: var(--color-gray-100);
    color: var(--color-navy-700);
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 6px var(--space-3) 6px 6px;
    border-radius: var(--radius-md);
    color: var(--color-gray-800);
    text-decoration: none;
    transition: var(--transition);
}
.topbar__user:hover { background: var(--color-gray-100); }
.topbar__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-cyan-500), var(--color-navy-500));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}
.topbar__user-info { line-height: 1.2; }
.topbar__user-name { font-weight: 600; color: var(--color-navy-900); }
.topbar__user-role {
    font-size: 0.7rem;
    color: var(--color-gray-500);
    text-transform: capitalize;
}

/* ============ SÉLECTEUR D'ANNÉE ============ */
.year-switcher {
    position: relative;
}
.year-switcher__btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px var(--space-3);
    background: var(--color-gray-100);
    border: 1px solid var(--color-gray-200);
    color: var(--color-navy-900);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
}
.year-switcher__btn:hover {
    background: var(--color-white);
    border-color: var(--color-navy-400);
    box-shadow: var(--shadow);
}
.year-switcher__btn[aria-expanded="true"] {
    background: var(--color-navy-50);
    border-color: var(--color-navy-500);
    color: var(--color-navy-900);
}
.year-switcher__btn .icon:last-child {
    transition: transform var(--transition);
}
.year-switcher__btn[aria-expanded="true"] .icon:last-child {
    transform: rotate(180deg);
}
.year-switcher__label { font-family: var(--font-mono); font-weight: 700; }

.year-switcher__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    overflow: hidden;
    z-index: 100;
}
.year-switcher--open .year-switcher__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.year-switcher__header {
    padding: var(--space-3) var(--space-4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-gray-500);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
    font-weight: 600;
}
.year-switcher__form { padding: var(--space-1); }
.year-switcher__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius);
    color: var(--color-gray-800);
    font-family: inherit;
    transition: var(--transition);
}
.year-switcher__item:hover { background: var(--color-navy-50); }
.year-switcher__item--active {
    background: var(--color-navy-50);
    color: var(--color-navy-900);
    font-weight: 600;
}
.year-switcher__item-code {
    font-family: var(--font-mono);
    font-weight: 700;
    flex: 1;
}
.year-switcher__badge {
    font-size: 0.65rem;
    background: var(--color-cyan-500);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.year-switcher__check { color: var(--color-success); }

/* ============ CONTENT ============ */
.content {
    flex: 1;
    padding: var(--space-6);
    max-width: 100%;
    overflow-x: hidden;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-navy-900);
    margin: 0 0 var(--space-5);
}

/* ============ FOOTER ============ */
.footer {
    background: var(--color-white);
    border-top: 1px solid var(--color-gray-200);
    padding: var(--space-3) var(--space-6);
    color: var(--color-gray-500);
    font-size: 0.78rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.footer__meta { color: var(--color-gray-600); }

/* ============ ALERTS ============ */
.alert {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border-left: 4px solid;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert--success { background: #ecfdf5; color: #065f46; border-left-color: var(--color-success); }
.alert--error   { background: #fef2f2; color: #991b1b; border-left-color: var(--color-error); }
.alert--warning { background: #fffbeb; color: #92400e; border-left-color: var(--color-warning); }
.alert--info    { background: #eff6ff; color: #1e40af; border-left-color: var(--color-info); }

/* ============ CARDS ============ */
.card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
}
.card--flush { padding: 0; overflow: hidden; }
.card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-navy-900);
    margin: 0 0 var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-gray-100);
}
.card__placeholder {
    text-align: center;
    color: var(--color-gray-400);
    padding: var(--space-8);
    font-style: italic;
}

/* ============ GRID ============ */
.grid { display: grid; gap: var(--space-4); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 9px var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.btn--primary {
    background: linear-gradient(135deg, var(--color-navy-700), var(--color-navy-600));
    color: var(--color-white);
    box-shadow: 0 1px 3px rgba(30, 58, 138, 0.3);
}
.btn--primary:hover {
    background: linear-gradient(135deg, var(--color-navy-800), var(--color-navy-700));
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.35);
    transform: translateY(-1px);
}
.btn--secondary {
    background: var(--color-white);
    color: var(--color-navy-900);
    border-color: var(--color-gray-300);
}
.btn--secondary:hover {
    background: var(--color-gray-50);
    border-color: var(--color-navy-400);
}
.btn--ghost {
    background: transparent;
    color: var(--color-gray-700);
}
.btn--ghost:hover {
    background: var(--color-gray-100);
    color: var(--color-navy-900);
}
.btn--sm { padding: 6px 10px; font-size: 0.78rem; }
.btn--danger-text:hover { color: var(--color-error); background: #fef2f2; }

/* ============ FORMS ============ */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form__section {
    margin-top: var(--space-5);
    margin-bottom: 0;
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--color-gray-200);
    color: var(--color-navy-900);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}
.form__section:first-child { margin-top: 0; }

.form__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
}
.form__group { display: flex; flex-direction: column; gap: 6px; }
.form__group--grow { flex: 1; }
.form__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gray-700);
}
.form__input, .form__select, .form__textarea {
    padding: 9px 12px;
    font-size: 0.88rem;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    background: var(--color-white);
    color: var(--color-gray-900);
    font-family: inherit;
    transition: var(--transition);
    width: 100%;
}
.form__input:focus, .form__select:focus, .form__textarea:focus {
    outline: none;
    border-color: var(--color-navy-500);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}
.form__select--inline { display: inline-block; width: auto; }
.form__hint { font-size: 0.75rem; color: var(--color-gray-500); }
.form__checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 0.88rem;
}
.form__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-gray-100);
}

/* Page header (filtres + bouton créer) */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.search-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.search-form__input {
    min-width: 220px;
    padding: 9px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    background: var(--color-white);
    font-family: inherit;
    font-size: 0.88rem;
}
.search-form__input:focus {
    outline: none;
    border-color: var(--color-navy-500);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* ============ TABLES ============ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-gray-500);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
    font-weight: 600;
}
.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-gray-100);
    font-size: 0.88rem;
    color: var(--color-gray-800);
    vertical-align: middle;
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--color-gray-50); }
.data-table__actions { text-align: right; white-space: nowrap; }
.data-table__empty {
    text-align: center;
    color: var(--color-gray-400);
    padding: var(--space-10);
    font-style: italic;
}

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    line-height: 1.5;
    white-space: nowrap;
}
.badge--code {
    font-family: var(--font-mono);
    background: var(--color-gray-100);
    color: var(--color-navy-900);
    text-transform: none;
}
.badge--success { background: #d1fae5; color: #065f46; }
.badge--error   { background: #fee2e2; color: #991b1b; }
.badge--warning { background: #fef3c7; color: #92400e; }
.badge--info    { background: #dbeafe; color: #1e40af; }
.badge--muted   { background: var(--color-gray-100); color: var(--color-gray-600); }
.badge--level   { background: var(--color-navy-50); color: var(--color-navy-700); }
.badge--count   {
    background: var(--color-cyan-500);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    padding: 0;
    justify-content: center;
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border-top: 1px solid var(--color-gray-100);
}
.pagination__link, .pagination__current {
    padding: 6px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.85rem;
    color: var(--color-gray-700);
    transition: var(--transition);
}
.pagination__link:hover { background: var(--color-gray-100); color: var(--color-navy-900); }
.pagination__current {
    background: var(--color-navy-700);
    color: var(--color-white);
    font-weight: 600;
}

/* ============ KPI ============ */
.kpi { text-align: left; padding: var(--space-5); }
.kpi__label {
    color: var(--color-gray-500);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.kpi__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-navy-900);
    line-height: 1.1;
    margin-bottom: 6px;
}
.kpi__trend { color: var(--color-gray-600); font-size: 0.78rem; }

/* ============ WELCOME ============ */
.welcome {
    background: linear-gradient(135deg, var(--color-navy-900), var(--color-navy-700));
    color: var(--color-white);
    padding: var(--space-6) var(--space-8);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
}
.welcome h2 {
    margin: 0 0 var(--space-2);
    font-size: 1.4rem;
}
.welcome p { color: rgba(255,255,255,0.85); margin: 0; }

/* ============ AUTH (login) ============ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-navy-900) 0%, var(--color-navy-700) 100%);
    padding: var(--space-5);
}
.auth-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}
.auth-card__header {
    text-align: center;
    margin-bottom: var(--space-6);
}
.auth-card__logo {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-4);
    background: linear-gradient(135deg, var(--color-cyan-500), var(--color-navy-500));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3);
}
.auth-card__title { color: var(--color-navy-900); font-size: 1.5rem; margin: 0; }
.auth-card__subtitle { color: var(--color-gray-500); font-size: 0.88rem; margin-top: var(--space-2); }

/* ============ UTILITY ============ */
.text-success { color: var(--color-success); }
.text-error   { color: var(--color-error); }
.text-muted   { color: var(--color-gray-500); }
.link-strong  {
    color: var(--color-navy-700);
    font-weight: 600;
    text-decoration: none;
}
.link-strong:hover { color: var(--color-cyan-500); text-decoration: underline; }

/* ============ PROFILE CARD (étudiants/enseignants) ============ */
.profile-card { text-align: center; padding: var(--space-3); }
.profile-card__photo {
    width: 120px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 3px solid var(--color-navy-100);
    margin: 0 auto var(--space-4);
    display: block;
    box-shadow: var(--shadow);
}
.profile-card__avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-cyan-500), var(--color-navy-600));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto var(--space-4);
    box-shadow: var(--shadow-lg);
}
.profile-card__name { font-size: 1.25rem; color: var(--color-navy-900); margin-bottom: var(--space-2); }
.profile-card__matricule { margin-bottom: var(--space-3); }
.profile-card__status { margin-top: var(--space-2); }

.info-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: var(--space-3) var(--space-4);
    margin: 0;
}
.info-grid dt {
    color: var(--color-gray-500);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding-top: 2px;
}
.info-grid dd {
    color: var(--color-gray-800);
    margin: 0;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--color-gray-100);
    padding-bottom: var(--space-3);
}

/* ============ BORDEREAU (saisie de notes) ============ */
.bordereau-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-5);
    background: linear-gradient(135deg, var(--color-navy-900), var(--color-navy-700));
    color: var(--color-white);
    padding: var(--space-5) var(--space-6);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}
.bordereau-header h2 { margin: 0 0 8px; font-size: 1.3rem; }
.bordereau-header p { color: rgba(255,255,255,0.85); margin: 0; font-size: 0.88rem; }
.bordereau-header__legend {
    text-align: right;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.2);
    padding: var(--space-3);
    border-radius: var(--radius);
}

.bordereau__table th, .bordereau__table td { text-align: center; padding: 6px 8px; }
.bordereau__table thead th { background: var(--color-gray-100); position: sticky; top: var(--topbar-height); z-index: 10; }
.bordereau__input {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid var(--color-gray-300);
    border-radius: 4px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.bordereau__input:focus {
    outline: none;
    border-color: var(--color-navy-500);
    background: var(--color-navy-50);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}
.bordereau__moy { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; }
.bordereau__moy--ok { color: var(--color-success); }
.bordereau__moy--ko { color: var(--color-error); }
.bordereau__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-navy-900);
    color: var(--color-white);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    margin-top: var(--space-4);
    position: sticky;
    bottom: 16px;
    z-index: 10;
    box-shadow: var(--shadow-xl);
}
.bordereau__stats { color: rgba(255,255,255,0.9); font-size: 0.88rem; }
.bordereau__stats strong { color: var(--color-cyan-400); }

/* ============ BULLETIN ============ */
.bulletin {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    border: 2px solid var(--color-gray-200);
    margin-bottom: var(--space-6);
}
.bulletin__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px double var(--color-navy-900);
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-5);
}
.bulletin__header h1 { font-size: 1.5rem; color: var(--color-navy-900); margin: 0; }
.bulletin__header p { color: var(--color-gray-600); margin-top: 4px; }
.bulletin__student { display: flex; gap: var(--space-3); align-items: center; text-align: right; }
.bulletin__student > div:last-child { line-height: 1.6; }
.bulletin__avatar {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-cyan-500), var(--color-navy-600));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    overflow: hidden;
}
.bulletin__avatar img { width: 100%; height: 100%; object-fit: cover; }
.bulletin__table { width: 100%; border-collapse: collapse; margin: var(--space-4) 0; }
.bulletin__table th, .bulletin__table td {
    padding: 8px 10px;
    border: 1px solid var(--color-gray-300);
    text-align: center;
    font-size: 0.85rem;
}
.bulletin__table th {
    background: var(--color-navy-900);
    color: var(--color-white);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bulletin__ue-header td {
    background: linear-gradient(135deg, var(--color-navy-600), var(--color-navy-500));
    color: var(--color-white);
    font-weight: 600;
    text-align: left;
}
.bulletin__ue-header td:first-child { text-align: left; }
.bulletin__moy { font-family: var(--font-mono); font-weight: 700; }
.bulletin__moy--ok { color: var(--color-success); }
.bulletin__moy--ko { color: var(--color-error); }
.bulletin__summary {
    background: var(--color-gray-50);
    padding: var(--space-5);
    border-radius: var(--radius);
    margin-top: var(--space-5);
}
.bulletin__summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}
.bulletin__kpi {
    text-align: center;
    padding: var(--space-3);
    background: var(--color-white);
    border-radius: var(--radius);
    border: 1px solid var(--color-gray-200);
}
.bulletin__kpi span {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--color-gray-500);
    margin-bottom: 6px;
}
.bulletin__kpi strong { font-size: 1.2rem; color: var(--color-navy-900); }
.bulletin__big-moy { font-size: 1.6rem !important; font-family: var(--font-mono); }
.bulletin__big-moy.ok { color: var(--color-success) !important; }
.bulletin__big-moy.ko { color: var(--color-error)   !important; }
.bulletin__decision--admis    { color: var(--color-success); }
.bulletin__decision--compense { color: var(--color-warning); }
.bulletin__decision--ajourne  { color: var(--color-error);   }
.bulletin__footer {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-6);
    margin-top: var(--space-10);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-gray-200);
}
.bulletin__signature { text-align: center; font-size: 0.85rem; }
.bulletin__signature-line { height: 60px; border-bottom: 1px solid var(--color-gray-400); margin-top: var(--space-4); }

@media print {
    .sidebar, .topbar, .footer, .page-header, .alert, .sidebar-backdrop, .sprite-loader { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    .bulletin { border: 1px solid #000 !important; }
    .bulletin__ue-header td { background: #eee !important; color: #000 !important; }
    .bulletin__table th { background: #333 !important; color: #fff !important; }
}

/* ============ DASHBOARD ============ */
.gender-chart { display: flex; flex-direction: column; gap: var(--space-3); }
.gender-chart__item {
    display: grid;
    grid-template-columns: 30px 1fr 80px;
    gap: var(--space-3);
    align-items: center;
}
.gender-chart__icon { font-size: 1.5rem; text-align: center; color: var(--color-gray-600); }
.gender-chart__bar { height: 28px; background: var(--color-gray-100); border-radius: 14px; overflow: hidden; }
.gender-chart__bar-fill { height: 100%; border-radius: 14px; transition: width 0.4s; }
.gender-chart__bar-fill--male   { background: linear-gradient(90deg, var(--color-navy-500), var(--color-cyan-500)); }
.gender-chart__bar-fill--female { background: linear-gradient(90deg, #f472b6, #ec4899); }
.gender-chart__count { text-align: right; }
.gender-chart__count strong { display: block; font-size: 1.1rem; color: var(--color-navy-900); }
.gender-chart__count span { font-size: 0.75rem; color: var(--color-gray-500); }

.bar-chart { display: flex; flex-direction: column; gap: var(--space-2); }
.bar-chart__row { display: grid; grid-template-columns: 60px 1fr; gap: var(--space-3); align-items: center; }
.bar-chart__label { font-size: 0.85rem; font-weight: 600; color: var(--color-gray-700); }
.bar-chart__track { height: 26px; background: var(--color-gray-100); border-radius: 4px; position: relative; overflow: hidden; }
.bar-chart__fill { height: 100%; background: linear-gradient(90deg, var(--color-cyan-500), var(--color-navy-500)); transition: width 0.4s; }
.bar-chart__fill--alt { background: linear-gradient(90deg, var(--color-gold-500), var(--color-gold-400)); }
.bar-chart__value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-navy-900);
}

.activity-list { display: flex; flex-direction: column; gap: var(--space-2); list-style: none; padding: 0; margin: 0; }
.activity-list__item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-gray-100);
}
.activity-list__item:last-child { border-bottom: none; }
.activity-list__icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    background: var(--color-gray-100);
    color: var(--color-gray-700);
}
.activity-list__desc { font-size: 0.88rem; color: var(--color-gray-800); }
.activity-list__meta { font-size: 0.72rem; color: var(--color-gray-500); margin-top: 2px; }

.shortcuts { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.shortcut {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--color-gray-200);
    color: var(--color-navy-900);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}
.shortcut:hover {
    background: var(--color-white);
    border-color: var(--color-cyan-500);
    transform: translateX(4px);
    box-shadow: var(--shadow);
}
.shortcut__icon {
    font-size: 1.4rem;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-white);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}
.shortcut__label { font-size: 0.88rem; }

/* ============ RESPONSIVE ============ */

/* Tablette : sidebar rétractée par défaut */
@media (max-width: 1024px) {
    .layout:not(.layout--mobile-open) .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    .layout:not(.layout--mobile-open) .main {
        margin-left: var(--sidebar-collapsed-width);
    }
    .layout:not(.layout--mobile-open) .sidebar__label,
    .layout:not(.layout--mobile-open) .sidebar__brand-text,
    .layout:not(.layout--mobile-open) .sidebar__group-title,
    .layout:not(.layout--mobile-open) .sidebar__user-info {
        opacity: 0;
        pointer-events: none;
    }
}

/* Mobile : sidebar en overlay */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }
    .layout--mobile-open .sidebar { transform: translateX(0); }
    .layout--mobile-open .sidebar__label,
    .layout--mobile-open .sidebar__brand-text,
    .layout--mobile-open .sidebar__group-title,
    .layout--mobile-open .sidebar__user-info {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    .main { margin-left: 0 !important; }

    .topbar__page-title { display: block; flex: 1; }
    .topbar__user-info { display: none; }
    .year-switcher__btn { padding: 8px 10px; }
    .year-switcher__label { display: none; }
    .year-switcher__dropdown { right: -50px; min-width: 220px; }

    .content { padding: var(--space-4); }
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; gap: var(--space-1); }
    .info-grid dd { padding-bottom: var(--space-2); margin-bottom: var(--space-2); }
    .bulletin__summary-grid { grid-template-columns: repeat(2, 1fr); }
    .bulletin { padding: var(--space-4); }
    .bulletin__header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
    .bordereau-header { grid-template-columns: 1fr; }
    .bordereau-header__legend { text-align: left; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: var(--space-2); }
    .footer { flex-direction: column; align-items: flex-start; }
    .shortcuts { grid-template-columns: 1fr; }
    .page-title { font-size: 1.2rem; }
}

/* Petit mobile */
@media (max-width: 480px) {
    .topbar { padding: 0 var(--space-3); gap: var(--space-2); }
    .topbar__icon-btn { width: 36px; height: 36px; }
    .content { padding: var(--space-3); }
    .auth-card { padding: var(--space-5); }
    .kpi__value { font-size: 1.5rem; }
    .welcome { padding: var(--space-4) var(--space-5); }
    .welcome h2 { font-size: 1.15rem; }
}

/* =====================================================================
   BOUTONS D'ACTION DE TABLE — pastilles colorées + tooltips au survol
   ===================================================================== */

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--action-bg, var(--color-gray-100));
    color: var(--action-fg, var(--color-gray-700));
    border: 0;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease,
                background 0.15s ease, color 0.15s ease;
    padding: 0;
    font-family: inherit;
    vertical-align: middle;
    margin: 0 1px;
}
.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}
.btn-action:active {
    transform: translateY(0);
    box-shadow: none;
}
.btn-action:focus-visible {
    outline: 2px solid var(--action-fg);
    outline-offset: 2px;
}

/* Tooltip au survol via data-tooltip */
.btn-action[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #111827;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease 0.2s, transform 0.15s ease 0.2s, visibility 0.15s 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
/* Petite flèche du tooltip */
.btn-action[data-tooltip]::before {
    content: "";
    position: absolute;
    top: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #111827;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease 0.2s, visibility 0.15s 0.2s;
    pointer-events: none;
    z-index: 1000;
}
.btn-action[data-tooltip]:hover::after,
.btn-action[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}
.btn-action[data-tooltip]:hover::after {
    transform: translateX(-50%) translateY(0);
}

/* Variantes sémantiques (pastel doux + icône vive) */
.btn-action--view {
    --action-bg: #dbeafe;
    --action-fg: #2563eb;
}
.btn-action--view:hover {
    --action-bg: #bfdbfe;
}

.btn-action--edit {
    --action-bg: #e0e7ff;
    --action-fg: #4f46e5;
}
.btn-action--edit:hover {
    --action-bg: #c7d2fe;
}

.btn-action--duplicate {
    --action-bg: #ede9fe;
    --action-fg: #7c3aed;
}
.btn-action--duplicate:hover {
    --action-bg: #ddd6fe;
}

.btn-action--archive {
    --action-bg: #d1fae5;
    --action-fg: #059669;
}
.btn-action--archive:hover {
    --action-bg: #a7f3d0;
}

.btn-action--restore {
    --action-bg: #d1fae5;
    --action-fg: #047857;
}
.btn-action--restore:hover {
    --action-bg: #a7f3d0;
}

.btn-action--toggle {
    --action-bg: #fef3c7;
    --action-fg: #d97706;
}
.btn-action--toggle:hover {
    --action-bg: #fde68a;
}

.btn-action--reset {
    --action-bg: #fef3c7;
    --action-fg: #b45309;
}
.btn-action--reset:hover {
    --action-bg: #fde68a;
}

.btn-action--download {
    --action-bg: #cffafe;
    --action-fg: #0e7490;
}
.btn-action--download:hover {
    --action-bg: #a5f3fc;
}

.btn-action--pdf {
    --action-bg: #fee2e2;
    --action-fg: #b91c1c;
}
.btn-action--pdf:hover {
    --action-bg: #fecaca;
}

.btn-action--delete {
    --action-bg: #fee2e2;
    --action-fg: #dc2626;
}
.btn-action--delete:hover {
    --action-bg: #fecaca;
    color: #991b1b;
}

/* Form inline contenant un btn-action (pour les actions DELETE/POST) */
.action-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

/* Tooltip qui s'affiche au-dessus si l'élément est dans les dernières lignes */
.data-table tbody tr:nth-last-child(-n+2) .btn-action[data-tooltip]::after {
    top: auto;
    bottom: calc(100% + 6px);
}
.data-table tbody tr:nth-last-child(-n+2) .btn-action[data-tooltip]::before {
    top: auto;
    bottom: calc(100% + 1px);
    border-bottom-color: transparent;
    border-top-color: #111827;
}

/* Mobile : tooltips moins envahissants */
@media (max-width: 768px) {
    .btn-action {
        width: 30px;
        height: 30px;
    }
    .btn-action[data-tooltip]::after,
    .btn-action[data-tooltip]::before {
        display: none;
    }
}

/* =====================================================================
   TOASTS — Notifications modernes en haut à droite
   Inspiré de GitHub, Linear, Notion, Stripe
   ===================================================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100vw - 40px);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 20px 48px rgba(0, 0, 0, 0.04);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    transform: translateX(420px) scale(0.98);
    opacity: 0;
    transition:
        transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.25s ease-out;
    min-width: 320px;
    max-width: 420px;
    width: 100%;
}

.toast--visible {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.toast--leaving {
    transform: translateX(420px) scale(0.95);
    opacity: 0;
    transition:
        transform 0.25s cubic-bezier(0.4, 0, 1, 1),
        opacity 0.2s ease-out;
}

/* Barre colorée à gauche selon le type */
.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--toast-accent, var(--color-gray-400));
}

/* Icône colorée à gauche */
.toast__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--toast-accent);
    margin-top: 1px;
}
.toast__icon svg { width: 22px; height: 22px; }

/* Corps du message */
.toast__body {
    flex: 1;
    min-width: 0;
    padding-right: 4px;
}
.toast__title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--color-gray-900);
    margin-bottom: 2px;
    line-height: 1.35;
}
.toast__message {
    color: var(--color-gray-700);
    font-size: 0.85rem;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Bouton fermeture × */
.toast__close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: transparent;
    border: 0;
    color: var(--color-gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    margin-top: 1px;
}
.toast__close:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
}
.toast__close:active { background: var(--color-gray-200); }
.toast__close:focus-visible { outline: 2px solid var(--toast-accent); outline-offset: 1px; }

/* Barre de progression en bas */
.toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--toast-accent);
    opacity: 0.5;
    transform-origin: left;
    width: 100%;
    animation: toast-progress linear forwards;
}

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Pause progression au survol */
.toast:hover .toast__progress {
    animation-play-state: paused;
}

/* ============ Variantes par type ============ */
.toast--success {
    --toast-accent: #10b981;
    background: linear-gradient(135deg, rgba(236, 253, 245, 0.96), rgba(255, 255, 255, 0.96));
}
.toast--error {
    --toast-accent: #ef4444;
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.96), rgba(255, 255, 255, 0.96));
}
.toast--warning {
    --toast-accent: #f59e0b;
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.96));
}
.toast--info {
    --toast-accent: #3b82f6;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.96));
}

/* ============ Mode sombre (auto via prefers-color-scheme) ============ */
@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) .toast {
        background: rgba(31, 41, 55, 0.94);
        border-color: rgba(255, 255, 255, 0.08);
        color: #e5e7eb;
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.2),
            0 8px 24px rgba(0, 0, 0, 0.3),
            0 20px 48px rgba(0, 0, 0, 0.15);
    }
    body:not([data-theme="light"]) .toast__title { color: #f9fafb; }
    body:not([data-theme="light"]) .toast__message { color: #d1d5db; }
    body:not([data-theme="light"]) .toast__close { color: #9ca3af; }
    body:not([data-theme="light"]) .toast__close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #f3f4f6;
    }
    body:not([data-theme="light"]) .toast--success {
        background: linear-gradient(135deg, rgba(6, 78, 59, 0.5), rgba(31, 41, 55, 0.94));
    }
    body:not([data-theme="light"]) .toast--error {
        background: linear-gradient(135deg, rgba(127, 29, 29, 0.5), rgba(31, 41, 55, 0.94));
    }
    body:not([data-theme="light"]) .toast--warning {
        background: linear-gradient(135deg, rgba(120, 53, 15, 0.5), rgba(31, 41, 55, 0.94));
    }
    body:not([data-theme="light"]) .toast--info {
        background: linear-gradient(135deg, rgba(30, 58, 138, 0.5), rgba(31, 41, 55, 0.94));
    }
}

/* Mode sombre forcé via classe */
body[data-theme="dark"] .toast {
    background: rgba(31, 41, 55, 0.94);
    border-color: rgba(255, 255, 255, 0.08);
}
body[data-theme="dark"] .toast__title { color: #f9fafb; }
body[data-theme="dark"] .toast__message { color: #d1d5db; }
body[data-theme="dark"] .toast__close { color: #9ca3af; }
body[data-theme="dark"] .toast__close:hover { background: rgba(255, 255, 255, 0.1); color: #f3f4f6; }

/* ============ Animation d'apparition décalée pour empilement ============ */
@keyframes toastStackBounce {
    0%   { transform: translateY(0); }
    100% { transform: translateY(0); }
}

/* ============ Responsive ============ */
@media (max-width: 640px) {
    .toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
        width: auto;
    }
    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
        padding: 12px 14px;
    }
    .toast__message { font-size: 0.82rem; }
}

/* ============ Animation alternative pour les utilisateurs préférant peu d'animation ============ */
@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: opacity 0.15s ease-out;
        transform: none !important;
    }
    .toast--leaving { transition: opacity 0.15s ease-out; }
    .toast__progress { animation: none; }
}

/* =====================================================================
   PAGE PARAMÈTRES DE L'ÉTABLISSEMENT
   ===================================================================== */
.settings-page { max-width: 1100px; }

.settings-intro {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, var(--color-navy-900) 0%, var(--color-navy-700) 100%);
    color: var(--color-white);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
}
.settings-intro__icon {
    width: 56px; height: 56px;
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-cyan-400);
    flex-shrink: 0;
}
.settings-intro h2 { margin: 0 0 4px; font-size: 1.25rem; }
.settings-intro p { margin: 0; color: rgba(255,255,255,0.8); font-size: 0.85rem; }

.settings-form { display: flex; flex-direction: column; gap: var(--space-4); }

.settings-section {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.settings-section__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
}
.settings-section__icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-navy-50), var(--color-navy-100));
    color: var(--color-navy-700);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.settings-section__header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--color-navy-900);
}
.settings-section__header p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: var(--color-gray-500);
}
.settings-section__body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-gray-200);
    position: sticky;
    bottom: 16px;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

/* Tuiles d'identité visuelle */
.branding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-4);
}
.branding-tile {
    background: var(--color-gray-50);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    border: 1px dashed var(--color-gray-300);
}
.branding-tile__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-gray-700);
}
.branding-tile__preview {
    background: var(--color-white);
    border-radius: var(--radius);
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--color-gray-200);
}
.branding-tile__preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.branding-tile__placeholder {
    color: var(--color-gray-400);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
}
.branding-tile__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.branding-tile__filename {
    flex: 1;
    font-size: 0.72rem;
    color: var(--color-gray-500);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
