/* ==========================================================================
   Portolina — Feuille de style globale
   Design tropical lagon · clarté staff · accessibilité AA
   ========================================================================== */

:root {
    color-scheme: light;

    /* Palette */
    --ink: #0d272c;
    --text: #274148;
    --muted: #5e7a81;
    --muted-soft: #88a1a7;
    --line: #d6e8e6;
    --line-strong: #b6d4d0;
    --surface: #ffffff;
    --surface-soft: #f3fbf8;
    --surface-alt: #eaf6f1;
    --page: #ecf8f4;

    /* Accents */
    --lagoon: #0a9aa3;
    --lagoon-dark: #076f76;
    --leaf: #247b4b;
    --leaf-soft: #e4f5e9;
    --sand: #f7dfad;
    --coral: #e06e52;
    --accent: #078985;
    --accent-dark: #075f65;
    --accent-soft: #dff7f1;
    --gold: #bf8424;
    --gold-soft: #fff1cf;
    --danger: #b83f45;
    --danger-soft: #fde9ea;
    --success: #1c8a5a;
    --success-soft: #defaee;

    /* Typo + élévations */
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --shadow: 0 18px 46px rgba(13, 39, 44, .10);
    --shadow-soft: 0 8px 24px rgba(13, 39, 44, .07);
    --shadow-strong: 0 28px 64px rgba(13, 39, 44, .18);
    --ring: 0 0 0 4px rgba(8, 137, 133, .18);
    --ring-danger: 0 0 0 4px rgba(184, 63, 69, .22);

    /* Layout */
    --topbar-height: 72px;
    --max-width: 1280px;
    --easing: cubic-bezier(.2, .7, .2, 1);
}

/* ----- Reset léger ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 8%, rgba(10, 154, 163, .18), transparent 34vw),
        radial-gradient(circle at 92% 18%, rgba(247, 223, 173, .55), transparent 28vw),
        linear-gradient(180deg, rgba(236, 248, 244, .78), rgba(247, 252, 249, 1) 500px),
        var(--page);
    background-attachment: fixed;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .52;
    background-image:
        linear-gradient(115deg, transparent 0 47%, rgba(8, 137, 133, .06) 48% 52%, transparent 53% 100%),
        radial-gradient(circle at 40px 40px, rgba(255, 255, 255, .45) 0 1px, transparent 2px);
    background-size: 120px 120px, 34px 34px;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; display: block; }
main { min-height: 75vh; }

/* Focus accessible global */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Scrollbar discrète */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(8, 137, 133, .25);
    border: 3px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(8, 137, 133, .45); background-clip: padding-box; border: 3px solid transparent; }

::selection { background: rgba(8, 137, 133, .25); color: var(--ink); }

/* Sélecteur d'accessibilité */
.skip-link {
    position: absolute;
    top: -40px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 800;
    transition: top .2s var(--easing);
}
.skip-link:focus-visible { top: 12px; }

/* ----- Topbar / Navigation --------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    min-height: var(--topbar-height);
    padding: 12px clamp(18px, 4vw, 58px);
    background: rgba(255, 255, 255, .82);
    border-bottom: 1px solid rgba(207, 228, 226, .9);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset;
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    backdrop-filter: saturate(140%) blur(16px);
    transition: box-shadow .25s var(--easing), background .25s var(--easing);
}

.topbar.is-scrolled {
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 6px 24px rgba(13, 39, 44, .08);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -.01em;
    transition: opacity .18s var(--easing);
}
.brand:hover { opacity: .85; }


nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

nav a:not(.button) {
    position: relative;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    transition: background .18s var(--easing), color .18s var(--easing);
}

nav a:not(.button):hover {
    color: var(--accent-dark);
    background: var(--accent-soft);
}

nav a.is-active {
    color: var(--accent-dark);
    background: var(--accent-soft);
}

nav a.is-active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -3px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--lagoon), var(--gold));
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 4px 12px 4px 4px;
    margin-left: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, .9);
    color: var(--ink);
    font-weight: 700;
    transition: border-color .18s var(--easing), box-shadow .18s var(--easing);
}
.user-chip:hover { border-color: var(--line-strong); box-shadow: var(--shadow-soft); background: var(--surface); }
.user-chip img,
.user-chip .avatar-fallback {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    object-fit: cover;
    background: linear-gradient(145deg, var(--lagoon), var(--leaf));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    flex: none;
}
.user-chip .role-tag {
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.role-tag.lead { background: var(--gold-soft); color: var(--gold); }
.role-tag.manager { background: #e6e1fb; color: #5d4ab1; }
.role-tag.referent { background: var(--accent-soft); color: var(--accent-dark); }
.role-tag.colead { background: var(--leaf-soft); color: var(--leaf); }
.role-tag.citizen { background: var(--surface-alt); color: var(--muted); }

/* Menu burger (mobile) */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .9);
    color: var(--ink);
    transition: background .18s var(--easing), border-color .18s var(--easing);
}
.menu-toggle:hover { background: var(--surface); border-color: var(--line-strong); }
.menu-toggle svg { width: 22px; height: 22px; }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

