.admin-container {
    width: min(1280px, calc(100% - 32px));
}

.admin-header {
    margin-bottom: 18px;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.admin-nav a,
.admin-button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 9px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
}

.admin-nav a:hover,
.admin-button:hover {
    background: var(--accent-dark);
}

.admin-filters {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, minmax(150px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.admin-filters label {
    margin-bottom: 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.admin-table th {
    white-space: nowrap;
}

.admin-table td {
    vertical-align: top;
}

.admin-table a {
    font-weight: 700;
}

.admin-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.admin-kpi {
    background: #fcfcfd;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
}

.admin-kpi strong {
    display: block;
    font-size: 1.8rem;
    color: var(--accent);
}

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef4ff;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 700;
}

.badge-green {
    background: #ecfdf3;
    color: #05603a;
}

.badge-orange {
    background: #fff6e5;
    color: #93370d;
}

.badge-red {
    background: #fef3f2;
    color: #b42318;
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.admin-detail-list {
    display: grid;
    gap: 8px;
}

.admin-detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 7px;
}

.admin-detail-list dt {
    font-weight: 700;
}

.admin-detail-list dd {
    margin: 0;
    text-align: right;
}

.admin-login {
    max-width: 520px;
    margin: 70px auto;
}

.admin-warning {
    background: #fff6e5;
    border-left: 4px solid #f79009;
    padding: 12px 14px;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .admin-filters,
    .admin-kpis,
    .admin-detail-grid {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 0.85rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px;
    }
}


.admin-status-form {
    display: grid;
    gap: 14px;
}

.admin-notes {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.admin-note {
    background: #fcfcfd;
    border: 1px solid var(--border);
    border-left: 5px solid var(--accent);
    border-radius: 12px;
    padding: 14px;
}

.admin-note p {
    margin-top: 0;
}

.admin-note small {
    color: var(--muted);
}

.admin-export-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.admin-export-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    background: #fcfcfd;
}

.admin-export-card h3 {
    margin-top: 0;
}

@media (max-width: 800px) {
    .admin-export-grid {
        grid-template-columns: 1fr;
    }
}


.admin-kpis-wide {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-kpi small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.35;
}


.admin-season-filter {
    grid-template-columns: minmax(260px, 420px) auto auto;
}

@media (max-width: 800px) {
    .admin-season-filter {
        grid-template-columns: 1fr;
    }
}


.inline-form {
    display: inline-block;
    margin: 0 0 6px 0;
}

.inline-form button {
    padding: 7px 10px;
    font-size: 0.85rem;
}

.admin-table small {
    color: var(--muted);
}


.danger-button {
    background: #d92d20 !important;
    color: #fff !important;
}

.danger-button:hover {
    background: #b42318 !important;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 22px 0;
}


.diff-row {
    background: #fff6e5;
}

.diff-row td {
    border-bottom-color: #f79009;
}

.admin-detail-grid ul {
    margin-top: 8px;
}


button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


.admin-mini-list {
    margin: 0;
    padding-left: 18px;
}

.admin-payment-form {
    display: grid;
    gap: 14px;
}

.admin-payment-details {
    align-items: end;
}


.admin-total-row {
    background: #f8fafc;
}

.admin-muted {
    color: #667085;
    font-size: 0.9em;
    margin-left: 0.35rem;
}


/* Tableaux admin lisibles sans ascenseur horizontal.
   Les grands tableaux restent en tableau sur ordinateur,
   et deviennent des cartes sur écran plus étroit. */
@media (max-width: 1180px) {
    .table-wrapper-responsive-cards {
        overflow-x: visible;
    }

    .admin-table-responsive-cards,
    .admin-table-responsive-cards thead,
    .admin-table-responsive-cards tbody,
    .admin-table-responsive-cards tr,
    .admin-table-responsive-cards th,
    .admin-table-responsive-cards td {
        display: block;
        width: 100%;
    }

    .admin-table-responsive-cards {
        border-collapse: separate;
        border-spacing: 0;
    }

    .admin-table-responsive-cards thead {
        position: absolute;
        left: -9999px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }

    .admin-table-responsive-cards tbody tr {
        margin: 0 0 1rem;
        padding: 0.85rem;
        border: 1px solid #d7dce5;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    }

    .admin-table-responsive-cards tbody td {
        display: grid;
        grid-template-columns: minmax(120px, 34%) 1fr;
        gap: 0.75rem;
        align-items: start;
        padding: 0.45rem 0;
        border: 0;
        border-bottom: 1px solid #eef1f6;
        white-space: normal;
        word-break: break-word;
    }

    .admin-table-responsive-cards tbody td:last-child {
        border-bottom: 0;
    }

    .admin-table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #475467;
    }

    .admin-table-responsive-cards .inline-form {
        display: inline-flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        margin: 0.15rem 0;
    }

    .admin-table-responsive-cards button,
    .admin-table-responsive-cards .admin-button {
        white-space: normal;
    }
}

@media (max-width: 640px) {
    .admin-table-responsive-cards tbody td {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .admin-table-responsive-cards tbody td::before {
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }
}


/* Tableaux larges du back-office : version compacte sur ordinateur.
   Objectif : éviter l'ascenseur horizontal sur grand écran. */
@media (min-width: 1181px) {
    .table-wrapper-responsive-cards {
        overflow-x: visible;
    }

    .admin-table-compact {
        width: 100%;
        table-layout: fixed;
        font-size: 0.78rem;
    }

    .admin-table-compact th,
    .admin-table-compact td {
        padding: 0.34rem 0.36rem;
        line-height: 1.18;
        vertical-align: top;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    .admin-table-compact th {
        font-size: 0.72rem;
    }

    .admin-table-compact code {
        font-size: 0.72rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .admin-table-compact small {
        font-size: 0.68rem;
    }

    .admin-table-compact .badge {
        font-size: 0.68rem;
        padding: 0.12rem 0.32rem;
        display: inline-block;
        margin-top: 0.12rem;
    }

    .admin-table-compact .inline-form {
        display: inline-flex;
        flex-wrap: wrap;
        gap: 0.18rem;
        margin: 0.08rem 0;
    }

    .admin-table-compact button,
    .admin-table-compact .admin-button {
        font-size: 0.68rem;
        padding: 0.28rem 0.42rem;
        white-space: normal;
        line-height: 1.12;
    }

    .admin-table-compact a {
        font-size: 0.76rem;
    }

    /* Tableau de bord : 14 colonnes */
    .admin-table-compact th:nth-child(1),
    .admin-table-compact td:nth-child(1) { width: 7%; }   /* Date */
    .admin-table-compact th:nth-child(2),
    .admin-table-compact td:nth-child(2) { width: 6%; }   /* Saison */
    .admin-table-compact th:nth-child(3),
    .admin-table-compact td:nth-child(3) { width: 8%; }   /* Référence */
    .admin-table-compact th:nth-child(4),
    .admin-table-compact td:nth-child(4) { width: 10%; }  /* Nom */
    .admin-table-compact th:nth-child(5),
    .admin-table-compact td:nth-child(5) { width: 7%; }   /* Demande */
    .admin-table-compact th:nth-child(6),
    .admin-table-compact td:nth-child(6) { width: 7%; }   /* Licence */
    .admin-table-compact th:nth-child(7),
    .admin-table-compact td:nth-child(7),
    .admin-table-compact th:nth-child(8),
    .admin-table-compact td:nth-child(8),
    .admin-table-compact th:nth-child(9),
    .admin-table-compact td:nth-child(9) { width: 6%; }   /* Montants */
    .admin-table-compact th:nth-child(10),
    .admin-table-compact td:nth-child(10),
    .admin-table-compact th:nth-child(11),
    .admin-table-compact td:nth-child(11),
    .admin-table-compact th:nth-child(12),
    .admin-table-compact td:nth-child(12) { width: 7%; }  /* Statuts */
    .admin-table-compact th:nth-child(13),
    .admin-table-compact td:nth-child(13) { width: 9%; }  /* Action FFA */
    .admin-table-compact th:nth-child(14),
    .admin-table-compact td:nth-child(14),
    .admin-table-compact th:nth-child(15),
    .admin-table-compact td:nth-child(15) { width: 8%; }  /* Actions */
}


.admin-image-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 16px 0 22px;
}

.admin-image-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    padding: 12px;
}

.admin-image-item img {
    width: 100%;
    height: 135px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    margin-bottom: 10px;
}

.admin-image-item button {
    margin-top: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    background: var(--danger);
}

/* Menu admin latéral — V1 ergonomie back-office */
.admin-body {
    background: #f6f8fb;
}

.admin-shell {
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 290px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 30px rgba(16, 24, 40, 0.08);
    overflow-y: auto;
    padding: 18px 16px 26px;
    z-index: 60;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 18px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.admin-sidebar-logo {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.admin-sidebar-brand strong,
.admin-sidebar-brand small {
    display: block;
}

.admin-sidebar-brand small {
    margin-top: 2px;
    color: var(--muted);
    font-weight: 700;
}

.admin-sidebar-nav {
    display: grid;
    gap: 14px;
}

.admin-menu-group {
    display: grid;
    gap: 6px;
}

.admin-menu-group h2 {
    margin: 8px 8px 4px;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.admin-menu-group a {
    display: block;
    padding: 9px 10px;
    border-radius: 10px;
    color: #1d2939;
    text-decoration: none;
    font-weight: 700;
    line-height: 1.2;
}

.admin-menu-group a:hover {
    background: #eef4ff;
    color: var(--accent-dark);
}

.admin-menu-group a.is-active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(11, 92, 171, 0.22);
}

.admin-menu-group-secondary {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.admin-menu-group-secondary a {
    color: var(--accent-dark);
}

.admin-main {
    margin-left: 318px;
    padding-top: 24px;
    padding-bottom: 48px;
}

.admin-main .admin-header {
    background: #fff;
}

.admin-menu-toggle {
    display: none;
}

.admin-sidebar-backdrop {
    display: none;
}

@media (max-width: 1100px) {
    .admin-container.admin-main {
        width: min(100%, calc(100% - 24px));
    }

    .admin-main {
        margin-left: 0;
        padding-top: 72px;
    }

    .admin-menu-toggle {
        position: fixed;
        top: 12px;
        left: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 10px 14px;
        border: 0;
        border-radius: 999px;
        background: var(--accent);
        color: #fff;
        font-weight: 800;
        box-shadow: 0 8px 20px rgba(16, 24, 40, 0.18);
        z-index: 80;
        cursor: pointer;
    }

    .admin-sidebar {
        transform: translateX(-104%);
        transition: transform 0.22s ease;
        width: min(88vw, 320px);
    }

    .admin-menu-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(16, 24, 40, 0.45);
        z-index: 50;
    }

    .admin-menu-open .admin-sidebar-backdrop {
        display: block;
    }

    .admin-menu-open {
        overflow: hidden;
    }
}

@media (max-width: 640px) {
    .admin-main {
        padding-top: 66px;
    }

    .admin-header h1 {
        font-size: 1.55rem;
    }

    .admin-menu-group a {
        padding: 11px 10px;
    }
}

/* Version V3 : menu admin et pied de page */
.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.admin-sidebar-brand:hover {
    text-decoration: none;
}

.admin-version-footer {
    margin: 26px 0 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}


/* V10.3.22 — signalement des dossiers présentant des écarts avec la base FFA. */
.ffa-difference-name {
    background: #fff4f2;
    border-left: 4px solid #d92d20;
}

.ffa-difference-person {
    color: #b42318;
    font-weight: 900;
}

.badge-ffa-difference {
    margin-top: 5px;
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}


/* V10.3.23 — import et suivi des parcours santé FFA / PPS. */
.pps-stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); gap:12px; margin:18px 0; }
.pps-stats-grid > div { border:1px solid #d9e2ec; border-radius:10px; padding:14px; background:#f8fafc; }
.pps-stats-grid strong { display:block; font-size:1.65rem; line-height:1.1; }
.pps-stats-grid span { display:block; margin-top:5px; color:#52606d; }
.pps-state-in_progress { background:#fff4d6; color:#7a4d00; }
.pps-state-to_validate { background:#e3f2fd; color:#0d4f7c; }
.pps-state-validated_presaisie { background:#e4f7e8; color:#176b2c; }


/* V10.3.24 — affichage PPS dans les dossiers d'inscription. */
.pps-inline-status {
    margin-top: 6px;
    max-width: 260px;
    white-space: normal;
    line-height: 1.25;
    text-align: left;
    vertical-align: top;
}
.pps-state-not-found {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}
.pps-state-not-checkable,
.pps-state-unavailable {
    background: #f2f4f7;
    border-color: #d0d5dd;
    color: #475467;
}
.pps-detail-block code {
    overflow-wrap: anywhere;
}

/* V10.3.26 — rapprochement des dossiers électroniques payés et des parcours PPS. */
.pps-reconciliation-filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.pps-reconciliation-stats > div:nth-child(1) { border-left: 5px solid #d92d20; }
.pps-reconciliation-stats > div:nth-child(2) { border-left: 5px solid #12b76a; }
.pps-reconciliation-stats > div:nth-child(3) { border-left: 5px solid #2e90fa; }
.pps-situation-badge {
    max-width: 250px;
    white-space: normal;
    line-height: 1.25;
}
.pps-situation-incomplete {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}
.pps-situation-complete {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
}
.pps-situation-pps-only {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #175cd3;
}
.pps-reconciliation-row.pps-situation-incomplete td:first-child { border-left: 4px solid #d92d20; }
.pps-reconciliation-row.pps-situation-complete td:first-child { border-left: 4px solid #12b76a; }
.pps-reconciliation-row.pps-situation-pps-only td:first-child { border-left: 4px solid #2e90fa; }
.pps-reminder-inline-form {
    margin-top: 8px;
}
.pps-reconciliation-table td {
    min-width: 150px;
}
.pps-reconciliation-table td:nth-child(2),
.pps-reconciliation-table td:nth-child(4) {
    min-width: 220px;
}

/* V10.3.30B — file opérateur et accès direct e-Licence SI-FFA. */
.siffa-safety-notice {
    border-top: 6px solid #7f56d9;
    background: #f9f5ff;
}

.siffa-direct-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 18px;
    align-items: center;
    margin: 16px 0 22px;
    padding: 16px;
    border: 1px solid #d6bbfb;
    border-left: 5px solid #7f56d9;
    border-radius: 12px;
    background: #f9f5ff;
}

.siffa-direct-panel p {
    margin: 6px 0 0;
}

.siffa-direct-panel small {
    grid-column: 1 / -1;
    color: #6941c6;
    font-weight: 700;
}

.siffa-direct-panel-actions,
.siffa-ready-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.siffa-direct-button {
    background: #6941c6 !important;
    color: #fff !important;
}

.siffa-direct-button:hover {
    background: #53389e !important;
}

.siffa-manual-button {
    background: #475467 !important;
    color: #fff !important;
}

.siffa-ready-table code {
    font-weight: 800;
}

.siffa-ready-table .admin-button {
    display: inline-block;
    padding: 8px 11px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.82rem;
    line-height: 1.2;
}

@media (max-width: 900px) {
    .siffa-direct-panel {
        grid-template-columns: 1fr;
    }

    .siffa-direct-panel small {
        grid-column: auto;
    }
}
