/* public/css/style.css - Feuille principale (Phase 2)
   Mobile-first (D-14), chemins relatifs (D-15), cibles tactiles >= 44 px, aucun défilement horizontal à 320 px. */

/* Police de la charte Hermes (Poppins) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-wrap: anywhere; /* titres et noms de fichiers longs */
}

/* Attribut hidden toujours masquant (messages fermés, erreurs client) */
[hidden] {
    display: none !important;
}

/* ===== RESPONSIVE IMAGES ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== MOBILE-FIRST (< 768px) ===== */
.container {
    max-width: 100%;
    padding: 16px;
    margin: 0 auto;
}

form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px; /* 16 px à toutes les largeurs : pas de zoom automatique sur iOS */
    font-family: inherit;
}

button {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    min-height: 44px; /* Touch-friendly */
}

button:hover {
    background-color: #0056b3;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 16px 0;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f0f0f0;
    font-weight: bold;
}

/* ===== TABLET (≥768px) ===== */
@media (min-width: 768px) {
    .container {
        max-width: 750px;
        padding: 24px;
    }

    form {
        padding: 30px;
    }

    input, textarea, select {
        padding: 14px;
    }

    button {
        width: auto;
        padding: 10px 24px;
    }
}

/* ===== DESKTOP (≥1024px) ===== */
@media (min-width: 1024px) {
    .container {
        max-width: 960px;
        padding: 32px;
    }

    form {
        padding: 40px;
    }

    .form-row {
        display: flex;
        gap: 16px;
    }

    .form-row > div {
        flex: 1;
    }

    table {
        font-size: 14px;
    }
}

/* ===== FORM STYLING ===== */
.form-group {
    margin: 20px 0;
}

/* Fieldset sans bordure ni marge, min-width: 0 pour éviter le débordement horizontal */
fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}

legend {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 8px;
    max-width: 100%;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="date"],
textarea,
select {
    width: 100%;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.help-text {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.required-hint {
    font-size: 13px;
    color: #666;
    margin: 0 0 16px 0;
    font-weight: normal;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    cursor: pointer;
    font-weight: normal;
    font-size: 16px;
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
    flex: 0 0 24px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.service-desc {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s;
    min-height: 44px;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Messages */
.message {
    padding: 16px;
    margin: 16px 0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.message-body {
    min-width: 0;
    flex: 1 1 auto;
}

.message-body ul {
    margin: 4px 0 0 0;
    padding-left: 20px;
}

.message-body li {
    margin: 4px 0;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.close-btn {
    width: auto;
    min-width: 44px;
    min-height: 44px;
    margin: -8px -8px -8px 0;
    padding: 0 8px;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    flex: 0 0 auto;
}

.close-btn:hover {
    background: none;
    opacity: 0.7;
}

/* Language switcher */
.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    text-align: left;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.lang-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0 12px;
    color: #0056b3;
    text-decoration: none;
    font-weight: normal;
    border-radius: 4px;
}

.lang-switcher a[aria-current="true"] {
    font-weight: bold;
    text-decoration: underline;
    background-color: #e7f0ff;
}

.lang-sep {
    color: #666;
}

/* Menu principal : liens des pages, puis langues (mobile d'abord, retour à la ligne) */
.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 16px;
    width: 100%;
}

.site-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav-list a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: #0056b3;
    text-decoration: none;
    border-radius: 4px;
}

.site-nav-list a[aria-current="page"] {
    font-weight: bold;
    text-decoration: underline;
    background-color: #e7f0ff;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.header h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
}

.subtitle {
    color: #666;
    margin: 0;
}

/* Info box */
.info-box {
    background-color: #f0f4ff;
    border-left: 4px solid #007bff;
    padding: 16px;
    margin-top: 32px;
    border-radius: 4px;
}

.info-box h3 {
    margin-top: 0;
    color: #0056b3;
}

.info-box ul {
    margin: 0;
    padding-left: 20px;
}

.info-box li {
    margin: 8px 0;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (min-width: 768px) {
    .form-actions {
        flex-wrap: nowrap;
    }
}

@media (min-width: 1024px) {
    .form-group {
        margin: 24px 0;
    }

    .checkbox-group {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* ===== BROUILLON LOCAL (D-08) ===== */
#draft-banner {
    background-color: #f0f4ff;
    border-left: 4px solid #007bff;
    padding: 12px 16px;
    margin: 0 0 16px 0;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

#draft-banner p {
    margin: 0;
    flex: 1 1 100%;
    min-width: 0;
}

#draft-banner-text {
    font-weight: bold;
}

#draft-banner button {
    width: auto;
    margin: 0;
}

/* ===== PIÈCES JOINTES (D-05, D-06) ===== */
#file-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

#file-list li {
    padding: 4px 0;
}

.file-existing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
    gap: 12px;
}

.file-existing-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    background-color: #fafafa;
    border-radius: 4px;
}

