/*
 * Feuille de style unique de l'application (docs/design/DESIGN-HANDOFF.md).
 * Aucun style inline dans les templates (CSP `style-src 'self'`) : tout passe
 * par des classes définies ici. Polices auto-hébergées (assets/fonts/),
 * jamais chargées depuis un CDN.
 */

@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/fraunces-latin-500-normal-6BGZRP0.woff2") format('woff2');
}

@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/fraunces-latin-600-normal-AQmZ6pP.woff2") format('woff2');
}

@font-face {
    font-family: 'Public Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/public-sans-latin-400-normal-FdCi-lj.woff2") format('woff2');
}

@font-face {
    font-family: 'Public Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/public-sans-latin-500-normal-78ZO697.woff2") format('woff2');
}

@font-face {
    font-family: 'Public Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/public-sans-latin-600-normal-iY8tfZ6.woff2") format('woff2');
}

@font-face {
    font-family: 'Public Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/public-sans-latin-700-normal-UeV5zpK.woff2") format('woff2');
}

/* ---------------------------------------------------------------- Tokens */

:root {
    color-scheme: light;

    --bg: #F4F1EA;
    --bg-sunken: #EAE5DA;
    --surface: #FFFFFF;
    --surface-muted: #FAF8F3;
    --border: #E2DDD2;
    --border-soft: #ECE7DD;
    --border-control: #CFC8BA;
    --ink: #1C2629;
    --ink-soft: #3E484B;
    --muted: #5B6568;
    --primary: #1E5F5B;
    --primary-hover: #174B48;
    --primary-ink: #16403D;
    --primary-soft: #E3EFEC;
    --primary-soft-border: #BFD8D3;
    --primary-tint: #F4F9F8;
    --info-soft: #E6EEED;
    --sidebar: #17302E;
    --sidebar-raised: #1F3B38;
    --sidebar-hover: #21403D;
    --sidebar-active: #2A5652;
    --sidebar-border: #2C4845;
    --sidebar-ink: #C9D6D3;
    --sidebar-muted: #9FB3AF;
    --sidebar-soft: #B9CBC7;
    --sidebar-light: #D3E6E2;
    --accent: #E9B872;
    --warn-bg: #FBEFD9;
    --warn: #8A5210;
    --ok-bg: #E3F0E5;
    --ok: #285F33;
    --danger: #A3342B;
    --danger-ink: #8A2A22;
    --danger-bg: #FBEDEB;
    --danger-border: #E3BDB8;
    --ref-bg: #F1ECE2;
    --ref-ink: #5B5140;
    --hatch-a: #F1ECE2;
    --hatch-b: #EAE3D6;
    --hatch-ink: #4F585B;
    --hatch-border: #A99E88;
    --leave-bg: #E6EEFB;
    --leave-ink: #23497F;
    --absence-bg: #FBEDEB;
    --absence-ink: #8A2A22;
    --focus: #C27A2C;

    --radius-card: 14px;
    --radius-control: 10px;
    --font-sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --sidebar-width: 248px;
    --tabbar-height: 80px;
}

/* ------------------------------------------------------------------ Base */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary);
}

a:hover {
    color: var(--primary-hover);
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.2;
}

h2 {
    font-size: 17px;
}

h3 {
    font-size: 15px;
}

p {
    margin: 0;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95em;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--ref-bg);
    word-break: break-all;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

/*
 * !important : un utilitaire de masquage doit l'emporter sur les règles de
 * composant (ex. boutons pleine largeur sur mobile), sinon l'élément caché
 * garde sa largeur et provoque un défilement horizontal.
 */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.icon--sm {
    width: 18px;
    height: 18px;
}

.icon--lg {
    width: 30px;
    height: 30px;
}

.serif {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.num {
    font-variant-numeric: tabular-nums;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stack--sm {
    gap: 8px;
}

.stack--lg {
    gap: 24px;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

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

.row--end {
    justify-content: flex-end;
}

.row--baseline {
    align-items: baseline;
}

.grow {
    flex-grow: 1;
    min-width: 0;
}

/* ------------------------------------------------------------- Coquille */

.app {
    min-height: 100vh;
}

.sidebar {
    display: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 12px 0 16px;
    background: var(--sidebar);
    color: #FFFFFF;
}

.topbar__household {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    min-width: 0;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
}

.topbar__household:hover {
    color: #FFFFFF;
}

.topbar__household span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar__account {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-active);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    text-transform: uppercase;
}

.topbar__account:hover {
    color: #FFFFFF;
    background: var(--sidebar-hover);
}

.logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--sidebar);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo--sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.logo--lg {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--sidebar);
    color: var(--accent);
}

