/* ============================================================
   ISA SANTÉ — DESIGN SYSTEM
   Charte Graphique 2025
   Polices : Heebo (titres) + Poppins (corps)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700;800;900&family=Poppins:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --isa-dark:      #0A4B59;
    --isa-primary:   #16808C;
    --isa-light:     #9AD9C7;
    --isa-pale:      #D5F2EA;
    --isa-green:     #53A687;
    --isa-black:     #111827;
    --isa-white:     #ffffff;
    --isa-bg:        #f0f4f2;
    --isa-surface:   #ffffff;
    --isa-border:    rgba(10, 75, 89, 0.08);
    --isa-muted:     #6b7280;
    --isa-danger:    #dc2626;
    --isa-warning:   #d97706;

    --sidebar-w:     240px;
    --topbar-h:      72px;

    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     14px;
    --radius-xl:     20px;

    --shadow-sm:     0 1px 3px rgba(10,75,89,.06), 0 1px 2px rgba(10,75,89,.04);
    --shadow-md:     0 4px 16px rgba(10,75,89,.08);
    --shadow-lg:     0 10px 40px rgba(10,75,89,.12);

    --transition:    all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: var(--isa-black);
    background: var(--isa-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
    font-family: 'Heebo', sans-serif;
    font-weight: 800;
    color: var(--isa-dark);
    line-height: 1.2;
}
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
h4 { font-size: 14px; }
h5 { font-size: 12px; letter-spacing: .3px; }

.text-muted  { color: var(--isa-muted); }
.text-primary { color: var(--isa-primary); }
.text-dark   { color: var(--isa-dark); }
.text-success { color: var(--isa-green); }
.text-danger  { color: var(--isa-danger); }
.text-warning { color: var(--isa-warning); }

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
    grid-column: 1;
    grid-row: 1 / 3;
    background: linear-gradient(180deg, #073f4b 0%, #064b55 48%, #053f49 100%);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 50;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
    min-height: 128px;
    padding: 24px 20px 22px;
    border-bottom: 1px solid rgba(255,255,255,.09);
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(255,255,255,.05) 0%, rgba(255,255,255,0) 70%);
}
.brand-logo {
    width: 78px;
    height: 78px;
    border-radius: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible;
    padding: 0;
    border: none;
    box-shadow: none;
}
.brand-logo img {
    width: 78px;
    height: 78px;
    display: block;
    object-fit: contain;
    border-radius: 0;
}
.brand-text { min-width: 0; }
.brand-text .brand-name {
    font-family: 'Heebo', sans-serif;
    font-weight: 800;
    font-size: 17px;
    color: #ffffff;
    letter-spacing: .4px;
    line-height: 1.1;
    white-space: normal;
}
.brand-text .brand-sub {
    margin-top: 8px;
    font-size: 12px;
    color: #e8d680;
    opacity: 1;
    font-weight: 400;
    line-height: 1.2;
}

.nav-section {
    padding: 18px 16px 4px;
    font-size: 9px;
    font-weight: 600;
    color: rgba(154,217,199,.45);
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    font-size: 12.5px;
    font-weight: 400;
    color: rgba(255,255,255,.6);
    cursor: pointer;
    border-left: 3px solid transparent;
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}
.nav-item:hover {
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.9);
}
.nav-item.active {
    background: rgba(22,128,140,.22);
    color: #fff;
    border-left-color: var(--isa-light);
    font-weight: 500;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.nav-badge {
    margin-left: auto;
    background: var(--isa-primary);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

.nav-item.has-sub { flex-wrap: wrap; }
.nav-sub {
    display: none;
    width: 100%;
    padding-left: 28px;
    padding-top: 4px;
}
.nav-item.open > .nav-sub { display: block; }
.nav-sub-item {
    display: block;
    padding: 5px 0;
    font-size: 11px;
    color: rgba(255,255,255,.45);
    text-decoration: none;
    transition: var(--transition);
}
.nav-sub-item:hover { color: rgba(255,255,255,.8); }

.sidebar-footer {
    margin-top: auto;
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--isa-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Heebo', sans-serif;
    font-weight: 800;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-user .user-name { font-size: 12px; font-weight: 500; color: #fff; }
.sidebar-user .user-role { font-size: 9px; color: var(--isa-light); opacity: .7; }
.sidebar-user .logout-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-user .logout-btn:hover { background: rgba(220,38,38,.25); }
.sidebar-user .logout-btn svg { width: 14px; height: 14px; color: rgba(255,255,255,.6); }

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
    grid-column: 2;
    grid-row: 1;
    background: var(--isa-white);
    border-bottom: 1px solid var(--isa-border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-title {
    font-family: 'Heebo', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: var(--isa-dark);
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}
.topbar-title .breadcrumb-sep { color: var(--isa-border); font-weight: 300; }
.topbar-title .page-sub { font-size: 12px; color: var(--isa-muted); font-weight: 300; font-family: 'Poppins', sans-serif; }

.topbar-search {
    position: relative;
}
.topbar-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--isa-muted);
}
.topbar-search input {
    width: 220px;
    padding: 7px 14px 7px 32px;
    border: 1px solid var(--isa-border);
    border-radius: var(--radius-xl);
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    color: var(--isa-dark);
    background: var(--isa-bg);
    outline: none;
    transition: var(--transition);
}
.topbar-search input:focus {
    border-color: var(--isa-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(22,128,140,.1);
}

.topbar-period {
    font-size: 11px;
    font-weight: 500;
    color: var(--isa-dark);
    background: var(--isa-pale);
    padding: 5px 12px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(10,75,89,.12);
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--isa-border);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}
.topbar-icon-btn:hover { background: var(--isa-pale); border-color: var(--isa-primary); }
.topbar-icon-btn svg { width: 16px; height: 16px; color: var(--isa-dark); }
.notif-dot {
    width: 8px;
    height: 8px;
    background: var(--isa-danger);
    border-radius: 50%;
    position: absolute;
    top: 6px;
    right: 6px;
    border: 1.5px solid #fff;
}

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
    grid-column: 2;
    grid-row: 2;
    padding: 24px 28px;
    overflow-x: hidden;
}

/* ── CARDS ────────────────────────────────────────────────────── */
.card {
    background: var(--isa-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--isa-border);
    box-shadow: var(--shadow-sm);
}
.card-header {
    padding: 18px 22px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 16px 22px 20px; }
