:root {
    --blue: #000091;
    --blue-hover: #1818ff;
    --blue-dark: #06063b;
    --blue-soft: #f5f5fe;
    --blue-tint: #eaeaff;
    --red: #e1000f;
    --red-soft: #fff4f4;
    --surface-grey: #f5f6f8;
    --white: #ffffff;
    --text: #161616;
    --muted: #666666;
    --border: #e4e4ec;
    --border-strong: #cfcfd9;
    --success-bg: #e8f8ee;
    --success-text: #18794e;
    --pending-bg: #fff8e6;
    --pending-text: #946200;
    --error-bg: #fff1f2;
    --error-text: #b42318;
    --shadow-card: 0 10px 28px rgba(6, 6, 59, 0.05);
    --shadow-hover: 0 18px 38px rgba(0, 0, 145, 0.09);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Public Sans', sans-serif;
    background: var(--surface-grey);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* TOP LINE TRICOLORE */

.top-line {
    height: 5px;
    background: linear-gradient(
        90deg,
        var(--blue) 0%,
        #3b3bff 33%,
        var(--white) 33%,
        var(--white) 66%,
        var(--red) 66%,
        var(--red) 100%
    );
    animation: lineExpand 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* HEADER MINISTÉRIEL */

.header {
    background: var(--white);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 20;
    animation: headerDrop 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.header-container {
    max-width: 1250px;
    margin: auto;
    padding: 26px 35px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.republic-logo {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
    min-width: 130px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: transform 0.28s ease, background-color 0.28s ease;
}

.republic-logo:hover {
    transform: translateY(-2px);
    background: var(--blue-soft);
}

.flag {
    display: flex;
    width: 44px;
    height: 16px;
    margin-bottom: 8px;
    border: 1px solid #d8d8e2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.flag span {
    flex: 1;
}

.flag span:nth-child(1) {
    background: var(--blue);
}

.flag span:nth-child(2) {
    background: var(--white);
}

.flag span:nth-child(3) {
    background: var(--red);
}

.republic-logo strong {
    font-size: 13px;
    line-height: 1.15;
    font-weight: 800;
}

.republic-logo small {
    margin-top: 5px;
    font-size: 9px;
    color: var(--muted);
    font-style: italic;
}

.header-separator {
    width: 1px;
    height: 68px;
    background: linear-gradient(180deg, transparent, var(--border-strong), transparent);
}

.institution {
    flex: 1;
    animation: slideRight 0.75s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.institution-label {
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    display: block;
}

.institution h1 {
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 800;
    letter-spacing: -0.8px;
    color: var(--blue-dark);
    margin: 4px 0;
}

.institution p {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.header-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--blue-soft);
    border: 1px solid #d4d4fb;
    color: var(--blue-dark);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-text);
    box-shadow: 0 0 0 0 rgba(24, 121, 78, 0.55);
    animation: pulseDot 2s infinite;
}

.header-live-pill.is-offline .live-dot {
    background: var(--red);
    animation: none;
}

/* NAVIGATION */

.navigation {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--white);
}

.nav-container {
    max-width: 1250px;
    margin: auto;
    padding: 0 35px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nav-link {
    position: relative;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.nav-link.active {
    color: var(--blue);
    background: var(--blue-soft);
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--blue);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-link.active::after,
.nav-link:hover::after {
    transform: scaleX(1);
}

.nav-link:hover {
    background: var(--blue-soft);
    color: var(--blue);
}

.nav-dot {
    height: 7px;
    width: 7px;
    border-radius: 50%;
    background: currentColor;
    transition: transform 0.25s ease;
}

.nav-link:hover .nav-dot,
.nav-link.active .nav-dot {
    transform: scale(1.45);
}

/* MAIN & CARTES BLANCHES */

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1250px;
    margin: auto;
    padding: 38px 35px 52px;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
    animation: sectionEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.white-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: 4px;
    padding: 34px 38px;
    box-shadow: var(--shadow-card);
    opacity: 0;
    transform: translateY(14px);
    transition:
        opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.3s ease;
}

.white-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.white-card:hover {
    box-shadow: var(--shadow-hover);
}

.contact-card,
.login-card {
    max-width: 900px;
}

.admin-card {
    border-left-color: var(--red);
}

.card-badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.gov-tag {
    display: inline-block;
    background: var(--blue-soft);
    color: var(--blue);
    border: 1px solid #d4d4fb;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 2px;
}

.gov-tag-soft {
    background: var(--surface-grey);
    color: var(--text);
    border-color: var(--border);
}

.gov-tag-red {
    background: var(--red-soft);
    color: var(--red);
    border-color: #f9c8cb;
    margin-bottom: 12px;
}

.hero-title,
.section-heading {
    color: var(--blue-dark);
    font-size: clamp(24px, 3.2vw, 34px);
    font-weight: 800;
    letter-spacing: -0.6px;
    line-height: 1.2;
    margin-bottom: 14px;
}

.section-heading {
    font-size: clamp(20px, 2.5vw, 26px);
    margin-bottom: 8px;
}

.sub-heading {
    color: var(--blue-dark);
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}

.section-subtitle {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.65;
    margin-bottom: 22px;
    max-width: 78ch;
}

.hero-description {
    color: var(--text);
    font-size: 15px;
    line-height: 1.75;
    max-width: 78ch;
}

.hero-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.highlights-grid {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.mini-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: 3px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.mini-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(0, 0, 145, 0.08);
}

.panel-index {
    font-size: 11px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: 1px;
}

.mini-panel strong {
    font-size: 14px;
    color: var(--blue-dark);
}

.mini-panel span:last-child {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.5;
}

/* KPI SUIVI */

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.kpi-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: 3px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-box.kpi-pending {
    border-top-color: #d99000;
}

.kpi-box.kpi-accepted {
    border-top-color: var(--success-text);
}

.kpi-box.kpi-refused {
    border-top-color: var(--red);
}

.kpi-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.kpi-box strong {
    font-size: 22px;
    font-weight: 800;
    color: var(--blue-dark);
}

/* FORMULAIRES & BOUTONS */

.gov-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 0, 145, 0.14);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.btn {
    padding: 12px 20px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.16s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--blue-hover);
    box-shadow: 0 6px 16px rgba(0, 0, 145, 0.22);
}

.btn-secondary {
    background: var(--blue-soft);
    color: var(--blue);
    border-color: #c8c8f5;
}

.btn-secondary:hover {
    background: var(--blue-tint);
}

.btn-ghost {
    background: var(--white);
    color: var(--blue-dark);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    background: var(--surface-grey);
}

.form-feedback {
    min-height: 20px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 3px;
}

.form-feedback.success {
    padding: 11px 14px;
    background: var(--success-bg);
    color: var(--success-text);
    border-left: 3px solid var(--success-text);
    animation: popIn 0.28s ease;
}

.form-feedback.error {
    padding: 11px 14px;
    background: var(--error-bg);
    color: var(--error-text);
    border-left: 3px solid var(--error-text);
    animation: popIn 0.28s ease;
}

/* ESPACE PERSONNEL & DÉMARCHES */

.staff-workspace {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.role-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 2px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--blue-dark);
    color: var(--white);
}