/* ----- Hero ------------------------------------------------------------ */
.hero {
    min-height: calc(100vh - var(--topbar-height));
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
    align-items: end;
    gap: clamp(22px, 5vw, 72px);
    padding: clamp(46px, 8vw, 92px) clamp(20px, 6vw, 88px);
    overflow: hidden;
    color: white;
    background:
        linear-gradient(90deg, rgba(8, 28, 32, .86) 0%, rgba(8, 66, 70, .56) 48%, rgba(8, 66, 70, .1) 100%),
        linear-gradient(180deg, rgba(255, 210, 125, .18), rgba(8, 28, 32, .5)),
        url("https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&w=1900&q=88") center/cover;
    isolation: isolate;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: -1;
}
.hero::before {
    width: 42vw;
    height: 42vw;
    min-width: 360px;
    min-height: 360px;
    right: -12vw;
    top: -16vw;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 218, 143, .72), rgba(255, 218, 143, .18) 36%, transparent 66%);
    animation: floatHalo 14s ease-in-out infinite;
}
.hero::after {
    left: -8vw;
    right: -8vw;
    bottom: -1px;
    height: 120px;
    background:
        radial-gradient(70% 100% at 50% 100%, rgba(247, 223, 173, .95), rgba(247, 223, 173, .35) 56%, transparent 57%),
        linear-gradient(180deg, transparent, rgba(236, 248, 244, .96) 80%);
}

.hero-content { width: min(780px, 100%); padding-bottom: clamp(8px, 4vh, 36px); }
.hero h1 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(58px, 10vw, 118px);
    line-height: .92;
    letter-spacing: -.02em;
    text-wrap: balance;
}
.hero p:not(.eyebrow) {
    max-width: 690px;
    margin: 18px 0 0;
    color: rgba(255, 255, 255, .92);
    font-size: clamp(18px, 2vw, 22px);
    line-height: 1.58;
}
.hero .actions { margin-top: 28px; }
.hero .eyebrow { color: #ffd98f; }

.island-card {
    align-self: center;
    display: grid;
    gap: 14px;
    padding: 22px;
    color: white;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .1)),
        rgba(6, 70, 75, .34);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .22);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    animation: floatCard 7s ease-in-out infinite;
}

.island-card strong { color: #ffffff; font-size: 24px; }
.island-card p { margin: 0; color: rgba(255, 255, 255, .86); }

.sun-mark {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: radial-gradient(circle at 34% 32%, #fff7ce, #ffd77b 42%, #e6814b 100%);
    box-shadow: 0 0 50px rgba(255, 211, 113, .5);
}

.island-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.island-stats span {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .16);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.island-strip {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin: -34px clamp(18px, 5vw, 72px) 0;
    overflow: hidden;
    border: 1px solid rgba(207, 228, 226, .95);
    border-radius: var(--radius-md);
    background: var(--line);
    box-shadow: var(--shadow);
}
.island-strip > div {
    display: grid;
    gap: 4px;
    min-height: 118px;
    padding: 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(243, 251, 248, .92));
    transition: background .25s var(--easing), transform .25s var(--easing);
}
.island-strip > div:hover { background: #ffffff; transform: translateY(-2px); }
.island-strip strong { color: var(--ink); font-size: 19px; }
.island-strip span { color: var(--muted); line-height: 1.5; }

/* ----- Sections, titres, blocs ---------------------------------------- */
.eyebrow {
    margin: 0 0 12px;
    color: var(--gold);
    text-transform: uppercase;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: .12em;
}

.section { padding: clamp(42px, 6vw, 74px) clamp(18px, 5vw, 72px); }
.section.compact { max-width: var(--max-width); margin: 0 auto; }

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 24px;
}
.section-title > div { min-width: 0; }

h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; text-wrap: balance; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 58px); line-height: 1.02; }
h2 { margin: 0 0 18px; font-size: clamp(24px, 3vw, 32px); line-height: 1.14; }
h3 { margin: 0 0 12px; font-size: 21px; line-height: 1.2; }
p { line-height: 1.62; }
ol, ul { margin: 0; padding-left: 22px; }
li { margin: 9px 0; line-height: 1.55; }
hr { margin: 22px 0; border: none; height: 1px; background: var(--line); }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.panel {
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(250, 254, 252, .96));
    border: 1px solid rgba(207, 228, 226, .95);
    border-radius: var(--radius-md);
    padding: clamp(20px, 3vw, 28px);
    box-shadow: var(--shadow-soft);
    transition: border-color .2s var(--easing), box-shadow .2s var(--easing);
}
.panel:hover { border-color: var(--line-strong); }
.panel.narrow { max-width: 760px; margin: 64px auto; }

