:root {
    color-scheme: light;
    --pi-primary: #123f33;
    --pi-primary-dark: #0a2c24;
    --pi-primary-soft: #e6f0ed;
    --pi-accent: #e97812;
    --pi-accent-soft: #fff0e3;
    --pi-blue: #006b8f;
    --pi-brown: #6b3018;
    --pi-ink: #18211e;
    --pi-muted: #52605b;
    --pi-surface: #ffffff;
    --pi-background: #f5f7f6;
    --pi-border: #cbd5d1;
    --pi-focus: #005fcc;
    --bs-primary: #123f33;
    --bs-primary-rgb: 18, 63, 51;
    --bs-link-color: #0d5946;
    --bs-link-hover-color: #073e31;
    --bs-body-color: #18211e;
    --bs-body-bg: #f5f7f6;
    --bs-border-color: #cbd5d1;
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--pi-background);
    color: var(--pi-ink);
    line-height: 1.55;
    overflow-x: hidden;
}

main {
    flex: 1 0 auto;
}

h1,
h2,
h3 {
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p,
li {
    max-width: 72ch;
}

a,
button,
input,
select,
textarea,
summary,
[tabindex]:not([tabindex="-1"]) {
    scroll-margin-top: 1rem;
}

:focus-visible {
    outline: 3px solid var(--pi-focus) !important;
    outline-offset: 3px !important;
    box-shadow: none !important;
}

.btn,
.form-control,
.form-select,
.page-link,
.site-navigation-link {
    min-height: 44px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 650;
}

.btn-primary {
    --bs-btn-bg: var(--pi-primary);
    --bs-btn-border-color: var(--pi-primary);
    --bs-btn-hover-bg: var(--pi-primary-dark);
    --bs-btn-hover-border-color: var(--pi-primary-dark);
    --bs-btn-active-bg: var(--pi-primary-dark);
    --bs-btn-active-border-color: var(--pi-primary-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--pi-primary);
    --bs-btn-border-color: var(--pi-primary);
    --bs-btn-hover-bg: var(--pi-primary);
    --bs-btn-hover-border-color: var(--pi-primary);
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.75rem 1rem;
    color: #fff;
    background: var(--pi-primary-dark);
    border-radius: 0.5rem;
    transform: translateY(-150%);
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

.site-header {
    background: var(--pi-surface);
    border-bottom: 1px solid var(--pi-border);
}

.app-header {
    color: #fff;
    background: var(--pi-primary-dark);
}

.brand {
    display: inline-flex;
    gap: 0.65rem;
    align-items: center;
    min-height: 44px;
    color: var(--pi-primary-dark);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.brand:hover {
    color: var(--pi-primary);
}

.brand-light,
.brand-light:hover {
    color: #fff;
}

.brand-mark {
    display: inline-grid;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    color: #fff;
    background: var(--pi-primary);
    border-radius: 0.65rem;
}

.brand-logo {
    width: 4rem;
    height: 4rem;
    flex: 0 0 auto;
    display: block;
    object-fit: cover;
    object-position: center;
    border-radius: 0.65rem;
    background: #fff;
}

.brand-light .brand-mark {
    color: var(--pi-primary-dark);
    background: #fff;
}

.site-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    margin: 0;
    list-style: none;
}

.site-navigation-toggle {
    display: none;
    min-height: 44px;
    padding: 0.55rem 0.85rem;
    color: var(--pi-primary-dark);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--pi-border);
    border-radius: 0.5rem;
    background: var(--pi-surface);
}

.site-navigation-menu {
    position: relative;
}

.site-navigation-toggle::-webkit-details-marker {
    display: none;
}

.site-navigation-toggle-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.site-navigation-toggle-icon span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.site-navigation-link {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.75rem;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0.5rem;
}

.site-navigation-link:hover,
.site-navigation-link.active {
    color: var(--pi-primary-dark);
    background: var(--pi-primary-soft);
}

.app-header .site-navigation-link:hover,
.app-header .site-navigation-link.active {
    color: #fff;
    background: rgb(255 255 255 / 14%);
}

.app-header .site-navigation-toggle {
    color: #fff;
    background: transparent;
    border-color: rgb(255 255 255 / 35%);
}

.site-footer {
    color: #fff;
    background: var(--pi-primary-dark);
}

.hero-section {
    color: #f7fbf9;
    background-image:
        linear-gradient(112deg, rgb(18 63 51 / 97%) 0%, rgb(10 105 73 / 88%) 38%, rgb(0 107 143 / 65%) 68%, rgb(233 120 18 / 58%) 100%),
        url('/accueil/photo-accueil.avif');
    background-position: center, center;
    background-size: cover, cover;
    background-attachment: scroll;
    border-bottom: 1px solid var(--pi-border);
}

.hero-section h1,
.hero-section h2 {
    color: #fff;
    text-shadow: none;
}

.hero-section .lead {
    max-width: 50rem;
    color: #e2f0eb;
    font-weight: 500;
}

.hero-section .eyebrow {
    color: #ffc68f;
}

.hero-section .btn-primary {
    color: var(--pi-primary-dark);
    background: #fff;
    border-color: #fff;
}

.hero-section .btn-primary:hover,
.hero-section .btn-primary:focus-visible {
    color: var(--pi-primary-dark);
    background: #e2f0eb;
    border-color: #e2f0eb;
}

.hero-section .btn-outline-primary {
    color: #fff;
    border-color: #fff;
}

.hero-section .btn-outline-primary:hover,
.hero-section .btn-outline-primary:focus-visible {
    color: var(--pi-primary-dark);
    background: #fff;
    border-color: #fff;
}

.hero-section .trust-panel {
    color: var(--pi-ink);
    background: #fff;
    border-color: #9ebbb0;
    box-shadow: 0 0.75rem 1.5rem rgb(18 63 51 / 13%);
}

.hero-section .trust-panel h2 {
    color: var(--pi-primary-dark);
}

.py-lg-6 {
    padding-top: 5rem;
    padding-bottom: 5rem;
}

.eyebrow {
    color: var(--pi-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.trust-panel,
.surface-card,
.kpi-card,
.empty-state {
    background: var(--pi-surface);
    border: 1px solid var(--pi-border);
    border-radius: 0.85rem;
    box-shadow: 0 0.3rem 1.2rem rgb(18 63 51 / 7%);
}

.trust-panel {
    padding: 1.5rem;
    border-left: 0.35rem solid var(--pi-accent);
}

.check-list {
    display: grid;
    gap: 0.8rem;
    padding-left: 1.3rem;
}

.kpi-card {
    padding: 1.25rem;
    border-top: 0.3rem solid var(--pi-primary);
}

.kpi-card-warning {
    border-top-color: var(--pi-accent);
}

.kpi-card-success {
    border-top-color: #197044;
}

.kpi-label,
.kpi-help {
    margin: 0;
    color: var(--pi-muted);
}

.kpi-value {
    margin: 0.2rem 0;
    font-size: clamp(1.8rem, 8vw, 2.5rem);
    font-weight: 800;
    line-height: 1.1;
}

.design-section {
    padding: 2rem 0;
    border-top: 1px solid var(--pi-border);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
}

.color-swatch {
    display: flex;
    min-height: 7rem;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
    border: 1px solid var(--pi-border);
    border-radius: 0.75rem;
    font-weight: 700;
}

.color-swatch code {
    color: inherit;
}

.swatch-primary {
    color: #fff;
    background: var(--pi-primary);
}

.swatch-accent {
    color: #fff;
    background: var(--pi-accent);
}

.swatch-surface {
    background: var(--pi-background);
}

.table-responsive {
    border: 1px solid var(--pi-border);
    border-radius: 0.75rem;
    background: #fff;
}

.table caption {
    padding: 0.75rem;
    color: var(--pi-ink);
    font-weight: 700;
}

.table thead th {
    color: #fff;
    background: var(--pi-primary);
}

.page-link {
    display: inline-flex;
    align-items: center;
}

.form-label {
    font-weight: 700;
}

.form-control,
.form-select {
    border-color: #788781;
}

.form-control:disabled,
.form-select:disabled,
.btn:disabled {
    cursor: wait;
}

.connection-status {
    position: sticky;
    top: 0;
    z-index: 2050;
    padding: 0.75rem 1rem;
    color: #fff;
    text-align: center;
    background: #652b00;
}

.invalid-feedback {
    font-weight: 600;
}

.empty-state {
    padding: clamp(1.5rem, 5vw, 3rem);
    text-align: center;
}

.empty-state p {
    margin-inline: auto;
}

.empty-state-icon {
    margin-bottom: 0.75rem;
    color: var(--pi-primary);
    font-size: 2.5rem;
    line-height: 1;
}

.app-dialog {
    width: min(34rem, calc(100% - 2rem));
    padding: 0;
    border: 0;
    border-radius: 0.85rem;
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 25%);
}

.app-dialog[open] {
    position: fixed;
    inset: 0;
    z-index: 1100;
}

.app-dialog::backdrop {
    background: rgb(0 0 0 / 55%);
}

.app-dialog-content {
    padding: 1.5rem;
}

.admin-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 1rem;
    color: #fff;
    background: #652b00;
    border-radius: 0.65rem;
}

.agency-nav .nav-link,
.admin-banner + .row .nav-link {
    min-height: 44px;
}

@media (max-width: 575.98px) {
    .site-header .container,
    .app-header .container-fluid {
        align-items: center !important;
    }

    .site-header nav,
    .app-header nav,
    .site-navigation-menu {
        width: auto;
    }

    .site-navigation-toggle {
        display: grid;
        width: 44px;
        height: 44px;
        padding: 0;
        place-items: center;
        text-align: center;
    }

    .site-navigation-menu[open] .site-navigation {
        display: flex;
        position: absolute;
        right: 0;
        z-index: 20;
        width: max-content;
        min-width: 12rem;
        margin-top: 0.5rem;
        background: var(--pi-surface);
        border: 1px solid var(--pi-border);
        border-radius: 0.5rem;
        box-shadow: 0 0.5rem 1rem rgb(0 0 0 / 15%);
    }

    .site-navigation li,
    .site-navigation-link {
        width: 100%;
    }

    .site-navigation-link {
        justify-content: center;
    }

    .responsive-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--pi-border);
    }

    .responsive-table tr:last-child {
        border-bottom: 0;
    }

    .responsive-table td {
        display: grid;
        grid-template-columns: minmax(7rem, 42%) 1fr;
        gap: 0.75rem;
        padding: 0.5rem 0.75rem;
        border: 0;
        overflow-wrap: anywhere;
    }

    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 700;
    }

    .pagination {
        gap: 0.25rem;
    }

    .page-item:first-child,
    .page-item:last-child {
        width: 100%;
    }

    .page-item:first-child .page-link,
    .page-item:last-child .page-link {
        justify-content: center;
    }
}