.main {
    padding: 20px 16px calc(var(--tabbar-height) + 32px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.main--with-action-bar {
    padding-bottom: calc(var(--tabbar-height) + 104px);
}

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: var(--tabbar-height);
    padding: 4px 4px 16px;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.tabbar a {
    flex: 1;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
}

.tabbar a:hover {
    color: var(--ink);
}

.tabbar a[aria-current="page"] {
    color: var(--primary);
}

.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--tabbar-height);
    z-index: 15;
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.action-bar > * {
    flex-grow: 1;
    min-width: 0;
}

/* Sur téléphone (ou avec une taille de texte système agrandie), un libellé
   long passe à la ligne au lieu de pousser la barre hors de l'écran. */
.action-bar .btn {
    white-space: normal;
    text-align: center;
}

.action-bar > .btn--icon-label {
    flex-grow: 0;
}

.action-bar form {
    display: flex;
}

.action-bar form .btn {
    width: 100%;
}

@media (min-width: 1024px) {
    .app {
        display: grid;
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }

    .topbar, .tabbar {
        display: none;
    }

    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 28px;
        padding: 24px 16px;
        background: var(--sidebar);
        color: #FFFFFF;
    }

    .sidebar__brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0 8px;
        color: #FFFFFF;
        text-decoration: none;
        font-family: var(--font-serif);
        font-weight: 600;
        font-size: 21px;
    }

    .sidebar__brand:hover {
        color: #FFFFFF;
    }

    .sidebar__label {
        display: block;
        padding: 0 8px;
        margin-bottom: 6px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--sidebar-muted);
    }

    .sidebar__household {
        width: 100%;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 0 12px;
        border-radius: var(--radius-control);
        border: 1px solid #33524F;
        background: var(--sidebar-raised);
        color: #FFFFFF;
        font-weight: 600;
        text-decoration: none;
    }

    .sidebar__household:hover {
        color: #FFFFFF;
        background: var(--sidebar-hover);
    }

    .sidebar__nav {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .sidebar a.sidebar__link {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 44px;
        padding: 0 12px;
        border-radius: var(--radius-control);
        color: var(--sidebar-ink);
        text-decoration: none;
        font-weight: 500;
    }

    .sidebar a.sidebar__link:hover {
        background: var(--sidebar-hover);
        color: #FFFFFF;
    }

    .sidebar a.sidebar__link[aria-current="page"] {
        background: var(--sidebar-active);
        color: #FFFFFF;
        font-weight: 600;
    }

    .sidebar__account {
        margin-top: auto;
        padding: 16px 8px 0;
        border-top: 1px solid var(--sidebar-border);
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .sidebar__email {
        font-size: 14px;
        font-weight: 600;
        overflow-wrap: anywhere;
    }

    .sidebar__role {
        font-size: 13px;
        color: var(--sidebar-muted);
    }

    .sidebar a.sidebar__logout {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 40px;
        margin-top: 4px;
        color: var(--sidebar-ink);
        text-decoration: none;
        font-weight: 500;
    }

    .sidebar a.sidebar__logout:hover {
        color: #FFFFFF;
    }

    .main {
        padding: 36px 40px 48px;
        gap: 24px;
    }

    .main--with-action-bar {
        padding-bottom: 48px;
    }

    .action-bar {
        position: static;
        padding: 0;
        background: transparent;
        border: 0;
        justify-content: flex-end;
    }

    .action-bar > * {
        flex-grow: 0;
    }

    .hide-desktop {
        display: none !important;
    }
}

@media (max-width: 1023.98px) {
    .hide-mobile {
        display: none !important;
    }
}

/* ------------------------------------------------------- En-tête de page */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
}

.page-title {
    margin-top: 4px;
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: -0.01em;
    font-size: 28px;
    line-height: 1.1;
}

.page-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 4px;
}

.page-title-row .page-title {
    margin-top: 0;
}

.page-lead {
    margin-top: 8px;
    font-size: 15px;
    color: var(--muted);
}

/*
 * Liens vers les pages liées (en-tête de page), à la place de liens soulignés
 * séparés par « · », illisibles sur mobile. Mobile : liste groupée dans une
 * carte (rangées pleine largeur, chevron). Desktop : pastilles en ligne.
 */
.quick-links {
    display: flex;
    flex-direction: column;
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    overflow: hidden;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0 12px 0 14px;
    border-top: 1px solid var(--border-soft);
    color: var(--ink);
    font: 600 15px var(--font-sans);
    text-decoration: none;
}

.quick-link:first-child {
    border-top: 0;
}

.quick-link__label {
    flex: 1;
    min-width: 0;
}

.quick-link .icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.quick-link .quick-link__chevron {
    color: #9AA3A5;
}

.quick-link:hover {
    background: var(--surface-muted);
    color: var(--ink);
}

.quick-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

@media (max-width: 1023.98px) {
    /* La carte prend toute la largeur, même à côté du bouton d'action. */
    .page-header > div:has(> .quick-links) {
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .quick-links {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 12px;
        border: 0;
        border-radius: 0;
        background: none;
        overflow: visible;
    }

    .quick-link {
        gap: 8px;
        min-height: 40px;
        padding: 0 16px 0 12px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--surface);
        color: var(--primary-ink);
    }

    .quick-link:first-child {
        border-top: 1px solid var(--border);
    }

    .quick-link .icon {
        width: 18px;
        height: 18px;
    }

    .quick-link .quick-link__chevron {
        display: none;
    }

    .quick-link:hover {
        background: var(--primary-soft);
        border-color: var(--primary-soft);
        color: var(--primary-ink);
    }

    .quick-link:focus-visible {
        outline-offset: 2px;
    }
}

.page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

/* Sélecteur mois/année du titre (month_picker_controller.js). */
.month-picker {
    position: relative;
}

.month-picker__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 -6px;
    padding: 2px 6px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-align: left;
    cursor: pointer;
}

.month-picker__trigger:hover {
    background: var(--bg-sunken);
}

.month-picker__trigger:disabled {
    cursor: default;
    background: none;
}

.month-picker__trigger:disabled .month-picker__caret {
    display: none;
}

.month-picker__caret {
    width: 0.6em;
    height: 0.6em;
    color: var(--muted);
    transition: transform 0.15s;
}

