/* Shared UI components for the whole "stages" module (prof + BDE)
   Goal: consistent pagination, tables and drawers across views. */

/* Masquer l'indicateur de calendrier natif pour tous les champs date avec date picker personnalisé */
input[type="date"].date-picker-input::-webkit-calendar-picker-indicator,
input[type="date"].drawer-date-input::-webkit-calendar-picker-indicator,
input.date-picker-input::-webkit-calendar-picker-indicator,
input.drawer-date-input::-webkit-calendar-picker-indicator {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
}

input[type="date"].date-picker-input::-moz-calendar-picker-indicator,
input[type="date"].drawer-date-input::-moz-calendar-picker-indicator,
input.date-picker-input::-moz-calendar-picker-indicator,
input.drawer-date-input::-moz-calendar-picker-indicator {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
}

:root {
    --stages-surface: rgba(2, 6, 23, 0.35);
    --stages-surface-strong: rgba(15, 23, 42, 0.55);
    --stages-border: rgba(148, 163, 184, 0.18);
    --stages-border-strong: rgba(148, 163, 184, 0.30);
    --stages-text: #e5e7eb;
    --stages-muted: #9ca3af;
    --stages-accent: #60a5fa;
    --stages-accent-2: #93c5fd;
    --stages-danger: #ef4444;
    --stages-warning: #f59e0b;
    --stages-success: #22c55e;
}

/* Badges : canon stages/css/badges.css */

/* ---------- En-têtes workflow (source de vérité admin / prof / BDE) ---------- */
.workflow-section-header {
    display: flex;
    align-items: center;
    gap: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-left: 4px solid #3b82f6;
    background:
        radial-gradient(ellipse 110% 90% at 100% 0%, rgba(59, 130, 246, 0.1), transparent 55%),
        rgba(15, 23, 42, 0.45);
    position: relative;
    overflow: hidden;
}

.workflow-section-header::after {
    content: "";
    position: absolute;
    inset: auto -36px -36px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.07), transparent 70%);
    pointer-events: none;
}

.workflow-section-header-medallion {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.32), rgba(37, 99, 235, 0.12));
    border: 1px solid rgba(96, 165, 250, 0.32);
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.16);
    position: relative;
    z-index: 1;
}

.workflow-section-header-medallion i {
    font-size: 1.1rem;
    color: #bfdbfe;
    line-height: 1;
}

.workflow-step-content {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.workflow-step-content h2 {
    margin: 0 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: #f3f4f6;
}

.workflow-step-content h2:only-child {
    margin-bottom: 0;
}

.workflow-step-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--stages-muted, #9ca3af);
    line-height: 1.55;
}

.workflow-section-header-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-self: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.workflow-section-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin: -0.5rem 0 1.5rem;
}

.workflow-section-stat {
    min-width: 72px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.45);
    text-align: center;
}

.workflow-section-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #f3f4f6;
    line-height: 1.1;
}

.workflow-section-stat-label {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}

.workflow-action-label-short {
    display: none;
}