@media (max-width: 767.98px) {
    .navbar-expand-md > .container,
    .navbar-expand-md > .container-xl,
    .navbar-vertical .container,
    .navbar-vertical .container-xl {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .navbar-expand-md > .container > .navbar-brand,
    .navbar-expand-md > .container-xl > .navbar-brand,
    .navbar-vertical .container > .navbar-brand,
    .navbar-vertical .container-xl > .navbar-brand {
        order: 1;
        flex: 0 1 auto;
        margin-right: auto;
    }

    .navbar-expand-md > .container > .navbar-toggler,
    .navbar-expand-md > .container-xl > .navbar-toggler,
    .navbar-vertical .container > .navbar-toggler,
    .navbar-vertical .container-xl > .navbar-toggler {
        order: 2;
        margin-left: auto;
    }

    .navbar-expand-md > .container > .navbar-nav,
    .navbar-expand-md > .container-xl > .navbar-nav,
    .navbar-vertical .container > .navbar-nav,
    .navbar-vertical .container-xl > .navbar-nav {
        order: 3;
    }

    .navbar-expand-md > .container > .navbar-collapse.show,
    .navbar-expand-md > .container-xl > .navbar-collapse.show,
    .navbar-vertical .container > .navbar-collapse.show,
    .navbar-vertical .container-xl > .navbar-collapse.show {
        margin-top: 0.75rem;
        padding: 0.75rem;
        background: var(--pi-surface);
        border: 1px solid var(--pi-border);
        border-radius: 0.75rem;
        box-shadow: 0 0.75rem 1.5rem rgb(18 63 51 / 14%);
    }

    .navbar-expand-md:has(> .container > .navbar-collapse.show) > .container > .navbar-brand,
    .navbar-expand-md:has(> .container-xl > .navbar-collapse.show) > .container-xl > .navbar-brand,
    .navbar-vertical:has(.navbar-collapse.show) .navbar-brand {
        padding: 0.35rem 0.65rem;
        color: #fff;
        background: var(--pi-primary);
        border-radius: 0.5rem;
    }

    .navbar-expand-md:has(> .container > .navbar-collapse.show) > .container > .navbar-brand .brand-mark,
    .navbar-expand-md:has(> .container-xl > .navbar-collapse.show) > .container-xl > .navbar-brand .brand-mark,
    .navbar-vertical:has(.navbar-collapse.show) .navbar-brand .brand-mark {
        color: var(--pi-primary);
        background: #fff;
    }

    .navbar-toggler {
        color: var(--pi-primary-dark);
        border: 0;
        border-radius: 0.6rem;
        transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, transform 220ms ease;
    }

    .navbar-toggler .navbar-toggler-icon {
        transition: transform 220ms ease;
    }

    .navbar-toggler[aria-expanded="true"] {
        color: #fff;
        background: var(--pi-accent);
        box-shadow: 0 0.25rem 0.75rem rgb(169 75 0 / 30%);
    }

    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
        transform: rotate(90deg);
    }

    .navbar-collapse.collapsing {
        overflow: hidden;
        transition: height 280ms ease;
    }
}


@media (max-width: 360px) {
    .container,
    .container-fluid {
        --bs-gutter-x: 1rem;
    }

    .surface-card,
    .trust-panel {
        border-radius: 0.5rem;
    }

    .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    .skip-link,
    .site-navigation,
    .btn,
    .site-footer {
        display: none !important;
    }

    body,
    .surface-card,
    .table-responsive {
        color: #000;
        background: #fff;
        box-shadow: none;
    }
}