.card-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--isa-border);
    background: rgba(240,244,242,.4);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--isa-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--isa-border);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card.accent-dark::after  { background: var(--isa-dark); }
.stat-card.accent-primary::after { background: var(--isa-primary); }
.stat-card.accent-green::after { background: var(--isa-green); }
.stat-card.accent-light::after { background: var(--isa-light); }

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-label { font-size: 11px; color: var(--isa-muted); margin-bottom: 4px; }
.stat-value {
    font-family: 'Heebo', sans-serif;
    font-weight: 800;
    font-size: 28px;
    color: var(--isa-dark);
    line-height: 1;
}
.stat-value .unit { font-size: 13px; color: var(--isa-muted); font-weight: 400; }
.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 8px;
}
.trend-up   { background: #e6f4ef; color: var(--isa-green); }
.trend-down { background: #fef2f2; color: var(--isa-danger); }
.trend-neu  { background: var(--isa-pale); color: var(--isa-dark); }

/* ── TABLE ────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }

.isa-table {
    width: 100%;
    border-collapse: collapse;
}
.isa-table thead th {
    padding: 10px 20px;
    font-size: 10px;
    font-weight: 600;
    color: var(--isa-muted);
    text-align: left;
    letter-spacing: .6px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--isa-border);
    white-space: nowrap;
}
.isa-table thead th:first-child { padding-left: 22px; }
.isa-table tbody tr {
    border-bottom: 1px solid rgba(10,75,89,.04);
    transition: var(--transition);
    cursor: pointer;
}
.isa-table tbody tr:hover { background: rgba(213,242,234,.25); }
.isa-table tbody tr:last-child { border: none; }
.isa-table td {
    padding: 11px 20px;
    font-size: 12.5px;
    color: #374151;
    vertical-align: middle;
}
.isa-table td:first-child { padding-left: 22px; }

/* ── STUDENT CELL ──────────────────────────────────────────── */
.student-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stu-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Heebo', sans-serif;
    font-weight: 800;
    font-size: 11px;
    flex-shrink: 0;
    letter-spacing: .5px;
}
.stu-name { font-weight: 500; color: var(--isa-dark); font-size: 13px; }
.stu-mat  { font-size: 10px; color: var(--isa-muted); }

/* Avatar palette par initiales */
.av-teal    { background: #d5f2ea; color: #0a4b59; }
.av-blue    { background: #dbeafe; color: #1e40af; }
.av-green   { background: #dcfce7; color: #166534; }
.av-orange  { background: #ffedd5; color: #9a3412; }
.av-purple  { background: #ede9fe; color: #5b21b6; }
.av-pink    { background: #fce7f3; color: #831843; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    font-size: 10.5px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-success { background: #e6f4ef; color: #166534; }
.badge-warning { background: #fff7ed; color: #92400e; }
.badge-danger  { background: #fef2f2; color: #991b1b; }
.badge-info    { background: var(--isa-pale); color: var(--isa-dark); }
.badge-primary { background: rgba(22,128,140,.12); color: var(--isa-primary); }
.badge-dark    { background: var(--isa-dark); color: #fff; }

.class-tag {
    background: var(--isa-pale);
    color: var(--isa-dark);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(10,75,89,.12);
}

.score {
    font-family: 'Heebo', sans-serif;
    font-weight: 800;
    font-size: 14px;
}
.score-high { color: var(--isa-green); }
.score-mid  { color: var(--isa-warning); }
.score-low  { color: var(--isa-danger); }

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: 'Poppins', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
    background: var(--isa-dark);
    color: #fff;
}
.btn-primary:hover { background: var(--isa-primary); }

.btn-secondary {
    background: var(--isa-pale);
    color: var(--isa-dark);
    border: 1px solid rgba(10,75,89,.15);
}
.btn-secondary:hover { background: #c8ece3; }

.btn-outline {
    background: transparent;
    color: var(--isa-primary);
    border: 1px solid var(--isa-primary);
}
.btn-outline:hover { background: var(--isa-pale); }

.btn-danger {
    background: #fef2f2;
    color: var(--isa-danger);
    border: 1px solid rgba(220,38,38,.2);
}
.btn-danger:hover { background: var(--isa-danger); color: #fff; }

.btn-sm { padding: 5px 11px; font-size: 11.5px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon-only { padding: 7px; border-radius: var(--radius-md); }

/* ── FORMS ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--isa-dark);
    margin-bottom: 5px;
    letter-spacing: .2px;
}
.form-label .required { color: var(--isa-danger); margin-left: 3px; }
.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid rgba(10,75,89,.18);
    border-radius: var(--radius-md);
    font-family: 'Poppins', sans-serif;
    font-size: 12.5px;
    color: var(--isa-dark);
    background: #fff;
    outline: none;
    transition: var(--transition);
    appearance: none;
}
.form-control:focus {
    border-color: var(--isa-primary);
    box-shadow: 0 0 0 3px rgba(22,128,140,.1);
}
.form-control::placeholder { color: #b0bec5; }
.form-control.is-invalid { border-color: var(--isa-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.invalid-feedback { font-size: 11px; color: var(--isa-danger); margin-top: 4px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ── TABS ─────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--isa-border);
    gap: 4px;
    margin-bottom: 20px;
}
.tab-item {
    padding: 10px 18px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--isa-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}
.tab-item svg { width: 14px; height: 14px; }
.tab-item:hover { color: var(--isa-primary); }
.tab-item.active {
    color: var(--isa-dark);
    border-bottom-color: var(--isa-primary);
    font-weight: 600;
}

/* ── FILTERS ─────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--isa-border);
    flex-wrap: wrap;
}
.filter-pill {
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(10,75,89,.15);
    background: transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: var(--isa-muted);
    cursor: pointer;
    transition: var(--transition);
}
.filter-pill:hover { border-color: var(--isa-primary); color: var(--isa-primary); }
.filter-pill.active {
    background: var(--isa-dark);
    border-color: var(--isa-dark);
    color: #fff;
    font-weight: 500;
}

/* ── PAGINATION ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}
.page-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--isa-border);
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--isa-dark);
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
    text-decoration: none;
}
.page-btn:hover { background: var(--isa-pale); border-color: var(--isa-primary); }
.page-btn.active { background: var(--isa-dark); color: #fff; border-color: var(--isa-dark); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── ALERTS ───────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-success { background: #e6f4ef; color: #166534; border: 1px solid #bbf7d0; }
.alert-warning { background: #fff7ed; color: #92400e; border: 1px solid #fed7aa; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: var(--isa-pale); color: var(--isa-dark); border: 1px solid var(--isa-light); }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--isa-muted);
}
.empty-state svg { width: 56px; height: 56px; opacity: .3; margin: 0 auto 16px; display: block; }
.empty-state h4 { font-size: 15px; color: var(--isa-dark); margin-bottom: 8px; }
.empty-state p  { font-size: 12px; }

/* ── UTILS ────────────────────────────────────────────────────── */
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.ml-auto { margin-left: auto; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }

/* ── MODALS ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,75,89,.4);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--isa-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; }
.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: var(--isa-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--isa-muted);
    transition: var(--transition);
}
.modal-close:hover { background: #fef2f2; color: var(--isa-danger); }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 22px 26px; }
.modal-footer { padding: 16px 26px; border-top: 1px solid var(--isa-border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .topbar, .main-content { grid-column: 1; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ── GLOBAL CONTEXT BAR : école / année / niveau ────────────── */
.topbar-context {
    min-height: 72px;
    padding: 0 26px;
    justify-content: space-between;
    gap: 18px;
    box-shadow: 0 2px 14px rgba(15, 23, 42, .05);
}
.contextbar-left,
.contextbar-right,
.contextbar-form,
.context-field,
.context-user {
    display: flex;
    align-items: center;
}
.contextbar-left {
    min-width: 0;
    flex: 1;
    gap: 14px;
}
.contextbar-form {
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
}
.context-field {
    height: 42px;
    gap: 10px;
    background: #fff;
    border: 1px solid rgba(10, 75, 89, .10);
    border-radius: 14px;
    padding: 0 12px;
    box-shadow: 0 2px 10px rgba(10, 75, 89, .045);
    transition: var(--transition);
}
.context-field:hover,
.context-field:focus-within {
    border-color: rgba(22, 128, 140, .35);
    box-shadow: 0 4px 18px rgba(10, 75, 89, .08);
}
.context-school { min-width: 190px; }
.context-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4b2a16;
    flex: 0 0 auto;
}
.context-icon svg { width: 18px; height: 18px; }
.context-select {
    appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    min-width: 118px;
    max-width: 230px;
    padding: 0 22px 0 0;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--isa-black);
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, #4b2a16 50%), linear-gradient(135deg, #4b2a16 50%, transparent 50%);
    background-position: calc(100% - 10px) 17px, calc(100% - 5px) 17px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.context-static {
    font-size: 13px;
    font-weight: 700;
    color: var(--isa-black);
    white-space: nowrap;
}
.context-active-period {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f7eadf;
    color: #4b2a16;
    border: 1px solid rgba(75, 42, 22, .12);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.contextbar-right {
    gap: 10px;
    margin-left: auto;
}
.context-user {
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid rgba(10, 75, 89, .08);
}
.context-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #4b2a16;
    color: #fff;
    font-family: 'Heebo', sans-serif;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .3px;
}
.context-user-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 130px;
}
.context-user-text strong {
    font-size: 12px;
    color: var(--isa-black);
    font-weight: 700;
}
.context-user-text span {
    margin-top: 2px;
    font-size: 10px;
    color: var(--isa-muted);
    text-transform: capitalize;
}

@media (max-width: 1100px) {
    :root { --topbar-h: 92px; }
    .topbar-context { min-height: 92px; align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
    .contextbar-left { align-items: flex-start; }
    .context-active-period { display: none; }
}
@media (max-width: 768px) {
    .topbar-context { min-height: auto; position: relative; }
    .contextbar-left, .contextbar-form { width: 100%; }
    .context-field { flex: 1 1 100%; }
    .context-select { max-width: none; width: 100%; }
    .contextbar-right { display: none; }
}


/* ============================================================
   PATCH ISA — rendu propre du logo dans le menu
   ============================================================ */
.brand-logo-fallback {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: var(--isa-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Heebo', sans-serif;
    font-weight: 900;
    letter-spacing: .5px;
}

.sidebar .brand-logo {
    width: 78px !important;
    height: 78px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.sidebar .brand-logo img {
    width: 78px !important;
    height: 78px !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 0 !important;
}

.login-brand-logo,
.preview-logo,
.auth-logo {
    background: #ffffff !important;
    color: var(--isa-dark) !important;
}

.login-brand-logo img,
.preview-logo img {
    object-fit: contain !important;
    background: transparent !important;
}

/* ============================================================
   PATCH ISA — Logo sidebar carré avec fond vert du menu
   Date : 2026-05-18
   Objectif : supprimer le fond noir/blanc visible autour du logo
   et utiliser exactement le vert sombre du menu.
   ============================================================ */
.sidebar .sidebar-brand.isa-sidebar-brand-clean {
    padding: 20px 20px 18px !important;
    gap: 14px !important;
    background: var(--isa-dark, #0A4B59) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
}

.sidebar .brand-logo.isa-sidebar-logo-box {
    width: 82px !important;
    height: 88px !important;
    min-width: 82px !important;
    flex: 0 0 82px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--isa-dark, #0A4B59) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sidebar .brand-logo.isa-sidebar-logo-box::before,
.sidebar .brand-logo.isa-sidebar-logo-box::after {
    content: none !important;
    display: none !important;
}

.sidebar .brand-logo.isa-sidebar-logo-box img.isa-sidebar-logo-img {
    width: 82px !important;
    height: 88px !important;
    max-width: 82px !important;
    max-height: 88px !important;
    object-fit: contain !important;
    object-position: center center !important;
    display: block !important;
    background: var(--isa-dark, #0A4B59) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
}

.sidebar .sidebar-brand.isa-sidebar-brand-clean .brand-text {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.sidebar .sidebar-brand.isa-sidebar-brand-clean .brand-name {
    font-family: 'Heebo', sans-serif !important;
    color: #fff !important;
    font-size: 17px !important;
    font-weight: 900 !important;
    letter-spacing: .2px !important;
    line-height: 1.15 !important;
}

.sidebar .sidebar-brand.isa-sidebar-brand-clean .brand-sub,
.sidebar .sidebar-brand.isa-sidebar-brand-clean .isa-admin-sub {
    color: #e8c96d !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    margin-top: 6px !important;
    opacity: 1 !important;
}

@media (max-width: 768px) {
    .sidebar .brand-logo.isa-sidebar-logo-box {
        width: 76px !important;
        height: 82px !important;
        min-width: 76px !important;
        flex-basis: 76px !important;
    }
    .sidebar .brand-logo.isa-sidebar-logo-box img.isa-sidebar-logo-img {
        width: 76px !important;
        height: 82px !important;
        max-width: 76px !important;
        max-height: 82px !important;
    }
}
