:root {
    --color-bg: #eef1f5;
    --color-surface: #ffffff;
    --color-primary: #1d4f6e;
    --color-primary-hover: #163c54;
    --color-primary-dark: #0f2a3d;
    --color-primary-light: #e1e9ee;
    --color-accent: #b98a3d;
    --color-accent-light: #f6ecd9;
    --color-text: #1b2530;
    --color-text-muted: #5c6670;
    --color-border: #dbe1e6;
    --color-error-bg: #fbeae7;
    --color-error-text: #96372a;
    --color-success-bg: #e6f0e6;
    --color-success-text: #2b5c3f;
    --radius: 4px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(10, 25, 38, 0.07);
    --shadow-md: 0 10px 28px -8px rgba(10, 25, 38, 0.22), 0 2px 8px rgba(10, 25, 38, 0.1);
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    background:
        radial-gradient(1000px 420px at 100% -12%, rgba(29, 79, 110, 0.05), transparent),
        var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, .btn:focus-visible, .quick-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

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

/* ---------- Titres ---------- */

@keyframes vl-rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--color-primary-dark);
    margin: 0 0 24px;
    animation: vl-rise 0.5s ease both;
}
h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin: 0 0 14px;
}
@media (prefers-reduced-motion: reduce) {
    h1 { animation: none; }
}

/* ---------- Top navigation ---------- */

.nav-toggle-checkbox { display: none; }

.topbar {
    background: linear-gradient(180deg, var(--color-primary-dark), #0a1f2d 90%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 2px 12px rgba(8, 20, 18, 0.25);
}
.topbar-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 60px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    margin-right: 12px;
}
.brand:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 28px; flex-shrink: 0; }
.dev-badge {
    background: var(--color-accent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.04em;
}

.main-nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.78);
    padding: 9px 13px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}
.main-nav a:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.main-nav a.active { background: rgba(255,255,255,0.16); color: #fff; }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; }
.nav-user-mobile { display: none; }
.lang-menu-mobile { display: none; }

.main-nav a:focus-visible, .lang-menu summary:focus-visible, .nav-burger:focus-visible,
.logout-link:focus-visible, .user-chip:focus-visible {
    outline: 2px solid rgba(255,255,255,0.9);
    outline-offset: 2px;
}

/* ---------- Menu de langue ---------- */

.lang-menu { position: relative; margin-right: 4px; }
.lang-menu summary {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 8px;
    border-radius: 6px;
    letter-spacing: 0.02em;
    -webkit-user-select: none;
    user-select: none;
}
.lang-menu summary::-webkit-details-marker,
.lang-menu summary::marker { display: none; content: ""; }
.lang-menu summary:hover { background: rgba(255,255,255,0.1); color: #fff; }
.lang-menu[open] summary { background: rgba(255,255,255,0.16); color: #fff; }
.lang-menu-flag { width: 18px; height: 12px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.1); }
.lang-menu-code { line-height: 1; }
.lang-menu-caret { width: 11px; height: 11px; flex-shrink: 0; transition: transform 0.15s ease; }
.lang-menu[open] .lang-menu-caret { transform: rotate(180deg); }

.lang-menu-list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 30;
}
.lang-menu-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text);
}
.lang-menu-option:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.lang-menu-option:hover { background: var(--color-primary-light); text-decoration: none; }
.lang-menu-option.active { color: var(--color-primary); font-weight: 700; }

.lang-menu-anon { position: fixed; top: 16px; right: 16px; z-index: 50; margin-right: 0; }
.lang-menu-anon summary { color: var(--color-text-muted); background: rgba(15, 42, 61, 0.06); }
.lang-menu-anon summary:hover { background: var(--color-surface); }
.lang-menu-anon[open] summary { background: var(--color-surface); color: var(--color-primary-dark); box-shadow: var(--shadow-sm); }