.role-badge.is-admin {
    background: var(--red);
}

.accounts-box {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.accounts-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--blue-dark);
    margin-bottom: 12px;
}

.accounts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.account-pill {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-pill.is-admin {
    border-left-color: var(--red);
}

.filter-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-input-wrap {
    flex: 1;
    min-width: 240px;
}

.filter-select-wrap {
    min-width: 190px;
}

.demarches-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

.demarche-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: 3px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    animation: popIn 0.32s ease;
}

.demarche-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(6, 6, 59, 0.06);
}

.demarche-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.demarche-main {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 76ch;
}

.demarche-id {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: 0.6px;
}

.demarche-title {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--blue-dark);
}

.demarche-meta {
    font-size: 12.5px;
    color: var(--muted);
}

.demarche-motif {
    font-size: 13.5px;
    color: var(--text);
    margin-top: 4px;
    line-height: 1.55;
}

.visitor-message-box {
    background: var(--blue-soft);
    border: 1px solid #dadafc;
    border-left: 3px solid var(--blue);
    border-radius: 3px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--blue-dark);
}

.visitor-message-box strong {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--blue);
    margin-bottom: 4px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-en-attente {
    background: var(--pending-bg);
    color: var(--pending-text);
}

.status-accepte {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-refuse {
    background: var(--error-bg);
    color: var(--error-text);
}

.staff-decision-form {
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.staff-decision-form .form-group {
    gap: 5px;
}

.staff-decision-form label {
    font-size: 12px;
    color: var(--muted);
}

.staff-status-select,
.staff-message-input {
    padding: 9px 12px;
    font-size: 13px;
}

.empty-state {
    color: var(--muted);
    font-size: 13.5px;
    padding: 12px 0;
}

/* FOOTER */

.footer {
    border-top: 1px solid var(--border);
    background: var(--white);
}

.footer-container {
    max-width: 1250px;
    margin: auto;
    padding: 32px 35px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 800;
    color: var(--blue-dark);
}

.footer-flag {
    display: flex;
    width: 30px;
    height: 20px;
    border: 1px solid #ddd;
}

.footer-flag span {
    flex: 1;
}

.footer-flag span:nth-child(1) {
    background: var(--blue);
}

.footer-flag span:nth-child(2) {
    background: var(--white);
}

.footer-flag span:nth-child(3) {
    background: var(--red);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    margin-top: 22px;
    padding-top: 18px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
}

/* ANIMATIONS */

@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 rgba(24, 121, 78, 0.55); }
    70% { box-shadow: 0 0 0 7px rgba(24, 121, 78, 0); }
    100% { box-shadow: 0 0 0 0 rgba(24, 121, 78, 0); }
}

@keyframes sectionEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes headerDrop {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes lineExpand {
    from {
        transform: scaleX(0);
        transform-origin: left;
    }
    to {
        transform: scaleX(1);
    }
}

/* RESPONSIVE */

@media (max-width: 960px) {
    .kpi-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .highlights-grid,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .staff-decision-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .header-container {
        padding: 20px 18px;
        gap: 14px;
        flex-wrap: wrap;
    }

    .header-separator {
        height: 50px;
    }

    .institution h1 {
        font-size: 19px;
    }

    .institution p {
        font-size: 11px;
    }

    .institution-label {
        font-size: 8.5px;
    }

    .nav-container {
        padding: 0 12px;
    }

    .nav-link {
        padding: 15px 14px;
        font-size: 13px;
    }

    .main-content {
        padding: 24px 16px 40px;
    }

    .white-card {
        padding: 22px 18px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .footer-container {
        padding: 24px 18px;
    }

    .footer-bottom {
        flex-direction: column;
    }
}

/* ACCESSIBILITÉ */

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