:root {
    color-scheme: light;
    --bleu: #1d4e89;
    --bleu-fonce: #123a63;
    --gris-fond: #f4f6f8;
    --gris-bordure: #d7dee4;
    --texte: #1c2733;
    --vert: #1e7a46;
    --rouge: #a3231f;
    --orange: #a05a00;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--gris-fond);
    color: var(--texte);
    padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px);
}

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

.topbar {
    background: var(--bleu-fonce);
    color: #fff;
    padding: 0.75rem 1rem;
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
}

.brand {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    margin-right: auto;
}

.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.nav a { color: #dce8f7; text-decoration: none; font-size: 0.95rem; }
.nav a:hover { color: #fff; text-decoration: underline; }

.logout-form { display: flex; align-items: center; gap: 0.6rem; }
.who { font-size: 0.9rem; color: #cfe0f2; }
.link-button {
    background: none; border: 1px solid #4d7aa8; color: #fff;
    border-radius: 4px; padding: 0.3rem 0.6rem; cursor: pointer; font-size: 0.85rem;
}
.link-button:hover { background: #2a5d94; }

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

.footer {
    text-align: center;
    color: #6b7a87;
    font-size: 0.8rem;
    padding: 1rem;
}

h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.2rem; }

.card {
    background: #fff;
    border: 1px solid var(--gris-bordure);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--gris-bordure); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; color: #55606b; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-gris { background: #e5eaef; color: #46525c; }
.badge-bleu { background: #dbe8f7; color: var(--bleu-fonce); }
.badge-vert { background: #ddf1e4; color: var(--vert); }
.badge-orange { background: #fbe8cf; color: var(--orange); }
.badge-rouge { background: #f6dbda; color: var(--rouge); }

.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel],
select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--gris-bordure);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}
textarea { min-height: 6rem; resize: vertical; }
fieldset { border: 1px solid var(--gris-bordure); border-radius: 6px; margin-bottom: 1rem; }
legend { padding: 0 0.4rem; font-weight: 600; font-size: 0.9rem; }
.checkbox-list label { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 400; margin-bottom: 0.4rem; }
.checkbox-list input { width: auto; margin-top: 0.2rem; }

.btn {
    display: inline-block;
    background: var(--bleu);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--bleu-fonce); }
.btn-secondaire { background: #fff; color: var(--bleu); border: 1px solid var(--bleu); }
.btn-secondaire:hover { background: #eef4fb; }
.btn-danger { background: var(--rouge); }
.btn-danger:hover { background: #7f1c19; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.95rem; }
.alert-succes { background: #ddf1e4; color: var(--vert); }
.alert-erreur { background: #f6dbda; color: var(--rouge); }
.alert-info { background: #dbe8f7; color: var(--bleu-fonce); }

.muted { color: #6b7a87; font-size: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.login-wrap { max-width: 380px; margin: 3rem auto; }
.stat-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.stat-tile { flex: 1 1 160px; background: #fff; border: 1px solid var(--gris-bordure); border-radius: 8px; padding: 1rem; }
.stat-tile .value { font-size: 1.8rem; font-weight: 700; color: var(--bleu-fonce); }
.stat-tile .label { font-size: 0.85rem; color: #6b7a87; }

@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    tr { border-bottom: 2px solid var(--gris-bordure); padding-bottom: 0.5rem; margin-bottom: 0.5rem; }
    td { border: none; padding: 0.25rem 0; }
    td::before { content: attr(data-label); display: block; font-size: 0.72rem; text-transform: uppercase; color: #6b7a87; }
}