.month-picker__trigger[aria-expanded="true"] .month-picker__caret {
    transform: rotate(180deg);
}

.month-picker__panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    width: min(320px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(28, 38, 41, 0.16);
    font-family: var(--font-sans);
}

.month-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.month-picker__step {
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-color: transparent;
    border-radius: var(--radius-control);
}

.month-picker__heading {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: var(--ink);
    font: 600 16px var(--font-sans);
}

button.month-picker__heading {
    cursor: pointer;
}

button.month-picker__heading:hover {
    background: var(--bg-sunken);
}

.month-picker__heading .icon {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

.month-picker__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.month-picker__cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: none;
    color: var(--ink);
    font: 500 15px var(--font-sans);
    text-decoration: none;
    cursor: pointer;
}

.month-picker__cell:hover {
    background: var(--primary-tint);
    border-color: var(--primary-soft-border);
    color: var(--ink);
}

.month-picker__cell.is-current {
    border-color: var(--primary-soft-border);
    color: var(--primary-ink);
    font-weight: 700;
}

.month-picker__cell.is-selected,
.month-picker__cell.is-selected:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}

/* Point discret : mois (ou année) avec un bulletin déjà calculé. */
.month-picker__cell.is-marked::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 5px;
    height: 5px;
    margin-left: -2.5px;
    border-radius: 50%;
    background: var(--primary);
}

.month-picker__cell.is-selected.is-marked::after {
    background: #FFFFFF;
}

.month-picker__legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
}

.month-picker__legend::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.month-nav__title {
    text-align: center;
}

@media (min-width: 1024px) {
    .page-title {
        font-size: 38px;
        margin-top: 6px;
    }

    .breadcrumb {
        min-height: 0;
        font-size: 14px;
        font-weight: 400;
    }
}

/* ---------------------------------------------------------------- Cartes */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 18px;
}

.card__title {
    font-size: 17px;
    margin-bottom: 12px;
}

.card__title--serif {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 21px;
    letter-spacing: -0.01em;
}

.card__lead {
    margin: -6px 0 16px;
    font-size: 14px;
    color: var(--muted);
}

.card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card__head .card__title {
    margin-bottom: 0;
}

.card--danger {
    border-color: var(--danger-border);
}

.card--danger .card__title {
    color: var(--danger-ink);
    font-size: 16px;
}

.card--banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
}

.card--dark {
    background: var(--sidebar);
    border-color: var(--sidebar);
    color: #FFFFFF;
    border-radius: 18px;
}

.card--dark .card__title {
    font-size: 16px;
}

.card--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}

@media (min-width: 1024px) {
    .card {
        padding: 20px 24px;
    }

    .card--dark {
        border-radius: var(--radius-card);
        padding: 22px;
    }
}

.layout-split, .layout-split--wide, .layout-split--even {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

@media (min-width: 1024px) {
    .layout-split {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    }

    .layout-split--wide {
        grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
        gap: 20px;
    }

    .layout-split--even {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
        gap: 32px;
    }
}

/* -------------------------------------------------------------- Boutons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: var(--radius-control);
    border: 1px solid var(--border-control);
    background: var(--surface);
    color: var(--ink);
    font: 600 16px var(--font-sans);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover {
    background: #EFEBE2;
    color: var(--ink);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}

.btn--primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #FFFFFF;
}

.btn--light {
    background: #FFFFFF;
    border-color: #FFFFFF;
    color: var(--sidebar);
}

.btn--light:hover {
    background: var(--primary-soft);
    color: var(--sidebar);
}

.btn--danger {
    color: var(--danger);
    border-color: var(--danger-border);
}

.btn--danger:hover {
    background: var(--danger-bg);
    color: var(--danger-ink);
}

.btn--sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

.btn--icon {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
}

.btn--block {
    width: 100%;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font: 600 14px var(--font-sans);
    cursor: pointer;
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

@media (min-width: 1024px) {
    .btn {
        min-height: 44px;
        font-size: 15px;
    }

    .btn--sm {
        min-height: 36px;
        font-size: 14px;
    }

    .btn--icon {
        border-radius: var(--radius-control);
    }
}

/*
 * Mobile : tout bouton occupe la largeur disponible (cible tactile large,
 * colonne d'actions alignée). Exceptions : boutons ronds à icône seule et
 * boutons icône + libellé court de la barre d'action. Le conteneur flex ou
 * le formulaire qui porte le bouton doit lui aussi prendre toute la ligne,
 * sinon le bouton ne fait que 100 % d'un parent réduit à son contenu.
 */
@media (max-width: 1023.98px) {
    .btn:not(.btn--icon, .btn--icon-label) {
        width: 100%;
    }

    .page-header__actions,
    .row:has(> .btn:not(.btn--icon, .btn--icon-label)),
    form:has(> .btn:not(.btn--icon, .btn--icon-label)) {
        width: 100%;
    }

    :is(.row, .page-header__actions, .timeline__actions) > :is(.btn:not(.btn--icon, .btn--icon-label), form:has(> .btn)) {
        flex: 1 1 100%;
    }

    /* Checklist : le bouton passe sous le texte, aligné avec lui. */
    .alert-item:has(> form) {
        flex-wrap: wrap;
    }

    .alert-item:has(> form) > div {
        flex: 1 1 0;
        min-width: 0;
    }

    .alert-item > form {
        flex: 1 1 100%;
        padding-left: 44px;
    }

    /* Membres : la liste des rôles s'aligne sur la largeur du bouton. */
    .member__actions form > .input {
        flex: 1 1 100%;
    }
}

/* ------------------------------------------------------------- Badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    background: var(--info-soft);
    color: var(--primary);
}

.badge--draft, .badge--wait {
    background: var(--warn-bg);
    color: var(--warn);
}

.badge--ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.badge--muted {
    background: var(--ref-bg);
    color: var(--ref-ink);
}

/* ------------------------------------------------------- Formulaires */

.label {
    display: block;
    margin-bottom: 6px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}

.input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border-control);
    border-radius: var(--radius-control);
    background: var(--surface);
    font: 400 16px var(--font-sans);
    color: var(--ink);
}