@media (max-width: 768px) {
    .workflow-section-header {
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px 12px;
        margin-bottom: 12px;
        padding: 10px 12px;
    }

    .workflow-section-header-medallion {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .workflow-section-header-medallion i {
        font-size: 0.95rem;
    }

    .workflow-step-content h2 {
        margin: 0;
        font-size: 16px;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .workflow-step-content p {
        display: none;
    }

    .workflow-section-header-actions {
        width: auto;
        margin-left: auto;
        flex: 0 0 auto;
    }

    .workflow-section-header-actions .btn {
        min-height: 36px;
        font-size: 13px;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .workflow-action-label-full {
        display: none;
    }

    .workflow-action-label-short {
        display: inline;
    }

    .workflow-section-stats {
        justify-content: flex-start;
        margin: 0 0 12px;
    }
}

/* ---------- Filtres rétractables (renderStagesCollapsibleFilters) ---------- */
.requests-filters {
    margin-bottom: 20px;
}

.filters-bar {
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 16px;
}

.filters-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(auto-fit, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.filters-form-grid>input[type="hidden"] {
    display: none;
}

.filters-toolbar {
    display: contents;
}

.filters-advanced,
.filters-advanced-inner {
    display: contents;
}

.filters-toggle-btn {
    display: none !important;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Hauteur unique des contrôles de la barre (select = source de vérité) */
    --stages-filter-control-h: 34px;
}

/* display:flex ci-dessus écrase sinon le [hidden] natif (Suivi Liste / Imposés) */
.filter-field[hidden] {
    display: none !important;
}

.filter-field label {
    font-size: 12px;
    color: var(--stages-muted);
    font-weight: 500;
}

.filter-field input,
.filter-field select {
    height: var(--stages-filter-control-h);
    min-height: var(--stages-filter-control-h);
    padding: 0 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--stages-text);
    font-size: 13px;
    line-height: calc(var(--stages-filter-control-h) - 2px);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

/* Chevron FA-like sur tous les <select> natifs des filtres Stages */
.filter-field select {
    padding-right: 28px;
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(15, 23, 42, 0.6);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath fill='%2394a3b8' d='M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 11px;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Searchable-select dans barre de filtres : même chrome / hauteur que <select> natif */
.filter-field--searchable .searchable-select-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.filter-field--searchable .searchable-select-trigger {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: var(--stages-filter-control-h);
    min-height: var(--stages-filter-control-h);
    max-height: var(--stages-filter-control-h);
    padding: 0 28px 0 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--stages-text);
    font-size: 13px;
    line-height: calc(var(--stages-filter-control-h) - 2px);
    font-family: inherit;
    font-weight: inherit;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.filter-field--searchable .searchable-select-trigger:hover {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.3);
}

.filter-field--searchable .searchable-select-trigger.active,
.filter-field--searchable .searchable-select-trigger:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-field--searchable .searchable-select-value {
    color: var(--stages-text);
    font-size: inherit;
    line-height: inherit;
}

.filter-field--searchable .searchable-select-value.placeholder {
    color: var(--stages-muted);
}

.filter-field--searchable .searchable-select-trigger i {
    font-size: 11px;
    margin-left: 6px;
    color: var(--stages-muted);
    line-height: 1;
}

/* Dropdown items / recherche : même police que #filter_hosting (13px) */
.filter-field--searchable .searchable-select-search {
    width: 100%;
    height: var(--stages-filter-control-h);
    min-height: var(--stages-filter-control-h);
    padding: 0 28px 0 12px;
    font-size: 13px;
    line-height: calc(var(--stages-filter-control-h) - 2px);
    font-family: inherit;
    color: var(--stages-text);
    background: rgba(15, 23, 42, 0.6);
}

.filter-field--searchable .searchable-select-search-wrapper {
    padding: 6px 8px;
    justify-content: stretch;
}

.filter-field--searchable .searchable-select-search-wrapper .fa-search {
    right: 16px;
    font-size: 11px;
}

.filter-field--searchable .searchable-select-item {
    padding: 0 12px;
    height: var(--stages-filter-control-h);
    min-height: var(--stages-filter-control-h);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    font-size: 13px;
    line-height: 1.25;
    font-family: inherit;
    color: var(--stages-text);
}

.filter-field--searchable .searchable-select-item:hover {
    color: var(--stages-text);
}

.filter-field--searchable .searchable-select-item.selected {
    color: var(--stages-text);
}

.filter-field--searchable .searchable-select-dropdown .no-results {
    font-size: 13px;
    font-family: inherit;
    padding: 8px 12px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: var(--stages-filter-control-h);
    min-height: var(--stages-filter-control-h);
    padding: 0 8px 0 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-wrapper:focus-within {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}

.filter-field-search input,
.search-input-wrapper input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    padding: 8px 4px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.filter-field-search input:focus,
.search-input-wrapper input:focus {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}

.search-clear-btn {
    position: static;
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: var(--stages-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-clear-btn.visible {
    display: flex;
}

.search-clear-btn:hover {
    background: rgba(148, 163, 184, 0.2);
    color: var(--stages-text);
}

.search-clear-btn i {
    font-size: 12px;
}

.filters-toggle-icon {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.filters-toggle-btn.active .filters-toggle-icon {
    transform: rotate(180deg);
}

.filters-active-count:empty {
    display: none;
}

.filters-active-count {
    background: rgba(59, 130, 246, 0.2);
    color: var(--stages-accent);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

@media (max-width: 768px) {
    .requests-filters {
        margin-bottom: 12px;
    }

    .filters-bar {
        padding: 10px;
        background: rgba(15, 23, 42, 0.4);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* gap nul : l'espace sous la barre vient du padding du panneau, sinon un vide
       subsiste quand les filtres sont repliés. */
    .filters-form-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }

    .filters-toolbar {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 8px;
        width: 100%;
        min-width: 0;
        height: 40px;
        max-height: 40px;
    }

    .filter-field-search {
        position: relative;
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-width: 0;
        min-height: 0;
        margin: 0;
        height: auto;
        gap: 0;
    }

    .filter-field-search-label {
        position: absolute !important;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .search-input-wrapper {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        max-height: none;
        border-radius: 8px;
        background: rgba(15, 23, 42, 0.7);
    }

    /* Panneau repliable : la hauteur est animée par la rangée de grille (0fr -> 1fr),
       ce qui évite une hauteur maximale arbitraire. */
    .filters-advanced {
        display: grid;
        grid-template-rows: 0fr;
        width: 100%;
        min-width: 0;
        margin-top: 0;
        transition: grid-template-rows 280ms cubic-bezier(0.22, 1, 0.36, 1);
    }

    .filters-advanced.active {
        grid-template-rows: 1fr;
    }

    /* overflow:hidden uniquement replié : ouvert, il casse les <select> natifs
       (liste d’options invisible / « ne rend rien » sur mobile). */
    .filters-advanced-inner {
        position: relative;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: end;
        gap: 8px;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: opacity 180ms ease, visibility 0s linear 280ms;
    }

    .filters-advanced-inner::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 1px;
        background: rgba(148, 163, 184, 0.2);
    }

    .filters-advanced.active .filters-advanced-inner {
        overflow: visible;
        opacity: 1;
        visibility: visible;
        transition: opacity 240ms ease 40ms, visibility 0s linear 0s;
    }

    .filters-advanced .filter-field {
        flex: 1 1 0;
        min-width: 0;
        padding-top: 10px;
    }

    .filters-advanced .filter-field label {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .filter-field {
        --stages-filter-control-h: 42px;
    }

    .filter-field input,
    .filter-field select {
        padding: 0 12px;
        font-size: 14px;
    }

    .filter-field--searchable .searchable-select-trigger {
        padding: 0 28px 0 12px;
        font-size: 14px;
    }

    .filter-field--searchable .searchable-select-search,
    .filter-field--searchable .searchable-select-item,
    .filter-field--searchable .searchable-select-dropdown .no-results {
        font-size: 14px;
    }

    .filter-field-search input,
    .search-input-wrapper input {
        font-size: 16px;
        height: 100%;
        padding: 0 4px 0 0;
        line-height: 1.2;
        background: transparent;
        border: 0;
    }

    .filters-toggle-btn {
        display: inline-flex !important;
        appearance: none;
        flex: 0 0 auto;
        align-self: stretch;
        width: auto;
        height: auto;
        min-width: 40px;
        min-height: 0;
        max-height: none;
        margin: 0;
        padding: 0 10px;
        background: rgba(59, 130, 246, 0.1);
        border: 1px solid rgba(59, 130, 246, 0.3);
        border-radius: 8px;
        color: var(--stages-accent);
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        align-items: center;
        justify-content: center;
        gap: 6px;
        box-sizing: border-box;
        overflow: hidden;
        line-height: 1;
    }

    .filters-toggle-text {
        display: none;
    }

    .filters-toggle-icon {
        display: none;
    }

    .filters-toggle-btn:hover {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.4);
    }

    .filters-toggle-btn.active {
        background: rgba(59, 130, 246, 0.25);
        border-color: rgba(59, 130, 246, 0.55);
    }
}

@media (prefers-reduced-motion: reduce) {

    .filters-advanced,
    .filters-advanced-inner {
        transition: none;
    }
}

/* ---------- En-têtes overview dashboard (prof / BDE) ---------- */
.dashboard-overview-header {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background:
        radial-gradient(ellipse 120% 80% at 100% 0%, rgba(59, 130, 246, 0.12), transparent 55%),
        rgba(15, 23, 42, 0.45);
    border-left: 4px solid #3b82f6;
    position: relative;
    overflow: hidden;
}

.dashboard-overview-header::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08), transparent 70%);
    pointer-events: none;
}

.dashboard-overview-header--bde {
    background:
        radial-gradient(ellipse 120% 80% at 100% 0%, rgba(147, 51, 234, 0.14), transparent 55%),
        rgba(15, 23, 42, 0.45);
    border-left-color: #a855f7;
}

.dashboard-overview-header--bde::after {
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1), transparent 70%);
}

.dashboard-overview-header-medallion {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(37, 99, 235, 0.15));
    border: 1px solid rgba(96, 165, 250, 0.35);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
    align-self: flex-start;
}

.dashboard-overview-header-medallion i {
    font-size: 1.35rem;
    color: #bfdbfe;
}

.dashboard-overview-header--bde .dashboard-overview-header-medallion {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(126, 34, 206, 0.15));
    border-color: rgba(192, 132, 252, 0.35);
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.22);
}

.dashboard-overview-header--bde .dashboard-overview-header-medallion i {
    color: #e9d5ff;
}

.dashboard-overview-header-body {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.dashboard-overview-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}

.dashboard-overview-header-main {
    flex: 1 1 220px;
    min-width: 0;
}

.dashboard-overview-header-main h2 i {
    display: none;
}

.dashboard-overview-header-eyebrow {
    display: inline-block;
    margin-bottom: 0.35rem;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.25);
}

