:root {
    --bleu: #1a5fb4;
    --bleu-clair: #e8f0fb;
    --texte: #111;
    --gris: #f4f4f4;
    --bordure: #ccc;
    --gris-texte: #555;
    --vert: #2d6a2d;
    --rouge: #b91c1c;
    --esp: 1rem;
}

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

body {
    font-family: Georgia, 'Times New Roman', serif;
    background: #fff;
    color: var(--texte);
    line-height: 1.6;
    font-size: 16px;
}

a {
    color: var(--bleu);
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* header */
.site-header {
    border-bottom: 2px solid var(--texte);
    padding: 14px 0;
    background: #fff;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--texte);
    text-decoration: none;
    letter-spacing: 0px;
}

.logo:hover {
    text-decoration: none;
    color: var(--bleu);
}

.logo:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav ul a {
    color: var(--gris-texte);
    text-decoration: none;
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
}

nav ul a:hover {
    color: var(--texte);
    text-decoration: underline;
}

nav ul a.active {
    color: var(--texte);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

nav ul a:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--texte);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

/* contenu principal */
main {
    padding: 2rem 0;
}

/* formulaire de recherche en haut */
.hero {
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.hero > p {
    color: var(--gris-texte);
    font-family: system-ui, sans-serif;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.barre-recherche {
    display: flex;
    gap: 8px;
    max-width: 580px;
    margin-bottom: 1rem;
}

.barre-recherche input[type="search"] {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #888;
    font-size: 1rem;
    font-family: system-ui, sans-serif;
    color: var(--texte);
    background: #fff;
}

.barre-recherche input:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 0;
}

.btn-chercher {
    background: var(--bleu);
    color: #fff;
    border: none;
    padding: 9px 18px;
    font-size: 0.95rem;
    font-family: system-ui, sans-serif;
    cursor: pointer;
    font-weight: 600;
}

.btn-chercher:hover {
    background: #1348a0;
}

.btn-chercher:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

.filtres-recherche {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.filtre-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filtre-item label {
    font-size: 0.8rem;
    color: var(--gris-texte);
    font-family: system-ui, sans-serif;
}

.filtre-item select {
    padding: 6px 8px;
    border: 1px solid #888;
    font-size: 0.88rem;
    font-family: system-ui, sans-serif;
    color: var(--texte);
    background: #fff;
    cursor: pointer;
    min-width: 160px;
}

.filtre-item select:focus-visible {
    outline: 2px solid var(--bleu);
}

.lien-reset {
    font-size: 0.85rem;
    font-family: system-ui, sans-serif;
    color: var(--rouge);
    align-self: flex-end;
    padding-bottom: 2px;
}

.lien-reset:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

/* liste des résultats */
.resultats-header {
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
    color: var(--gris-texte);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bordure);
}

.grille-entreprises {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 2rem;
}

.carte-entreprise {
    padding: 1rem 0;
    border-bottom: 1px solid var(--bordure);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.carte-entreprise:first-child {
    border-top: 1px solid var(--bordure);
}

.carte-top {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.badge-statut {
    font-family: system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border: 1px solid;
}

.badge-statut.actif {
    border-color: var(--vert);
    color: var(--vert);
}

.badge-statut.ferme {
    border-color: var(--rouge);
    color: var(--rouge);
}

.badge-categorie {
    font-family: system-ui, sans-serif;
    font-size: 0.72rem;
    padding: 1px 7px;
    border: 1px solid var(--bordure);
    color: var(--gris-texte);
}

.badge-asso {
    font-family: system-ui, sans-serif;
    font-size: 0.72rem;
    padding: 1px 7px;
    border: 1px solid #a16207;
    color: #a16207;
}

.carte-nom {
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--texte);
}

.carte-secteur {
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
    color: var(--gris-texte);
}

.carte-adresse {
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
    color: var(--texte);
}

.note-etab {
    font-size: 0.78rem;
    color: var(--gris-texte);
    font-style: italic;
}

.carte-meta {
    font-family: system-ui, sans-serif;
    font-size: 0.8rem;
    color: var(--gris-texte);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-voir {
    align-self: flex-start;
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
    color: var(--bleu);
    text-decoration: none;
    margin-top: 2px;
}

.btn-voir:hover {
    text-decoration: underline;
}

.btn-voir:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

/* suggestions quand rien cherché */
.suggestions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bordure);
}

.suggestions h2 {
    font-size: 1rem;
    color: var(--gris-texte);
    font-weight: normal;
    margin-bottom: 0.8rem;
    font-family: system-ui, sans-serif;
}

.suggestions-grille {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-tag {
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
    color: var(--bleu);
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid var(--bleu-clair);
    background: var(--bleu-clair);
}

.suggestion-tag:hover {
    background: var(--bleu);
    color: #fff;
    text-decoration: none;
}

.suggestion-tag:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

/* numéros de page */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.page-btn {
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
    padding: 5px 10px;
    border: 1px solid var(--bordure);
    text-decoration: none;
    color: var(--bleu);
    background: #fff;
}

.page-btn:hover {
    background: var(--gris);
    text-decoration: none;
}

.page-btn.actif {
    background: var(--bleu);
    color: #fff;
    border-color: var(--bleu);
}

.page-btn:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

/* page de détail d'une entreprise */
.lien-retour {
    display: inline-block;
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
    color: var(--bleu);
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.lien-retour:hover {
    text-decoration: underline;
}

.lien-retour:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 3px;
}

.detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--texte);
}

.detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.detail-header h1 {
    font-size: 1.7rem;
    line-height: 1.2;
    margin-bottom: 4px;
}

.detail-siren {
    font-family: monospace;
    font-size: 0.88rem;
    color: var(--gris-texte);
}

.detail-contenu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h2 {
    font-size: 1rem;
    font-family: system-ui, sans-serif;
    color: var(--gris-texte);
    margin-bottom: 0.6rem;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--bordure);
}