.input:disabled {
    background: var(--surface-muted);
    color: var(--muted);
}

.input--sm {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 14px;
    width: auto;
    max-width: 100%;
}

.input--code {
    min-height: 64px;
    padding: 0 18px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.4em;
    font-variant-numeric: tabular-nums;
}

.input--code.is-backup {
    letter-spacing: 0.12em;
    font-size: 22px;
}

.input-group {
    position: relative;
}

.input-group .input {
    padding-right: 96px;
}

.input-group__action {
    position: absolute;
    right: 4px;
    top: 2px;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: 600 14px var(--font-sans);
    cursor: pointer;
}

/* Champ de durée heures:minutes + sélecteur à roues (duration_input_controller.js). */
.duration-input {
    position: relative;
}

.duration-input.is-enhanced .duration-input__field {
    padding-right: 52px;
}

.duration-input__trigger {
    position: absolute;
    top: 2px;
    right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
}

.duration-input__trigger:hover,
.duration-input__trigger[aria-expanded="true"] {
    background: var(--primary-soft);
}

.duration-input__trigger .icon {
    width: 22px;
    height: 22px;
}

.duration-input__panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    left: 0;
}

.duration-picker {
    width: min(300px, calc(100vw - 32px));
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(28, 38, 41, 0.16);
    font-family: var(--font-sans);
    color: var(--ink);
}

.duration-picker__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.duration-picker__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.duration-picker__value {
    font: 600 24px var(--font-serif);
    font-variant-numeric: tabular-nums;
    color: var(--primary-ink);
}

.duration-picker__wheels {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

/* Bande de sélection au centre des deux roues. */
.duration-picker__wheels::before {
    content: "";
    position: absolute;
    inset: 88px 0 auto;
    height: 44px;
    border-radius: var(--radius-control);
    background: var(--primary-soft);
    pointer-events: none;
}

.duration-picker__column {
    position: relative;
}

.duration-picker__wheel {
    position: relative;
    height: 220px;
    margin: 0;
    padding: 88px 0;
    overflow-y: auto;
    list-style: none;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    overscroll-behavior: contain;
    border-radius: var(--radius-control);
    /* Fondu en haut et en bas : effet de roue. */
    mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}

.duration-picker__wheel::-webkit-scrollbar {
    display: none;
}

.duration-picker__wheel:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    mask-image: none;
}

.duration-picker__item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding-right: 28px;
    scroll-snap-align: center;
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.duration-picker__item[aria-selected="true"] {
    font-weight: 700;
    color: var(--primary-ink);
}

.duration-picker__unit {
    position: absolute;
    top: 88px;
    right: 14px;
    display: flex;
    align-items: center;
    height: 44px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-ink);
    pointer-events: none;
}

.duration-picker__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.duration-picker__actions .btn {
    flex: 1;
}

/* Mobile : feuille en bas de l'écran, au-dessus de la barre d'onglets. */
@media (max-width: 1023.98px) {
    .duration-input__panel {
        position: fixed;
        z-index: 100;
        inset: 0;
        display: flex;
        align-items: flex-end;
        background: rgba(23, 48, 46, 0.4);
    }

    .duration-input__panel[hidden] {
        display: none;
    }

    .duration-picker {
        width: 100%;
        padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(28, 38, 41, 0.2);
    }

    .duration-picker__actions .btn {
        min-height: 52px;
    }
}

.field-help {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
}

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

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

@media (min-width: 720px) {
    .form-grid--cols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 20px;
    }
}

/* Valable à toute largeur : une grille --2 garde deux colonnes sur mobile. */
.form-grid__full {
    grid-column: 1 / -1;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 48px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--surface);
    font-size: 15px;
    cursor: pointer;
}

.choice input {
    accent-color: var(--primary);
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
}

.choice:has(input:checked) {
    border: 2px solid var(--primary);
    padding: 12px 13px;
    background: var(--primary-tint);
}

.choice:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
}

.choice__title {
    display: block;
    font-weight: 600;
}

.choice__help {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    position: relative;
    display: inline-flex;
}

.chip input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}

.chip span {
    min-width: 44px;
    min-height: 44px;
    padding: 0 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg);
    color: #6B6458;
    border: 1px solid var(--border);
}

.chip input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}

.chip input:focus-visible + span {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    padding-top: 10px;
    font-size: 15px;
    cursor: pointer;
}

.checkbox .field-help {
    display: block;
    margin-top: 2px;
}

.checkbox input {
    accent-color: var(--primary);
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
}

/* --------------------------------------------------- Messages / alertes */

.flash {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    border: 1px solid transparent;
}

.flash--error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-ink);
}