.tutorial-card { overflow: hidden; }
.tutorial-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, var(--lagoon), var(--sand), var(--coral));
}

.step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    color: var(--accent-dark);
    background: var(--accent-soft);
    border: 1px solid rgba(8, 137, 133, .16);
    font-weight: 950;
}

.lagoon-section {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(280px, 1.1fr);
    gap: 24px;
    align-items: stretch;
    color: white;
    background:
        linear-gradient(135deg, rgba(7, 95, 101, .95), rgba(10, 154, 163, .78)),
        url("https://images.unsplash.com/photo-1540202404-a2f29016b523?auto=format&fit=crop&w=1600&q=85") center/cover;
}
.lagoon-copy { max-width: 620px; }
.lagoon-copy h2 { color: #ffffff; }
.lagoon-copy p:not(.eyebrow) { color: rgba(255, 255, 255, .9); }

.lagoon-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lagoon-grid article {
    display: grid;
    align-content: end;
    min-height: 210px;
    padding: 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .08));
    border: 1px solid rgba(255, 255, 255, .26);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: transform .25s var(--easing), background .25s var(--easing);
}
.lagoon-grid article:hover { transform: translateY(-3px); background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .12)); }
.lagoon-grid strong { color: #fff5d8; font-size: 22px; }
.lagoon-grid span { color: rgba(255, 255, 255, .86); line-height: 1.45; }

/* ----- Boutons -------------------------------------------------------- */
.button {
    --btn-bg: linear-gradient(180deg, #12a9a1, var(--accent-dark));
    --btn-shadow: 0 10px 22px rgba(8, 124, 120, .22);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--btn-bg);
    color: white;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--btn-shadow);
    transition: transform .16s var(--easing), box-shadow .16s var(--easing), background .16s var(--easing), opacity .16s var(--easing);
    user-select: none;
}
.button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(8, 124, 120, .28); }
.button:active { transform: translateY(0); box-shadow: 0 6px 14px rgba(8, 124, 120, .25); }
.button:focus-visible { box-shadow: var(--btn-shadow), var(--ring); }
.button[disabled], .button.is-loading { opacity: .65; cursor: not-allowed; transform: none !important; }

.button.muted {
    --btn-bg: rgba(255, 255, 255, .94);
    --btn-shadow: var(--shadow-soft);
    border-color: rgba(207, 228, 226, .92);
    color: var(--ink);
}
.button.muted:hover { background: var(--surface-soft); }

.button.ghost {
    --btn-bg: transparent;
    --btn-shadow: none;
    border-color: var(--line);
    color: var(--ink);
}
.button.ghost:hover { background: var(--accent-soft); border-color: var(--line-strong); color: var(--accent-dark); }

.button.small { min-height: 34px; padding: 0 12px; font-size: 13px; box-shadow: none; }
.button.small:hover { box-shadow: var(--shadow-soft); }