.dashboard-overview-header--bde .dashboard-overview-header-eyebrow {
    color: #d8b4fe;
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(192, 132, 252, 0.25);
}

.dashboard-overview-header-stats {
    margin: 0;
    flex-shrink: 0;
}

.dashboard-overview-header-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.dashboard-overview-header-context-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.65rem;
    min-width: 0;
}

.dashboard-overview-header-context-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #60a5fa;
    font-size: 12px;
}

.dashboard-overview-header--bde .dashboard-overview-header-context-icon {
    color: #c084fc;
}

.dashboard-overview-context-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #60a5fa;
}

.dashboard-overview-header--bde .dashboard-overview-context-label {
    color: #c084fc;
}

.dashboard-overview-context-detail {
    font-size: 13px;
    color: #e5e7eb;
    line-height: 1.4;
}

.dashboard-overview-context-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #93c5fd;
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-overview-context-link:hover {
    color: #bfdbfe;
}

.dashboard-overview-header--bde .dashboard-overview-context-link {
    color: #d8b4fe;
}

.dashboard-overview-header--bde .dashboard-overview-context-link:hover {
    color: #e9d5ff;
}

@media (max-width: 900px) {
    .dashboard-overview-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .dashboard-overview-header-body {
        flex: 0 0 auto;
        width: 100%;
    }

    .dashboard-overview-header-medallion {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .dashboard-overview-header-top {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
    }

    /* En colonne, flex-basis: 220px devenait une hauteur (trou sous le titre). */
    .dashboard-overview-header-main {
        flex: 0 0 auto;
        width: 100%;
        min-height: 0;
    }

    .dashboard-overview-header-stats {
        justify-content: flex-start;
        width: 100%;
        margin: 0;
    }

    .dashboard-overview-header-context {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .dashboard-overview-header {
        gap: 8px;
        margin-bottom: 12px;
        padding: 10px 12px;
    }

    .dashboard-overview-header-medallion,
    .dashboard-overview-header-eyebrow,
    .dashboard-overview-header-main p {
        display: none;
    }

    .dashboard-overview-header-main h2 {
        margin: 0;
        font-size: 16px;
        line-height: 1.25;
    }

    .dashboard-overview-header-main h2 i {
        display: inline-block;
    }

    .dashboard-overview-header-top {
        gap: 8px;
    }

    .dashboard-overview-header-stats .workflow-section-stat {
        min-width: 0;
        flex: 1 1 0;
        padding: 6px 8px;
    }

    .dashboard-overview-header-stats .workflow-section-stat-value {
        font-size: 15px;
    }

    .dashboard-overview-header-context {
        margin-top: 8px;
        padding-top: 8px;
    }
}

/* ---------- Flash messages (global) ---------- */
.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.5);
    color: var(--stages-text);
}

/* display:flex ci-dessus écrase sinon l’attribut HTML hidden */
.flash[hidden] {
    display: none !important;
}

.flash.flex-center {
    align-items: center;
}

.flash>i {
    flex-shrink: 0;
    line-height: 1.3;
}

.flash>div {
    flex: 1;
    min-width: 0;
}

.flash.success {
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

.flash.warning {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.35);
    color: #fde68a;
}

.flash.error {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.flash .flash-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    color: inherit;
}

/* ---------- Tabs (shared, dashboards prof + BDE) ---------- */
.tabs-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.tab-link {
    padding: 10px 14px;
    text-decoration: none;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 600;
    border-radius: 10px 10px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.25);
    flex-shrink: 0;
}