.flash--success {
    background: var(--ok-bg);
    color: var(--ok);
}

.flash--info {
    background: var(--bg-sunken);
    color: var(--ink-soft);
}

.flash--warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.alert-item {
    display: flex;
    gap: 12px;
}

.alert-item__icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--info-soft);
    color: var(--primary);
}

.alert-item__icon--ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.alert-item__icon--warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.alert-item__title {
    font-weight: 600;
    font-size: 15px;
}

.alert-item__text {
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--muted);
}

.checks {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.checks li {
    display: flex;
    gap: 10px;
}

.checks__ok {
    color: var(--ok);
}

.checks__warn {
    color: var(--warn);
}

.note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-sunken);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-soft);
}

.note .icon {
    color: var(--primary);
}

/* ----------------------------------------------------- Bilans annuels */

.review > .review__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    list-style: none;
    cursor: pointer;
}

.review > .review__summary::-webkit-details-marker {
    display: none;
}

.review > .review__summary::after {
    content: '';
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    margin-inline-start: 4px;
}

.review[open] > .review__summary::after {
    transform: rotate(-135deg);
}

.review__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.review__title small {
    display: block;
    margin-top: 2px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 400;
}

.review__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-inline-start: auto;
}

.review__body {
    margin-top: 16px;
}

.review .card .card__title {
    font-size: 16px;
}

.review .kpi__value {
    font-size: 22px;
}

/* ------------------------------------------------------ Chiffres (KPI) */

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

.kpi__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.kpi__value {
    margin-top: 8px;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 26px;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.kpi__hint {
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted);
}

.card--primary .kpi__label, .card--primary .kpi__hint {
    color: var(--sidebar-light);
}

@media (min-width: 1024px) {
    .kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }

    .kpis .card {
        padding: 20px;
    }

    .kpi__value {
        font-size: 32px;
    }
}

.hero__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--sidebar-soft);
}

.hero__amount {
    margin-top: 10px;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 44px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hero__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 14px;
    font-size: 14px;
    color: var(--sidebar-light);
    font-variant-numeric: tabular-nums;
}

.hero .btn {
    margin-top: 18px;
}

/* ------------------------------------------------- Tuiles de jours */

.day-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

.day-tile {
    border-radius: 12px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
    background: var(--surface-muted);
    color: var(--ink-soft);
    border: 1px solid var(--border-soft);
}

.day-tile__weekday {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.day-tile__num {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 24px;
    font-variant-numeric: tabular-nums;
}

.day-tile__label {
    font-size: 12px;
    font-weight: 600;
}

.day-tile--worked {
    background: var(--primary-soft);
    border-color: var(--primary-soft);
    color: var(--primary);
}

.day-tile--worked .day-tile__num {
    color: var(--primary-ink);
}

.day-tile--holiday {
    background: repeating-linear-gradient(135deg, var(--hatch-a) 0 8px, var(--hatch-b) 8px 16px);
    border-color: transparent;
    color: var(--hatch-ink);
}

.day-tile--leave {
    background: var(--leave-bg);
    border-color: var(--leave-bg);
    color: var(--leave-ink);
}

.day-tile--absence {
    background: var(--absence-bg);
    border-color: var(--danger-border);
    color: var(--absence-ink);
}

@media (min-width: 1024px) {
    .day-tiles {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .day-tile {
        padding: 14px;
        text-align: left;
    }

    .day-tile__num {
        font-size: 28px;
    }

    .day-tile__label {
        font-size: 13px;
    }
}

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

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    padding: 0 12px 10px 0;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.table td {
    padding: 14px 12px 14px 0;
    border-top: 1px solid var(--border-soft);
    vertical-align: middle;
}

/* En-tête de ligne (tableau à double entrée, ex. comparaison de versions). */
.table tbody th {
    padding: 14px 12px 14px 0;
    border-top: 1px solid var(--border-soft);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    vertical-align: middle;
}

/* Comparaison de versions : sur téléphone, chaque ligne s'empile (libellé
   puis les trois valeurs étiquetées) au lieu de défiler horizontalement. */
@media (max-width: 1023.98px) {
    .table--compare thead {
        display: none;
    }

    .table--compare tbody tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px 12px;
        padding: 12px 0;
        border-top: 1px solid var(--border-soft);
    }

    .table--compare tbody th {
        grid-column: 1 / -1;
        padding: 0;
        border-top: none;
    }

    .table--compare tbody td {
        padding: 0;
        border-top: none;
        text-align: left;
        white-space: normal;
    }

    .table--compare tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 12px;
        font-weight: 400;
        color: var(--muted);
    }

    .table--compare .table--compare__wide {
        grid-column: 1 / -1;
    }
}

.table td:last-child, .table th:last-child {
    padding-right: 0;
}

.table .is-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table .is-strong {
    font-weight: 600;
}

.table tfoot td, .table tfoot th {
    font-weight: 700;
    color: var(--ink);
}

.list-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    color: var(--ink);
    text-decoration: none;
    border-top: 1px solid var(--border-soft);
}

.list-links li:first-child a {
    border-top: 0;
}

.list-links a:hover {
    color: var(--ink);
    background: var(--surface-muted);
}

.list-links__title {
    font-weight: 600;
    font-size: 15px;
}

.list-links__meta {
    font-size: 13px;
    color: var(--muted);
}

.list-links .icon {
    color: #9AA3A5;
}

.list-rows > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 14px 0;
    border-top: 1px solid var(--border-soft);
}

