/* Général */
body {
    font-family: Arial, sans-serif;
    line-height: 1.45; /* léger resserrement */
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
}

header, footer {
    background-color: #6200ea;
    color: #fff;
    padding: 12px; /* 20px -> 12px */
    text-align: center;
}

header nav a, footer .btn {
    color: #fff;
    text-decoration: none;
    margin: 0 10px;
    font-weight: bold;
    padding: 10px 15px;
    border-radius: 5px;
    background-color: #6200ea;
    cursor: pointer;
}
header nav a:hover, footer .btn:hover {
    opacity: 0.9;
}
footer .btn-danger {
    background-color: #d32f2f;
}

main {
    padding: 14px; /* 20px -> 14px */
    margin: 12px auto; /* 20px -> 12px */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.08);
}
section {
    margin-bottom: 14px; /* 20px -> 14px */
    padding: 10px; /* 15px -> 10px */
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 8px;
}

/* Formulaires */
form {
    margin-bottom: 14px; /* 20px -> 14px */
    display: flex;
    flex-direction: column;
    gap: 8px; /* 15px -> 8px */
}
form input, form select, form textarea, form button {
    font-family: inherit;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 14px;
    width: 100%;
}
form button {
    background-color: #007BFF;
    color: #fff;
    border: none;
    cursor: pointer;
}
form button:hover {
    background-color: #0056b3;
}

