* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

h1, .h1 { font-size: 2rem !important; }
h2, .h2 { font-size: 1.6rem !important; }
h3, .h3 { font-size: 1.4rem !important; }
h4, .h4 { font-size: 1.2rem !important; }
h5, .h5 { font-size: 1rem !important; }
h6, .h6 { font-size: 0.8rem !important; }

p, div, span, label, a { font-size: 0.8rem !important; }
.btn, button { font-size: 0.875rem !important; }
.btn-sm { font-size: 0.75rem !important; }
.btn-index-acceder { font-size: 1rem !important; }
.card-text { font-size: 0.9rem !important; }

.btn-index-nav,
.btn-index-action,
.btn.btn-lg.btn-index-nav,
.btn.btn-lg.btn-index-action {
    width: 8.5rem;
    white-space: nowrap;
    text-align: center;
    font-size: 0.85rem !important;
    padding: 0.5rem 0.8rem !important;
    border-width: 1px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-index-nav.btn-primary,
.btn-index-action.btn-primary {
    background-color: var(--proclasse-primary-bg) !important;
    border-color: var(--proclasse-primary) !important;
    color: var(--proclasse-primary) !important;
    font-weight: 600;
}

.btn-index-nav.btn-primary:hover,
.btn-index-nav.btn-primary:focus,
.btn-index-action.btn-primary:hover,
.btn-index-action.btn-primary:focus {
    background-color: var(--proclasse-primary) !important;
    border-color: var(--proclasse-primary) !important;
    color: #fff !important;
}

.index-buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 2em 4em;
    width: 100%;
    max-width: 100%;
}

.index-buttons-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 1 auto;
    max-width: 100%;
}

.index-buttons-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em;
    padding: 0.5em 0.5em;
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.50);
    width: 100%;
}

.index-buttons-row-actions {
    justify-content: center;
}
.navbar-brand { font-size: 1.5rem !important; font-weight: bold !important; }
.badge { font-size: 0.7rem !important; }
.form-control, .form-select, input, textarea, select { font-size: 0.8rem !important; font-family: inherit !important; }

table select.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
    padding-right: 0.1rem;
}
.form-label { font-size: 0.8rem !important; }
.modal-title { font-size: 1rem !important; }
.nav-link { font-size: 0.8rem !important; }
small, .small { font-size: 0.7rem; }

.criteres-preview-badge {
    border-radius: 4px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 0.15rem 0.45rem;
    white-space: normal;
}

#modalGroupesClassesParametres .modal-dialog {
    width: min(1480px, calc(100vw - 18px)) !important;
    max-width: min(1480px, calc(100vw - 18px)) !important;
}

#modalGroupesClassesParametres .modal-content {
    border: 1px solid #d8e0ec;
    border-radius: 8px;
    overflow: hidden;
    color: #14213d;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}

#modalGroupesClassesParametres .modal-header {
    min-height: auto;
    padding: 16px 20px !important;
    cursor: move;
    user-select: none;
}

#modalGroupesClassesParametres .modal-title {
    margin: 0 !important;
    font-weight: 600 !important;
}

#modalGroupesClassesParametres .modal-body {
    max-height: min(78vh, 760px) !important;
    padding: 18px 24px;
    background: #fbfcff;
}

#modalGroupesClassesParametres .modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: #f8fbff;
    border-top: 1px solid #dbe3ef;
}

.groupes-classes-modal-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.36fr) minmax(0, 1fr);
    gap: 18px;
}

.groupes-classes-top-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.2fr) minmax(180px, 0.8fr) minmax(260px, 1.2fr);
    gap: 28px;
    margin-bottom: 0;
}

.groupes-classes-top-grid.groupes-classes-top-grid--effectifs {
    grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
}

.groupes-classes-create-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #e4eaf3;
    background: #fff;
}

.groupes-classes-create-row-top {
    display: grid;
    grid-template-columns: minmax(150px, 0.32fr) minmax(130px, 0.28fr) minmax(200px, 1fr);
    gap: 16px 20px;
    align-items: start;
}

.groupes-classes-nom-single-wrap {
    max-width: min(100%, 520px);
}

.groupes-classes-nombre-wrap .form-control {
    max-width: 6.5rem;
}

.groupes-classes-section-niveau .groupes-classes-top-grid {
    margin-top: 1rem;
    margin-bottom: 0;
}

.groupes-classes-panel {
    border: 1px solid #dbe3ef;
    border-radius: 6px;
    background: #fff;
    padding: 14px 16px;
}