.button.danger {
    --btn-bg: linear-gradient(180deg, #c94a51, var(--danger));
    --btn-shadow: 0 10px 22px rgba(184, 63, 69, .22);
}
.button.danger:focus-visible { box-shadow: var(--btn-shadow), var(--ring-danger); }

.button.success {
    --btn-bg: linear-gradient(180deg, #28a974, var(--success));
    --btn-shadow: 0 10px 22px rgba(28, 138, 90, .22);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ----- Quick-nav (sous-navigation contextuelle) ----------------------- */
.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 18px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .8);
    box-shadow: var(--shadow-soft);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.quick-nav a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 800;
    font-size: 13.5px;
    transition: background .18s var(--easing), color .18s var(--easing);
}
.quick-nav a:hover { color: var(--accent-dark); background: var(--accent-soft); }
.quick-nav a.active,
.quick-nav a.is-active {
    color: white;
    background: linear-gradient(180deg, #12a9a1, var(--accent-dark));
    box-shadow: 0 6px 14px rgba(8, 124, 120, .25);
}

/* ----- Stats & cartes ------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}

.stat-card {
    position: relative;
    display: grid;
    gap: 4px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(243, 251, 248, .95));
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: transform .2s var(--easing), border-color .2s var(--easing);
}
.stat-card::before {
    content: "";
    position: absolute;
    inset: auto auto 0 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--lagoon), var(--gold));
    transform: scaleX(.4);
    transform-origin: 0 0;
    transition: transform .35s var(--easing);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.stat-card:hover::before { transform: scaleX(1); }

.stat-card span,
.muted-text { color: var(--muted); font-size: 13px; }

.stat-card strong { color: var(--ink); font-size: 28px; line-height: 1.05; font-weight: 900; }

.help-box {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--accent-dark);
    background: var(--accent-soft);
}

/* ----- Cartes entreprises -------------------------------------------- */
.companies {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.company {
    position: relative;
    display: grid;
    align-content: space-between;
    gap: 14px;
    min-height: 220px;
    padding: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(244, 252, 248, .98));
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    transition: transform .22s var(--easing), border-color .22s var(--easing), box-shadow .22s var(--easing);
}

.company::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, transparent, rgba(8, 137, 133, .35), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity .25s var(--easing);
    pointer-events: none;
}

.company::after {
    content: "";
    position: absolute;
    inset: auto 18px 18px auto;
    width: 42px;
    height: 2px;
    background: linear-gradient(90deg, var(--lagoon), var(--gold));
}

.company:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
}
.company:hover::before { opacity: 1; }

.company img {
    width: 78px;
    height: 78px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    padding: 8px;
}

.company strong { color: var(--ink); font-size: 18px; }
.company span, .empty, .note, .answer p { color: var(--muted); }

.empty {
    margin: 0;
    padding: 22px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .72);
    text-align: center;
}

/* ----- Formulaires ---------------------------------------------------- */
.form { display: grid; gap: 16px; }
.form h2, .panel h2 { padding-bottom: 12px; border-bottom: 1px solid var(--line); }

label {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-weight: 700;
}
label > span:first-child {
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}
label .hint {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

input, textarea, select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    color: var(--ink);
    background: #fbfdfd;
    outline: none;
    transition: border-color .16s var(--easing), box-shadow .16s var(--easing), background .16s var(--easing);
}
input::placeholder, textarea::placeholder { color: var(--muted-soft); }

textarea { min-height: 132px; resize: vertical; line-height: 1.55; }

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

input:hover:not(:disabled),
textarea:hover:not(:disabled),
select:hover:not(:disabled) { border-color: var(--line-strong); }

input:focus, textarea:focus, select:focus {
    background: #ffffff;
    border-color: rgba(8, 137, 133, .55);
    box-shadow: var(--ring);
}

input:disabled, textarea:disabled, select:disabled {
    color: #718087;
    background: #eef3f4;
    cursor: not-allowed;
}