.list-rows > li:first-child {
    border-top: 0;
    padding-top: 0;
}

.list-rows__amount {
    margin-left: auto;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------- Lignes de bulletin */

.calc-section {
    margin: 0;
    padding: 22px 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.payslip-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 16px;
    padding: 13px 0;
    border-top: 1px solid var(--border-soft);
}

.payslip-line__label {
    font-weight: 600;
    font-size: 15px;
}

.payslip-line__value {
    font-weight: 600;
    font-size: 15px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.payslip-line__value small {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.payslip-line__formula {
    grid-column: 1 / -1;
    font-size: 14px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.payslip-line__ref {
    grid-column: 1 / -1;
    justify-self: start;
}

.payslip-line.is-negative .payslip-line__value {
    color: var(--danger);
}

.payslip-line--total {
    margin: 8px -10px 0;
    padding: 12px 10px;
    border-top: 0;
    border-radius: var(--radius-control);
    background: var(--primary-soft);
}

.payslip-line--total + .flash {
    margin-top: 12px;
}

.payslip-line--total .payslip-line__label, .payslip-line--total .payslip-line__value {
    color: var(--primary-ink);
}

.payslip-line--total .payslip-line__value {
    font-family: var(--font-serif);
    font-size: 20px;
}

.payslip-line--total .payslip-line__value small {
    font-family: var(--font-sans);
    color: #2F5A56;
}

.ref {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    background: var(--ref-bg);
    color: var(--ref-ink);
    font-size: 12px;
    font-weight: 600;
}

@media (min-width: 1024px) {
    .payslip-line--total {
        margin: 8px -14px 0;
        padding: 13px 14px;
    }
}

/* ------------------------------------------- Valeurs à reporter (sombre) */

.report-values {
    margin: 12px 0 0;
}

.report-values__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--sidebar-border);
}

.report-values dt {
    font-size: 13px;
    color: var(--sidebar-soft);
}

.report-values dd {
    margin: 2px 0 0;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.report-values__note {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--sidebar-soft);
}

.copy-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid #33524F;
    background: transparent;
    color: var(--sidebar-light);
    cursor: pointer;
}

.copy-btn:hover {
    background: var(--sidebar-hover);
    color: #FFFFFF;
}

.copy-btn.is-copied {
    background: var(--sidebar-active);
    color: #FFFFFF;
}

.amount-rows > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.amount-rows > .amount-rows__total {
    align-items: baseline;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
}

.amount-rows__total span:first-child {
    font-weight: 700;
}

.amount-rows__total span:last-child {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 24px;
}

/* Sur mobile, les valeurs à reporter passent avant le calcul détaillé. */
.payslip-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.payslip-layout__aside {
    display: contents;
}

.payslip-layout__report {
    order: -2;
}

.payslip-layout__pay {
    order: -1;
}

@media (min-width: 1024px) {
    .payslip-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
        gap: 20px;
        align-items: start;
    }

    .payslip-layout__aside {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .payslip-layout__report, .payslip-layout__pay {
        order: 0;
    }
}

/* ------------------------------------------------ Calendrier de saisie */

.cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.cal__weekday {
    padding-bottom: 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.cal__weekday.is-contract {
    color: var(--primary);
}

.cal-cell {
    width: 100%;
    height: 72px;
    padding: 8px 6px 8px 8px;
    border-radius: var(--radius-control);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
    font-family: inherit;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    color: var(--ink);
}

.cal-cell__num {
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.cal-cell__sub {
    font-size: 11px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-cell--weekend {
    background: var(--surface-muted);
}

.cal-cell--blank {
    background: transparent;
    border: 1px dashed #DDD6C8;
}

.cal-cell--holiday {
    background: repeating-linear-gradient(135deg, var(--hatch-a) 0 8px, var(--hatch-b) 8px 16px);
    border-color: #E2DACB;
    color: var(--hatch-ink);
}

button.cal-cell {
    cursor: pointer;
}

button.cal-cell .cal-cell__num {
    font-size: 15px;
    font-weight: 700;
}

.cal-cell--planned {
    background: var(--primary-soft);
    border-color: var(--primary-soft-border);
    color: var(--primary-ink);
}

/* Jour prévu au planning pendant les vacances scolaires : liseré haut hachuré,
   qui reste visible quel que soit l'état choisi (fond). */
.cal-cell--school-holiday {
    box-shadow: inset 0 4px 0 var(--hatch-border);
}

.cal-cell--holiday.cal-cell--contract {
    border: 1px dashed var(--hatch-border);
}

.cal-cell--leave {
    background: var(--leave-bg);
    border-color: #C3D3EE;
    color: var(--leave-ink);
}

.cal-cell--absence {
    background: var(--absence-bg);
    border-color: var(--danger-border);
    color: var(--absence-ink);
}

.cal-cell.is-selected {
    box-shadow: 0 0 0 3px var(--primary);
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--ink-soft);
}

.legend li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend__swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
}

/* Pastille de légende dans une ligne de montants (bilan de l'année du tableau de bord). */
.amount-rows .legend__swatch {
    display: inline-block;
    margin-right: 6px;
    vertical-align: -2px;
}

/* Bilan de l'année du tableau de bord. */
.year-overview .card__head {
    margin-bottom: 0;
}

.year-overview .amount-rows > div {
    flex-wrap: wrap;
}

.year-overview .amount-rows > div > span:last-child {
    margin-left: auto;
    text-align: right;
}

@media (max-width: 1023px) {
    .year-overview .kpis > .card--primary,
    .year-overview .kpis > .card:last-child {
        grid-column: 1 / -1;
    }
}

.legend__swatch--planned {
    background: var(--primary-soft);
    border-color: var(--primary-soft-border);
}

.legend__swatch--holiday {
    background: repeating-linear-gradient(135deg, var(--hatch-a) 0 3px, #DCD3C3 3px 6px);
    border-color: #CFC5B3;
}

.legend__swatch--leave {
    background: var(--leave-bg);
    border-color: #C3D3EE;
}

.legend__swatch--absence {
    background: var(--absence-bg);
    border-color: var(--danger-border);
}

.legend__swatch--selected {
    background: var(--surface);
    border: 0;
    box-shadow: 0 0 0 2px var(--primary);
}

/* Jours de saisie : liste dépliable en mobile, panneau du jour sélectionné en desktop. */

.entry-days {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.entry-day {
    border-radius: var(--radius-card);
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
}

.entry-day.is-open {
    border: 2px solid var(--primary);
}

.entry-day__toggle {
    width: 100%;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 0;
    background: transparent;
    text-align: left;
    font-family: inherit;
    color: var(--ink);
    cursor: pointer;
}

.entry-day__date {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.entry-day__date .serif {
    font-size: 22px;
    line-height: 1;
}

.entry-day__date small {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.entry-day--holiday .entry-day__date {
    background: repeating-linear-gradient(135deg, var(--hatch-a) 0 8px, var(--hatch-b) 8px 16px);
    border: 1px dashed var(--hatch-border);
    color: var(--hatch-ink);
}

.entry-day--school-holiday .entry-day__date {
    box-shadow: inset 0 4px 0 var(--hatch-border);
}

.badge--school-holiday {
    margin-top: 4px;
    background: repeating-linear-gradient(135deg, var(--hatch-a) 0 6px, var(--hatch-b) 6px 12px);
    border: 1px dashed var(--hatch-border);
    color: var(--hatch-ink);
}

.entry-day__title {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

.entry-day__sub {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    color: var(--muted);
}

.entry-day__chevron {
    color: var(--muted);
    transition: transform 0.15s ease;
}

.entry-day.is-open .entry-day__chevron {
    transform: rotate(180deg);
}

.entry-day__panel {
    display: none;
    padding: 4px 14px 16px;
    flex-direction: column;
    gap: 14px;
}

.entry-day.is-open .entry-day__panel {
    display: flex;
}

/* Sans JavaScript (contrôleur `day-select` non connecté), tous les jours
   restent dépliés et saisissables. */
.entry-form:not(.is-enhanced) .entry-day__panel {
    display: flex;
}

.entry-day__heading {
    display: none;
}

.entry-day__panel [hidden] {
    display: none !important;
}

@media (min-width: 1024px) {
    .entry-days {
        gap: 0;
    }

    .entry-day {
        display: none;
        border: 0;
        border-radius: 0;
        overflow: visible;
        background: transparent;
    }

    .entry-day.is-selected, .entry-form:not(.is-enhanced) .entry-day {
        display: block;
    }

    .entry-form:not(.is-enhanced) .entry-day + .entry-day {
        margin-top: 24px;
        padding-top: 24px;
        border-top: 1px solid var(--border-soft);
    }

    .entry-day.is-open {
        border: 0;
    }

    .entry-day__toggle {
        display: none;
    }

    .entry-day__heading {
        display: block;
    }

    .entry-day__heading h3 {
        margin-top: 4px;
        font-family: var(--font-serif);
        font-weight: 600;
        font-size: 26px;
        letter-spacing: -0.01em;
    }

    .entry-day__panel, .entry-day.is-open .entry-day__panel {
        display: flex;
        padding: 0;
        gap: 18px;
    }
}

/* -------------------------------------------------------- Contrat */

.kv {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
}

.kv > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--border-soft);
}

.kv dt {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.kv dd {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.kv dd small {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
}

@media (min-width: 1024px) {
    .kv {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 22px 28px;
    }

    .kv > div {
        display: block;
        padding: 0;
        border: 0;
    }

    .kv dd {
        margin-top: 4px;
        text-align: left;
    }

    .kv__full {
        grid-column: 1 / -1;
    }
}

.weekday-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.weekday-chip {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg);
    color: #6B6458;
}

.weekday-chip.is-on {
    background: var(--primary);
    color: #FFFFFF;
}

@media (min-width: 1024px) {
    .weekday-chips {
        justify-content: flex-start;
        margin-top: 8px;
    }
}

.timeline > li {
    display: flex;
    gap: 14px;
}

.timeline__rail {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline__dot {
    width: 14px;
    height: 14px;
    margin-top: 4px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid #9AA3A5;
}

.timeline__line {
    flex-grow: 1;
    width: 2px;
    background: var(--border);
}

.timeline > li:last-child .timeline__line {
    display: none;
}

.timeline > li.is-current .timeline__dot {
    background: var(--primary);
    border-color: var(--primary);
}

.timeline__body {
    flex-grow: 1;
    min-width: 0;
    padding-bottom: 22px;
}

.timeline > li:last-child .timeline__body {
    padding-bottom: 0;
}

.timeline__date {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.timeline > li.is-current .timeline__date {
    color: var(--primary);
}

.timeline__summary {
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.45;
}

.timeline__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.timeline__detail {
    margin-top: 12px;
    padding: 4px 14px;
    border-radius: var(--radius-control);
    background: var(--surface-muted);
    border: 1px solid var(--border-soft);
}

.timeline__detail .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.timeline__detail .kv > div {
    display: flex;
    padding: 10px 0;
    border-top: 1px solid var(--border-soft);
}

.timeline__detail .kv > div:first-child {
    border-top: 0;
}

.timeline__detail .kv dd {
    margin: 0;
    text-align: right;
}

.disclosure-panel[hidden] {
    display: none;
}

/* -------------------------------------------------------- Membres */

.member {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0;
    border-top: 1px solid var(--border-soft);
}

.member:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.member__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.member__email {
    font-weight: 600;
    font-size: 15px;
    overflow-wrap: anywhere;
}

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

.member__actions form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


/* --------------------------------------------- Pages hors application */

.auth {
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    padding: 48px 24px 32px;
    display: flex;
    flex-direction: column;
}

.auth__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 24px;
    color: var(--ink);
    text-decoration: none;
}

.auth__title {
    margin-top: 40px;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.auth__lead {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--muted);
}

.auth__form {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth__footer {
    margin-top: auto;
    padding-top: 32px;
}

.auth__badge-icon {
    width: 64px;
    height: 64px;
    margin-top: 32px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
}

.auth__badge-icon + .auth__title {
    margin-top: 24px;
}

.qr {
    display: block;
    width: 240px;
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #FFFFFF;
}

.backup-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.backup-codes code {
    display: block;
    padding: 10px;
    text-align: center;
    font-size: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
}

/* ------------------------------------------- Calendrier annuel (bilan) */

.year-cal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.year-cal-month__title {
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    text-transform: capitalize;
}

.year-cal-weekdays, .year-cal-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
}

.year-cal-weekdays span {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}

.year-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    background: var(--surface);
    border: 1px solid var(--border-soft);
}

.year-cal-day--blank {
    background: transparent;
    border-color: transparent;
}

.year-cal-day--no-payslip {
    color: #8C8A82;
    border-style: dashed;
}

.year-cal-day--worked {
    background: var(--primary-soft);
    border-color: var(--primary-soft-border);
    color: var(--primary-ink);
    font-weight: 700;
}

.year-cal-day--paid-leave {
    background: var(--leave-bg);
    border-color: #C3D3EE;
    color: var(--leave-ink);
    font-weight: 700;
}

.year-cal-day--unplanned-absence {
    background: var(--absence-bg);
    border-color: var(--danger-border);
    color: var(--absence-ink);
    font-weight: 700;
}

.year-cal-day--employer-absence {
    background: repeating-linear-gradient(135deg, var(--hatch-a) 0 4px, #DCD3C3 4px 8px);
    border-color: #CFC5B3;
    color: var(--hatch-ink);
    font-weight: 700;
}

.year-cal-day--public-holiday {
    box-shadow: inset 0 -3px 0 var(--accent);
}

/* Vacances scolaires de la zone du foyer : liseré haut, cumulable avec l'état
   du jour (fond) et le liseré bas du jour férié. */
.year-cal-day--school-holiday {
    box-shadow: inset 0 3px 0 var(--hatch-border);
}

.year-cal-day--school-holiday.year-cal-day--public-holiday {
    box-shadow: inset 0 3px 0 var(--hatch-border), inset 0 -3px 0 var(--accent);
}

.legend__swatch--employer-absence {
    background: repeating-linear-gradient(135deg, var(--hatch-a) 0 3px, #DCD3C3 3px 6px);
    border-color: #CFC5B3;
}

.legend__swatch--public-holiday {
    box-shadow: inset 0 -3px 0 var(--accent);
}

.legend__swatch--school-holiday {
    box-shadow: inset 0 3px 0 var(--hatch-border);
}

.legend__swatch--no-payslip {
    border-style: dashed;
}

/* --------------------------------------------- Menu du compte (mobile) */

.account-menu {
    position: relative;
}

.account-menu summary {
    list-style: none;
    cursor: pointer;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
    width: min(280px, calc(100vw - 32px));
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-radius: var(--radius-card);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(23, 48, 46, 0.18);
    color: var(--ink);
}

.account-menu__role {
    font-size: 13px;
    color: var(--muted);
}

.account-menu__panel .btn {
    margin-top: 8px;
}

/* Panneau « Jour sélectionné » : carte en desktop, simple liste en mobile. */
@media (min-width: 1024px) {
    .entry-panel {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-card);
        padding: 24px;
    }
}

.entry-panel > .note + .entry-days {
    margin-top: 14px;
}

.entry-day__heading h3:focus {
    outline: none;
}

button.choice {
    width: 100%;
    align-items: center;
    text-align: left;
    font-family: inherit;
    color: var(--ink);
}

button.choice:hover {
    border-color: var(--primary);
}

button.choice:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.capitalize {
    display: inline-block;
}

.capitalize::first-letter {
    text-transform: uppercase;
}

.row--bottom {
    align-items: flex-end;
}

/* Un <select> prend la largeur de sa plus longue option : sans ce plafond,
   il déborde de la carte sur téléphone et élargit toute la page. */
.row--bottom > * {
    min-width: 0;
    max-width: 100%;
}

.card--banner > .grow {
    flex: 1 1 320px;
}

.row > .input.grow {
    width: auto;
    flex: 1 1 240px;
}