.groupes-classes-panel + .groupes-classes-panel,
.groupes-classes-side-stack .groupes-classes-panel + .groupes-classes-panel,
.groupes-classes-main-stack .groupes-classes-panel + .groupes-classes-panel {
    margin-top: 16px;
}

.groupes-classes-section-title {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 0 0 10px;
    color: #111c3a;
    font-size: 0.88rem !important;
    font-weight: 800;
    text-transform: uppercase;
}

.groupes-classes-section-title span {
    text-transform: none;
    font-weight: 500;
}

.groupes-classes-required {
    color: #dc3545;
}

.criteres-niveaux-codes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.criteres-toggle-niveau {
    min-width: 7.25rem;
    white-space: nowrap;
}

.btn.criteres-toggle-niveau.btn-outline-primary {
    background-color: #fff !important;
    border-color: #ced4da !important;
    color: #495057 !important;
    box-shadow: none !important;
}

.btn.criteres-toggle-niveau.btn-outline-primary:hover {
    background-color: var(--proclasse-primary-bg, #e8f0fe) !important;
    border-color: var(--proclasse-primary) !important;
    color: var(--proclasse-primary) !important;
    box-shadow: none !important;
}

.groupes-classes-radio-card,
.groupes-classes-method-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
    margin: 0;
    padding: 10px 11px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}

.groupes-classes-radio-card + .groupes-classes-radio-card,
.groupes-classes-method-card + .groupes-classes-method-card {
    margin-top: 8px;
}

.groupes-classes-radio-card:has(input:checked),
.groupes-classes-method-card:has(input:checked) {
    border-color: var(--proclasse-primary-border-soft);
    background: var(--proclasse-primary-bg-soft);
}

.groupes-classes-radio-card strong,
.groupes-classes-method-card strong {
    display: block;
    color: #111c3a;
    font-size: 0.84rem !important;
}

.groupes-classes-radio-card small,
.groupes-classes-method-card small,
.groupes-classes-help {
    display: block;
    margin-top: 3px;
    color: #394668;
    line-height: 1.35;
}

.groupes-classes-field-readonly {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced6e0;
    border-radius: 4px;
    background: #f3f5f8;
    color: #25314f;
}

.groupes-classes-effectifs-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.groupes-classes-effectif-row {
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(96px, 140px);
    align-items: center;
    gap: 8px;
}

.groupes-classes-effectif-row label {
    margin: 0;
    color: #2d3856;
    white-space: nowrap;
}

.groupes-classes-loa-grid {
    display: grid;
    gap: 12px;
}

.groupes-classes-loa-section-title,
.groupes-classes-base-title {
    color: #111c3a;
    font-weight: 800;
    text-transform: uppercase;
}

.groupes-classes-selection-globale {
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid #d0d7e4;
}

.groupes-classes-base-block + .groupes-classes-base-block {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e4eaf3;
}

.groupes-classes-options-list {
    display: grid;
    gap: 0.25rem;
    max-height: 11rem;
    overflow-y: auto;
    overflow-x: hidden;
    /* Laisse de la place au ring de focus Bootstrap (sinon contour bleu coupé à gauche). */
    padding: 0.35rem 0.35rem 0.35rem 0.45rem;
    margin-left: -0.1rem;
}

.groupes-classes-classes-list {
    max-height: 20rem;
}

.groupes-classes-options-list > .form-check {
    margin-left: 0.1rem;
}

.groupes-classes-class-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 30px;
    margin: 0;
    padding: 2px 0 2px 2px;
}

.groupes-classes-class-row .form-check-input {
    float: none;
    margin-left: 0;
    margin-top: 0.35em;
    flex: 0 0 auto;
}

.groupes-classes-class-row + .groupes-classes-class-row {
    margin-top: 4px;
}

.groupes-classes-classe-label {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    vertical-align: top;
}

.groupes-classes-class-name {
    font-weight: 800;
    color: #111c3a;
    flex: 0 1 auto;
    max-width: min(100%, 14rem);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.groupes-classes-class-badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.groupes-classes-effectif-badge {
    display: inline-flex;
    align-items: center;
    background: #eef2f7;
    color: #334155;
    border: 1px solid #d0d7e2;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.78rem !important;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    margin: 2px;
}

.groupes-classes-loa-badge {
    min-width: 0;
    border-radius: 4px;
    font-size: 0.78rem !important;
    font-weight: 700;
    line-height: 1.2;
}

.groupes-classes-loa-count {
    font-weight: 700;
}

.groupes-classes-created-list {
    min-height: 42px;
}

.groupes-classes-preview-panel {
    border: 1px solid #dbe3ef;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.groupes-classes-preview-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #e4eaf3;
    background: #fbfcff;
}

.groupes-classes-preview-title strong {
    color: #111c3a;
    font-size: 0.82rem !important;
}

.groupes-classes-preview-table {
    width: 100%;
    border-collapse: collapse;
}

.groupes-classes-preview-table th,
.groupes-classes-preview-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #edf1f7;
    vertical-align: middle;
}