input[aria-invalid="true"], textarea[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: var(--ring-danger);
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    cursor: pointer;
    user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ----- Flash messages ------------------------------------------------- */
.flash {
    position: relative;
    margin: 18px auto 0;
    max-width: 920px;
    padding: 14px 44px 14px 18px;
    border-radius: var(--radius-md);
    color: #6d4a0b;
    background: var(--gold-soft);
    border: 1px solid #e7c77e;
    box-shadow: var(--shadow-soft);
    animation: slideDown .35s var(--easing);
}
.flash.success { color: #0a5a3b; background: var(--success-soft); border-color: #b8e6cd; }
.flash.danger { color: #7a232a; background: var(--danger-soft); border-color: #f0c4c8; }
.flash .close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    opacity: .7;
    transition: opacity .16s var(--easing), background .16s var(--easing);
}
.flash .close:hover { opacity: 1; background: rgba(0, 0, 0, .06); }

/* ----- Badges & pills ------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 28px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-dark);
    border: 1px solid rgba(8, 137, 133, .18);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.badge.submitted { background: var(--gold-soft); color: var(--gold); border-color: #e7c77e; }
.badge.waitlist { background: #e6e1fb; color: #5d4ab1; border-color: #c8c0eb; }
.badge.accepted { background: var(--success-soft); color: var(--success); border-color: #b8e6cd; }
.badge.refused { background: var(--danger-soft); color: var(--danger); border-color: #f0c4c8; }
.badge.draft { background: var(--surface-alt); color: var(--muted); border-color: var(--line); }

/* ----- Tableaux ------------------------------------------------------ */
/* ----- Tableaux ------------------------------------------------------ */

.table { 
    width: 100%;
    overflow-x: auto; /* Permet le scroll horizontal sur mobile */
    padding: 0;
    border: 1px solid var(--line); /* Optionnel : pour bien délimiter le bloc */
    border-radius: 8px; /* Optionnel : pour adoucir les angles */
}

.table h2 { 
    padding: 24px 24px 16px; 
    margin: 0;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 720px; /* Force le scroll en dessous de cette largeur */
}

th, td { 
    padding: 15px 16px; 
    border-bottom: 1px solid var(--line); 
    text-align: left; 
    vertical-align: middle; 
}

th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 11.5px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    position: sticky;
    top: 0; /* Ajusté : souvent 0 à l'intérieur du conteneur overflow */
    z-index: 1;
    white-space: nowrap; /* Évite que les titres ne passent sur deux lignes */
}

tbody tr { 
    transition: background .14s var(--easing); 
}

/* Utilisation d'une couleur plus générique ou variable pour le hover */
tbody tr:hover { 
    background: rgba(0, 0, 0, 0.02); /* Ou garde ton #f4fbf7 si c'est ta charte */
}

tbody tr:last-child td { 
    border-bottom: none; 
}

td code { 
    font-size: 12.5px; 
    padding: 2px 6px;
    background: var(--surface-soft);
    border-radius: 4px;
}

.toolbar.panel {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap; /* Permet de passer à la ligne sur mobile */
}
.toolbar > form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0;
}
.toolbar > form + form {
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}
.toolbar > p,
.toolbar > .toolbar-info {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
}

.filters {
    display: flex !important;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    width: 100%;
}
.filters > input,
.filters > select {
    flex: 1 1 180px;
    min-width: 0;
    max-width: 320px;
}
.filters > input[name="q"],
.filters > input[type="search"],
.filters > .live-filter { flex: 2 1 240px; max-width: none; }
.filters > input[type="week"],
.filters > input[type="date"],
.filters > input[type="time"] { flex: 0 1 180px; max-width: 220px; }
.filters > button { flex: 0 0 auto; }

.live-filter {
    flex: 1 1 280px;
    max-width: 100%;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0;
}
.inline-form input,
.inline-form select,
.inline-form textarea { min-height: 36px; padding: 6px 10px; font-size: 13.5px; flex: 1 1 140px; min-width: 0; }
.inline-form .button { min-height: 36px; padding: 0 12px; font-size: 13px; flex: 0 0 auto; }

.stats-row { display: flex; flex-wrap: wrap; gap: 8px; }