.table-infos {
    width: 100%;
    border-collapse: collapse;
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
}

.table-infos th,
.table-infos td {
    padding: 7px 0;
    border-bottom: 1px solid var(--gris);
    text-align: left;
    vertical-align: top;
}

.table-infos th[scope="row"] {
    color: var(--gris-texte);
    font-weight: 500;
    width: 38%;
    padding-right: 12px;
}

.table-infos tr:last-child th,
.table-infos tr:last-child td {
    border-bottom: none;
}

.code-naf {
    font-size: 0.78rem;
    color: var(--gris-texte);
    font-family: monospace;
}

#carte {
    height: 300px;
    border: 1px solid var(--bordure);
}

/* dirigeants */
.liste-dirigeants {
    display: flex;
    flex-direction: column;
    gap: 0;
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
}

.dirigeant {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--gris);
    gap: 1rem;
}

.dirigeant:last-child {
    border-bottom: none;
}

.dirigeant-nom {
    font-weight: 600;
}

.dirigeant-role {
    color: var(--gris-texte);
    font-size: 0.82rem;
}

/* établissements */
.grille-etablissements {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.carte-etab {
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
    padding: 8px;
    background: var(--gris);
}

.etab-adresse {
    font-weight: 500;
}

.etab-commune {
    color: var(--gris-texte);
    font-size: 0.8rem;
}

/* page stats */

.stats-resume {
    font-family: system-ui, sans-serif;
    font-size: 0.95rem;
    color: var(--texte);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bordure);
}

.stats-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stats-section {
    margin-bottom: 1.5rem;
}

.stats-section h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.stats-sous-titre {
    font-size: 0.8rem;
    color: var(--gris-texte);
    font-weight: normal;
}

.stats-section-large {
    grid-column: 1 / -1;
}

.table-stats {
    width: 100%;
    border-collapse: collapse;
    font-family: system-ui, sans-serif;
    font-size: 0.88rem;
}

.table-stats th {
    text-align: left;
    padding: 5px 8px;
    border-bottom: 2px solid var(--texte);
    font-weight: 600;
    font-size: 0.82rem;
}

.table-stats td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--gris);
}

.table-stats tr:last-child td {
    border-bottom: none;
}

.table-stats td:last-child {
    text-align: right;
    color: var(--gris-texte);
}
.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--texte);
}

.page-header h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.page-header p {
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
    color: var(--gris-texte);
}


/* messages d'erreur et état vide */
.vide {
    font-family: system-ui, sans-serif;
    color: var(--gris-texte);
    padding: 2rem 0;
    border-top: 1px solid var(--bordure);
}

.vide a {
    color: var(--bleu);
}

.alerte-erreur {
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
    color: var(--rouge);
    padding: 10px;
    border: 1px solid var(--rouge);
    margin-bottom: 1rem;
}

.carte-petite {
    padding: 0.8rem 0;
}

/* pied de page */
.site-footer {
    border-top: 1px solid var(--bordure);
    padding: 1rem 0;
    font-family: system-ui, sans-serif;
    font-size: 0.8rem;
    color: var(--gris-texte);
    text-align: center;
    margin-top: 2rem;
}

.site-footer a {
    color: var(--bleu);
}

.site-footer a:focus-visible {
    outline: 2px solid var(--bleu);
    outline-offset: 2px;
}

.site-footer p + p {
    margin-top: 2px;
}

/* responsive mobile */
@media (max-width: 700px) {
    .nav-toggle {
        display: flex;
    }

    #mainNav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid var(--bordure);
        padding: 8px 1rem;
        z-index: 99;
    }

    #mainNav.open {
        display: block;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
    }

    nav ul a {
        display: block;
        padding: 8px 0;
        border-bottom: 1px solid var(--gris);
    }

    .site-header {
        position: relative;
    }

    .barre-recherche {
        flex-direction: column;
    }

    .filtres-recherche {
        flex-direction: column;
        align-items: stretch;
    }

    .filtre-item select {
        min-width: unset;
        width: 100%;
    }

    .detail-contenu {
        grid-template-columns: 1fr;
    }

    .stats-tables {
        grid-template-columns: 1fr;
    }

    .stats-section-large {
        grid-column: auto;
    }
}