.groupes-classes-preview-table th {
    color: #25314f;
    font-size: 0.68rem !important;
    font-weight: 800;
    background: #fbfcff;
}

.groupes-classes-preview-table tr:last-child td {
    border-bottom: 0;
}

.groupes-classes-preview-name {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.groupes-classes-preview-row-label {
    color: #25314f;
    font-weight: 700;
    white-space: nowrap;
}

.groupes-classes-preview-input {
    width: 100%;
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid #d3dbe8;
    border-radius: 4px;
    background: #fff;
    color: #14213d;
    font-weight: 600;
}

.groupes-classes-preview-input:focus {
    border-color: var(--proclasse-primary);
    box-shadow: 0 0 0 2px rgba(var(--proclasse-primary-rgb), 0.12);
    outline: 0;
}

.groupes-classes-preview-effectif {
    color: #25314f;
    font-weight: 700;
    white-space: nowrap;
}

.groupes-classes-preview-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.groupes-classes-preview-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 26px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-color: color-mix(in srgb, var(--niveau-color, var(--proclasse-primary)) 34%, transparent);
    background: rgba(15, 23, 42, 0.04);
    background: color-mix(in srgb, var(--niveau-color, var(--proclasse-primary)) 20%, transparent);
    color: #111c3a;
    cursor: pointer;
    opacity: 1;
    transition: background-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    white-space: nowrap;
    user-select: none;
}

.groupes-classes-preview-level input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.groupes-classes-preview-level:has(input:checked) {
    border-color: rgba(15, 23, 42, 0.16);
    background: var(--niveau-color, var(--proclasse-primary));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--niveau-color, var(--proclasse-primary)) 18%, transparent);
    color: #fff;
}

.groupes-classes-preview-level:hover {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--niveau-color, var(--proclasse-primary)) 12%, transparent);
}

.groupes-classes-preview-level:has(input:checked):hover {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--niveau-color, var(--proclasse-primary)) 22%, transparent);
}

.groupes-classes-preview-sans-niveau {
    --niveau-color: #6c757d;
}

.groupes-classes-preview-empty {
    padding: 14px;
    color: #6c7892;
}

.groupes-classes-footer-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 680px;
    padding: 10px 12px;
    border: 1px solid var(--proclasse-primary-border-subtle);
    border-radius: 6px;
    background: var(--proclasse-primary-bg-soft);
    color: #24314f;
    line-height: 1.35;
}

.groupes-classes-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
}

.groupes-classes-footer-actions .btn {
    min-width: 140px;
}

@media (max-width: 1100px) {
    .groupes-classes-modal-grid,
    .groupes-classes-top-grid,
    .groupes-classes-create-row-top {
        grid-template-columns: 1fr;
    }

    #modalGroupesClassesParametres .modal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .groupes-classes-footer-actions {
        width: 100%;
    }

    .groupes-classes-footer-actions .btn {
        flex: 1 1 0;
    }
}

.base-eleves-table,
.repartition-table {
    text-align: center;
}

.base-eleves-table .small,
.repartition-table .small {
    font-size: 0.5625rem !important;
}

.base-eleves-table th,
.base-eleves-table td,
.repartition-table th,
.repartition-table td {
    font-size: 0.5625rem !important;
    text-align: center;
    vertical-align: middle;
    padding: 0px;
}

.base-eleves-table tbody td,
.repartition-table tbody td {
    padding: 0px;
    vertical-align: middle;
    font-size: 0.5625rem !important;
}

.base-eleves-table tbody input,
.repartition-table tbody input {
    padding: 0px;
    font-size: 0.5625rem !important;
    height: 8px;
    margin: 0;
    border: none !important;
}

.base-eleves-table tbody select,
.repartition-table tbody select,
.base-eleves-table select,
.repartition-table select {
    font-size: 0.5625rem !important;
}

.base-eleves-table select[class*="attitude-select-"],
.base-eleves-table select[class*="niveau-select-"],
.base-eleves-table select[class*="nvf-select-"],
.base-eleves-table select[class*="nvm-select-"],
.repartition-table select[class*="attitude-select-"],
.repartition-table select[class*="niveau-select-"],
.repartition-table select[class*="nvf-select-"],
.repartition-table select[class*="nvm-select-"] {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 15px !important;
    min-height: 15px !important;
    line-height: 15px !important;
    margin: 0 !important;
    padding: 0 !important;
    background-image: none !important;
    box-sizing: border-box !important;
}