.vote-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}
.vote-pill.accept { color: #086049; background: #e2f6ec; border: 1px solid #bfe8d4; }
.vote-pill.refuse { color: #8f2930; background: var(--danger-soft); border: 1px solid #f0c4c8; }

.inline-admin {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    padding: 14px;
    margin: 0;
}
.inline-admin > input,
.inline-admin > select,
.inline-admin > textarea {
    flex: 1 1 160px;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13.5px;
}
.inline-admin > input[type="number"] { flex: 0 1 100px; max-width: 110px; }
.inline-admin > input[type="date"],
.inline-admin > input[type="time"] { flex: 0 1 150px; max-width: 170px; }
.inline-admin > textarea { min-height: 38px; resize: vertical; }
.inline-admin > .check {
    flex: 0 0 auto;
    padding: 0 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    min-height: 38px;
    font-size: 12.5px;
}
.inline-admin > .button { flex: 0 0 auto; min-width: 110px; }
.inline-admin > .badge { flex: 0 0 auto; }

.admin-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 10px;
    align-items: stretch;
}
.admin-item > form:first-child { min-width: 0; }
.admin-item > form:last-child { display: flex; align-items: stretch; }
.admin-item > form:last-child .button { height: 100%; }

@media (max-width: 920px) {
    .admin-item { grid-template-columns: 1fr; }
    .admin-item > form:last-child .button { height: auto; }
}

.answer { border-bottom: 1px solid var(--line); padding: 14px 0; }
.answer:first-of-type { padding-top: 0; }
.answer:last-of-type { border-bottom: none; }
.answer strong { display: block; color: var(--ink); margin-bottom: 5px; }
.answer p { margin: 0; }

.note {
    margin: 12px 0 0;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    border: 1px solid var(--line);
}
.note strong { color: var(--ink); }

/* ----- Footer --------------------------------------------------------- */
.footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding: 32px clamp(18px, 4vw, 56px);
    color: var(--muted);
    background: linear-gradient(90deg, rgba(255, 255, 255, .96), rgba(243, 251, 248, .96));
    border-top: 1px solid var(--line);
    font-size: 13.5px;
}
.footer a:hover { color: var(--accent-dark); }
.footer .footer-links { display: flex; flex-wrap: wrap; gap: 18px; }

/* ----- Code et utilitaires ------------------------------------------- */
code, pre {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    background: #eef8f6;
    border: 1px solid #d4ebe7;
    border-radius: var(--radius-xs);
}
code { padding: 2px 6px; color: var(--accent-dark); font-size: .92em; }
pre { padding: 14px; overflow: auto; }

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    cursor: pointer;
    transition: color .15s var(--easing), border-color .15s var(--easing), background .15s var(--easing);
}
.copy-btn:hover { color: var(--accent-dark); background: var(--accent-soft); border-color: var(--line-strong); }
.copy-btn.is-copied { color: var(--success); background: var(--success-soft); border-color: #b8e6cd; }

/* Reveal (intersection observer) */
.reveal-item {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .55s var(--easing), transform .55s var(--easing);
    will-change: opacity, transform;
}
.reveal-item.is-visible { opacity: 1; transform: translateY(0); }

/* Spinner mini */
.spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: spin .8s linear infinite;
}

/* ----- Animations ----------------------------------------------------- */
@keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes floatHalo {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-2vw, 1.5vw); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ----- Responsive ----------------------------------------------------- */
@media (max-width: 920px) {
    .menu-toggle { display: inline-flex; }
    .topbar {
        flex-wrap: wrap;
        align-items: center;
    }
    nav {
        order: 3;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding-top: 8px;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height .35s var(--easing), opacity .25s var(--easing), padding .25s var(--easing);
    }
    nav a:not(.button) { width: 100%; min-height: 44px; }
    nav .button { width: 100%; }
    .topbar.is-open nav {
        max-height: 520px;
        opacity: 1;
        padding-top: 12px;
        border-top: 1px solid var(--line);
        margin-top: 8px;
    }
    .user-chip { width: 100%; justify-content: flex-start; margin-left: 0; }

    .grid.two,
    .grid.three,
    .hero,
    .lagoon-section,
    .lagoon-grid,
    .island-strip { grid-template-columns: 1fr; }
    .island-strip { margin-top: 0; }
    .inline-admin { grid-template-columns: 1fr 1fr; }
    .filters { grid-template-columns: 1fr; }
    th { position: static; }
}

@media (max-width: 640px) {
    .hero {
        min-height: 72vh;
        padding-top: 56px;
        grid-template-columns: 1fr;
    }
    .hero h1 { font-size: clamp(48px, 18vw, 76px); }
    .section-title, .footer { align-items: flex-start; flex-direction: column; }
    .section { padding-left: 16px; padding-right: 16px; }
    .panel { padding: 18px; }
    .island-card { display: none; }
    .button { width: 100%; }
    nav .button { width: 100%; }
    .actions { width: 100%; }
    .actions .button { flex: 1 1 210px; }
    .inline-admin { grid-template-columns: 1fr; }
    .quick-nav { overflow-x: auto; flex-wrap: nowrap; }
    .quick-nav a { white-space: nowrap; }
}

/* ----- Print ---------------------------------------------------------- */
@media print {
    body { background: #fff; }
    .topbar, .footer, .button, .menu-toggle, .quick-nav, .toolbar { display: none !important; }
    .panel { box-shadow: none; border-color: #ccc; }
}