.file-existing img {
    max-width: 100%;
    height: auto;
    max-height: 10rem;
    object-fit: contain;
}

.file-existing-item a {
    overflow-wrap: anywhere;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ===== LISTE EN CARTES (D-10, D-14) ===== */
.pending-list {
    margin-top: 32px;
}

.pending-list > h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.cards {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}

.card {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.card h3 {
    font-size: 16px;
    margin: 0;
    overflow-wrap: anywhere;
}

.card-meta {
    font-size: 13px;
    color: #666;
    overflow-wrap: anywhere;
}

.card-meta span {
    display: block;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: #e7f0ff;
    color: #0056b3;
    font-size: 12px;
    font-weight: bold;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.card-actions form {
    flex: 1 1 8rem;
    background: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    min-width: 0;
}

.card-actions > a {
    flex: 1 1 8rem;
}

.card-actions .btn,
.card-actions button {
    width: 100%;
    margin: 0;
}

a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 44px;
}

.btn-danger {
    background-color: #a71d2a;
    color: white;
}

.btn-danger:hover {
    background-color: #7d1520;
}

/* ===== ARTICLE EXPORTÉ : LECTURE SEULE (D-09) ===== */
.article-readonly {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 0;
}

.article-readonly h3 {
    overflow-wrap: anywhere;
    margin: 16px 0 8px 0;
}

.article-body {
    overflow-wrap: anywhere;
    margin: 8px 0 16px 0;
}


@media (min-width: 768px) {
    .card-actions .btn,
    .card-actions button {
        width: auto;
    }

    .card-actions > a,
    .card-actions form {
        flex: 0 1 auto;
    }
}

/* ===== ADMINISTRATION (Phase 3, D-14, D-15, D-16) ===== */

/* Texte réservé aux lecteurs d'écran : technique clip, jamais display: none (Pitfall 7) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* En-tête admin : titre, langues et utilisateur sur plusieurs lignes si besoin */
.admin-header {
    gap: 8px 16px;
}

.admin-user {
    font-size: 14px;
    margin: 0;
    overflow-wrap: anywhere;
}

/* Formulaires d'une ligne : annulent le style de carte global des formulaires */
.inline-form {
    background: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    min-width: 0;
}

.inline-form button {
    width: auto;
    margin: 0;
}

.admin-page .checkbox-label {
    flex-wrap: wrap;
}

.admin-content {
    min-width: 0;
}

.admin-content h2 {
    font-size: 20px;
    margin: 0 0 12px 0;
    overflow-wrap: anywhere;
}

.admin-content h3 {
    font-size: 16px;
    margin: 0 0 8px 0;
    overflow-wrap: anywhere;
}

.admin-services,
.admin-service-form {
    min-width: 0;
}

/* Barre latérale : visible sans JavaScript ; masquée seulement si script.js a ajouté la classe js (Pitfall 8) */
.sidebar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 8px;
    margin-bottom: 16px;
    min-width: 0;
}

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

.sidebar a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    color: #0056b3;
    text-decoration: none;
    border-radius: 4px;
    overflow-wrap: anywhere;
}

.sidebar a[aria-current="page"] {
    font-weight: bold;
    background-color: #e7f0ff;
}

/* Bouton « Menu » : caché sans JavaScript, affiché avec la classe js sous 768 px */
.sidebar-toggle {
    display: none;
}

.js .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 44px;
    min-height: 44px;
    margin: 0 0 16px 0;
    padding: 8px 16px;
}

.js .sidebar {
    display: none;
}

.js .sidebar.is-open {
    display: block;
}

/* Tableau en cartes sous 768 px (D-15) : libellés issus de data-label */
.table-responsive {
    display: block;
    width: 100%;
    margin: 16px 0;
    background: none;
}

.table-responsive thead {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.table-responsive tbody {
    display: block;
}

.table-responsive tr {
    display: block;
}

.table-responsive tbody tr {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 12px;
    margin-bottom: 16px;
    min-width: 0;
}

.table-responsive td {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 6px 0;
    border: 0;
    overflow-wrap: anywhere;
}

.table-responsive td::before {
    content: attr(data-label);
    display: block;
    flex: 0 0 100%;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    margin-bottom: 2px;
}

.table-responsive .actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions-cell > * {
    flex: 1 1 8rem;
    min-width: 0;
}

.actions-cell .btn,
.actions-cell button {
    width: 100%;
    margin: 0;
    min-height: 44px;
}

/* Statut actif / inactif : libellé textuel et couleur */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
}