.base-eleves-table td:nth-child(15),
.repartition-table td:nth-child(15) {
    padding-right: 1px !important;
}

.base-eleves-table select option,
.repartition-table select option {
    font-size: 0.5625rem !important;
}

.base-eleves-table th,
.repartition-table th {
    padding: 0px 1px;
    font-size: 0.5625rem !important;
    height: 10px;
    line-height: 0.8;
}

.base-eleves-table .classe-titre-tableau,
.repartition-table .classe-titre-tableau {
    position: relative;
    width: 100% !important;
    max-width: none !important;
    height: 22px !important;
    min-height: 22px !important;
    line-height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    font-weight: bold !important;
}

.base-eleves-table th.classe-titre-tableau > .entete-classe-couleurs-zone,
.repartition-table th.classe-titre-tableau > .entete-classe-couleurs-zone {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 22px !important;
    box-sizing: border-box !important;
    width: auto !important;
    height: auto !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    font-weight: bold !important;
    line-height: 22px !important;
    color: inherit !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    z-index: 4 !important;
}

.base-eleves-table thead th,
.repartition-table thead th,
.base-eleves-table thead th .entete-zone-haute,
.repartition-table thead th .entete-zone-haute,
.base-eleves-table thead th .entete-classe-couleurs-zone,
.repartition-table thead th .entete-classe-couleurs-zone,
.base-eleves-table thead th .afficher-masquer-entete-couleur-libelle,
.repartition-table thead th .afficher-masquer-entete-couleur-libelle {
    font-weight: bold !important;
}

.trombi-btn-classe {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 12px;
    pointer-events: auto;
}

.trombi-btn-classe svg {
    width: 12px;
    height: 12px;
    display: block;
    pointer-events: none;
    fill: currentColor;
}

th.classe-titre-tableau.entete-classe-couleurs-survol .trombi-btn-classe:not(:hover):not(:focus-visible) {
    background: transparent;
}

.trombi-btn-classe:hover,
.trombi-btn-classe:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    outline: none;
}

.groupe-btn-actualiser {
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 12px;
    pointer-events: auto;
}

.groupe-btn-actualiser svg {
    width: 12px;
    height: 12px;
    display: block;
    pointer-events: none;
    fill: currentColor;
}

th.classe-titre-tableau.entete-classe-couleurs-survol .groupe-btn-actualiser:not(:hover):not(:focus-visible) {
    background: transparent;
}

.groupe-btn-actualiser:hover,
.groupe-btn-actualiser:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    outline: none;
}

.groupe-btn-actualiser.is-busy,
.groupes-classes-refresh.is-busy {
    opacity: 0.65;
    pointer-events: none;
}

.groupe-btn-actualiser.is-busy svg,
.groupes-classes-refresh.is-busy span {
    animation: groupes-classes-refresh-spin 0.7s linear infinite;
}

@keyframes groupes-classes-refresh-spin {
    to { transform: rotate(360deg); }
}

.base-eleves-table th:nth-child(1),
.base-eleves-table td:nth-child(1),
.base-eleves-table th:nth-child(2),
.base-eleves-table td:nth-child(2),
.repartition-table th:nth-child(1),
.repartition-table td:nth-child(1),
.repartition-table th:nth-child(2),
.repartition-table td:nth-child(2) {
    font-weight: bold !important;
}

.base-eleves-table input,
.base-eleves-table select,
.repartition-table input,
.repartition-table select {
    font-weight: bold !important;
}

.base-eleves-table th:nth-child(2),
.repartition-table th:nth-child(2),
.base-eleves-table td:nth-child(2),
.repartition-table td:nth-child(2) {
    width: 125px;
    min-width: 125px;
    text-align: center !important;
}

.base-eleves-table td:nth-child(2) input,
.repartition-table td:nth-child(2) input {
    text-align: center !important;
}

.base-eleves-table thead tr:first-child th[colspan="8"],
.base-eleves-table thead tr:first-child th[colspan="10"],
.repartition-table thead tr:first-child th[colspan="8"],
.repartition-table thead tr:first-child th[colspan="10"] {
    font-size: 0.6875rem !important;
}

/* Tableaux de groupes (langues / options / aménagements) — mauve moderne */
.section-tableaux-groupes-classes {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: max-content;
    max-width: 100%;
    margin: 48px auto 0;
    box-sizing: border-box;
    gap: 0;
}

.section-tableaux-groupes-classes:first-child {
    margin-top: 0;
}