.tab-link:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.22);
}

.tab-link.active {
    color: var(--stages-accent);
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.25);
}

.tab-link i {
    font-size: 14px;
}

/* Boutons utilisés comme onglets (Suivi Liste/Imposés, etc.) */
.tabs-nav button.tab-link {
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.tab-label-mobile {
    display: none;
}

/* .tab-badge chrome : canon badges.css */

@media (max-width: 768px) {
    nav.tabs-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        border-bottom: none;
        margin-bottom: 12px;
        overflow: visible;
    }

    nav.tabs-nav .tab-link {
        position: relative;
        padding: 8px 8px 6px;
        font-size: 12px;
        min-height: 52px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border-bottom: none;
        border-radius: 8px;
        background: rgba(15, 23, 42, 0.4);
        border: 1px solid rgba(148, 163, 184, 0.2);
        margin-bottom: 0;
        text-align: center;
        flex-shrink: 1;
        box-sizing: border-box;
    }

    nav.tabs-nav .tab-link:hover {
        background: rgba(15, 23, 42, 0.6);
        border-color: rgba(148, 163, 184, 0.3);
        transform: translateY(-1px);
    }

    nav.tabs-nav .tab-link.active {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.4);
        color: var(--stages-accent);
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    }

    nav.tabs-nav .tab-link i {
        font-size: 14px;
    }

    nav.tabs-nav .tab-link .tab-label-full {
        display: none;
    }

    nav.tabs-nav .tab-link .tab-label-mobile {
        display: block;
        font-size: 12px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        text-align: center;
    }

    nav.tabs-nav .tab-badge {
        position: absolute;
        top: 3px;
        right: 4px;
        margin-left: 0;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        font-size: 10px;
        line-height: 16px;
        border-radius: var(--stages-badge-radius, 6px);
        pointer-events: none;
    }
}

/* ---------- Pagination (global) ---------- */
.pagination {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--stages-border);
    background: var(--stages-surface);
}

.pagination-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.pagination-link {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--stages-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background: var(--stages-surface-strong);
    white-space: nowrap;
    line-height: 1;
}

.pagination-link:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
}

.pagination-link--disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
}

.pagination-link-text--short {
    display: none;
}

.pagination-info {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.35);
    color: #cbd5e1;
    font-size: 12px;
    white-space: nowrap;
}

.pagination-info-short {
    display: none;
}

.pagination-per-page {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 0;
    justify-content: flex-end;
}

.pagination-per-page label {
    font-size: 12px;
    color: #cbd5e1;
    font-weight: 600;
    margin: 0;
}

.pagination-per-page select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: var(--stages-surface-strong);
    color: var(--stages-text);
    font-size: 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pagination-per-page select:hover {
    border-color: rgba(148, 163, 184, 0.4);
}

.pagination-per-page select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Mobile : nav ← · X/Y · → sur une ligne ; « Par page » dessous. */
@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }

    .pagination-nav {
        display: grid;
        grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .pagination-link {
        min-width: 2.75rem;
        min-height: 2.75rem;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        font-size: 16px;
    }

    .pagination-link-text--full {
        display: none;
    }

    .pagination-link-text--short {
        display: inline;
    }

    .pagination-info {
        justify-self: center;
        text-align: center;
        padding: 6px 8px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pagination-info-full {
        display: none;
    }

    .pagination-info-short {
        display: inline;
    }

    .pagination-per-page {
        width: 100%;
        justify-content: space-between;
        margin: 0;
        padding-top: 8px;
        border-top: 1px solid rgba(148, 163, 184, 0.14);
    }

    .pagination-per-page select {
        min-height: 2.75rem;
        min-width: 5.5rem;
    }
}

/* ---------- Table headers (title + actions) ---------- */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.table-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 750;
    color: var(--stages-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.table-header .table-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.table-header .table-header-subtitle {
    width: 100%;
    margin: 6px 0 0 0;
    color: var(--stages-muted);
    font-size: 13px;
    line-height: 1.45;
}

/* In a card-table (flush tables), the header should be padded and separated */
.card.card-table .table-header {
    margin: 0;
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--stages-border);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.04));
}