.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.user-chip {
    color: #fff;
    background: rgba(255,255,255,0.12);
    padding: 7px 14px;
    border-radius: 20px;
    font-weight: 600;
}
.user-chip:hover { background: rgba(255,255,255,0.2); text-decoration: none; }
.logout-link {
    color: rgba(255,255,255,0.85);
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
.logout-link svg { width: 18px; height: 18px; }
.logout-link:hover { background: rgba(255,255,255,0.14); text-decoration: none; }

.nav-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    cursor: pointer;
    margin-left: auto;
    color: #fff;
}
.nav-burger svg { width: 22px; height: 22px; }

/* ---------- Mise en page ---------- */

.page-content {
    max-width: 1140px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    min-height: 60vh;
}

.site-footer {
    text-align: center;
    padding: 28px;
    color: var(--color-text-muted);
    font-size: 0.83rem;
}

.flash {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 22px;
    font-size: 0.92rem;
    font-weight: 500;
}
.flash-error { background: var(--color-error-bg); color: var(--color-error-text); }
.flash-success { background: var(--color-success-bg); color: var(--color-success-text); }
.flash-floating {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    box-shadow: var(--shadow-md);
    max-width: 90vw;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 26px 28px;
    margin-bottom: 20px;
}
.card-action { border-top: 3px solid var(--color-primary); }

/* ---------- Boutons & formulaires ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 0.93rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--color-primary-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.btn-secondary:hover { background: #d2e2da; }
.btn-danger { background: #c24a3f; }
.btn-danger:hover { background: #a53a30; }
.btn-small { padding: 7px 13px; font-size: 0.83rem; border-radius: 6px; }

.form-group { margin-bottom: 17px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.88rem; color: var(--color-text); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], textarea, select {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; min-height: 100px; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(29, 79, 110, 0.13);
}
input:disabled { background: #f2f4f1; color: var(--color-text-muted); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: -4px; padding: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
th { color: var(--color-text-muted); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
tbody tr:hover { background: #f7faf8; }
tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; }
.badge-pending { background: var(--color-accent-light); color: #8a5a1c; }

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    vertical-align: middle;
}
.icon-badge svg { width: 13px; height: 13px; }

.status-toggle-form { display: flex; align-items: center; gap: 9px; }
label.switch {
    position: relative;
    display: inline-block;
    width: 34px; height: 20px;
    flex-shrink: 0;
    margin: 0;
    vertical-align: middle;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; background: #d3dad2; border-radius: 24px; transition: background 0.15s ease; pointer-events: none; }
.switch-track::before {
    content: "";
    position: absolute;
    height: 14px; width: 14px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    transition: transform 0.15s ease;
}
.switch input:checked + .switch-track { background: var(--color-primary); }
.switch input:checked + .switch-track::before { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(29, 79, 110, 0.28); }
.switch-label { font-size: 0.82rem; color: var(--color-text-muted); min-width: 60px; }

.privacy-toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.9rem; }
.privacy-toggle-row:last-child { margin-bottom: 0; }

/* ---------- Pages d'authentification ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
}

.auth-brand {
    flex: 1 1 42%;
    background: linear-gradient(160deg, #0a1f2d, var(--color-primary-dark) 55%, #1b4a63);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px;
    position: relative;
    overflow: hidden;
}
.auth-brand::after {
    content: "";
    position: absolute;
    top: -70px; right: -60px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(185, 138, 61, 0.35), transparent 70%);
}
.auth-coastline {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 92px;
}
.auth-brand-inner { position: relative; max-width: 320px; z-index: 1; }
.auth-tagline { font-size: 0.95rem; color: rgba(255,255,255,0.72); margin: 14px 0 0; line-height: 1.6; }
.auth-location { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(255,255,255,0.55); margin: 28px 0 0; }

.logo-badge {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
}
.logo-badge svg { width: 32px; height: 32px; }

.auth-wordmark {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.7rem;
    font-weight: 600;
    margin: 0;
}

.auth-form-panel {
    flex: 1 1 58%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--color-surface);
}
.auth-form-box { width: 100%; max-width: 340px; }
.auth-form-box h1 { font-size: 1.65rem; margin: 0 0 6px; }
.auth-subtitle { color: var(--color-text-muted); font-size: 0.9rem; margin: 0 0 30px; }
.auth-footnote { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--color-text-muted); }

@media (max-width: 860px) {
    .auth-page { flex-direction: column; }
    .auth-brand { flex: none; padding: 30px 28px; }
    .auth-brand::after, .auth-coastline { display: none; }
    .auth-brand-inner { max-width: none; display: flex; align-items: center; gap: 14px; }
    .logo-badge { width: 44px; height: 44px; border-radius: 11px; margin-bottom: 0; }
    .logo-badge svg { width: 24px; height: 24px; }
    .auth-wordmark { font-size: 1.3rem; }
    .auth-tagline, .auth-location { display: none; }
    .auth-form-panel { padding: 36px 24px 48px; }
}

/* ---------- Contenus ---------- */