.section-tableaux-groupes-classes > .titre-tableaux-groupes,
.section-tableaux-groupes-classes > .titre-tableaux-repartition-groupes,
.section-tableaux-groupes-classes > .titre-tableaux-base-eleves-groupes {
    margin: 0;
    padding: 1em 0;
    line-height: 1.2;
    text-align: left;
    width: 100%;
    border-top: 2px solid var(--proclasse-groupe-ligne);
}

.section-tableaux-groupes-classes > .tableaux-repartition-groupes,
.section-tableaux-groupes-classes > .tableaux-base-eleves-groupes {
    border-top: none;
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.section-tableaux-groupes-classes > .tableaux-repartition-groupes ~ .tableaux-repartition-groupes,
.section-tableaux-groupes-classes > .tableaux-base-eleves-groupes ~ .tableaux-base-eleves-groupes {
    margin-top: 32px !important;
}

.tableaux-repartition-groupes,
.tableaux-base-eleves-groupes {
    margin-top: 0 !important;
}

.titre-tableaux-groupes,
.titre-tableaux-repartition-groupes,
.titre-tableaux-base-eleves-groupes {
    font-weight: 700;
    color: var(--proclasse-groupe-titre);
    font-size: 14px;
    box-sizing: border-box;
}

.tableaux-repartition-groupes .shadow-sm {
    outline-color: var(--proclasse-groupe-ligne) !important;
}

.base-eleves-table[data-groupe-classes="true"] thead.table-primary,
.repartition-table[data-groupe-classes="true"] thead.table-primary {
    --bs-table-bg: var(--proclasse-groupe-entete-bg);
    --bs-table-color: var(--proclasse-groupe-entete-text);
    --bs-table-border-color: var(--proclasse-groupe-entete-bordure);
}

.base-eleves-table[data-groupe-classes="true"] thead th,
.base-eleves-table[data-groupe-classes="true"] thead th.bg-primary,
.repartition-table[data-groupe-classes="true"] thead th,
.repartition-table[data-groupe-classes="true"] thead th.bg-primary,
.base-eleves-table[data-groupe-classes="true"] thead th.text-white,
.repartition-table[data-groupe-classes="true"] thead th.text-white {
    background-color: var(--proclasse-groupe-entete-bg) !important;
    background-image: none !important;
    color: var(--proclasse-groupe-entete-text) !important;
    border-color: var(--proclasse-groupe-entete-bordure) !important;
}

.statistiques-tableau-classe[data-groupe-classes="true"] .stats-cell[style*="var(--proclasse-primary)"] {
    background-color: var(--proclasse-groupe-entete-bg) !important;
    color: var(--proclasse-groupe-entete-text) !important;
}

.base-eleves-table + div table,
.base-eleves-table + div table th,
.base-eleves-table + div table td,
.repartition-table + div table,
.repartition-table + div table th,
.repartition-table + div table td {
    font-size: 0.5625rem !important;
    padding: 0px 1px;
    line-height: 0.8;
}

.liste-classes-base div.fw-bold,
.liste-classes-repartition div.fw-bold {
    font-size: 14px !important;
}

.classe-effectif {
    font-size: 8px !important;
}

#table-contraintes {
    border: 1px solid #dee2e6 !important;
}

#table-contraintes thead {
    border-top: none !important;
}

#table-contraintes th,
#table-contraintes td {
    border: 1px solid #dee2e6 !important;
}

#table-contraintes thead tr,
#table-contraintes tbody tr {
    height: 38px !important;
    max-height: 38px !important;
}

#table-contraintes thead th,
#table-contraintes tbody td {
    height: 38px !important;
    max-height: 38px !important;
    vertical-align: middle !important;
    padding: 2px 4px !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
}

#table-contraintes thead tr:first-child th[rowspan="2"] {
    font-size: 14px !important;
}

#table-contraintes select {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    padding: 0 4px !important;
    margin: 0 !important;
    font-size: 0.9em !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    line-height: 1 !important;
}

#table-recap-langues-options {
    border: 1px solid #dee2e6 !important;
}

#table-recap-langues-options th,
#table-recap-langues-options td {
    border: 1px solid #dee2e6 !important;
}

#table-recap-langues-options thead tr,
#table-recap-langues-options tbody tr {
    height: 38px !important;
    max-height: 38px !important;
}

#table-recap-langues-options thead th,
#table-recap-langues-options tbody td {
    height: 38px !important;
    max-height: 38px !important;
    vertical-align: middle !important;
    padding: 2px 4px !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
}

#table-recap-langues-options .badge {
    line-height: 1 !important;
    padding: 4px 8px !important;
    margin: 2px !important;
    font-size: 1em !important;
    vertical-align: middle !important;
}