/* Common "actions cell" helper used in some list tables */
.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Utility: compact "Actions" column — en-tête + ⋮ / bouton direct centrés
 * (!important : bat `admin_common th { text-align: left }` et les flex enfants
 * sur lesquels `text-align` seul est inopérant). Autres colonnes inchangées. */
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(th.stages-col-actions, td.stages-col-actions) {
    width: var(--stages-actions-col-width, 3rem);
    white-space: nowrap;
    text-align: center !important;
    vertical-align: middle;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(td.stages-col-actions) {
    padding-left: 6px;
    padding-right: 6px;
    overflow: visible;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(th.stages-col-actions, td.stages-col-actions) :is(.action-menu, .stages-action-direct) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

/* Utility: compact "Statut" column (badges) */
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(th.stages-col-status, td.stages-col-status) {
    width: var(--stages-status-col-width, 140px);
    white-space: nowrap;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) th.stages-col-status {
    text-align: center;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) td.stages-col-status {
    text-align: center;
}

/* Utility: compact content-driven columns (e.g., Type, Classe) */
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(th.stages-col-compact, td.stages-col-compact) {
    width: 1%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Common fixed-width columns (used with table-layout: fixed) */
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(th.stages-col-chevron, td.stages-col-chevron) {
    width: 44px;
    white-space: nowrap;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(th.stages-col-type, td.stages-col-type) {
    width: var(--stages-type-col-width, 140px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) :is(th.stages-col-class, td.stages-col-class) {
    width: var(--stages-class-col-width, 120px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Tables (module-wide look) ---------- */
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) {
    width: 100% !important;
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    table-layout: auto;
    display: table;
    border-collapse: separate !important;
    border-spacing: 0;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--stages-border);
    border-radius: 12px;
    overflow: hidden;
}

/* Annuaire mobile densifié : fixed + min-width 0 (écrase table-layout:auto ci-dessus). */
@media (max-width: 768px) {
    .companies-table-wrapper > .companies-table {
        table-layout: fixed;
        min-width: 0;
    }
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) thead th {
    background: rgba(2, 6, 23, 0.55);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    text-align: left;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: middle;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) tbody td {
    padding: 12px 14px;
    color: var(--stages-text);
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
    vertical-align: middle;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) a,
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) code,
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) pre {
    overflow-wrap: anywhere;
    word-break: break-word;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) tbody tr:last-child td {
    border-bottom: none;
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.20);
}

:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table) tbody tr:hover {
    background: rgba(59, 130, 246, 0.10);
}

/* Opt-out utility if a specific table needs natural sizing */
.table-layout-auto {
    table-layout: auto !important;
}

/* Keep common "empty value" style consistent */
.empty-value {
    color: var(--stages-muted);
    font-size: 11px;
}

/* Utility: table container */
.table-container {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

/* ---------- List tables: fixed layout + aligned columns (pattern users.php) ---------- */
:is(.stages-table, .companies-table, .requests-table, .catchups-table, .classes-table, .pending-forms-table, .suivi-forms-table).stages-list-table {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
}

.stages-list-table :is(th, td) {
    min-width: 0;
}

.stages-list-table :is(th, td).stages-col-flex,
.stages-list-table :is(th, td).stages-col-desc,
.stages-list-table :is(th, td).stages-col-period,
.stages-list-table :is(th, td).stages-col-student {
    width: auto;
    min-width: 0;
}

.stages-list-table td.stages-col-flex,
.stages-list-table td.stages-col-desc,
.stages-list-table td.stages-col-period,
.stages-list-table td.stages-col-student {
    overflow: hidden;
}

.stages-list-table :is(th, td).stages-col-name,
.stages-list-table :is(th, td).stages-col-label {
    width: 14%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stages-list-table :is(th, td).stages-col-role {
    width: 7.5rem;
    white-space: nowrap;
}

.stages-list-table :is(th, td).stages-col-status {
    width: var(--stages-status-col-width, 6.5rem);
    white-space: nowrap;
    text-align: center;
}

.stages-list-table :is(th, td).stages-col-date {
    width: 9.5rem;
    white-space: nowrap;
}

.stages-list-table :is(th, td).stages-col-code {
    width: 6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stages-list-table :is(th, td).stages-col-class {
    width: 8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stages-list-table :is(th, td).stages-col-num {
    width: 5rem;
    white-space: nowrap;
    text-align: center;
}

.stages-list-table :is(th, td).stages-col-icon {
    width: 3rem;
    white-space: nowrap;
    text-align: center;
}

.stages-list-table :is(th, td).stages-col-checkbox {
    width: 2.75rem;
    text-align: center;
}

.stages-list-table :is(th, td).stages-col-type {
    width: var(--stages-type-col-width, 8.75rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suivi-forms-table {
    --stages-status-col-width: 13rem;
}

.bde-overview-pending-table {
    --stages-status-col-width: 12.5rem;
    table-layout: fixed;
    width: 100%;
}

/*
 * Desktop overview : Élève = colonne fluide (reste de la largeur + ellipsis).
 * Spécificité > `.requests-table thead th.col-student-desktop { width: 20% }` (dashboard_prof).
 */
.requests-table.bde-overview-pending-table thead th.col-student-desktop,
.requests-table.bde-overview-pending-table tbody td.col-student-desktop,
.requests-table.bde-overview-pending-table :is(th, td).stages-col-name {
    width: 100%;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.requests-table.bde-overview-pending-table thead th.col-class-desktop,
.requests-table.bde-overview-pending-table tbody td.col-class-desktop,
.requests-table.bde-overview-pending-table :is(th, td).stages-col-class {
    width: 7rem;
    min-width: 7rem;
    max-width: 7rem;
}

.requests-table.bde-overview-pending-table thead th.col-period-desktop,
.requests-table.bde-overview-pending-table tbody td.col-period-desktop,
.requests-table.bde-overview-pending-table :is(th, td).stages-col-period {
    width: 13rem;
    min-width: 13rem;
    max-width: 13rem;
    white-space: nowrap;
}

.suivi-forms-table :is(th, td).stages-col-status {
    width: var(--stages-status-col-width);
    min-width: var(--stages-status-col-width);
    overflow: hidden;
}

.requests-table.bde-overview-pending-table thead th.col-status,
.requests-table.bde-overview-pending-table tbody td.col-status,
.requests-table.bde-overview-pending-table :is(th, td).stages-col-status {
    width: var(--stages-status-col-width);
    min-width: var(--stages-status-col-width);
    max-width: var(--stages-status-col-width);
    overflow: hidden;
}

.requests-table.bde-overview-pending-table thead th.stages-col-actions,
.requests-table.bde-overview-pending-table tbody td.stages-col-actions,
.requests-table.bde-overview-pending-table :is(th, td).stages-col-actions {
    width: 3.25rem;
    min-width: 3.25rem;
    max-width: 3.25rem;
}

/*
 * Tableaux Suivi + overview BDE ≤768 : Statut en icône.
 * Sans ça, largeur statut desktop + table-layout:fixed font exploser
 * la hauteur (libellés qui wrappent). Période Suivi repliée sous l’élève.
 */
@media (max-width: 768px) {
    .suivi-forms-table,
    .bde-overview-pending-table {
        --stages-status-col-width: 2.75rem;
        table-layout: fixed;
        width: 100%;
    }

    .bde-overview-pending-table thead th.col-student,
    .bde-overview-pending-table tbody td.col-student {
        width: auto !important;
        min-width: 0;
    }

    .suivi-forms-table :is(th, td).stages-col-student {
        width: auto;
        min-width: 0;
    }

    .suivi-forms-table :is(th, td).stages-col-period {
        display: none;
    }

    .suivi-forms-table .suivi-student-period-mobile {
        display: block;
        margin-top: 2px;
        font-size: 11px;
        color: #9ca3af;
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .suivi-forms-table thead th.stages-col-status,
    .bde-overview-pending-table thead th.stages-col-status {
        font-size: 0;
        line-height: 0;
        color: transparent;
        overflow: hidden;
    }

    .suivi-forms-table :is(th, td).stages-col-status,
    .bde-overview-pending-table :is(th, td).stages-col-status {
        width: var(--stages-status-col-width);
        min-width: var(--stages-status-col-width);
        max-width: var(--stages-status-col-width);
        padding-left: 0.35rem;
        padding-right: 0.35rem;
        text-align: center;
        vertical-align: middle;
    }

    .suivi-forms-table td.stages-col-status .stages-badge,
    .bde-overview-pending-table td.stages-col-status .stages-badge {
        box-sizing: border-box;
        gap: 0;
        padding: 0;
        width: var(--stages-btn-icon-box, 28px);
        height: var(--stages-btn-icon-box, 28px);
        min-width: var(--stages-btn-icon-box, 28px);
        min-height: var(--stages-btn-icon-box, 28px);
        max-width: var(--stages-btn-icon-box, 28px);
        justify-content: center;
        font-size: 0;
        line-height: 0;
    }

    .suivi-forms-table td.stages-col-status .stages-badge i,
    .bde-overview-pending-table td.stages-col-status .stages-badge i {
        font-size: 0.75rem;
        line-height: 1;
        margin: 0;
    }

    .suivi-forms-table td.stages-col-status .stages-badge-label,
    .bde-overview-pending-table td.stages-col-status .stages-badge-label {
        display: none;
    }

    .bde-overview-pending-table .student-info {
        min-width: 0;
        margin-bottom: 0;
    }

    .bde-overview-pending-table .student-meta {
        flex-wrap: nowrap;
        min-width: 0;
        overflow: hidden;
    }

    .bde-overview-pending-table .student-period {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .suivi-forms-table .catchup-bde-student-identity,
    .suivi-forms-table .catchup-bde-student-name-row {
        min-width: 0;
    }

    /* Overview prof : Élève flexible + actions compactes (pas de colonne Statut - toutes « à valider »). */
    .prof-overview-pending-table {
        table-layout: fixed;
        width: 100%;
    }

    .prof-overview-pending-table thead th.col-student,
    .prof-overview-pending-table tbody td.col-student {
        width: auto !important;
        min-width: 0;
    }

    .prof-overview-pending-table :is(th, td).col-actions {
        width: 3rem !important;
        min-width: 3rem;
        max-width: 3rem;
    }

    .prof-overview-pending-table .student-info {
        min-width: 0;
        margin-bottom: 0;
    }

    .prof-overview-pending-table .student-meta {
        flex-wrap: nowrap;
        min-width: 0;
        overflow: hidden;
    }

    .prof-overview-pending-table .student-class,
    .prof-overview-pending-table .student-period,
    .prof-overview-pending-table .student-separator {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .prof-overview-pending-table .student-company {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/*
 * Tooltips statut mobile (tap ≤768) - source unique Mes fiches + Suivi + overview BDE.
 * JS : stages/js/stages-mobile-status-badges.js (classe .is-tooltip-open).
 */
@media (max-width: 768px) {
    .requests-table td.col-status .badge-mobile-ready,
    .suivi-forms-table td.stages-col-status .badge-mobile-ready,
    .bde-overview-pending-table td.stages-col-status .badge-mobile-ready,
    .bde-overview-pending-table td.col-status .badge-mobile-ready {
        position: relative;
        cursor: pointer;
    }

    .requests-table td.col-status .badge-mobile-ready::after,
    .suivi-forms-table td.stages-col-status .badge-mobile-ready::after,
    .bde-overview-pending-table td.stages-col-status .badge-mobile-ready::after,
    .bde-overview-pending-table td.col-status .badge-mobile-ready::after {
        content: attr(data-label);
        position: absolute;
        left: 50%;
        bottom: -8px;
        transform: translate(-50%, calc(100% - 4px)) scale(0.98);
        transform-origin: top center;
        z-index: 10;
        background: rgba(2, 6, 23, 0.98);
        color: #e5e7eb;
        border: 1px solid rgba(148, 163, 184, 0.45);
        border-radius: 8px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
        padding: 6px 8px;
        font-size: 11px;
        line-height: 1.25;
        white-space: normal;
        width: max-content;
        max-width: 170px;
        text-align: center;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition:
            opacity 0.16s cubic-bezier(0.2, 0.8, 0.2, 1),
            transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1),
            visibility 0.16s linear;
    }

    .requests-table td.col-status .badge-mobile-ready.is-tooltip-open::after,
    .suivi-forms-table td.stages-col-status .badge-mobile-ready.is-tooltip-open::after,
    .bde-overview-pending-table td.stages-col-status .badge-mobile-ready.is-tooltip-open::after,
    .bde-overview-pending-table td.col-status .badge-mobile-ready.is-tooltip-open::after {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, 100%) scale(1);
    }

    @media (prefers-reduced-motion: reduce) {
        .requests-table td.col-status .badge-mobile-ready::after,
        .suivi-forms-table td.stages-col-status .badge-mobile-ready::after,
        .bde-overview-pending-table td.stages-col-status .badge-mobile-ready::after,
        .bde-overview-pending-table td.col-status .badge-mobile-ready::after {
            transition: none;
            transform: translate(-50%, 100%);
        }

        .requests-table td.col-status .badge-mobile-ready.is-tooltip-open::after,
        .suivi-forms-table td.stages-col-status .badge-mobile-ready.is-tooltip-open::after,
        .bde-overview-pending-table td.stages-col-status .badge-mobile-ready.is-tooltip-open::after,
        .bde-overview-pending-table td.col-status .badge-mobile-ready.is-tooltip-open::after {
            transform: translate(-50%, 100%);
        }
    }
}

/* Période compacte sous l’élève : desktop masquée (colonne Période visible). */
.suivi-student-period-mobile {
    display: none;
}

.stages-list-table :is(th, td).stages-col-actions {
    width: var(--stages-actions-col-width, 4.75rem);
    min-width: var(--stages-actions-col-width, 4.75rem);
    max-width: var(--stages-actions-col-width, 4.75rem);
    text-align: center !important;
    vertical-align: middle;
}

.stages-list-table td.stages-col-actions :is(.action-menu, .stages-action-direct) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.stages-cell-ellipsis {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.actions-cell.stages-col-actions {
    justify-content: center;
}

.stages-section {
    margin-top: 2rem;
}

.stages-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.section-title-meta {
    font-size: 14px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 0.5rem;
}

.stages-nowrap {
    white-space: nowrap;
}

.btn-xs {
    font-size: 11px;
    padding: 4px 8px;
}

.stages-actions-inline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.text-center {
    text-align: center;
}

.card.card-table {
    padding: 0;
    overflow: hidden;
}

.card.card-table .table-wrapper {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.card.card-table .table-wrapper table {
    min-width: 100%;
}

.card.card-table .card-table-body {
    padding: 16px;
}

.card.card-table .card-table-body .stages-empty,
.card.card-table .card-table-body .empty-state {
    margin: 0;
}

.card.card-table :is(table.stages-table, table.companies-table, table.requests-table, table.catchups-table, table.classes-table, table.pending-forms-table, table.suivi-forms-table) {
    border: none;
    border-radius: 0;
    background: transparent;
}

/* Empty states (canon dashboards + pages config) */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    min-height: 120px;
}

/* display:flex ci-dessus écrase sinon le [hidden] natif du navigateur */
.empty-state[hidden] {
    display: none !important;
}

.empty-state-icon {
    display: block;
    font-size: 48px;
    color: #4b5563;
    margin-bottom: 16px;
}

.empty-state-text,
.empty-state p {
    margin: 0;
    font-size: 14px;
    color: #9ca3af;
}

/* Alias legacy pages config → même look */
.stages-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    min-height: 120px;
    color: #9ca3af;
    font-size: 14px;
}

.stages-empty > i {
    display: block;
    font-size: 48px;
    color: #4b5563;
    margin-bottom: 16px;
}

.stages-empty > p {
    margin: 0;
}

/* Utility: clickable rows with CSS variables */
.stages-click-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
    background: var(--stages-row-bg, rgba(15, 23, 42, 0.20));
    border-left: 5px solid var(--stages-row-border, transparent);
}

.stages-click-row:hover {
    background: var(--stages-row-hover, rgba(59, 130, 246, 0.10));
}

/* .stages-badge chrome : canon badges.css */

/* ---------- Cards (legacy BDE/admin pages use .card) ---------- */
.card {
    background: rgba(15, 23, 42, 0.55);
    border-radius: 14px;
    border: 1px solid var(--stages-border);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.45);
    margin-bottom: 20px;
}

.card:hover {
    border-color: rgba(148, 163, 184, 0.25);
}

.card h2,
.card h3,
.card h4 {
    color: var(--stages-text);
}

.card p {
    color: var(--stages-muted);
}

/* ---------- Drawers (unify overlay + panel) ---------- */
/* Generic drawer pattern already used by annexes */
.stages-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    background: rgba(15, 23, 42, 0.80);
    backdrop-filter: blur(4px);
}

.stages-drawer-overlay.active {
    display: block;
}

.stages-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 900px;
    background: linear-gradient(180deg, #1f2937 0%, #020617 100%);
    border-left: 1px solid var(--stages-border-strong);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.7);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.stages-drawer-overlay.active .stages-drawer {
    transform: translateX(0);
}

.stages-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.30);
    background: rgba(15, 23, 42, 0.90);
}

.stages-drawer-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--stages-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.stages-drawer-title i {
    color: var(--stages-accent);
}

.stages-drawer-subtitle {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--stages-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stages-drawer-close,
.stages-drawer-header .btn.btn-secondary.btn-sm,
.class-drawer .class-drawer-close,
.request-detail-drawer-close {
    background: none;
    border: none;
    color: var(--stages-muted);
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--stages-btn-radius, 6px);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.stages-drawer-close:hover,
.stages-drawer-header .btn.btn-secondary.btn-sm:hover,
.class-drawer .class-drawer-close:hover,
.request-detail-drawer-close:hover {
    background: rgba(148, 163, 184, 0.15);
    color: var(--stages-text);
}

.stages-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.stages-drawer-actions {
    padding: 14px 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(2, 6, 23, 0.35);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Map existing drawer implementations to the generic look (no markup change required) */

/* Class drawers (BDE admin) */
.class-drawer {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, 0.80);
    backdrop-filter: blur(4px);
    pointer-events: none;
    display: none;
}

.class-drawer.active {
    display: block;
    pointer-events: auto;
}

/* S'assurer que le contenu du tiroir peut recevoir les clics */
.class-drawer.active .class-drawer-content {
    pointer-events: auto !important;
}

.class-drawer.active .class-drawer-content * {
    pointer-events: auto !important;
}

.class-drawer .class-drawer-overlay {
    position: absolute;
    inset: 0;
    background: transparent !important;
    opacity: 1 !important;
    z-index: 1;
    pointer-events: auto;
}

/* S'assurer que le contenu du tiroir est au-dessus de l'overlay et intercepte les clics */
.class-drawer .class-drawer-content * {
    pointer-events: auto;
}

.class-drawer .class-drawer-content {
    pointer-events: auto !important;
}

.class-drawer .class-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 900px;
    height: 100%;
    background: linear-gradient(180deg, #1f2937 0%, #020617 100%) !important;
    border-left: 1px solid var(--stages-border-strong);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 10;
    pointer-events: auto;
}

.class-drawer.active .class-drawer-content {
    transform: translateX(0);
}

.class-drawer .class-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.30);
    background: rgba(15, 23, 42, 0.90) !important;
    flex-shrink: 0;
}

.class-drawer .class-drawer-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--stages-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.class-drawer .class-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.class-drawer .class-drawer-body {
    position: relative;
    z-index: 1;
}

.class-drawer .class-drawer-body form {
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

.class-drawer .class-drawer-body button[type="submit"],
.class-drawer .class-drawer-body .btn {
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
    cursor: pointer !important;
}

.class-drawer .class-drawer-body input,
.class-drawer .class-drawer-body select,
.class-drawer .class-drawer-body textarea {
    position: relative;
    z-index: 5;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Catchup drawer (prof) */
#catchup-detail-drawer.catchup-drawer {
    background: rgba(15, 23, 42, 0.80);
    backdrop-filter: blur(4px);
}

#catchup-detail-drawer.active .catchup-drawer-content {
    background: linear-gradient(180deg, #1f2937 0%, #020617 100%);
    max-width: 900px;
}

/* Request detail drawer (prof) */
#request-detail-drawer.request-detail-drawer {
    background: rgba(15, 23, 42, 0.80);
    backdrop-filter: blur(4px);
    z-index: 1100;
}

#request-detail-drawer.active .request-detail-drawer-content {
    background: linear-gradient(180deg, #1f2937 0%, #020617 100%);
}

/* Company form drawer (BDE) */
.company-form-drawer-overlay {
    background: rgba(15, 23, 42, 0.80) !important;
    backdrop-filter: blur(4px);
}

.company-form-drawer {
    background: transparent;
}

.company-form-drawer-content {
    background: linear-gradient(180deg, #1f2937 0%, #020617 100%);
    max-width: 900px;
}

/* ---------- Toasts (non bloquants, palette alignée sur .flash) ---------- */
.stages-toast-host {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: min(420px, calc(100vw - 32px));
    pointer-events: none;
    z-index: 10500;
}

.stages-toast-host .stages-toast {
    pointer-events: auto;
}

.stages-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: #0f172a;
    color: var(--stages-text);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
    animation: stages-toast-in 0.22s ease-out;
}

.stages-toast--out {
    animation: stages-toast-out 0.2s ease-in forwards;
}

@keyframes stages-toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes stages-toast-out {
    to {
        opacity: 0;
        transform: translateY(6px);
    }
}

.stages-toast__icon {
    flex-shrink: 0;
    line-height: 1.3;
    margin-top: 1px;
}

.stages-toast__text {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
    word-break: break-word;
}

.stages-toast__close {
    flex-shrink: 0;
    margin: -4px -6px -4px 0;
    padding: 6px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--stages-muted);
    cursor: pointer;
    line-height: 1;
}

.stages-toast__close:hover {
    background: rgba(148, 163, 184, 0.12);
    color: var(--stages-text);
}

.stages-toast--success {
    background: #14532d;
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

.stages-toast--warning {
    background: #78350f;
    border-color: rgba(245, 158, 11, 0.35);
    color: #fde68a;
}

.stages-toast--error {
    background: #7f1d1d;
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.stages-toast--info {
    background: #1e3a8a;
    border-color: rgba(96, 165, 250, 0.35);
    color: #bfdbfe;
}

/* ---------- Skeletons (placeholders animés pour chargements) ---------- */
@keyframes stages-skel-shimmer {
    0% {
        background-position: -300px 0;
    }

    100% {
        background-position: 300px 0;
    }
}

.stages-skel,
.stages-skel-line,
.stages-skel-circle,
.stages-skel-rect,
.stages-skel-card {
    background-color: rgba(148, 163, 184, 0.12);
    background-image: linear-gradient(90deg,
            rgba(148, 163, 184, 0.06) 0%,
            rgba(148, 163, 184, 0.18) 50%,
            rgba(148, 163, 184, 0.06) 100%);
    background-size: 600px 100%;
    background-repeat: no-repeat;
    border-radius: 6px;
    animation: stages-skel-shimmer 1.4s ease-in-out infinite;
    display: block;
}

.stages-skel-line {
    height: 12px;
    margin: 8px 0;
    width: 100%;
}

.stages-skel-line.stages-skel-line--sm {
    height: 10px;
}

.stages-skel-line.stages-skel-line--lg {
    height: 16px;
}

.stages-skel-line.stages-skel-line--w-25 {
    width: 25%;
}

.stages-skel-line.stages-skel-line--w-50 {
    width: 50%;
}

.stages-skel-line.stages-skel-line--w-75 {
    width: 75%;
}

.stages-skel-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.stages-skel-rect {
    height: 80px;
    width: 100%;
}

.stages-skel-card {
    padding: 16px;
    margin: 8px 0;
    height: 84px;
    background-image: none;
    border: 1px solid var(--stages-border);
    border-radius: 10px;
}

.stages-skel-card .stages-skel-line {
    margin: 6px 0;
}

.stages-skel-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stages-skel-list>li {
    padding: 12px 0;
    border-bottom: 1px solid var(--stages-border);
}

.stages-skel-list>li:last-child {
    border-bottom: none;
}

@media (prefers-reduced-motion: reduce) {

    .stages-skel,
    .stages-skel-line,
    .stages-skel-circle,
    .stages-skel-rect,
    .stages-skel-card {
        animation: none;
    }
}

/* Texte visible uniquement aux lecteurs d'écran (accessibilité). */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}