.status-badge.is-active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.is-inactive {
    background-color: #e2e3e5;
    color: #383d41;
}

.status-badge.is-failed {
    background-color: #f8d7da;
    color: #721c24;
}

/* Section export de l'administration : aperçu, bouton de lancement, résultat par service */
.admin-export {
    min-width: 0;
}

.admin-export h3,
.export-result {
    margin-top: 24px;
}

#export-form {
    margin: 16px 0;
}

#export-form button {
    min-height: 44px;
}

/* Adresses d'un service */
.contact-list {
    list-style: none;
    margin: 0 0 16px 0;
    padding: 0;
}

.contact-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 4px 0;
    border-bottom: 1px solid #ddd;
}

.contact-email {
    flex: 1 1 12rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-contacts,
.danger-zone {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 16px;
    margin-top: 24px;
    min-width: 0;
}

.danger-zone {
    border-left: 4px solid #a71d2a;
}

.admin-login {
    max-width: 28rem;
    margin: 24px auto;
    min-width: 0;
}

/* Historique des exports (Phase 5, D-07, D-08, D-09) : mobile d'abord, aucun défilement horizontal à 320 px */
.admin-history {
    min-width: 0;
}

.history-filters {
    margin: 16px 0;
}

/* Un fieldset a sinon une largeur minimale égale à celle de son contenu */
.history-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 16px;
}

.history-fieldset legend {
    font-weight: bold;
    padding: 0;
    margin-bottom: 8px;
}

.history-fieldset .help-text,
.history-fieldset .form-actions {
    grid-column: 1 / -1;
}

.history-total {
    margin: 8px 0;
}

.history-list {
    list-style: none;
    margin: 16px 0;
    padding: 0;
}

.history-item {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 12px;
    margin-bottom: 16px;
    min-width: 0;
}

.history-item > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    cursor: pointer;
    list-style: none;
}

.history-item > summary::-webkit-details-marker {
    display: none;
}

.history-item > summary::before {
    content: "\25B8";
}

.history-item[open] > summary::before {
    content: "\25BE";
}

.history-item > summary:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.history-date {
    font-weight: bold;
}

/* Ligne repliée : compteurs, services et liste complète des adresses (une longue liste passe à la ligne) */
.history-meta,
.history-services,
.history-recipients {
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
    color: #555;
}