.jumbotron {
    background: linear-gradient(135deg, var(--proclasse-primary-gradient-start) 0%, var(--proclasse-primary-gradient-mid) 55%, var(--proclasse-primary-gradient-end) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.75rem 1.25rem;
    min-height: 140px;
}

.jumbotron > .text-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0;
}

.jumbotron > .text-center > h1,
.jumbotron > .text-center > p {
    margin: 0;
}

.card {
    transition: transform 0.2s ease-in-out;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary {
    background-color: var(--proclasse-primary);
    border: none;
}

.btn-primary:hover {
    background-color: var(--proclasse-primary-hover);
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.eleve-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.eleve-card:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.eleves-container {
    min-height: 250px;
    padding: 10px;
    border-radius: 8px;
    background: #f8f9fa;
}

.modal-header {
    border-bottom: 2px solid #dee2e6;
}

.modal-footer {
    border-top: 2px solid #dee2e6;
}

.base-tab {
    min-width: fit-content;
    width: auto !important;
    white-space: nowrap !important;
    padding: 0.375rem 1.2rem;
    overflow: visible !important;
    flex-shrink: 0;
    margin-right: 0.5rem;
    position: relative;
    transition: all 0.2s ease-in-out;
}

.base-tab.selected {
    background-color: #e9ecef !important;
    border: 2px solid var(--proclasse-primary) !important;
    color: var(--proclasse-primary) !important;
    font-weight: 600 !important;
}

.base-tab.selected.active {
    background-color: var(--proclasse-primary) !important;
    color: white !important;
    border-color: var(--proclasse-primary-active) !important;
}

.bases-tabs-scroll {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

.bases-tabs-scroll::-webkit-scrollbar {
    height: 6px;
}

.bases-tabs-scroll::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

.bases-tabs-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.bases-tabs-scroll::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.table-responsive-custom {
    width: 100% !important;
    max-width: 100% !important;
    position: relative;
}

.table-responsive-custom > div {
    width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-color: #6c757d #e9ecef;
    padding-bottom: 12px;
}

.table-responsive-custom > div::-webkit-scrollbar {
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
}

.table-responsive-custom > div::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 6px;
    margin: 0 10px;
}

.table-responsive-custom > div::-webkit-scrollbar-thumb {
    background: #495057;
    border-radius: 6px;
    border: 2px solid #e9ecef;
    min-width: 50px;
}

@media (max-width: 900px), (orientation: portrait) {
    .mobile-tabs-toolbar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 0.65rem !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
    }

    .mobile-tabs-title,
    .mobile-tabs-row,
    .mobile-tabs-actions {
        width: 100% !important;
        min-width: 0 !important;
    }

    .mobile-tabs-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0.4rem !important;
        overflow: hidden !important;
    }

    .mobile-tabs-row .bases-tabs-scroll {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-tabs-row .bases-tabs {
        display: inline-flex !important;
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
        width: max-content !important;
        max-width: none !important;
        min-width: max-content !important;
        white-space: nowrap !important;
    }

    .mobile-tabs-row .base-tab {
        flex: 0 0 auto !important;
        min-width: max-content !important;
        max-width: none !important;
        width: auto !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.2 !important;
    }

    .mobile-tabs-row > .btn-group {
        display: flex !important;
        flex-wrap: nowrap !important;
        flex: 0 0 auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        gap: 0.25rem !important;
    }

    .mobile-tabs-row > .btn-group > .btn {
        flex: 0 0 auto !important;
        min-width: 2.25rem !important;
        white-space: nowrap !important;
    }

    .mobile-tabs-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        gap: 0.5rem !important;
    }

    .mobile-tabs-actions .btn {
        max-width: 100% !important;
        white-space: nowrap !important;
        overflow-wrap: normal !important;
        line-height: 1.15 !important;
    }
}

.table-responsive-custom > div::-webkit-scrollbar-thumb:hover {
    background: #343a40;
}

.table-responsive-custom > div::-webkit-scrollbar-thumb:active {
    background: #343a40;
}

.table-responsive-custom > div::-webkit-scrollbar-corner {
    background: #e9ecef;
}

.keyboard-nav-highlight {
    outline: 3px solid var(--proclasse-primary) !important;
    outline-offset: -2px !important;
    background-color: rgba(var(--proclasse-primary-rgb), 0.1) !important;
    position: relative;
    z-index: 10;
}

@keyframes highlightPulse {
    0% { outline-color: var(--proclasse-primary); }
    50% { outline-color: var(--proclasse-primary-pulse); }
    100% { outline-color: var(--proclasse-primary); }
}