.site-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.admin-env-banner {
    margin: 16px auto 0;
    padding: 12px 16px;
    border-left: 4px solid #ff9800;
    background: #fff3e0;
    color: #663c00;
    border-radius: 6px;
    max-width: 960px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.admin-env-banner strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.95rem;
}
.admin-env-banner ul {
    margin: 0;
    padding-left: 18px;
}
.admin-env-banner li {
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.site-filter-label {
    font-weight: 600;
    color: #444;
}
.site-filter-current {
    font-size: 0.95em;
    color: #555;
}
.site-filter-form {
    margin-bottom: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: auto;
}
.site-filter-form button {
    width: auto;
    background: #fff;
    color: #6200ea;
    border: 1px solid #6200ea;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.site-filter-form button.active,
.site-filter-form button:hover {
    background: #6200ea;
    color: #fff;
}

/* TABLES - Nettoyage et harmonisation */
table, .styled-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px; /* 20px -> 12px */
    table-layout: auto;
}
table th, table td, .styled-table th, .styled-table td {
    border: 1px solid #ddd;
    vertical-align: top;
    font-size: 0.97em;
    padding: 0.12em 0.5em;
    line-height: 1.05;
}
table th, .styled-table th {
    background-color: #6200ea;
    color: #fff;
    text-align: left;
    cursor: pointer;
}

.styled-table th.sort-asc::after { content: " \25B2"; }
.styled-table th.sort-desc::after { content: " \25BC"; }

.styled-table .actions-cell, .styled-table td.actions-cell, .actions-cell {
    padding: 0 !important;
    min-width: 120px;
    width: 120px;
}
.styled-table .actions-flex, .actions-flex {
    display: flex;
    flex-direction: row;
    gap: 2px;
    align-items: center;
    justify-content: flex-start;
}
.styled-table .actions-flex form, .actions-flex form {
    margin: 0;
    display: inline;
}

.styled-table .btn,
.styled-table button,
.styled-table .icon-btn,
.actions-flex .btn,
.actions-flex button,
.actions-flex .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 2px 6px;
    margin: 0 1px;
    cursor: pointer;
    font-size: 1.1em;
    border-radius: 5px;
    transition: background 0.2s, color 0.2s;
    min-width: 0;
    min-height: 0;
    height: 28px;
    width: 28px;
}
.styled-table .btn-success, .actions-flex .btn-success { color: #388e3c; }
.styled-table .btn-danger, .actions-flex .btn-danger { color: #d32f2f; }
.styled-table .btn-warning, .actions-flex .btn-warning { color: #fbc02d; }
.styled-table .btn-secondary, .actions-flex .btn-secondary { color: #1976d2; }
.styled-table .btn-primary, .actions-flex .btn-primary { color: #6200ea; }
.styled-table .btn:hover, .styled-table button:hover, .styled-table .icon-btn:hover,
.actions-flex .btn:hover, .actions-flex button:hover, .actions-flex .icon-btn:hover {
    background: #f0f0f0;
}

/* Messages */
.message {
    padding: 10px;
    color: green;
    border: 1px solid green;
    border-radius: 5px;
    background-color: #e6ffe6;
    margin-bottom: 10px;
}

textarea {
    min-height: 50px;
    font-family: "Courier New", Courier, monospace;
    resize: vertical;
}

.details-row { display: none; }
.details-row.open { display: table-row; }

@media only screen and (max-width: 900px) {
    html, body { min-width: 100vw; min-height: 100vh; font-size: 13px; padding: 0; margin: 0; }
    main, section { padding: 5px !important; margin: 5px 0 !important; }
    table { font-size: 12px; display: block; overflow-x: auto; white-space: nowrap; }
    th, td { padding: 4px !important; }
    .styled-table th, .styled-table td { min-width: 70px; max-width: 180px; padding: 0.18em 0.3em; }
    .styled-table th.actions-cell, .styled-table td.actions-cell, .actions-cell { min-width: 90px; max-width: 120px; }
    .styled-table .actions-flex, .actions-flex { flex-wrap: nowrap; }
    header, footer { padding: 10px !important; }
}
@media only screen and (orientation: portrait) and (max-width: 900px) {
    #landscape-warning { display: none; }
    main, header, footer, section { filter: none; pointer-events: auto; user-select: auto; }
}
#landscape-warning {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fffbe7;
    color: #d32f2f;
    font-size: 1.3em;
    text-align: center;
    padding-top: 30vh;
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px 6px;
    margin: 0 2px;
    cursor: pointer;
    position: relative;
    font-size: 1.1em;
    transition: background 0.2s;
}
.icon-btn .btn-label {
    display: none;
    position: absolute;
    left: 50%;
    top: 120%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.95em;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.icon-btn:hover .btn-label,
.icon-btn:focus .btn-label {
    display: block;
    opacity: 1;
}
.icon-btn .icon { font-size: 1.2em; pointer-events: none; }
.icon-btn.btn-danger:hover { background: #ffeaea; }
.icon-btn.btn-warning:hover { background: #fff8e1; }
.icon-btn.btn-secondary:hover { background: #e3f2fd; }
.actions-cell { padding: 0 !important; }
.actions-flex { display: flex; flex-direction: row; gap: 2px; align-items: center; justify-content: flex-start; }
.actions-flex form { margin: 0; display: inline; }

.tabs-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 6px; /* 8px -> 6px */
    background: #f4f4f9;
    border-radius: 8px;
    padding: 4px 8px; /* 8x12 -> 4x8 */
    margin-bottom: 1em; /* 1.5em -> 1em */
    box-shadow: 0 2px 6px rgba(98,0,234,0.05);
    border: 1px solid #e0e0e0;
    overflow-x: auto;
}
.tab-btn {
    background: #fff;
    color: #6200ea;
    border: none;
    border-radius: 6px 6px 0 0;
    padding: 6px 14px; /* 10x22 -> 6x14 */
    font-size: 0.95em; /* léger */
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(98,0,234,0.04);
    margin-bottom: -2px;
    outline: none;
    position: relative;
}
.tab-btn.active {
    background: #6200ea;
    color: #fff;
    box-shadow: 0 4px 12px rgba(98,0,234,0.10);
    z-index: 2;
}
.tab-btn:not(.active):hover {
    background: #ede7f6;
    color: #311b92;
}
@media (max-width: 600px) {
    .tabs-container { flex-wrap: wrap; gap: 4px; padding: 6px 2px; }
    .tab-btn { font-size: 0.95em; padding: 8px 10px; }
}

.generate-code-form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6em; /* 1em -> 0.6em */
    flex-wrap: wrap;
    margin-top: 1em; /* 1.5em -> 1em */
}
.generate-code-form label,
.generate-code-form select,
.generate-code-form input,
.generate-code-form button {
    margin: 0;
    width: auto;
    min-width: unset;
    max-width: unset;
    flex: none;
}
@media (max-width: 600px) {
    .generate-code-form { flex-direction: column; align-items: stretch; gap: 0.5em; }
}

/* Header admin */
.admin-header {
    background: linear-gradient(90deg, #1a4a7a 0%, #3b7bbf 100%);
    border-bottom: 1px solid #e0e0e0;
    padding: 0.5em 0 0 0;
    box-shadow: 0 2px 8px #eee;
}
.header-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1em;
    gap: 1em;
}
.admin-nav { display: flex; align-items: center; position: relative; }
.nav-toggle {
    display: inline-block;
    background: #e0e7ef;
    color: #1a4a7a;
    border: none;
    font-size: 2em;
    cursor: pointer;
    margin: 0 0.5em 0 0;
    padding: 0.2em 0.5em;
    border-radius: 6px;
    transition: background 0.2s;
    z-index: 11;
}
.header-title {
    color: #fff;
    text-shadow: 0 2px 8px #1a4a7a33;
    font-size: 2em;
    margin: 0.2em 0;
    flex: 0 1 auto;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.nav-links a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    padding: 0.4em 1em;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    background: none;
    border: none;
    font-size: 1em;
}
.nav-links a:hover, .nav-links a:focus {
    background: #e0e7ef;
    color: #1a4a7a;
}
@media (max-width: 600px) {
    .header-title { font-size: 1.2em; text-align: left; flex: 1 1 auto; }
    .header-content { flex-direction: row; align-items: center; gap: 0.5em; padding: 0 0.5em; }
    .admin-nav { margin-right: 0.5em; }
    .nav-links {
        display: none;
        flex-direction: column;
        background: #fff;
        position: absolute;
        left: 0;
        top: 2.5em;
        width: 95vw;
        max-width: 340px;
        min-width: 180px;
        box-shadow: 0 2px 16px #bbb;
        padding: 1em 0.5em;
        gap: 0.5em;
        z-index: 10;
        border-radius: 12px;
        text-align: center;
    }
    .nav-links.show { display: flex; }
    .nav-links a {
        font-size: 1.1em;
        padding: 0.7em 0;
        border-bottom: 1px solid #eee;
        background: #f7fafd;
        margin: 0.2em 0;
        color: #1a4a7a;
        border-radius: 8px;
        box-shadow: 0 1px 2px #e0e0e0;
    }
    .nav-links a:last-child { border-bottom: none; }
}

/* TABLES - Largeur des colonnes harmonisée et responsive */
.styled-table th, .styled-table td {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.styled-table th.actions-cell, .styled-table td.actions-cell, .actions-cell {
    min-width: 110px;
    max-width: 160px;
    width: 1%;
    padding: 0 !important;
}
.styled-table .actions-flex, .actions-flex { flex-wrap: wrap; gap: 2px; align-items: center; justify-content: flex-start; }
.styled-table th:nth-child(1), .styled-table td:nth-child(1) { min-width: 48px; max-width: 60px; }
.styled-table th:nth-child(2), .styled-table td:nth-child(2) { min-width: 120px; max-width: 320px; white-space: normal; overflow: visible; text-overflow: initial; }
.styled-table th:nth-child(3), .styled-table td:nth-child(3) { min-width: 80px; max-width: 120px; }
.styled-table th:nth-child(4), .styled-table td:nth-child(4) { min-width: 110px; max-width: 160px; }
.styled-table th:nth-child(5), .styled-table td:nth-child(5) { min-width: 90px; max-width: 120px; }
@media (max-width: 900px) {
    .styled-table, table { display: block; overflow-x: auto; white-space: nowrap; font-size: 12px; }
    .styled-table th, .styled-table td { min-width: 70px; max-width: 180px; padding: 0.18em 0.3em; }
    .styled-table th.actions-cell, .styled-table td.actions-cell, .actions-cell { min-width: 90px; max-width: 120px; }
    .styled-table .actions-flex, .actions-flex { flex-wrap: nowrap; }
    .styled-table th:nth-child(2), .styled-table td:nth-child(2) { min-width: 100px; max-width: 90vw; white-space: normal; overflow: visible; text-overflow: initial; }
}
@media (min-width: 901px) {
    .styled-table .actions-flex, .actions-flex { flex-wrap: nowrap; }
}

/* Sous-tableaux (détail des sessions) modernisés */
.sub-table-container {
    background: #f6f8fc;
    border-radius: 12px;
    box-shadow: 0 2px 10px #b3c6e622;
    padding: 0.8em 0.8em 0.6em 0.8em; /* resserré */
    margin: 0.8em 0 0.4em 0; /* 1em / 0.5em -> 0.8 / 0.4 */
    border: 1px solid #e0e7ef;
    min-width: 320px;
    max-width: 100%;
    overflow-x: auto;
}
.sub-table-header {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1.1em;
    font-weight: bold;
    color: #1a4a7a;
    margin-bottom: 0.7em;
}
.sub-table-icon { font-size: 1.3em; margin-right: 0.2em; }
.sub-table-title { font-size: 1.08em; letter-spacing: 0.01em; }
.sub-table-scroll {
    overflow-x: auto;
    width: 100%;
    min-width: 0;
}
.sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.97em;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px #e0e7ef44;
    margin-bottom: 0;
    min-width: 480px;
    width: max-content;
    max-width: none;
}
.sub-table th, .sub-table td {
    border: 1px solid #e0e7ef;
    padding: 0.14em 0.4em; /* léger resserrement */
    text-align: left;
    white-space: nowrap;
    font-size: 0.95em;
}
.sub-table th {
    background: #e3f0fa;
    color: #1a4a7a;
    font-weight: 600;
}
.sub-table tr.enigme-resolue {
    background: #c8e6c9 !important;
    color: #155724 !important;
    font-weight: bold !important;
}
.sub-table tr.enigme-non-resolue {
    background: #fff !important;
    color: #111 !important;
    font-weight: normal !important;
}
.sub-table tr.temps-rapide { background: #e8f5e9; }
.sub-table tr.temps-lent { background: #fce4ec; }
.sub-table td.indice-1 { background: #ffb74d !important; color: #222 !important; }
.sub-table td.indice-2 { background: #ff9800 !important; color: #fff !important; }
.sub-table td.indice-3, .sub-table td.indice-4, .sub-table td.indice-5 { background: #c62828 !important; color: #fff !important; }
.sub-table td.err-1 { background: #ffb74d !important; color: #222 !important; }
.sub-table td.err-2 { background: #ff9800 !important; color: #fff !important; }
.sub-table td.err-3, .sub-table td.err-4, .sub-table td.err-5 { background: #c62828 !important; color: #fff !important; }
.sub-table td.temps-rapide, .sub-table td.temps-rapide span { color: #2e7d32 !important; font-weight: bold; }
.sub-table td.temps-lent, .sub-table td.temps-lent span { color: #c62828 !important; font-weight: bold; }

.cell-green { background: #c8e6c9 !important; }
.cell-orange { background: #fff3cd !important; color: #856404 !important; font-weight: bold; }
.cell-red { background: #f8d7da !important; color: #721c24 !important; font-weight: bold; }
.font-bold { font-weight: bold !important; }
.font-normal { font-weight: normal !important; }
.text-black { color: #111 !important; }
.cell-white { background: #fff !important; }
.sub-table-photo {
    min-width: 120px;
    max-width: 160px;
    margin-right: 1em;
    display: flex;
    align-items: flex-start;
}
.sub-table-photo img {
    max-width: 160px;
    max-height: 180px;
    border-radius: 8px;
    box-shadow: 0 2px 8px #aaa;
    display: block;
    margin-bottom: 1em;
    object-fit: cover;
}

/* Tableau des temps par énigme (admin_stats.php) */
.temps-enigme-table .enigme-nom-cell {
    max-width: 350px;
    min-width: 120px;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: initial;
}
.temps-enigme-table .temps-normal-cell {
    cursor: pointer;
    background: #f8f8f8;
    min-width: 70px;
    text-align: center;
}
.temps-normal-edit {
    width: 60px;
    text-align: center;
}

/* --- Correction responsive sous-tableaux et photo --- */
.sub-table-container {
    overflow-x: auto;
    max-width: 100vw;
}
.sub-table-scroll {
    overflow-x: auto;
    width: 100%;
    min-width: 0;
}
.sub-table {
    min-width: 480px;
    width: max-content;
    max-width: none;
}
/* Pour la zone photo + tableau (onglet terminés) : scroll horizontal groupé */
@media (max-width: 1100px) {
    .sub-table-container.flex-photo-table {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 1em;
        overflow-x: auto;
        max-width: 100vw;
    }
    .sub-table-photo {
        flex: 0 0 auto;
        min-width: 120px;
        max-width: 160px;
    }
    .sub-table-scroll {
        flex: 1 1 auto;
        min-width: 0;
    }
}
@media (max-width: 700px) {
    .sub-table {
        min-width: 600px;
    }
}

/* MODAL ADMIN SESSIONS */
.modal-overlay {
    display: none; /* Caché par défaut */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    padding: 2em;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 300px;
    max-width: 90%;
}
.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1em;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1em;
    margin-top: 1em;
}

/* Photo équipe dans le détail session (admin) */
.session-photo-info {
    flex-shrink: 0;
    margin-right: 1.5em;
    display: flex;
    align-items: flex-start;
}
.session-photo-img {
    max-width: 110px;
    max-height: 110px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px #0002;
    display: block;
}
@media (max-width: 600px) {
    .session-photo-info {
        margin-right: 0.5em;
    }
    .session-photo-img {
        max-width: 70px;
        max-height: 70px;
    }
}

/* Tables admin : colonnes auto-adaptatives et minimales */
.styled-table,
.styled-table th,
.styled-table td {
    table-layout: auto !important;
    width: auto !important;
    min-width: 1px !important;
    max-width: none !important;
    white-space: nowrap;
}
.styled-table th,
.styled-table td {
    padding: 0.12em 0.5em;
    vertical-align: top;
    font-size: 0.97em;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
}
.styled-table th {
    background-color: #6200ea;
    color: #fff;
    text-align: left;
    cursor: pointer;
}
.styled-table .actions-cell, .styled-table td.actions-cell, .actions-cell {
    min-width: 60px !important;
    width: 1%;
    white-space: nowrap;
}
.styled-table .commentaire-cell {
    min-width: 120px;
    max-width: 220px;
    white-space: normal;
}
@media (max-width: 900px) {
    .styled-table th, .styled-table td {
        font-size: 12px;
        min-width: 40px;
        max-width: 120px;
        padding: 0.18em 0.3em;
    }
    .styled-table .actions-cell, .styled-table td.actions-cell, .actions-cell {
        min-width: 40px !important;
        max-width: 70px !important;
    }
}

/* Styles pour la gestion des clients KPAR */
.kpar-clients-container { max-width: 900px; margin: 0 auto; }
.kpar-client-form label { display:block; margin:0.5em 0; }
.admin-table { width:100%; border-collapse:collapse; margin-bottom:1em; }
.admin-table th, .admin-table td { border:1px solid #ccc; padding:0.5em; }
.btn-xs { font-size:0.8em; padding:0.2em 0.5em; }

/* Styles pour les statistiques */
.info-text {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 1em;
}
#stats-codes-table, 
#stats-declaration-table {
    width: auto;
    min-width: 50%;
}
.tabs-container {
    margin: 2em 0 1em 0;
}
.styled-table h3 {
    margin-top: 2em;
}
.styled-table tfoot tr {
    font-weight: bold;
    background: #f0f0f0;
}

/* Styles pour les paramètres vendeurs */
.vendeur-card {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1.5em;
    margin-bottom: 1.5em;
    background-color: #f9f9f9;
}
.vendeur-card h3 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5em;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1em;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-weight: bold;
    margin-bottom: 0.3em;
    font-size: 0.9em;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}
.form-group-checkbox {
    display: flex;
    align-items: center;
    margin-top: 1em;
}
.form-group-checkbox input {
    margin-right: 0.5em;
}

/* Style pour la liste des codes dans la modale de facture */
.codes-facture-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px;
    background-color: #f9f9f9;
}

.code-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: background-color 0.2s, border-color 0.2s;
    cursor: pointer;
}

/* Coloration par ville dans la modale */
.code-item-trevou {
    background-color: #e8f0ff; /* bleu très léger */
    border-color: #90caf9;
}
.code-item-treb {
    background-color: #ffe8e8; /* rouge très léger */
    border-color: #ef9a9a;
}

.code-item:hover {
    background-color: #f0f8ff;
    border-color: #007BFF;
}

.code-item input[type="checkbox"] {
    margin-right: 12px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.code-item-details {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.code-item-adventure-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.code-item-id {
    font-weight: bold;
    color: #007BFF;
    font-size: 14px;
}

.code-item-comment {
    color: #666;
    font-size: 13px;
    font-style: italic;
}

.code-item-amount {
    font-weight: bold;
    color: #28a745;
    font-size: 14px;
}

.codes-facture-empty {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

.codes-facture-controls {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #007BFF;
    background-color: #fff;
    color: #007BFF;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background-color: #007BFF;
    color: #fff;
}

/* Styles pour les codes dans les tableaux de factures */
.codes-list {
    max-height: 80px;
    overflow-y: auto;
    padding: 4px;
    margin: 0;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background-color: #f9f9f9;
    font-size: 11px;
    line-height: 1.2;
}

.codes-list::-webkit-scrollbar {
    width: 6px;
}

.codes-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.codes-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.codes-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.code-badge {
    display: inline-block;
    background-color: #007BFF;
    color: white;
    padding: 2px 6px;
    margin: 1px 2px 1px 0;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    white-space: nowrap;
}

/* Coloration par ville dans la colonne "Codes concernés" */
.code-badge-trevou { background-color: #1e88e5; }
.code-badge-treb { background-color: #e53935; }

.codes-summary {
    font-size: 11px;
    color: #666;
    font-style: italic;
    text-align: center;
    margin-top: 2px;
}

/* Filtres pour les tableaux */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 12px;
    font-weight: bold;
    color: #555;
}

.filter-select, .filter-input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 150px;
    background-color: #fff;
}

.filter-input {
    min-width: 200px;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Masquer les lignes filtrées */
.filtered-hidden {
    display: none !important;
}

/* Résumé des filtres */
.filter-summary {
    margin: 10px 0;
    padding: 8px 12px;
    background-color: #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    color: #6c757d;
    border-left: 4px solid #007BFF;
    font-weight: 500;
}

/* Responsive design pour les filtres */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .filter-group label {
        min-width: 80px;
        margin-bottom: 0;
    }
    
    .filter-select, .filter-input {
        min-width: auto;
        flex: 1;
    }
}

/* Sous-onglets pour les localisations */
.sub-tabs-container {
    display: flex;
    margin: 12px 0 10px 0; /* 20px/15px -> 12px/10px */
    border-bottom: 2px solid #e0e0e0;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.sub-tab-btn {
    padding: 8px 16px; /* 12x24 -> 8x16 */
    border: none;
    background-color: transparent;
    color: #6c757d;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    font-size: 13px; /* 14px -> 13px */
}

.sub-tab-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

.sub-tab-btn.active {
    background-color: #007BFF;
    color: white;
    font-weight: 600;
}

.sub-tab-section {
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 14px; /* 20px -> 14px */
    background-color: #fff;
}

/* En-tête de localisation */
.location-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px; /* 20px -> 12px */
    padding-bottom: 10px; /* 15px -> 10px */
    border-bottom: 1px solid #e9ecef;
}

.location-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background-color: #007BFF;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Section de génération de codes */
.generate-code-section {
    margin-top: 20px; /* 30px -> 20px */
    padding: 14px; /* 20px -> 14px */
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.generate-code-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1em;
}

.form-row {
    display: flex;
    gap: 10px; /* 15px -> 10px */
    align-items: end;
    flex-wrap: wrap;
}

.form-row .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-row .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.form-row .form-group select,
.form-row .form-group input {
    padding: 6px 10px; /* 8x12 -> 6x10 */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 140px;
}

.form-row .form-group:last-child {
    margin-top: 20px;
}

/* Responsive pour les sous-onglets */
@media (max-width: 768px) {
    .location-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-row .form-group:last-child {
        margin-top: 10px;
    }
    
    .sub-tabs-container {
        flex-direction: column;
    }
    
    .sub-tab-btn {
        text-align: left;
        border-radius: 0;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .sub-tab-btn:last-child {
        border-bottom: none;
    }
}

/* Formulaires */
/* Badges Facturation */
.badge-draft { background-color: #6c757d; color: white; }
.badge-generated { background-color: #fd7e14; color: white; }
.badge-encaisse { background-color: #28a745; color: white; }
.badge-baf { background-color: #17a2b8; color: white; }
.badge-todo { background-color: #e9ecef; color: #495057; }
.badge-free { background-color: #20c997; color: white; }
.badge-default { background-color: #007bff; color: white; }

/* Lignes en retard */
tr.row-late td {
    background-color: #fff3cd !important; /* Jaune pâle */
    border-bottom: 1px solid #ffeeba;
}
tr.row-late:hover td {
    background-color: #ffe8a1 !important;
}
.late-indicator {
    color: #dc3545;
    margin-right: 5px;
    font-weight: bold;
}

/* Filtres */
.table-filters {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    flex-wrap: wrap;
}
.table-filters input, .table-filters select {
    padding: 5px;
    border: 1px solid #ced4da;
    border-radius: 3px;
}