.announcement { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--color-border); }
.announcement:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.announcement-meta { color: var(--color-text-muted); font-size: 0.8rem; margin-bottom: 6px; }
.pin-icon-inline { width: 13px; height: 13px; color: var(--color-accent); vertical-align: -2px; margin-right: 3px; }
.pinned { border-left: 3px solid var(--color-accent); padding-left: 14px; margin-left: -3px; }

.actions-row { display: flex; gap: 8px; margin-top: 16px; }
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.page-header h1 { margin-bottom: 0; }

.quick-links { display: flex; gap: 14px; flex-wrap: wrap; }
.quick-link {
    flex: 1;
    min-width: 160px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--color-text);
    font-weight: 600;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.quick-link:hover { border-color: var(--color-primary); background: var(--color-primary-light); text-decoration: none; }
.quick-link-icon {
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    flex-shrink: 0;
}
.quick-link-icon svg { width: 21px; height: 21px; }

/* ---------- Navigation responsive ---------- */

@media (max-width: 900px) {
    .nav-burger { display: flex; }
    .main-nav {
        position: fixed;
        top: 60px; left: 0; right: 0;
        background: var(--color-primary-dark);
        flex-direction: column;
        align-items: stretch;
        padding: 8px;
        gap: 2px;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        transform: translateY(-8px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease, transform 0.15s ease;
        box-shadow: 0 12px 20px rgba(0,0,0,0.15);
    }
    .main-nav a { padding: 12px 14px; }
    .nav-user-mobile {
        display: flex;
        flex-direction: column;
        border-top: 1px solid rgba(255,255,255,0.15);
        margin-top: 6px;
        padding-top: 6px;
    }
    .nav-user-mobile a { color: rgba(255,255,255,0.78); padding: 12px 14px; border-radius: 8px; display: flex; align-items: center; gap: 6px; }
    .nav-user-mobile a:hover { background: rgba(255,255,255,0.1); color: #fff; }
    .topbar-user { display: none; }
    .topbar-inner > .lang-menu { display: none; }
    .lang-menu-mobile {
        display: block;
        border-top: 1px solid rgba(255,255,255,0.15);
        margin-top: 6px;
        padding-top: 6px;
    }
    .lang-menu-mobile summary { color: rgba(255,255,255,0.78); padding: 12px 14px; border-radius: 8px; }
    .lang-menu-mobile summary:hover { background: rgba(255,255,255,0.1); color: #fff; }
    .lang-menu-mobile .lang-menu-list {
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 2px 0 0 14px;
    }
    .lang-menu-mobile .lang-menu-option { color: rgba(255,255,255,0.78); }
    .lang-menu-mobile .lang-menu-option:hover { background: rgba(255,255,255,0.1); color: #fff; }
    .lang-menu-mobile .lang-menu-option.active { color: #fff; }
    .nav-toggle-checkbox:checked ~ .topbar .main-nav {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 560px) {
    .page-content { padding: 22px 16px 48px; }
    .card { padding: 18px; }
    h1 { font-size: 1.5rem; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header > div { display: flex; flex-direction: column; gap: 8px; }
    .page-header .btn { justify-content: center; }
    .actions-row { flex-direction: column; }
    .actions-row form, .actions-row .btn { width: 100%; }
    .actions-row .btn { justify-content: center; }
}

/* Empêche le zoom automatique iOS sur les champs (nécessite 16px minimum) */
@media (max-width: 900px) {
    input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
    input[type="number"], textarea, select {
        font-size: 16px;
    }
}