.keyboard-nav-highlight {
    animation: highlightPulse 1s ease-in-out infinite;
}

.bases-tabs {
    display: flex;
    gap: 4px;
    justify-content: flex-start;
    align-items: center;
    width: max-content;
    padding: 0 1rem;
}

.tab-context-menu {
    background: #fff !important;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: 1000;
    min-width: 170px;
    padding: 6px 0;
    display: none;
    opacity: 1 !important;
    transition: box-shadow 0.2s, border-radius 0.2s;
}
.tab-context-menu-item {
    padding: 6px 18px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #222;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
    transition: background 0.18s, color 0.18s;
}
.tab-context-menu-item:hover {
    background: var(--proclasse-primary-bg-alt);
    color: var(--proclasse-primary-alt);
}
.tab-context-menu-item.danger {
    color: #dc3545;
}
.tab-context-menu-item.danger:hover {
    background: #ffeaea;
    color: #b71c1c;
}
.tab-context-menu-separator {
    height: 1px;
    background-color: #dee2e6;
    margin: 6px 0;
    border-radius: 2px;
}

@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .btn {
        display: none !important;
    }
    
    th {
        background: #e5e7eb !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

@media (max-width: 768px) {
    .jumbotron {
        padding: 1.25rem 1rem;
        min-height: 120px;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .eleve-card {
        margin-bottom: 6px;
        padding: 6px 10px;
    }
}

.btn-effectuer:disabled,
.btn-supprimer:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: auto;
}

.btn-effectuer:disabled:hover,
.btn-supprimer:disabled:hover {
    opacity: 0.5;
}

.status-badge[data-status="empty"] {
    background-color: #e5e7eb !important;
    color: #6b7280 !important;
}

tr.grised-base-eleve td {
    background: #D9D9D9 !important;
    background-color: #D9D9D9 !important;
    background-image: none !important;
    color: #888 !important;
}

tr.grised-base-eleve td input {
    background: #D9D9D9 !important;
    background-color: #D9D9D9 !important;
    background-image: none !important;
    color: #888 !important;
}

tr.grised-base-eleve td select {
    background: #D9D9D9 !important;
    background-color: #D9D9D9 !important;
    background-image: none !important;
    color: #888 !important;
}

html.proclasse-regroup-sep-actif tr.grised-base-eleve td:has(input[class*="nom-input-"]),
html.proclasse-regroup-sep-actif tr.grised-base-eleve td:has(input[class*="input-classe"]),
html.proclasse-regroup-sep-actif tr.ligne-grisee td:has(input[class*="nom-input-"]),
html.proclasse-regroup-sep-actif tr.ligne-grisee td:has(input[class*="input-classe"]),
html.proclasse-regroup-sep-actif tr.ligne-grisee-active td:has(input[class*="nom-input-"]),
html.proclasse-regroup-sep-actif tr.ligne-grisee-active td:has(input[class*="input-classe"]) {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: inherit !important;
}

html.proclasse-regroup-sep-actif tr.grised-base-eleve td:has(input[class*="nom-input-"]) input,
html.proclasse-regroup-sep-actif tr.grised-base-eleve td:has(input[class*="input-classe"]) input,
html.proclasse-regroup-sep-actif tr.ligne-grisee td:has(input[class*="nom-input-"]) input,
html.proclasse-regroup-sep-actif tr.ligne-grisee td:has(input[class*="input-classe"]) input,
html.proclasse-regroup-sep-actif tr.ligne-grisee-active td:has(input[class*="nom-input-"]) input,
html.proclasse-regroup-sep-actif tr.ligne-grisee-active td:has(input[class*="input-classe"]) input {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: inherit !important;
}

#btn-toggle-deplacements.active,
#btn-toggle-deplacements-base.active {
    background-color: var(--proclasse-primary) !important;
    border-color: var(--proclasse-primary-active) !important;
    color: white !important;
}

#btn-toggle-deplacements.active:hover,
#btn-toggle-deplacements-base.active:hover {
    background-color: var(--proclasse-primary-active) !important;
    border-color: var(--proclasse-primary-deep) !important;
}

.btn.btn-outline-primary:hover {
    background-color: var(--proclasse-primary) !important;
    border-color: var(--proclasse-primary) !important;
    color: white !important;
}

.btn.btn-outline-primary:not(.active):hover {
    box-shadow: 0 2px 8px rgba(var(--proclasse-primary-rgb), 0.3);
}

.btn.btn-outline-primary.active {
    background-color: var(--proclasse-primary) !important;
    border-color: var(--proclasse-primary-active) !important;
    color: white !important;
}