.history-body {
    margin-top: 12px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.history-service {
    border-top: 1px solid #ddd;
    margin-top: 12px;
    padding-top: 12px;
    min-width: 0;
}

.history-article {
    margin: 12px 0;
    padding-left: 12px;
    border-left: 3px solid #ddd;
    min-width: 0;
}

/* Retours à la ligne du corps conservés sans nl2br ; jamais white-space: pre (pas de défilement horizontal) */
.history-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.history-raw {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-width: 100%;
    margin: 8px 0;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

.history-links {
    margin: 4px 0 0;
    padding-left: 20px;
}

.history-links a {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    overflow-wrap: anywhere;
}

.history-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 16px 0;
}

.history-pager .btn {
    width: auto;
    min-height: 44px;
}

/* ===== ADMINISTRATION : TABLETTE ET ORDINATEUR (≥768px) ===== */
@media (min-width: 768px) {
    .admin-page .container {
        max-width: 100%;
    }

    .admin-layout {
        display: grid;
        grid-template-columns: 14rem minmax(0, 1fr);
        gap: 24px;
        align-items: start;
    }

    .sidebar,
    .js .sidebar {
        display: block;
    }

    .history-fieldset {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .js .sidebar-toggle {
        display: none;
    }

    .table-responsive {
        display: table;
        background: white;
    }

    .table-responsive thead {
        display: table-header-group;
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        clip: auto;
        clip-path: none;
        white-space: normal;
    }

    .table-responsive tbody {
        display: table-row-group;
    }

    .table-responsive tr {
        display: table-row;
    }

    .table-responsive tbody tr {
        background: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        margin-bottom: 0;
    }

    .table-responsive th,
    .table-responsive td {
        display: table-cell;
        width: auto;
        padding: 12px;
        border-bottom: 1px solid #ddd;
    }

    .table-responsive td::before {
        content: none;
    }

    .table-responsive .actions-cell {
        display: table-cell;
    }

    .actions-cell > * {
        flex: 0 1 auto;
    }

    .actions-cell .btn,
    .actions-cell button {
        width: auto;
    }
}

@media (min-width: 1024px) {
    .admin-page .container {
        max-width: 1200px;
    }
}

/* ===== THÈME HERMES (charte de la maquette) ===== */
body {
    background-color: #F4F3F0;
    color: #2B2B2B;
    font-family: 'Poppins', 'Segoe UI', Roboto, Arial, sans-serif;
}

a {
    color: #0E4A60;
}

a:hover {
    color: #0A3646;
}

:focus-visible {
    outline: 3px solid rgba(14, 74, 96, 0.45);
    outline-offset: 2px;
}

/* En-tête : carte blanche, marque Hermes en teal */
.site-header {
    background: #FFFFFF;
    box-shadow: 0 2px 12px rgba(43, 43, 43, 0.06);
    padding: 16px 24px;
    margin-bottom: 24px;
}

.header h1 {
    color: #0E4A60;
    font-weight: 700;
}

.subtitle {
    color: #6B6964;
}

/* Menu : pilules, page courante en noir */
.site-nav-list a {
    border-radius: 999px;
    color: #2B2B2B;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
}

.site-nav-list a:hover {
    background-color: #EFEDE9;
}

.site-nav-list a[aria-current="page"] {
    background-color: #2B2B2B;
    color: #FFFFFF;
    text-decoration: none;
}

/* Langues : FR / EN, langue active en orange clair */
.lang-switcher a {
    border-radius: 8px;
    color: #55534F;
    font-weight: 600;
}

.lang-switcher a[aria-current="true"] {
    background-color: #FDEBD0;
    color: #8A4B00;
    text-decoration: none;
}

.lang-sep {
    color: #DDD9D2;
}

/* Boutons : orange pour l'action principale, contour pour le reste */
.btn {
    border-radius: 10px;
    font-weight: 600;
}

.btn-primary {
    background-color: #F29100;
    color: #2B2B2B;
}

.btn-primary:hover {
    background-color: #D97F00;
}

.btn-secondary {
    background-color: #FFFFFF;
    color: #2B2B2B;
    border: 1.5px solid #DDD9D2;
}

.btn-secondary:hover {
    background-color: #EFEDE9;
}

.btn-danger {
    background-color: #A32638;
}

.btn-danger:hover {
    background-color: #7D1A28;
}

/* Cartes et listes : fond blanc, bordure douce, coins arrondis */
.card {
    border: 1px solid #E4E2DD;
    border-radius: 16px;
    box-shadow: none;
}

.info-box {
    background-color: #D3ECE5;
    border-radius: 16px;
}

.message-error {
    border-radius: 12px;
}

/* Logo azergo dans le menu */
.azergo-logo {
    height: 28px;
    width: auto;
    align-self: center;
}

/* Couleurs des services (cinq teintes de la charte, choisies par identifiant de service) */
.service-color-0 { background-color: #FDEBD0; color: #8A4B00; }
.service-color-1 { background-color: #D6E8EE; color: #0E4A60; }
.service-color-2 { background-color: #F8DDE0; color: #8E1F30; }
.service-color-3 { background-color: #D3ECE5; color: #1F6455; }
.service-color-4 { background-color: #DCE6FB; color: #1E4FC2; }

.service-tag {
    display: inline-block;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

/* Bandeau : compteur et prochain départ */
.pending-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 24px;
}

.pending-next {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: #0E4A60;
    color: #FFFFFF;
    border-radius: 20px;
    padding: 18px 22px;
    box-shadow: 0 10px 30px rgba(14, 74, 96, 0.25);
}

.pending-count {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #F29100;
    color: #2B2B2B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

.pending-next-text {
    display: flex;
    flex-direction: column;
}

.pending-next-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #CDE7E1;
}

.pending-next-date {
    font-size: 20px;
    font-weight: 600;
}

/* Filtres par service */
.pending-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.pending-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1.5px solid #DDD9D2;
    background-color: #FFFFFF;
    color: #2B2B2B;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.pending-chip[aria-current="page"] {
    background-color: #2B2B2B;
    color: #FFFFFF;
    border-color: #2B2B2B;
}


/* Carte d'article en attente */
.pending-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.btn-danger-outline {
    background-color: #FFFFFF;
    color: #A32638;
    border: 1.5px solid #F2C4CB;
}

.btn-danger-outline:hover {
    background-color: #FBEFF1;
}

/* Confirmation de suppression en ligne */
.confirm-inline {
    width: 100%;
    background-color: #FBEFF1;
    border-radius: 12px;
    padding: 12px 14px;
}

.confirm-question {
    margin: 0 0 8px;
    color: #8E1F30;
    font-weight: 600;
}

.confirm-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.confirm-buttons form {
    margin: 0;
}

/* Filtres de service : teinte du service, la page courante reste en noir */
.pending-chip.service-color-0 { background-color: #FDEBD0; color: #8A4B00; border-color: #F5D7A8; }
.pending-chip.service-color-1 { background-color: #D6E8EE; color: #0E4A60; border-color: #B5D3DE; }
.pending-chip.service-color-2 { background-color: #F8DDE0; color: #8E1F30; border-color: #F0BFC6; }
.pending-chip.service-color-3 { background-color: #D3ECE5; color: #1F6455; border-color: #B1DACD; }
.pending-chip.service-color-4 { background-color: #DCE6FB; color: #1E4FC2; border-color: #B9CCF4; }
.pending-chip[aria-current="page"] { background-color: #2B2B2B; color: #FFFFFF; border-color: #2B2B2B; }

/* ===== MISE EN PAGE HERMES (maquette Hermes Azergo) ===== */
body {
    background-color: #F4F3F0;
}

/* Barre d'en-tête */
.topbar {
    background: #FFFFFF;
    box-shadow: 0 2px 12px rgba(43, 43, 43, 0.06);
    position: relative;
    z-index: 2;
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #2B2B2B;
}

.brand-divider {
    width: 1px;
    height: 32px;
    background: #E4E2DD;
}

.brand-hermes {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: #0E4A60;
}

.brand-tagline {
    font-size: 12px;
    color: #6B6964;
}

.topbar .site-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    width: auto;
}

.topbar .site-nav-list {
    gap: 4px;
}

.topbar .site-nav-list a {
    padding: 10px 16px;
}

.nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    margin-left: 6px;
    border-radius: 999px;
    background: #F29100;
    color: #2B2B2B;
    font-size: 12px;
    font-weight: 700;
}

.topbar .lang-switcher {
    margin-left: 0;
    gap: 6px;
}

.topbar .lang-switcher a {
    min-width: 44px;
    height: 36px;
    padding: 0 12px;
    background: #EFEDE9;
}

.topbar .lang-switcher a[aria-current="true"] {
    background-color: #FDEBD0;
}

/* Bandeau d'accueil */
.hero {
    position: relative;
    overflow: hidden;
    background: #FFFFFF;
    border-bottom: 1px solid #E4E2DD;
}

.hero-blob {
    position: absolute;
    right: -80px;
    top: -40px;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 36px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.hero-text {
    flex: 1 1 420px;
    min-width: 0;
}

.eyebrow {
    display: inline-block;
    background: #F7C948;
    color: #2B2B2B;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 4px 12px;
}

.hero h1 {
    margin: 12px 0 8px;
    font-size: clamp(30px, 6vw, 44px);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -1px;
    color: #2B2B2B;
}

.hero-lead {
    margin: 0;
    max-width: 560px;
    font-size: 16px;
    color: #55534F;
}

.next-card {
    flex: 0 1 360px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #0E4A60;
    color: #FFFFFF;
    border-radius: 20px;
    padding: 18px 22px;
    box-shadow: 0 10px 30px rgba(14, 74, 96, 0.25);
}

.next-count {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #F29100;
    color: #2B2B2B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

.next-text {
    display: flex;
    flex-direction: column;
}

.next-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #CDE7E1;
}

.next-date {
    font-size: 20px;
    font-weight: 600;
}

.next-ready {
    font-size: 13px;
    color: #CDE7E1;
}

.legend-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
}

/* Conteneur de page */
.page-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 56px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-post {
    border-radius: 999px;
    min-height: 44px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.btn-outline {
    background: #FFFFFF;
    color: #2B2B2B;
    border: 1.5px solid #2B2B2B;
    border-radius: 10px;
    min-height: 44px;
    padding: 0 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-outline:hover {
    background: #EFEDE9;
}

.btn-outline-danger {
    background: #FFFFFF;
    color: #A32638;
    border: 1.5px solid #F2C4CB;
    border-radius: 10px;
    min-height: 44px;
    padding: 0 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-outline-danger:hover {
    background: #FBEFF1;
}

/* Tableau des articles en attente */
.pending-table {
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 20px;
    overflow: hidden;
}

.pending-head,
.pending-row {
    display: grid;
    grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 236px;
    gap: 16px;
    align-items: center;
    padding: 12px 20px;
}

.pending-head {
    background: #F4F3F0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #55534F;
}

.pending-row {
    padding: 16px 20px;
    border-top: 1px solid #EFEDE9;
}

.pending-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.lang-pill {
    background: #DCE6FB;
    color: #1E4FC2;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    padding: 1px 8px;
}

.submitted {
    font-size: 12px;
    color: #6B6964;
}

.pending-title {
    margin: 6px 0 0;
    font-size: 16px;
    font-weight: 600;
    word-break: break-word;
}

.cell {
    font-size: 14px;
}

.pending-actions {
    display: flex;
    gap: 6px;
}

.pending-actions .btn-outline,
.pending-actions .btn-outline-danger {
    flex: 1;
}

.empty-state {
    background: #FFFFFF;
    border: 2px dashed #DDD9D2;
    border-radius: 20px;
    padding: 48px 24px;
    text-align: center;
}

.empty-state h2,
.empty-state p {
    margin: 0;
}

/* Formulaire : deux colonnes */
.layout-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.layout-main {
    min-width: 0;
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 20px;
    padding: 8px 24px 24px;
}

.layout-aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 24px;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 12px;
    font-size: 18px;
    font-weight: 600;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2B2B2B;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
}

legend .step-num {
    margin-right: 8px;
}

.step-optional {
    font-size: 13px;
    font-weight: 400;
    color: #6B6964;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    border-radius: 10px;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.checkbox-group .checkbox-label {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1.5px dashed #DDD9D2;
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    background: #FFFFFF;
}

.checkbox-group .checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.checkbox-group .checkbox-label:focus-within {
    outline: 3px solid rgba(14, 74, 96, 0.45);
    outline-offset: 2px;
}

.checkbox-group .checkbox-label:has(input:checked) {
    border-style: solid;
    border-color: #0E4A60;
    background: #D6E8EE;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.form-actions .btn-primary {
    border-radius: 999px;
    min-height: 48px;
    padding: 0 24px;
}

/* Colonne de droite */
.aside-card {
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 20px;
    padding: 20px;
}

.aside-card h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aside-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.aside-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-top: 1px solid #EFEDE9;
}

.aside-item strong {
    font-weight: 600;
    font-size: 14px;
}

.aside-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #0E4A60;
}

.aside-how ol {
    margin: 12px 0 0;
    padding-left: 20px;
    font-size: 14px;
    color: #55534F;
}

.aside-how li {
    margin-bottom: 6px;
}

.aside-fun {
    background: #2B2B2B;
    border-color: #2B2B2B;
    color: #FFFFFF;
    font-size: 13px;
}

.aside-fun p {
    margin: 0;
}

/* Carnet de route : exports */
.history-page .history-item {
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 16px;
    margin-bottom: 12px;
}

.history-day {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    padding: 6px 0;
    border-radius: 12px;
    background: #0E4A60;
    color: #FFFFFF;
    text-align: center;
}

.history-day-num {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.history-day-month {
    font-size: 11px;
    text-transform: uppercase;
}

.history-body > .history-service {
    flex: 1 1 260px;
    border: 1px solid #E4E2DD;
    border-radius: 14px;
    padding: 14px;
}

.history-body > p,
.history-body > pre,
.history-body > .help-text {
    flex: 1 1 100%;
}

/* Administration */
.admin-shell {
    min-height: 100vh;
    background: #F4F3F0;
}

.admin-band {
    background: #0E4A60;
    color: #FFFFFF;
}

.admin-band-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-band .admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
}

.admin-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #F29100;
    color: #2B2B2B;
    font-weight: 700;
}

.admin-band .btn-outline {
    background: transparent;
    color: #FFFFFF;
    border-color: #FFFFFF;
}

.admin-band .btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
}

.admin-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sidebar {
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 20px;
    padding: 12px;
}

.sidebar-list a[aria-current="page"] {
    background: #FDEBD0;
    color: #8A4B00;
    font-weight: 600;
    text-decoration: none;
}

.admin-content {
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 20px;
    padding: 28px;
    min-width: 0;
}

/* Adaptation aux écrans étroits */
@media (max-width: 900px) {
    .layout-form {
        grid-template-columns: 1fr;
    }

    .layout-aside {
        position: static;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .topbar .site-nav-list {
        overflow-x: auto;
        flex-wrap: nowrap;
        max-width: 100%;
    }

    .pending-head {
        display: none;
    }

    .pending-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pending-row .cell::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 500;
        color: #6B6964;
    }

    .hero-inner {
        padding: 28px 18px 24px;
    }

    .page-main {
        padding: 20px 12px 40px;
    }
}

/* ===== DÉTAILS DE LA MAQUETTE : logo, pastilles de service, initiales, petites pointes ===== */
.azergo-mark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.azergo-smiley {
    width: 28px;
    height: 28px;
}

.brand-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.brand-waves {
    flex: none;
}

/* Choix du service en pastilles */
.service-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 6px;
}

.service-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1.5px solid #DDD9D2;
    background: #FFFFFF;
    color: #2B2B2B;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.service-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.service-pill.service-color-0 .dot { background: #F29100; }
.service-pill.service-color-1 .dot { background: #0E4A60; }
.service-pill.service-color-2 .dot { background: #C94F5B; }
.service-pill.service-color-3 .dot { background: #2E7D62; }
.service-pill.service-color-4 .dot { background: #1E4FC2; }

.service-pill[aria-pressed="true"] {
    background: #2B2B2B;
    border-color: #2B2B2B;
    color: #FFFFFF;
}

.service-pill[aria-pressed="true"] .dot {
    background: #FFFFFF;
}

.select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.btn-all {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin: 0 0 10px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid #0E4A60;
    background: #FFFFFF;
    color: #0E4A60;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-all:hover {
    background: #D6E8EE;
}

/* Initiales des destinataires */
.svc-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* Petite pointe orange dans l'encadré d'anecdote */
.fun-dot {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #F29100;
    margin-bottom: 12px;
}

/* Actions dans la colonne de droite */
.aside-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.btn-mini {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 8px;
    border: 1.5px solid #2B2B2B;
    background: #FFFFFF;
    color: #2B2B2B;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.btn-mini-danger {
    border-color: #F2C4CB;
    color: #A32638;
}

/* Encadré « Comment ça marche ? » : fond menthe comme la maquette */
.aside-how {
    background: #D3ECE5;
    border-color: transparent;
}

/* Carte « En attente d'export » : même présentation que la maquette */
.aside-head .nav-count {
    background: #FDEBD0;
    color: #8A4B00;
}
.aside-item {
    border: 1px solid #E4E2DD;
    border-radius: 14px;
    padding: 14px;
    margin-top: 12px;
    gap: 6px;
}
.aside-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.aside-top .service-tag {
    padding: 3px 8px;
    font-size: 11px;
}
.aside-date,
.aside-meta {
    font-size: 12px;
    color: #6B6964;
}
.aside-item .aside-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.aside-item .btn-mini {
    flex: 1;
    justify-content: center;
    min-height: 40px;
    font-weight: 600;
}

/* Cercle orange du bandeau : il flotte comme dans la maquette (désactivé si le système demande moins d animations) */
@keyframes hm-fly {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(10px, -8px) rotate(-6deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
.next-count {
    animation: hm-fly 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .next-count {
        animation: none;
    }
}

/* ===== CARNET DE ROUTE : filtres, tuiles, pastilles (maquette) ===== */
.history-filters {
    background: #FFFFFF;
    border: 1px solid #E4E2DD;
    border-radius: 20px;
    padding: 20px 24px;
    margin: 0 0 20px;
}

.history-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.history-fieldset legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
    padding: 0;
}

.history-fieldset .form-group {
    margin-bottom: 0;
}

.history-fieldset label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #55534F;
}

.history-fieldset select,
.history-fieldset input[type="date"] {
    border-radius: 10px;
    min-height: 44px;
    background: #F4F3F0;
    border: 1px solid #E4E2DD;
}

.history-fieldset .form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.history-fieldset .help-text {
    margin: 0;
}

.history-fieldset .btn {
    border-radius: 999px;
    min-height: 44px;
    padding: 0 20px;
}

.history-fieldset .btn-primary {
    background: #F29100;
    color: #2B2B2B;
}

.history-fieldset .btn-secondary {
    background: #FFFFFF;
    color: #2B2B2B;
    border: 1.5px solid #DDD9D2;
}

/* Grille des filtres : service, du, au, statut sur une ligne */
.history-fieldset > .form-group,
.history-fieldset > fieldset > .form-group {
    display: inline-block;
    width: calc(25% - 12px);
    vertical-align: top;
    margin-right: 16px;
}

.history-item > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.history-stats {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.stat-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 76px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #F4F3F0;
    font-size: 11px;
    color: #55534F;
}

.stat-tile strong {
    font-size: 18px;
    color: #2B2B2B;
}

.history-body {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px 20px;
    border-top: 1px solid #EFEDE9;
}

.history-body > .history-service {
    flex: 1 1 240px;
    max-width: 340px;
}

.history-body > .history-service h3 {
    margin: 0 0 8px;
}

.history-body > .history-service h3 .service-tag {
    font-size: 11px;
}

@media (max-width: 900px) {
    .history-fieldset > .form-group,
    .history-fieldset > fieldset > .form-group {
        width: calc(50% - 12px);
    }
}

@media (max-width: 600px) {
    .history-fieldset > .form-group,
    .history-fieldset > fieldset > .form-group {
        width: 100%;
        margin-right: 0;
    }

    .history-stats {
        margin-left: 0;
        width: 100%;
    }
}

/* Libellés de livraison de la maquette */
.deliveries-label {
    width: 100%;
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #55534F;
}
.see-articles {
    width: 100%;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #8A4B00;
    text-decoration: underline;
}

/* Filtres du carnet de route : quatre colonnes sur une ligne, comme la maquette */
.history-fieldset {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px 20px;
    align-items: end;
}
.history-fieldset > .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: auto;
    margin: 0;
    min-width: 0;
}
.history-fieldset > .help-text {
    grid-column: 1 / -1;
    margin: 0;
}
.history-fieldset > .form-actions {
    grid-column: 1 / -1;
    margin-top: 4px;
}
@media (max-width: 900px) {
    .history-fieldset {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 600px) {
    .history-fieldset {
        grid-template-columns: 1fr;
    }
}

/* Carnet de route : carte compacte, chevron à droite, coche, livraisons (maquette) */
.history-item > summary {
    list-style: none;
}
.history-item > summary::-webkit-details-marker {
    display: none;
}
.history-item > summary::before {
    display: none;
    content: none;
}
.history-item > summary::after {
    content: "";
    order: 99;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-right: 2px solid #2B2B2B;
    border-bottom: 2px solid #2B2B2B;
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}
.history-item[open] > summary::after {
    transform: rotate(-135deg);
}
.history-item > summary .status-badge.is-active::before {
    content: "\2713\00a0";
}
.history-item > summary .history-recipients {
    display: none;
}
.history-item > summary .history-services {
    flex-basis: 100%;
    font-size: 14px;
    color: #55534F;
}
.history-body > .deliveries-label {
    order: -1;
}
.history-body > .see-articles {
    order: 99;
}
.history-service > h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-service > p .status-badge {
    background: none;
    padding: 0;
    color: #1F6455;
    font-size: 12px;
    font-weight: 600;
}

/* ===== ADMINISTRATION : harmonisation avec la maquette (liste des services et tableaux) ===== */
.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-head h2 {
    margin: 0 0 4px;
}

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    background: #F29100;
    color: #2B2B2B;
    font-weight: 600;
    text-decoration: none;
}

.svc-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 10px;
    border-radius: 50%;
    vertical-align: middle;
}

.svc-dot.dot-0 { background: #F29100; }
.svc-dot.dot-1 { background: #0E4A60; }
.svc-dot.dot-2 { background: #C94F5B; }
.svc-dot.dot-3 { background: #2E7D62; }
.svc-dot.dot-4 { background: #1E4FC2; }

.btn-icon-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    border: 1.5px solid #F2C4CB;
    background: #FFFFFF;
    color: #A32638;
    cursor: pointer;
}

.btn-icon-danger:hover {
    background: #FBEFF1;
}

/* Tableaux de l'administration : en-tête discret, lignes séparées */
.admin-content table thead th {
    background: #F4F3F0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #55534F;
}

.admin-content table tbody td {
    vertical-align: middle;
    border-top: 1px solid #EFEDE9;
    padding: 14px 12px;
}

/* Actions alignées sur une ligne */
.actions-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.actions-cell .inline-form {
    display: inline-flex;
    margin: 0;
}

.actions-cell .btn {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font-weight: 600;
}

/* Lien vers une page publique : petite flèche, comme dans la maquette */
.sidebar-list a[href="historique"]::after {
    content: "\2197";
    margin-left: 6px;
    font-size: 12px;
    color: #55534F;
}

/* Alignement du smiley sur le mot azergo (le texte est centré un peu plus haut que sa boîte) */
.azergo-mark {
    align-items: center;
}
.azergo-smiley {
    transform: translateY(-2px);
}
