:root {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
    background: #f4f6f8;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; padding: 1rem 2rem; background: #fff;
    border-bottom: 1px solid #e5e7eb;
}
.topbar nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; }
.subtitle { margin-left: .75rem; color: #6b7280; }
.user { padding: .35rem .65rem; background: #eef2f7; border-radius: 999px; }
.container { width: min(1100px, 94%); margin: 2rem auto; }
.card {
    background: white; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,.035);
}
.login-card { width: min(440px, 94%); margin: 8vh auto; }
.hero, .section-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; margin-bottom: 1.25rem;
}
.hero { margin-bottom: 1.5rem; }
h1, h2 { margin-top: 0; }
.muted { color: #6b7280; }
form { display: grid; gap: .85rem; }
label { font-weight: 600; }
input, select {
    width: 100%; padding: .8rem .9rem; border: 1px solid #cbd5e1;
    border-radius: 8px; background: #fff; font: inherit;
}
button, .button {
    display: inline-block; border: 0; border-radius: 8px; padding: .8rem 1rem;
    cursor: pointer; text-decoration: none; font: inherit; font-weight: 650;
}
button, .button.primary { background: #1f4f78; color: white; }
.button.secondary { background: #e5e7eb; color: #111827; }
.actions { display: flex; gap: .75rem; margin-top: .5rem; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.radio-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.radio-pill {
    display: flex; align-items: center; gap: .45rem; border: 1px solid #cbd5e1;
    border-radius: 8px; padding: .7rem .8rem; font-weight: 500;
}
.radio-pill input { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .75rem; border-bottom: 1px solid #e5e7eb; }
th { background: #f8fafc; white-space: nowrap; }
.flash { padding: .85rem 1rem; margin-bottom: 1rem; border-radius: 8px; }
.flash.success { background: #e8f5ec; }
.flash.error { background: #fdecec; }
@media (max-width: 760px) {
    .topbar, .hero, .section-header { align-items: flex-start; flex-direction: column; }
    .topbar { padding: 1rem; }
    .grid.two { grid-template-columns: 1fr; }
    .container { margin-top: 1rem; }
}

.badge {
    display: inline-block;
    padding: .3rem .6rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 700;
}
.badge.active { background: #e8f5ec; }
.badge.inactive { background: #eef0f3; color: #6b7280; }
.actions-inline { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.button.small, button.small { padding: .5rem .7rem; font-size: .9rem; }
button.danger, .button.danger { background: #a53636; color: white; }

.badge.locked {
    margin-left: .35rem;
    background: #f3e8d2;
    color: #6d4c1d;
}

.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.badge.draft { background: #eef2f7; color: #475569; }
.report-section { margin-top: 1.5rem; }
.report-section h2 {
    padding-bottom: .45rem;
    border-bottom: 2px solid #e5e7eb;
}
.validation-panel {
    margin-top: 2rem;
    padding: 1rem;
    border: 1px solid #d7dee7;
    border-radius: 10px;
    background: #f8fafc;
}
.empty-report {
    padding: 2rem;
    text-align: center;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    margin-top: 1rem;
}


.highlight-box {
    margin: 1.25rem 0 1.5rem;
    padding: 1rem 1.1rem;
    border: 1px solid #d7dee7;
    border-radius: 10px;
    background: #fbfcfe;
}
.highlight-box h2 { margin-bottom: .5rem; }
.highlight-box p { white-space: pre-wrap; margin-bottom: 0; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: grid;
    place-items: center;
    padding: 1rem;
    z-index: 1000;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
    width: min(620px, 96vw);
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-card textarea {
    width: 100%;
    resize: vertical;
    min-height: 130px;
}

.report-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}


.sector-neant {
    padding: .85rem;
    border: 1px solid #d7dee7;
    text-align: center;
    font-weight: 700;
    border-radius: 6px;
}

.red-frame {
    border: 2px solid #c62828;
    background: #fff;
}

.report-staff-summary {
    margin: 1rem 0 1.5rem;
    padding: 1rem;
    border: 1px solid #d7dee7;
    border-radius: 8px;
}

.report-staff-summary h2 {
    margin-bottom: .6rem;
}

.astreinte-text {
    color: #c62828;
    font-weight: 700;
}

.modal-large {
    width: min(760px, 96vw);
    max-height: 92vh;
    overflow-y: auto;
}

.popup-section {
    margin: 1.25rem 0;
    padding-top: .75rem;
    border-top: 1px solid #e5e7eb;
}

.popup-section h3 {
    margin: 0 0 .75rem;
}

.staff-list {
    display: grid;
    gap: .5rem;
}

.staff-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .7rem;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    font-weight: 500;
}

.staff-row input {
    width: auto;
}

.asvp-row {
    justify-content: space-between;
}

.asvp-row > label {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.astreinte-label {
    color: #a61b1b;
    font-weight: 700;
}


.stats-filter-form {
    gap: 1.2rem;
}

.stats-fieldset {
    border: 1px solid #d7dee7;
    border-radius: 8px;
    padding: 1rem;
}

.stats-fieldset legend {
    padding: 0 .4rem;
    font-weight: 700;
}

.stats-quarter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: .6rem;
}

.stats-check {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 500;
}

.stats-check input {
    width: auto;
}

.stats-select-actions {
    display: flex;
    gap: .5rem;
    margin-top: .8rem;
    flex-wrap: wrap;
}

.detail-check {
    width: fit-content;
}

.number-col {
    text-align: right;
    white-space: nowrap;
}

.stats-total {
    font-size: 1.05rem;
}

.stats-results tfoot th {
    border-top: 2px solid #cbd5e1;
}

.stats-errors {
    margin-top: 1rem;
}

@media (max-width: 720px) {
    .stats-quarter-grid {
        grid-template-columns: 1fr;
    }
}


.category-admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.admin-panel {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.1rem;
    background: #fbfcfe;
}

.admin-panel h2 {
    margin-bottom: 1rem;
}

.category-children {
    display: grid;
    gap: .45rem;
}

.category-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .5rem .65rem;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #fff;
}

.category-child.inactive-row {
    opacity: .65;
}

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