.btn.btn-outline-primary.active:hover {
    background-color: var(--proclasse-primary-active) !important;
    border-color: var(--proclasse-primary-deep) !important;
}

:root {
    --proclasse-primary: #0d6efd;
    --proclasse-primary-rgb: 13, 110, 253;
    --proclasse-primary-hover: #0b5ed7;
    --proclasse-primary-active: #0a58ca;
    --proclasse-primary-deep: #0a3161;
    --proclasse-primary-alt: #1976d2;
    --proclasse-primary-pulse: #3d8bfd;
    --proclasse-primary-bg: #e8f0fe;
    --proclasse-primary-bg-alt: #e3f0ff;
    --proclasse-primary-bg-soft: #eef6ff;
    --proclasse-primary-bg-subtle: #f0f7ff;
    --proclasse-primary-bg-pcc: #dbeafe;
    --proclasse-primary-bg-pcc-alt: #e0f0ff;
    --proclasse-primary-border-soft: #cfe0ff;
    --proclasse-primary-border-subtle: #dbe8ff;
    --proclasse-primary-border-muted: #c2d4f8;
    --proclasse-primary-border-strong: #9ec5fe;
    --proclasse-primary-gradient-start: #1e40af;
    --proclasse-primary-gradient-mid: #2563eb;
    --proclasse-primary-gradient-end: #3b82f6;
    --bs-primary: var(--proclasse-primary);
    --bs-primary-rgb: var(--proclasse-primary-rgb);
    --bs-link-color: var(--proclasse-primary);
    --bs-link-hover-color: var(--proclasse-primary-active);
    --overlay-noir-transparent: rgba(0, 0, 0, 0.35);
    --overlay-transition-ms: 180ms;
    /* Groupes classes - mauve assorti a la couleur principale. */
    --proclasse-groupe-ligne: #c5b3f2;
    --proclasse-groupe-titre: #6f42c1;
    --proclasse-groupe-entete-bg: #8a63d2;
    --proclasse-groupe-entete-text: #ffffff;
    --proclasse-groupe-entete-bordure: #7451b8;
    --proclasse-groupe-carte-fond: #f3f0ff;
    --proclasse-groupe-carte-bordure: #d0bfff;
}

a:not(.btn):not(.nav-link):not(.navbar-brand),
.text-primary {
    color: var(--proclasse-primary) !important;
}

a:not(.btn):not(.nav-link):not(.navbar-brand):hover {
    color: var(--proclasse-primary-active);
}

.navbar-dark .navbar-brand,
.navbar-dark .navbar-brand:hover,
.navbar-dark .navbar-brand:focus {
    color: #fff !important;
}

.bg-primary {
    background-color: var(--proclasse-primary) !important;
}

.border-primary {
    border-color: var(--proclasse-primary) !important;
}

.btn-primary {
    background-color: var(--proclasse-primary) !important;
    border-color: var(--proclasse-primary) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--proclasse-primary-hover) !important;
    border-color: var(--proclasse-primary-hover) !important;
    color: #fff !important;
}

.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
    background-color: var(--proclasse-primary-active) !important;
    border-color: var(--proclasse-primary-active) !important;
    color: #fff !important;
}

.btn-primary:disabled,
.btn-primary.disabled {
    color: #fff !important;
}

.base-tab.active,
.base-tab.selected.active {
    color: #fff !important;
}

.btn-outline-primary {
    color: var(--proclasse-primary) !important;
    border-color: var(--proclasse-primary) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
    background-color: var(--proclasse-primary) !important;
    border-color: var(--proclasse-primary) !important;
    color: #fff !important;
}

.form-check-input:checked {
    background-color: var(--proclasse-primary);
    border-color: var(--proclasse-primary);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--proclasse-primary-border-strong);
    box-shadow: 0 0 0 0.25rem rgba(var(--proclasse-primary-rgb), 0.25);
}

.table-primary {
    --bs-table-bg: var(--proclasse-primary-bg);
    --bs-table-striped-bg: var(--proclasse-primary-bg-soft);
    --bs-table-hover-bg: var(--proclasse-primary-bg-alt);
    --bs-table-border-color: var(--proclasse-primary-border-muted);
    --bs-table-color: #000;
}

.modal-backdrop {
    --bs-backdrop-bg: 0, 0, 0;
    --bs-backdrop-opacity: 0.35;
    transition: opacity var(--overlay-transition-ms) ease !important;
}

.swal2-container,
.swal2-container.swal2-backdrop-show,
.swal2-container.swal2-noanimation {
    background: var(--overlay-noir-transparent) !important;
    transition: background-color var(--overlay-transition-ms) ease !important;
}
