:root {
    --bg: #ffffff;
    --bg-soft: #faf8f4;
    --card: #ffffff;
    --ink: #14241f;
    --muted: #5a6b64;
    --brand: #0b5c4a;          /* vert royal */
    --brand-2: #0f7a62;
    --brand-soft: rgba(11, 92, 74, 0.08);
    --gold: #c6a35a;
    --gold-2: #d9bc74;
    --gold-deep: #8f6f2f;
    --line: #e8e2d6;
    --warn: #b45309;
    --danger: #b91c1c;
    --ok: #0b5c4a;
    --pending: #a16207;
    --radius: 12px;
    --shadow: 0 10px 28px rgba(20, 36, 31, 0.06);
    --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --font-display: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --motion: 220ms;
    --motion-slow: 420ms;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--ink);
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 420px at 8% -8%, rgba(198, 163, 90, 0.12), transparent 55%),
        radial-gradient(700px 360px at 100% 0%, rgba(11, 92, 74, 0.08), transparent 50%),
        repeating-linear-gradient(
            45deg,
            transparent 0 18px,
            rgba(198, 163, 90, 0.035) 18px 19px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent 0 18px,
            rgba(11, 92, 74, 0.025) 18px 19px
        );
    background-attachment: fixed;
    min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; transition: color var(--motion) ease; }
a:hover { color: var(--gold-deep); text-decoration: underline; }

/* Page load / transition */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}
.page-loader.on {
    opacity: 1;
    pointer-events: all;
}
.page-loader-spin {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid rgba(11, 92, 74, 0.15);
    border-top-color: var(--gold);
    border-right-color: var(--brand);
    animation: portal-spin .7s linear infinite;
}
@keyframes portal-spin {
    to { transform: rotate(360deg); }
}

main.container {
    animation: page-enter var(--motion-slow) ease both;
}
@keyframes page-enter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
body.is-leaving main.container {
    animation: page-leave 200ms ease both;
}
@keyframes page-leave {
    to { opacity: 0; transform: translateY(-6px); }
}

.topbar {
    background: linear-gradient(90deg, #084c3d 0%, var(--brand) 55%, #0a6a55 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 4px 18px rgba(11, 92, 74, 0.2);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.brand {
    color: var(--gold-2);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: .03em;
    text-decoration: none;
    transition: color var(--motion) ease, transform var(--motion) ease;
}
.brand:hover { color: #fff; text-decoration: none; transform: translateY(-1px); }
.nav { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: center; margin-left: auto; }
.nav a {
    color: rgba(255,255,255,.92);
    font-size: .9rem;
    text-decoration: none;
    padding: .35rem .55rem;
    border-radius: 8px;
    transition: background var(--motion) ease, color var(--motion) ease, transform var(--motion) ease;
}
.nav a.active, .nav a:hover {
    background: rgba(198, 163, 90, 0.22);
    color: var(--gold-2);
    text-decoration: none;
}
.nav a:active { transform: scale(0.96); }
.nav-agency { font-size: .8rem; color: var(--gold-2); margin-left: .5rem; }
.nav-logout { border: 1px solid rgba(198, 163, 90, .45); }
.nav-account {
    position: relative;
    margin-left: .65rem;
}
.nav-account-trigger {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 220px;
    padding: .35rem .7rem;
    border-radius: 999px;
    border: 1px solid rgba(198, 163, 90, .45);
    background: rgba(0, 0, 0, .12);
    color: var(--gold-2);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--motion) ease, border-color var(--motion) ease;
}
.nav-account-trigger:hover,
.nav-account.is-open .nav-account-trigger,
.nav-account.is-active .nav-account-trigger {
    background: rgba(255, 255, 255, .12);
    border-color: var(--gold-2);
}
.nav-account-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-account-caret {
    font-size: .7rem;
    opacity: .85;
}
.nav-account-menu {
    position: absolute;
    top: calc(100% + .35rem);
    right: 0;
    min-width: 190px;
    padding: .4rem;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 12px 28px rgba(20, 36, 31, 0.16);
    display: none;
    z-index: 80;
}
.nav-account:hover .nav-account-menu,
.nav-account.is-open .nav-account-menu {
    display: block;
}
.nav-account-menu a {
    display: block;
    padding: .55rem .75rem;
    border-radius: 8px;
    color: var(--ink) !important;
    text-decoration: none !important;
    font-size: .9rem;
    font-weight: 500;
}
.nav-account-menu a:hover {
    background: var(--brand-soft);
    color: var(--brand) !important;
    transform: none;
}
.nav-account-logout {
    margin-top: .25rem;
    border-top: 1px solid var(--line);
    border-radius: 0 0 8px 8px !important;
    color: #7f1d1d !important;
}
.nav-account-logout:hover {
    background: #fef2f2 !important;
    color: #991b1b !important;
}
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(198, 163, 90, .5);
    color: var(--gold-2);
    border-radius: 8px;
    padding: .35rem .55rem;
}

.container { max-width: 1100px; margin: 0 auto; padding: .75rem 1rem 1.75rem; }
.page-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    margin: 0 0 .55rem;
    color: var(--brand);
    letter-spacing: .02em;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .75rem .9rem;
    margin-bottom: .75rem;
    transition: box-shadow var(--motion) ease, border-color var(--motion) ease;
}
.card:hover {
    border-color: rgba(198, 163, 90, 0.45);
    box-shadow: 0 12px 28px rgba(20, 36, 31, 0.07);
}
.card h2 {
    margin: 0 0 .5rem;
    font-size: .95rem;
    font-family: var(--font-display);
    color: var(--brand);
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat {
    background: linear-gradient(180deg, #fff, var(--bg-soft));
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 1rem;
    transition: transform var(--motion) ease, box-shadow var(--motion) ease;
}
.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat .n { font-size: 1.35rem; font-weight: 700; color: var(--brand); font-family: var(--font-display); }
.stat .l { color: var(--muted); font-size: .78rem; }

label { display: block; font-size: .76rem; font-weight: 600; margin-bottom: .2rem; }
.req { color: var(--danger); }
.form-row { display: grid; gap: .55rem; grid-template-columns: repeat(2, 1fr); margin-bottom: .55rem; }
.form-row.one { grid-template-columns: 1fr; }
.form-row.four { grid-template-columns: repeat(4, 1fr); }
.primes-box {
    margin: .65rem 0;
    padding: .6rem .7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-soft);
}
.primes-box h3 { margin: 0 0 .45rem; font-size: .84rem; color: var(--brand); }
.primes-box input[readonly] { background: #f3efe6; font-weight: 600; }
.subscriber-from-benef-box { margin-bottom: 1rem; }
.subscriber-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    align-items: flex-end;
    margin-top: .5rem;
}
.subscriber-type-col {
    flex: 1 1 220px;
    min-width: 0;
}
.subscriber-benef-question label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 600;
    color: var(--brand);
}
.subscriber-from-benef-box.is-pending-blink {
    animation: subscriber-benef-blink 1.1s ease-in-out infinite;
}
@keyframes subscriber-benef-blink {
    0%, 100% {
        border-color: rgba(26, 84, 58, 0.35);
        box-shadow: 0 0 0 0 rgba(26, 84, 58, 0);
        background: #f8f5ef;
    }
    50% {
        border-color: var(--brand, #1a543a);
        box-shadow: 0 0 0 3px rgba(26, 84, 58, 0.22);
        background: #eef6f1;
    }
}
@media (prefers-reduced-motion: reduce) {
    .subscriber-from-benef-box.is-pending-blink { animation: none; border-color: var(--brand, #1a543a); }
    .benef-tab.is-subscriber-reminder {
        animation: none;
        border-color: var(--brand);
        color: var(--brand);
        background: #eef6f1;
    }
}
.primes-table { margin-top: .5rem; }
.primes-table th { font-size: .8rem; color: var(--muted); }
.primes-table tr.active td { background: rgba(198, 163, 90, .12); font-weight: 600; }

input, select, textarea {
    width: 100%;
    padding: .4rem .52rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    font-size: .86rem;
    background: #fff;
    transition: border-color var(--motion) ease, box-shadow var(--motion) ease;
}
textarea {
    min-height: 4.75rem;
    resize: vertical;
    line-height: 1.45;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(198, 163, 90, .28);
    border-color: var(--gold);
}
.is-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 2px rgba(185,28,28,.15); }
.type-card.is-invalid,
.btn.is-invalid {
    border: 2px solid var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(185,28,28,.12);
}
.group-invalid {
    outline: 2px solid rgba(185,28,28,.35);
    outline-offset: 4px;
    border-radius: 10px;
}
label:has(+ input.is-invalid),
label:has(+ textarea.is-invalid),
label:has(+ select.is-invalid) { color: var(--danger); }

.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    border: none; border-radius: 8px; padding: .42rem .8rem;
    font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform var(--motion) ease, box-shadow var(--motion) ease, background var(--motion) ease, color var(--motion) ease, filter var(--motion) ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(11, 92, 74, 0.22);
}
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-secondary {
    background: #fff;
    color: var(--brand);
    border: 1px solid var(--line);
}
.btn-secondary:hover {
    border-color: var(--gold);
    color: var(--gold-deep);
    background: #fffdf8;
}
.btn-warning {
    background: linear-gradient(135deg, var(--gold-2), var(--gold));
    color: #1a1714;
}
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-sm { padding: .32rem .58rem; font-size: .78rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: btn-ripple .5s ease-out;
    background: rgba(255, 255, 255, 0.45);
    pointer-events: none;
}
@keyframes btn-ripple {
    to { transform: scale(2.6); opacity: 0; }
}

.actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; align-items: center; }
.wizard-nav-actions {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .5rem;
    width: 100%;
}
.wizard-nav-slot {
    display: flex;
    align-items: center;
    min-width: 0;
}
.wizard-nav-slot-left { justify-content: flex-start; }
.wizard-nav-slot-center { justify-content: center; }
.wizard-nav-slot-right { justify-content: flex-end; }
.wizard-nav-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
}
.wizard-nav-actions .btn-ic {
    width: 1.05em;
    height: 1.05em;
    flex-shrink: 0;
}
.wizard-nav-actions.is-save-only {
    grid-template-columns: 1fr;
    justify-items: center;
}
.wizard-nav-actions.is-save-only .wizard-nav-slot-center {
    justify-content: center;
}

.benef-page-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: .65rem;
}
.benef-page-toolbar .actions { margin-top: 0; }
.btn-excel .btn-excel-icon { flex-shrink: 0; display: block; }

.av-editable-cell {
    cursor: pointer;
    transition: background .15s;
}
.av-editable-cell:hover { background: rgba(198, 163, 90, .12); }
.av-inline-editing { padding: .25rem .3rem !important; background: #fff; }
.av-inline-edit-wrap {
    display: flex;
    align-items: center;
    gap: .35rem;
    min-width: 160px;
}
.av-inline-edit-wrap .av-inline-input,
.av-inline-edit-wrap input {
    flex: 1;
    min-width: 80px;
    padding: .35rem .5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}
.av-inline-edit-actions {
    display: flex;
    gap: .25rem;
    flex-shrink: 0;
}
.av-inline-btn {
    padding: .25rem .5rem;
    min-width: 1.75rem;
    justify-content: center;
    font-size: .95rem;
    line-height: 1;
    border-radius: 6px;
}
.av-inline-btn-ok {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: 0 2px 6px rgba(11, 92, 74, .2);
}
.av-inline-btn-ok:hover { color: #fff; filter: brightness(1.05); }
.av-inline-btn-cancel {
    background: #fff;
    color: var(--danger);
    border: 1px solid #fecaca;
}
.av-inline-btn-cancel:hover {
    background: #fef2f2;
    color: var(--danger);
}

.av-import-preview-root .table-responsive,
.av-import-preview-root .av-import-preview-scroll {
    background: #fff;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.av-import-preview-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .85rem;
}
.av-import-preview-table th,
.av-import-preview-table td {
    padding: .45rem .5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    background: #fff;
    white-space: nowrap;
}
.av-import-preview-table tr.table-danger td,
.av-import-preview-table tr.row-error td {
    background: #fef2f2;
}
.av-import-preview-table thead th {
    background: #f8fbfa;
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
}
.av-import-col-num {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 2.25rem;
    width: 2.25rem;
    text-align: center;
}
.av-import-col-nom {
    position: sticky;
    left: 2.25rem;
    z-index: 2;
    min-width: 5.5rem;
    max-width: 8rem;
}
.av-import-col-prenom {
    position: sticky;
    left: 7.75rem;
    z-index: 2;
    min-width: 5.5rem;
    max-width: 8rem;
}
.av-import-col-naissance {
    position: sticky;
    left: 13.25rem;
    z-index: 2;
    min-width: 5.75rem;
    max-width: 7.5rem;
}
.av-import-col-type-piece {
    position: sticky;
    left: 19rem;
    z-index: 2;
    min-width: 5.5rem;
    max-width: 8rem;
}
.av-import-col-num-piece {
    position: sticky;
    left: 24.5rem;
    z-index: 2;
    min-width: 6rem;
    max-width: 9rem;
}
.av-import-col-benef-type {
    position: sticky;
    left: 30.5rem;
    z-index: 2;
    min-width: 8.5rem;
    max-width: 11rem;
    white-space: normal;
    box-shadow: 4px 0 8px -2px rgba(20, 36, 31, .1);
}
.avis-recap-benef-table .av-import-col-benef-type .badge {
    display: inline-block;
    margin: 0 .15rem .15rem 0;
}
.av-import-col-status {
    position: sticky;
    right: 0;
    z-index: 2;
    min-width: 9rem;
    max-width: 18rem;
    white-space: normal;
    box-shadow: -4px 0 8px -2px rgba(20, 36, 31, .1);
}
.av-import-preview-table thead th.av-import-col-num,
.av-import-preview-table thead th.av-import-col-nom,
.av-import-preview-table thead th.av-import-col-prenom,
.av-import-preview-table thead th.av-import-col-naissance,
.av-import-preview-table thead th.av-import-col-type-piece,
.av-import-preview-table thead th.av-import-col-num-piece,
.av-import-preview-table thead th.av-import-col-benef-type,
.av-import-preview-table thead th.av-import-col-status {
    z-index: 4;
    background: #f8fbfa;
}
.av-import-preview-table tr.row-error td.av-import-col-num,
.av-import-preview-table tr.row-error td.av-import-col-nom,
.av-import-preview-table tr.row-error td.av-import-col-prenom,
.av-import-preview-table tr.row-error td.av-import-col-naissance,
.av-import-preview-table tr.row-error td.av-import-col-type-piece,
.av-import-preview-table tr.row-error td.av-import-col-num-piece,
.av-import-preview-table tr.row-error td.av-import-col-benef-type,
.av-import-preview-table tr.row-error td.av-import-col-status,
.av-import-preview-table tr.table-danger td.av-import-col-num,
.av-import-preview-table tr.table-danger td.av-import-col-nom,
.av-import-preview-table tr.table-danger td.av-import-col-prenom,
.av-import-preview-table tr.table-danger td.av-import-col-naissance,
.av-import-preview-table tr.table-danger td.av-import-col-type-piece,
.av-import-preview-table tr.table-danger td.av-import-col-num-piece,
.av-import-preview-table tr.table-danger td.av-import-col-benef-type,
.av-import-preview-table tr.table-danger td.av-import-col-status {
    background: #fef2f2;
}
.av-import-preview-table .av-editable-cell:hover {
    background: rgba(198, 163, 90, .12);
}
.av-import-preview-table tr.row-error .av-import-col-num:hover,
.av-import-preview-table tr.row-error .av-import-col-nom:hover,
.av-import-preview-table tr.row-error .av-import-col-prenom:hover,
.av-import-preview-table tr.row-error .av-import-col-naissance:hover,
.av-import-preview-table tr.row-error .av-import-col-type-piece:hover,
.av-import-preview-table tr.row-error .av-import-col-num-piece:hover {
    background: #fde8e8;
}
.av-import-preview-table tr.table-danger,
.av-import-preview-table tr.row-error { background: #fef2f2; }
.av-import-status-cell {
    text-align: center;
    min-width: 3.2rem;
}
.av-import-status-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    min-height: 2rem;
    padding: .2rem .45rem;
    border-radius: 8px;
    background: #dcfce7;
    border: 1px solid #86efac;
}
.av-import-thumb {
    font-size: 1.05rem;
    line-height: 1;
}
.av-import-status-err {
    display: inline-block;
    max-width: none;
    color: var(--danger);
    font-size: .78rem;
    text-align: left;
    line-height: 1.35;
}
.av-inline-edit-wrap select.av-inline-input {
    min-width: 8rem;
    width: auto;
    max-width: 14rem;
}
.text-danger { color: var(--danger); }
.text-success { color: var(--brand); }
.small { font-size: .82rem; }

table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: .42rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
td.editable {
    cursor: pointer;
    border-radius: 4px;
    transition: background .15s;
}
td.editable:hover { background: rgba(198, 163, 90, .1); }
td.locked {
    cursor: not-allowed;
    color: #6b7280;
    background: #f7f5f1;
}
td.locked:hover { background: #f7f5f1; }
td.editing { padding: .25rem .3rem; background: #fff; }
td.editing input {
    margin: 0;
    padding: .4rem .5rem;
    font-size: inherit;
    border-color: var(--gold);
}
td.saving { opacity: .65; }
.hint-inline { color: var(--muted); font-size: .78rem; margin: 0 0 .55rem; }
.badge-lock {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: rgba(198, 163, 90, .18);
    color: var(--gold-deep);
    white-space: nowrap;
}
.search-box label { font-size: .8rem; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

.badge { display: inline-block; padding: .15rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.muted { color: var(--muted); font-size: .8rem; }
.badge-draft { background: #e8f5f1; color: var(--brand); }
.badge-subscriber {
    display: inline-block;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: rgba(198, 163, 90, .28);
    color: var(--gold-deep);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
    margin-left: .2rem;
}
.subscriber-summary-list {
    margin: .35rem 0 0;
    padding-left: 1.1rem;
    font-size: .82rem;
}
.subscriber-modal-card {
    max-width: min(720px, 96vw);
    max-height: 90vh;
    overflow: auto;
}
.subscriber-modal-group {
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--line);
}
.subscriber-modal-group:last-of-type {
    border-bottom: 0;
    margin-bottom: .5rem;
}
.subscriber-modal-group h4 {
    margin: 0 0 .5rem;
    font-size: .9rem;
    color: var(--brand);
}
.subscriber-pick-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}
.subscriber-pick-table th,
.subscriber-pick-table td {
    padding: .4rem .45rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.subscriber-pick-table thead th {
    background: #f8fbfa;
    font-size: .72rem;
    text-transform: uppercase;
    color: var(--muted);
}
.badge-pending { background: #f8efd8; color: #8a6b2e; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-ko { background: #fee2e2; color: #991b1b; }

.alert { padding: .55rem .75rem; border-radius: 8px; margin-bottom: .75rem; font-size: .84rem; animation: page-enter .35s ease both; }
.alert-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #f4faf8; color: var(--brand); border: 1px solid rgba(11, 92, 74, .2); }

.type-cards {
    --type-card-motion: 420ms cubic-bezier(.22, 1, .36, 1);
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 4.75rem;
}
.type-cards.is-collapsed {
    justify-content: center;
}
.type-card {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    z-index: 1;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: .9rem 1rem;
    background: #fff;
    cursor: pointer;
    text-align: left;
    color: #3d4f48;
    box-shadow: none;
    transform: translateX(0) scale(1);
    opacity: 1;
    transition:
        border-color var(--type-card-motion),
        background var(--type-card-motion),
        color var(--type-card-motion),
        box-shadow var(--type-card-motion),
        transform var(--type-card-motion),
        opacity var(--type-card-motion),
        flex-grow var(--type-card-motion),
        flex-basis var(--type-card-motion),
        max-width var(--type-card-motion),
        min-width var(--type-card-motion),
        padding var(--type-card-motion),
        margin var(--type-card-motion);
}
.type-card:hover:not(.active):not(.is-behind) {
    border-color: #c8c8c8;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
    color: #1f2e29;
}
.type-card strong {
    display: block;
    color: #2a3b35;
    font-weight: 700;
    letter-spacing: .01em;
    font-size: 1rem;
    line-height: 1.25;
}
.type-card .type-card-tagline {
    display: block;
    color: #5a6b65;
    font-size: .8rem;
    margin-top: .2rem;
    max-height: 2.4em;
    opacity: 1;
    transition: opacity .28s ease, max-height .28s ease, margin .28s ease;
}
.type-card-label,
.type-card-hint {
    display: block;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    transition: opacity .28s ease, max-height .28s ease, margin .28s ease;
}
.type-card.active:not(.is-behind) {
    border: 1.5px solid var(--brand);
    background: linear-gradient(180deg, #eef8f4 0%, #f7fcfa 55%, #ffffff 100%);
    box-shadow: 0 4px 16px rgba(11, 92, 74, .1);
    color: var(--brand);
}
.type-card.active:not(.is-behind) strong { color: var(--brand); }
.type-card.active:not(.is-behind) .type-card-tagline { color: #2f5a4c; }
.type-card:active:not(.is-behind) { transform: scale(0.985); }

/* État réduit : carte choisie centrée (design PJ) */
.type-cards.is-collapsed .type-card.is-solo {
    flex: 0 1 min(100%, 420px);
    max-width: 440px;
    z-index: 3;
    padding: 1rem 1.2rem 1rem 1.35rem;
    border: 1.5px solid var(--brand);
    background: #f3faf7;
    box-shadow: 0 6px 20px rgba(20, 36, 31, .08);
    transform: translateX(0) scale(1);
    opacity: 1;
}
.type-cards.is-collapsed .type-card.is-solo::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--gold);
    border-radius: 12px 0 0 12px;
}
.type-cards.is-collapsed .type-card.is-solo .type-card-label {
    max-height: 1.5em;
    opacity: 1;
    margin-bottom: .35rem;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9aa3a0;
    font-weight: 500;
}
.type-cards.is-collapsed .type-card.is-solo .type-card-hint {
    max-height: 1.5em;
    opacity: 1;
    margin-top: .45rem;
    font-size: .75rem;
    color: #8a9590;
    font-weight: 400;
}
.type-cards.is-collapsed .type-card.is-solo .type-card-tagline {
    max-height: 0;
    opacity: 0;
    margin: 0;
    overflow: hidden;
}

/* Les autres se glissent derrière / se ferment vers le centre */
.type-cards.is-collapsed .type-card.is-behind {
    flex: 0 0 0;
    max-width: 0;
    min-width: 0;
    width: 0;
    padding-left: 0;
    padding-right: 0;
    margin: 0;
    border-width: 0;
    opacity: 0;
    transform: scale(0.72) translateX(0);
    pointer-events: none;
    z-index: 0;
    box-shadow: none;
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .type-card,
    .type-card .type-card-tagline,
    .type-card-label,
    .type-card-hint {
        transition: none !important;
    }
}

.steps { display: flex; gap: .35rem; margin-bottom: .65rem; flex-wrap: wrap; }
.step {
    flex: 1; min-width: 100px; text-align: center; padding: .35rem .4rem;
    border-radius: 8px; background: #f3efe6; color: var(--muted); font-size: .72rem; font-weight: 600;
    transition: background var(--motion) ease, color var(--motion) ease, transform var(--motion) ease;
}
.step.on {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: 0 4px 12px rgba(11, 92, 74, .2);
}
.step.done { background: rgba(198, 163, 90, .22); color: var(--gold-deep); }

.login-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    animation: page-enter var(--motion-slow) ease both;
}
.login-card { width: min(420px, 100%); }
.login-card h1 {
    margin-top: 0;
    font-family: var(--font-display);
    color: var(--brand);
}

.btn-ok {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
}
.btn-ok:hover { color: #fff; filter: brightness(1.05); }

.benef-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .4rem;
    margin-bottom: .65rem;
    padding-bottom: 0;
    border-bottom: none;
}
.benef-tab {
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--muted);
    padding: .42rem .9rem;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 999px;
    transition:
        color var(--motion) ease,
        background var(--motion) ease,
        border-color var(--motion) ease,
        box-shadow var(--motion) ease,
        transform var(--motion) ease;
}
.benef-tab:hover:not(.active) {
    border-color: rgba(11, 92, 74, .35);
    color: var(--brand);
    background: #f3faf7;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(11, 92, 74, .08);
}
.benef-tab:active {
    transform: translateY(0) scale(0.98);
}
.benef-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-color: var(--brand);
    box-shadow: 0 4px 14px rgba(11, 92, 74, .22);
}
.benef-tab.is-subscriber-reminder {
    animation: subscriber-tab-blink 1.1s ease-in-out infinite;
}
@keyframes subscriber-tab-blink {
    0%, 100% {
        border-color: rgba(11, 92, 74, .35);
        box-shadow: 0 0 0 0 rgba(11, 92, 74, 0);
        color: var(--muted);
        background: #fff;
    }
    50% {
        border-color: var(--brand);
        box-shadow: 0 0 0 3px rgba(11, 92, 74, .18);
        color: var(--brand);
        background: #eef6f1;
    }
}
.subscriber-tab-hint {
    text-align: center;
    margin: 0 0 .75rem;
    font-size: .84rem;
}
.subscriber-tab-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--brand);
    cursor: pointer;
    text-decoration: underline;
}
.subscriber-tab-link:hover {
    color: var(--gold-deep);
}
.subscriber-tab-panel {
    margin-top: 0;
}
.subscriber-tab-actions {
    justify-content: center;
    margin-top: 1rem;
}
.benef-count { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.benef-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem;
    border-radius: 999px; background: var(--brand); color: #fff;
    font-size: .85rem; font-weight: 700;
}
.benef-toolbar {
    display: flex; flex-wrap: wrap; justify-content: space-between;
    align-items: flex-start; gap: .75rem; margin-bottom: .85rem;
}
.view-toggle { display: inline-flex; gap: .25rem; }
.search-input-wrap { margin-bottom: .85rem; }
.search-input-wrap input {
    width: 100%;
    padding: .65rem .8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--gold-deep); }
.benef-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
}
.benef-card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: .9rem 1rem;
    transition: transform var(--motion) ease, box-shadow var(--motion) ease, border-color var(--motion) ease;
}
.benef-card:hover {
    transform: translateY(-2px);
    border-color: rgba(198, 163, 90, .5);
    box-shadow: var(--shadow);
}
.benef-card-x {
    position: absolute; top: .4rem; right: .45rem;
    border: none; background: #fee2e2; color: var(--danger);
    width: 1.6rem; height: 1.6rem; border-radius: 999px;
    font-size: 1rem; line-height: 1; cursor: pointer;
    transition: transform var(--motion) ease;
}
.benef-card-x:active { transform: scale(0.9); }
.benef-modal-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-soft);
    padding: 1rem;
    margin-bottom: 1rem;
}
.benef-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 36, 31, .42);
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1rem;
    animation: page-enter .25s ease both;
}
.pdf-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 36, 31, .42);
    z-index: 200;
    display: none;
    place-items: center;
    padding: 1rem;
}
.pdf-overlay.is-open {
    display: grid;
}
.benef-popup {
    width: min(640px, 100%);
    max-height: min(90vh, 720px);
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
    padding: 1.1rem 1.2rem;
}
.benef-popup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .85rem;
}
.benef-popup-head h3 { margin: 0; color: var(--brand); font-family: var(--font-display); }
.benef-card .actions { margin-top: .65rem; }
.import-drop {
    border: 1px dashed var(--gold);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    background: #fffdf8;
    margin-bottom: 1rem;
    transition: background .15s, border-color .15s;
}
.import-drop.av-drop-active {
    background: #f3faf6;
    border-color: var(--brand);
    border-style: solid;
}
.is-hidden { display: none !important; }
#wizardContent .import-drop.import-drop-compact {
    padding: .45rem .65rem;
    max-width: 420px;
    margin-bottom: .65rem;
    border-radius: 8px;
}
#wizardContent .import-drop.import-drop-compact p {
    margin: 0 0 .35rem;
    font-size: .8rem;
}
#wizardContent .import-work-tabs { margin: .35rem 0 .55rem; }
#wizardContent .import-work-pane[hidden] { display: none !important; }
#wizardContent .import-family-tab-hint { margin: 0 0 .5rem; font-size: .78rem; }
#wizardContent .import-family-help { display: none; }
#wizardContent .import-family-wrap { margin-top: 0; padding: .65rem .75rem; }
#wizardContent .import-family-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.05rem;
    height: 1.05rem;
    margin-left: .25rem;
    border-radius: 999px;
    background: #c2410c;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
}

.recap-section-title {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: .5rem;
}
.wizard-toast {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 9999;
    width: min(300px, calc(100vw - 1.25rem));
    pointer-events: none;
    opacity: 0;
    transform: translate(110%, -50%);
    transition:
        opacity .28s ease,
        transform .35s cubic-bezier(.22, 1, .36, 1);
}
.wizard-toast.is-visible {
    opacity: 1;
    transform: translate(0, -50%);
    pointer-events: auto;
}
.wizard-toast-inner {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .9rem 1rem .9rem 1.1rem;
    border-radius: 12px 0 0 12px;
    box-shadow: -6px 0 28px rgba(20, 36, 31, .16);
    font-size: .92rem;
    line-height: 1.45;
    background: #fff;
}
.wizard-toast.is-err .wizard-toast-inner {
    background: #fff5f5;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger);
}
.wizard-toast.is-ok .wizard-toast-inner {
    background: #f0fdf8;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-left: 4px solid var(--ok);
}
.wizard-toast-icon {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.45;
}
.wizard-toast.is-err .wizard-toast-icon::before { content: '⚠'; }
.wizard-toast.is-ok .wizard-toast-icon::before { content: '✓'; }
.wizard-toast-message {
    flex: 1;
    min-width: 0;
    font-weight: 500;
}
.wizard-toast-close {
    flex-shrink: 0;
    align-self: flex-start;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .15rem;
    margin: -.1rem -.1rem 0 0;
    opacity: .65;
    border-radius: 6px;
    transition: opacity .15s ease, background .15s ease;
}
.wizard-toast-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, .06);
}
@media (max-width: 640px) {
    .wizard-toast {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        transform: translateY(110%);
    }
    .wizard-toast.is-visible {
        transform: translateY(0);
    }
    .wizard-toast-inner {
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -6px 28px rgba(20, 36, 31, .16);
    }
}
@media (prefers-reduced-motion: reduce) {
    .wizard-toast { transition: none; }
}
.type-card .type-card-tagline {
    display: none !important;
}
.wizard-tree-sticky {
    position: sticky;
    top: 3.55rem;
    z-index: 40;
    margin: 0 0 1rem;
    padding: .85rem 1rem;
    background: linear-gradient(135deg, #fffdf8 0%, #f3f7f5 100%);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(11, 92, 74, 0.08);
}
.wizard-tree-sticky .recap-section-title {
    margin-bottom: .55rem;
}
.recap-tree {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}
.recap-tree-path {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: .35rem;
}
.recap-tree-node {
    flex: 1 1 140px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .75rem .9rem;
}
.recap-tree-label {
    color: var(--muted);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .2rem;
}
.recap-tree-value {
    font-weight: 700;
    color: var(--brand);
    word-break: break-word;
}
.recap-tree-sep {
    display: flex;
    align-items: center;
    padding: 0 .2rem;
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 600;
}
.recap-contract {
    margin-bottom: .5rem;
}
.recap-group {
    padding-bottom: .65rem;
    margin-bottom: .65rem;
    border-bottom: 1px solid var(--line);
}
.recap-group:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}
.recap-group-title {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: .45rem;
}
.recap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .65rem;
}
.recap-benef-section {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--line);
}
.recap-box {
    background: #fff;
    border: 1px solid var(--line);
    border-top: 2px solid var(--gold);
    border-radius: 10px;
    padding: .55rem .65rem;
    transition: transform var(--motion) ease, box-shadow var(--motion) ease;
}
.recap-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.recap-box-label {
    color: var(--muted);
    font-size: .7rem;
    margin-bottom: .15rem;
}
.recap-box-value {
    font-weight: 700;
    font-size: .84rem;
    word-break: break-word;
    color: var(--brand);
    white-space: pre-wrap;
}
@media (max-width: 640px) {
    .recap-tree-sep {
        width: 100%;
        justify-content: center;
        transform: rotate(90deg);
        padding: .1rem 0;
    }
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .65rem;
}
.search-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .55rem;
}
.search-dates-always {
    margin-bottom: 0;
}
.search-box-body.is-collapsed {
    display: none;
}
.av-filter-card {
    background: #f8fbfa;
}
.av-filter-header {
    cursor: pointer;
    user-select: none;
}
.filter-checks {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    justify-content: flex-end;
    padding-bottom: .15rem;
}
.filter-check {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-weight: 500;
    margin: 0;
    cursor: pointer;
}
.filter-check input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    min-width: 1.05rem;
    padding: 0;
    accent-color: var(--brand);
}
.av-active-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin: 0 0 .85rem;
    padding: .7rem .9rem;
    border-radius: 10px;
    border: 1px solid #d7e8df;
    background: #eef7f3;
}
.av-active-filter-body {
    flex: 1;
    min-width: 0;
    font-size: .9rem;
    color: #27453c;
}
.av-active-filter-body strong {
    display: inline;
    margin-right: .35rem;
}
.av-results-count {
    font-size: .9rem;
}
.search-advanced-sep {
    height: 1px;
    background: var(--line);
    margin: .85rem 0 1rem;
}
.demandes-filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    margin-top: .75rem;
    padding-top: .65rem;
    border-top: 1px solid var(--line);
}
.demandes-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    margin-left: auto;
}
.demandes-filter-buttons.actions {
    margin-top: 0;
}
.footer {
    text-align: center;
    color: var(--muted);
    font-size: .8rem;
    padding: 1rem;
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.75);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--line);
}
.pagination-nav { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }

/* Import — organisation familles */
.import-family-wrap {
    margin-top: 1rem;
    padding: 1rem 1.1rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.import-family-help {
    margin: 0 0 1rem;
    padding: .85rem 1rem;
    border-radius: 10px;
    border: 1px solid #e4efe8;
    background: linear-gradient(180deg, #f7fbf9, #fff);
}
.import-family-help strong {
    display: block;
    color: var(--brand);
    margin-bottom: .45rem;
    font-size: .95rem;
}
.import-family-help ol {
    margin: 0 0 .55rem;
    padding-left: 1.2rem;
    color: #334155;
    font-size: .86rem;
    line-height: 1.45;
}
.import-family-help li { margin: .2rem 0; }
.import-family-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
}
.import-family-col {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .75rem;
    background: #f8fbfa;
}
.import-family-col h4 {
    margin: 0 0 .55rem;
    font-size: .95rem;
    color: var(--brand);
}
.import-family-list {
    min-height: 140px;
    max-height: 320px;
    overflow: auto;
}
.import-family-groups {
    min-height: 0;
    max-height: none;
    overflow: visible;
}
.import-family-drop {
    border: 1px dashed #c9d8d0;
    border-radius: 8px;
    padding: .5rem;
    background: #fff;
    min-height: 80px;
}
.import-family-drop.drag-over {
    border-color: var(--brand);
    background: rgba(11, 92, 74, .06);
}
.import-family-empty {
    margin: .35rem 0;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.45;
}
.import-family-person {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    box-sizing: border-box;
    padding: .45rem .55rem;
    margin-bottom: .4rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: grab;
    font-size: .88rem;
}
.import-family-person.is-dragging {
    opacity: .55;
}
.import-family-person input[type="checkbox"],
.import-family-person input[type="radio"] {
    width: 1.05rem;
    height: 1.05rem;
    min-width: 1.05rem;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--brand);
    cursor: pointer;
}
.import-family-person-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.import-family-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .65rem;
    margin-bottom: .65rem;
    background: #fff;
}
.import-family-card-head {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: .5rem;
}
.import-family-name {
    flex: 1;
    min-width: 140px;
    width: auto;
    padding: .35rem .5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.subscriber-id-section {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem;
    margin: .75rem 0 1rem;
    background: #fafcfb;
}
.subscriber-id-section h4 {
    margin: 0 0 .75rem;
    color: var(--brand);
    font-size: 1rem;
    font-weight: 600;
}
@media (max-width: 800px) {
    .form-row.three { grid-template-columns: 1fr; }
    .import-family-layout { grid-template-columns: 1fr; }
}

.family-toggle {
    border: 0;
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.35rem 0 0;
    line-height: 1;
}
.family-modal-card {
    max-width: 720px;
    width: 96%;
    max-height: 92vh;
    overflow: auto;
    background: #fff;
}
.family-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: 0 0 .85rem;
}
.family-modal-head strong {
    font-size: 1.15rem;
    color: var(--brand);
    font-family: var(--font-display);
}
.family-modal-head #familyModalClose {
    min-width: 2rem;
    padding: .25rem .55rem;
    font-size: 1.2rem;
    line-height: 1;
}
.mb-family-selected { margin-bottom: .9rem; }
.family-selected-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .5rem;
}
.family-member-card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .55rem .7rem .55rem .55rem;
    background: #f8fbfa;
}
.family-member-card strong { display: block; font-size: .9rem; }
.family-member-card .muted { font-size: .78rem; }
.family-member-card-remove {
    position: absolute;
    top: .15rem;
    right: .2rem;
    border: 0;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: .15rem .3rem;
}
.family-modal-footer {
    justify-content: flex-end;
    margin-top: 1rem;
}
.family-link {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.family-link:hover {
    border-bottom-color: var(--gold);
    color: var(--gold-deep);
}
.family-view-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.family-view-table th,
.family-view-table td {
    padding: .45rem .5rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
.family-view-table thead th {
    background: #f8fbfa;
    font-size: .82rem;
}
.family-view-count {
    margin: 0 0 .75rem;
    color: var(--muted);
    font-size: .88rem;
}
.family-add-panel {
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid var(--line);
}
.badge-chef {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
}
.family-members-pick {
    max-height: min(420px, 48vh);
    min-height: 220px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: #fafcfb;
}
.family-pick-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.92rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
}
.family-pick-item:hover {
    background: #fff;
    border-color: var(--line);
}
.family-pick-item input {
    margin-top: 0.2rem;
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    min-width: 1.05rem;
    padding: 0;
    accent-color: var(--brand);
}
.family-pick-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}
.family-pick-name {
    font-weight: 600;
    color: var(--ink, #1a2e28);
}
.family-pick-meta {
    font-size: 0.82rem;
    word-break: break-word;
}
.family-chef-row td { background: #f3faf7; }
.family-member-row td { background: #fafcfb; }
.family-child { padding-left: 1.5rem !important; }
.table-section td {
    background: #eef6f3;
    color: var(--brand);
    font-size: 0.85rem;
}
.recap-family-block { margin-bottom: 1rem; }

@media (max-width: 800px) {
    .grid-2, .grid-3, .grid-4, .form-row, .form-row.four { grid-template-columns: 1fr; }
    .type-cards { flex-wrap: wrap; }
    .type-card { flex: 1 1 100%; }
    .type-cards.is-collapsed {
        flex-wrap: nowrap;
    }
    .type-cards.is-collapsed .type-card.is-solo {
        flex: 1 1 100%;
        max-width: none;
    }
    .type-cards.is-collapsed .type-card.is-behind {
        flex: 0 0 0;
        max-width: 0;
        min-width: 0;
    }
    .nav-toggle { display: inline-block; margin-left: auto; }
    .nav {
        display: none; width: 100%; flex-direction: column; align-items: stretch;
        background: rgba(0,0,0,.12); padding: .5rem; border-radius: 8px;
    }
    .nav.open { display: flex; }
    .nav-account { margin-left: 0; width: 100%; }
    .nav-account-trigger { width: 100%; max-width: none; justify-content: space-between; }
    .nav-account-menu {
        position: static;
        margin-top: .35rem;
        box-shadow: none;
        width: 100%;
    }
    table { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    main.container { opacity: 1; transform: none; }
}

/* ——— Wizard nouvelle demande : compact + transitions ——— */
body.page-portal-compact main.container,
body.page-wizard main.container {
    padding: .65rem 1rem 1.25rem;
}
body.page-portal-compact .card:hover,
body.page-wizard .card:hover {
    transform: none;
    box-shadow: var(--shadow);
}
body.page-wizard #wizardContent {
    overflow: hidden;
}
body.page-wizard #wizardContent h2 {
    font-size: .95rem;
    margin: 0 0 .45rem;
    line-height: 1.3;
}
body.page-wizard #wizardContent .wizard-h2-section {
    margin-top: .55rem;
}
body.page-wizard #wizardContent h3 {
    font-size: .88rem;
    margin: 0 0 .4rem;
}
body.page-portal-compact .steps,
body.page-wizard .steps {
    gap: .3rem;
    margin-bottom: .55rem;
}
body.page-portal-compact .step,
body.page-wizard .step {
    padding: .3rem .4rem;
    font-size: .7rem;
    min-width: 0;
    flex: 1 1 0;
}
body.page-portal-compact .form-row.three,
body.page-wizard .form-row.three {
    grid-template-columns: repeat(3, 1fr);
}
body.page-portal-compact .type-cards,
body.page-wizard .type-cards {
    gap: .55rem;
    min-height: 3.5rem;
}
body.page-portal-compact .type-card,
body.page-wizard .type-card {
    padding: .55rem .65rem;
    border-radius: 8px;
}
body.page-portal-compact .type-card strong,
body.page-wizard .type-card strong {
    font-size: .84rem;
}
body.page-portal-compact .type-cards.is-collapsed .type-card.is-solo,
body.page-wizard .type-cards.is-collapsed .type-card.is-solo {
    padding: .65rem .85rem .65rem .95rem;
}
body.page-wizard .wizard-field-spaced {
    margin-top: .45rem;
}
.wizard-nav-actions-left {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.benef-count-solo-wrap {
    display: flex;
    justify-content: center;
    margin: .5rem 0 .65rem;
}
.benef-count-solo-card {
    position: relative;
    flex: 0 1 min(100%, 360px);
    max-width: 380px;
    width: 100%;
    padding: .65rem .85rem .65rem 1rem;
    border: 1.5px solid var(--brand);
    border-radius: 12px;
    background: #f3faf7;
    box-shadow: 0 6px 20px rgba(20, 36, 31, .08);
    text-align: left;
}
.benef-count-solo-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--gold);
    border-radius: 12px 0 0 12px;
}
.benef-count-solo-label {
    display: block;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #9aa3a0;
    font-weight: 500;
    margin-bottom: .35rem;
}
.benef-count-solo-card strong {
    display: block;
    color: var(--brand);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}
body.page-wizard .wizard-recap-hint {
    margin-top: .55rem;
    padding: .55rem .7rem;
    font-size: .8rem;
}
body.page-portal-compact .subscriber-type-row,
body.page-wizard .subscriber-type-row {
    gap: .65rem 1rem;
    margin-top: .35rem;
}
body.page-portal-compact .subscriber-id-section h4,
body.page-wizard .subscriber-id-section h4 {
    font-size: .84rem;
    margin: .35rem 0 .4rem;
}
body.page-portal-compact .subscriber-id-section,
body.page-wizard .subscriber-id-section {
    margin-top: .35rem;
}

@keyframes wizard-leave-forward {
    to { opacity: 0; transform: translateX(-24px); }
}
@keyframes wizard-enter-forward {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes wizard-leave-back {
    to { opacity: 0; transform: translateX(24px); }
}
@keyframes wizard-enter-back {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
}
#wizardContent.wizard-leave-forward {
    animation: wizard-leave-forward .5s ease forwards;
}
#wizardContent.wizard-enter-forward {
    animation: wizard-enter-forward .5s ease both;
}
#wizardContent.wizard-leave-back {
    animation: wizard-leave-back .5s ease forwards;
}
#wizardContent.wizard-enter-back {
    animation: wizard-enter-back .5s ease both;
}
.wizard-content-wrap {
    position: relative;
}
.wizard-step-loading {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    backdrop-filter: blur(3px);
}
.wizard-step-loading[hidden] {
    display: none !important;
    pointer-events: none !important;
}
.wizard-step-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    color: var(--brand);
    font-size: .88rem;
    font-weight: 600;
}
.wizard-step-loading-spin {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid rgba(11, 92, 74, 0.15);
    border-top-color: var(--gold);
    border-right-color: var(--brand);
    animation: portal-spin .7s linear infinite;
}
#wizardContent.is-step-transition {
    pointer-events: none;
}
body.wizard-step-busy .wizard-nav-actions .btn {
    pointer-events: none;
    opacity: .6;
}

/* ——— Avis / récapitulatif de souscription ——— */
.avis-recap {
    border: 1.5px solid var(--gold);
    border-radius: 12px;
    background: #fff;
    padding: 1rem 1.1rem 1.15rem;
}
.avis-recap-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--line);
}
.avis-recap-header-main {
    flex: 1 1 280px;
    min-width: 0;
}
.avis-recap-ref-block,
.avis-recap-ref-value {
    display: inline-block;
    border: 1.5px solid var(--gold);
    border-radius: 8px;
    padding: .45rem .75rem;
    font-weight: 700;
    color: var(--brand);
    margin: 0 .35rem .35rem 0;
}
.avis-recap-ref-value {
    font-size: 1.05rem;
}
.avis-recap-detail-title {
    margin-top: .5rem;
    font-weight: 600;
    color: var(--ink);
}
.avis-recap-created {
    margin-top: .25rem;
    font-size: .84rem;
}
.avis-recap-header-aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .5rem;
    min-width: 200px;
    position: relative;
    z-index: 12;
}
.avis-style-switcher {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
    width: 100%;
    max-width: 220px;
    position: relative;
    z-index: 13;
    pointer-events: auto;
}
.avis-style-switcher-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
    text-align: right;
}
.avis-style-btn {
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 6px;
    padding: .4rem .55rem;
    font: inherit;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    position: relative;
    z-index: 14;
    pointer-events: auto;
    touch-action: manipulation;
    transition: border-color var(--motion) ease, background var(--motion) ease, color var(--motion) ease;
}
.avis-style-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: #f3faf7;
}
.avis-style-btn.is-active {
    border-color: var(--brand);
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
}
.avis-status-badge {
    display: inline-block;
    padding: .35rem .85rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: .78rem;
    font-weight: 700;
}
.avis-qr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.avis-section {
    margin-bottom: 1rem;
}
.avis-section-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 .65rem;
}
.avis-section-title::before {
    content: "■ ";
    font-size: .72rem;
    color: var(--ink);
}
.avis-subsection {
    margin-bottom: .75rem;
}
.avis-subsection-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: .45rem;
}
.avis-box-row {
    display: grid;
    gap: .55rem;
    margin-bottom: .55rem;
}
.avis-box-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.avis-box-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.avis-box-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.avis-box-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.avis-box-row-1 { grid-template-columns: 1fr; }
.avis-box {
    border: 1.5px solid var(--gold);
    border-radius: 8px;
    padding: .55rem .65rem;
    background: #fff;
    min-height: 3.5rem;
}
.avis-box-label {
    font-size: .72rem;
    color: var(--muted);
    margin-bottom: .2rem;
}
.avis-box-value {
    font-size: .88rem;
    font-weight: 700;
    color: var(--brand);
    word-break: break-word;
    white-space: pre-wrap;
}
.avis-scroll-row {
    display: flex;
    gap: .55rem;
    overflow-x: auto;
    padding-bottom: .25rem;
    scroll-snap-type: x proximity;
}
.avis-scroll-row .avis-box {
    flex: 0 0 min(100%, 220px);
    scroll-snap-align: start;
}
.avis-subscriber-set {
    margin-bottom: .65rem;
}
.avis-subscriber-set-separated {
    margin-bottom: 1.15rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--line);
}
.avis-subscriber-members {
    margin-top: .75rem;
}
.avis-subscriber-members-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: .45rem;
}
.avis-section-subscribers .avis-benef-toolbar {
    margin-bottom: .75rem;
}
.avis-recap-benef-scroll {
    max-height: min(70vh, 540px);
}
.avis-recap-benef-root.is-export .avis-recap-benef-scroll,
.avis-doc-benef-table-wrap .avis-recap-benef-scroll {
    max-height: none;
    overflow: visible;
}
.avis-section-subscribers .avis-recap-benef-table .family-toggle {
    margin-right: .25rem;
}
.avis-section-subscribers .avis-recap-benef-table .badge {
    margin-right: .2rem;
}
.avis-subscriber-group-label {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: .35rem;
}
.avis-benef-count {
    font-size: .85rem;
    color: var(--muted);
    font-weight: 600;
}
.avis-benef-toolbar {
    margin-bottom: .65rem;
}
.avis-benef-search {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}
.avis-table-wrap {
    overflow-x: auto;
    border: 1.5px solid var(--gold);
    border-radius: 8px;
}
.avis-benef-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}
.avis-benef-table th,
.avis-benef-table td {
    padding: .45rem .5rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
.avis-benef-table thead th {
    background: #f3faf7;
    font-size: .72rem;
    text-transform: uppercase;
    color: var(--muted);
}
.avis-benef-table tbody tr:nth-child(even) td {
    background: #fafcfb;
}
.avis-recap-actions {
    justify-content: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .85rem;
    padding-top: .75rem;
    border-top: 1px solid var(--line);
}

/* Avis de demande de souscription (document imprimable) */
.avis-document {
    max-width: 920px;
    margin: 0 auto;
    padding: .5rem 0 1rem;
    color: var(--ink);
}
.avis-doc-header {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    position: relative;
    min-height: 100px;
}
.avis-doc-title-wrap {
    text-align: center;
    flex: 1 1 auto;
}
.avis-doc-title,
.avis-doc-ref {
    display: inline-block;
    border: 1.5px solid var(--brand);
    border-radius: 10px;
    padding: .5rem 1rem;
    font-weight: 700;
    color: var(--brand);
    background: #fff;
}
.avis-doc-title {
    font-size: 1rem;
    margin-bottom: .45rem;
}
.avis-doc-ref {
    font-size: 1.05rem;
    letter-spacing: .02em;
}
.avis-doc-qr {
    position: absolute;
    top: 0;
    right: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.avis-doc-panel {
    border: 1.5px solid var(--brand);
    border-radius: 10px;
    padding: 1rem 1.1rem 1rem;
    margin-bottom: 1rem;
    background: #fff;
    position: relative;
}
.avis-doc-panel-compact {
    max-width: 420px;
}
.avis-doc-panel-label {
    display: inline-block;
    border: 1.5px solid var(--brand);
    border-radius: 8px;
    padding: .35rem .7rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--brand);
    background: #fff;
    margin: -1.65rem 0 .65rem;
}
.avis-doc-list {
    margin: 0;
    padding: 0 0 0 1.1rem;
    list-style: square;
    font-size: .9rem;
    line-height: 1.55;
}
.avis-doc-list li {
    margin-bottom: .2rem;
}
.avis-doc-list strong {
    font-weight: 700;
    color: var(--ink);
}
.avis-doc-benef-label {
    display: inline-block;
    border: 1.5px solid var(--brand);
    border-radius: 8px;
    padding: .35rem .75rem;
    font-size: .85rem;
    font-weight: 700;
    color: var(--brand);
    margin-bottom: .55rem;
}
.avis-doc-benef-table-wrap {
    margin-top: .25rem;
}
table.avis-doc-benef-table {
    width: 100%;
    border-collapse: collapse;
    border: 1.5px solid var(--brand);
    font-size: .82rem;
}
table.avis-doc-benef-table th,
table.avis-doc-benef-table td {
    border: 1px solid var(--line);
    padding: .35rem .45rem;
    text-align: left;
    vertical-align: middle;
}
table.avis-doc-benef-table th {
    background: #f3faf7;
    color: #5a6b64;
    font-size: .72rem;
    text-transform: uppercase;
    font-weight: 700;
}
table.avis-doc-benef-table tr:nth-child(even) td {
    background: #fafcfb;
}
.avis-doc-family-mark {
    color: var(--brand);
    font-size: .75rem;
    margin-right: .15rem;
}
.avis-doc-family-indent {
    display: inline-block;
    padding-left: 1.1rem;
}
.avis-doc-family-toggle {
    border: none;
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    padding: 0 .15rem 0 0;
    font-size: .75rem;
    line-height: 1;
    vertical-align: middle;
}
body.page-avis-document main {
    max-width: 980px;
}
body.page-avis-document .avis-document-page {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.25rem 1.35rem 1.5rem;
}
body.page-portal-compact .avis-recap,
body.page-wizard .avis-recap {
    padding: .75rem .85rem;
}
body.page-portal-compact .avis-box-row-5,
body.page-portal-compact .avis-box-row-4,
body.page-wizard .avis-box-row-5,
body.page-wizard .avis-box-row-4 {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* Style 2 — Administratif */
.avis-style-admin {
    border-color: #0b5c4a;
    border-radius: 4px;
    padding: .75rem .85rem;
}
.avis-style-admin .avis-recap-header {
    border-bottom: 2px solid #0b5c4a;
    padding-bottom: .65rem;
    margin-bottom: .75rem;
}
.avis-style-admin .avis-recap-ref-block,
.avis-style-admin .avis-recap-ref-value {
    border-radius: 2px;
    border-color: #0b5c4a;
    padding: .35rem .6rem;
    font-size: .82rem;
}
.avis-style-admin .avis-recap-ref-value { font-size: .95rem; }
.avis-style-admin .avis-section-title {
    background: #0b5c4a;
    color: #fff;
    padding: .35rem .55rem;
    margin: 0 0 .5rem;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 2px;
}
.avis-style-admin .avis-section-title::before { content: none; }
.avis-style-admin .avis-box {
    border: 1px solid #c5d5d0;
    border-radius: 2px;
    padding: .4rem .5rem;
    min-height: 2.8rem;
    background: #fafcfb;
}
.avis-style-admin .avis-box-label {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.avis-style-admin .avis-box-value { font-size: .8rem; color: #14241f; }
.avis-style-admin .avis-table-wrap {
    border: 1px solid #c5d5d0;
    border-radius: 2px;
}
.avis-style-admin .avis-benef-table thead th {
    background: #0b5c4a;
    color: #fff;
    font-size: .68rem;
}
.avis-style-admin .avis-subscriber-set-separated {
    border-bottom-style: solid;
    border-color: #d8e4df;
}
.avis-style-admin .avis-box-row { gap: .35rem; margin-bottom: .35rem; }
.avis-style-admin .avis-section { margin-bottom: .75rem; }

/* Style 3 — Compact */
.avis-style-compact {
    border: 1px solid #b8c5c0;
    border-radius: 2px;
    padding: .55rem .65rem;
    font-size: .82rem;
}
.avis-style-compact .avis-recap-header {
    margin-bottom: .55rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid #d8e4df;
}
.avis-style-compact .avis-recap-ref-block,
.avis-style-compact .avis-recap-ref-value {
    border: 1px solid #b8c5c0;
    border-radius: 0;
    padding: .25rem .45rem;
    font-size: .76rem;
    margin-bottom: .2rem;
}
.avis-style-compact .avis-recap-detail-title { font-size: .8rem; margin-top: .35rem; }
.avis-style-compact .avis-recap-created { font-size: .74rem; }
.avis-style-compact .avis-section-title {
    font-size: .78rem;
    margin-bottom: .35rem;
    padding-bottom: .2rem;
    border-bottom: 1px solid #0b5c4a;
    color: #0b5c4a;
}
.avis-style-compact .avis-section-title::before { content: none; }
.avis-style-compact .avis-subsection-label { font-size: .65rem; margin-bottom: .25rem; }
.avis-style-compact .avis-box {
    border: none;
    border-bottom: 1px dotted #d8e4df;
    border-radius: 0;
    padding: .2rem 0;
    min-height: 0;
    background: transparent;
    display: flex;
    gap: .35rem;
    align-items: baseline;
}
.avis-style-compact .avis-box-label {
    flex: 0 0 38%;
    font-size: .68rem;
    margin: 0;
}
.avis-style-compact .avis-box-value {
    flex: 1;
    font-size: .76rem;
    font-weight: 600;
    color: #14241f;
}
.avis-style-compact .avis-box-row {
    gap: 0;
    margin-bottom: .15rem;
    border: 1px solid #e0ebe7;
    padding: .15rem .35rem;
    background: #fafcfb;
}
.avis-style-compact .avis-scroll-row {
    flex-direction: column;
    overflow: visible;
}
.avis-style-compact .avis-scroll-row .avis-box { flex: none; width: 100%; }
.avis-style-compact .avis-table-wrap { border: 1px solid #d8e4df; border-radius: 0; }
.avis-style-compact .avis-benef-table { font-size: .74rem; }
.avis-style-compact .avis-benef-table th,
.avis-style-compact .avis-benef-table td { padding: .28rem .35rem; }
.avis-style-compact .avis-subscriber-set-separated {
    margin-bottom: .65rem;
    padding-bottom: .55rem;
}
.avis-style-compact .avis-section { margin-bottom: .55rem; }
.avis-style-compact .avis-qr { width: 88px; height: 88px; }

@media (max-width: 900px) {
    .avis-box-row-5,
    .avis-box-row-4,
    .avis-box-row-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 560px) {
    .avis-box-row-5,
    .avis-box-row-4,
    .avis-box-row-3,
    .avis-box-row-2 {
        grid-template-columns: 1fr;
    }
    .avis-recap-header-aside {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ——— Portail compact : barre, listes, détail ——— */
body.page-portal-compact .topbar-inner {
    padding: .6rem 1rem;
}
body.page-portal-compact .brand {
    font-size: 1.05rem;
}
body.page-portal-compact .nav a {
    font-size: .82rem;
    padding: .3rem .45rem;
}
body.page-portal-compact .nav-account-trigger {
    font-size: .78rem;
    padding: .3rem .6rem;
}
body.page-portal-compact .footer {
    font-size: .78rem;
    padding: .65rem 0;
    color: var(--muted);
}
body.page-portal-compact .footer .container {
    padding-top: 0;
    padding-bottom: 1rem;
}
body.page-portal-compact .search-box.card {
    padding: .65rem .75rem;
}
body.page-portal-compact .search-box-head h2,
body.page-portal-compact .search-box h2 {
    font-size: .9rem !important;
}
body.page-portal-compact .detail-top-avis-actions {
    margin: 0 0 .75rem !important;
    padding-bottom: .75rem !important;
    gap: .4rem !important;
}
body.page-portal-compact .detail-avis-wrap .avis-recap {
    padding: .7rem .85rem;
}
body.page-portal-compact .stat {
    padding: .75rem .85rem;
}
body.page-portal-compact .card > .actions:first-child,
body.page-portal-compact .benef-page-toolbar .actions {
    gap: .4rem;
}
body.page-portal-compact .wizard-nav-actions .btn {
    min-height: 2rem;
}
body.page-portal-compact .avis-recap-actions .btn {
    padding: .38rem .7rem;
    font-size: .82rem;
}

/* Menu Actions — liste bénéficiaires */
.benef-actions-cell {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
}
.row-action-menu {
    position: relative;
    display: inline-block;
}
.row-action-toggle::after {
    content: ' ▾';
    font-size: .75em;
    opacity: .85;
}
.row-action-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 60;
    min-width: 12.5rem;
    max-width: 18rem;
    padding: .35rem 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(20, 36, 31, 0.14);
}
.row-action-menu.is-open .row-action-dropdown {
    display: block;
}
.row-action-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: .45rem .75rem;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: .82rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    white-space: normal;
    line-height: 1.35;
}
.row-action-item:hover:not(.is-disabled) {
    background: var(--brand-soft);
    color: var(--brand);
}
.row-action-item.row-action-danger {
    color: var(--danger);
}
.row-action-item.row-action-danger:hover {
    background: #fef2f2;
    color: #991b1b;
}
.row-action-item.row-action-warn {
    color: var(--warn);
}
.row-action-item.row-action-link {
    color: var(--brand);
    font-weight: 600;
}
.row-action-item.is-disabled {
    color: var(--muted);
    cursor: not-allowed;
    font-size: .78rem;
}
.benef-edit-modal-card {
    max-width: min(720px, 96vw);
    max-height: 90vh;
    overflow: auto;
}

/* Mise en évidence bénéficiaire — détail demande */
.avis-recap-benef-table tr.avis-benef-row-highlight td,
.avis-benef-table tr.avis-benef-row-highlight td {
    font-weight: 700;
    color: #0b5c8c;
    background: #e8f4fc;
}
.avis-recap-benef-table tr.avis-benef-row-highlight td:first-child,
.avis-benef-table tr.avis-benef-row-highlight td:first-child {
    box-shadow: inset 3px 0 0 #0b5c8c;
}

@media print {
    .topbar, .footer, .steps, .wizard-nav-actions, .wizard-recap-hint,
    .avis-recap-actions, .page-title, .avis-benef-toolbar, .avis-style-switcher { display: none !important; }
    body.page-portal-compact main.container,
    body.page-wizard main.container { padding: 0; }
    .avis-recap { border: none; padding: 0; }
}

/* ——— Barre latérale (toutes les pages connectées) ——— */
:root { --sidebar-w: 232px; --topbar-h: 48px; }

body.has-sidebar .topbar-inner {
    max-width: none;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.portal-sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    z-index: 40;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: .85rem .65rem 1rem;
    background: linear-gradient(180deg, #084c3d 0%, var(--brand) 60%, #0a6a55 100%);
    border-right: 2px solid var(--gold);
    box-shadow: 4px 0 18px rgba(11, 92, 74, .14);
    scrollbar-width: thin;
    scrollbar-color: rgba(198, 163, 90, .45) transparent;
}

.sidebar-section + .sidebar-section {
    margin-top: .85rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(198, 163, 90, .22);
}

.sidebar-section-bottom {
    margin-top: auto !important;
}

.sidebar-title {
    margin: 0 0 .35rem .55rem;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--gold-2);
    opacity: .9;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .65rem;
    margin-bottom: .15rem;
    border-radius: 9px;
    color: rgba(255, 255, 255, .9);
    font-size: .84rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: background var(--motion) ease, color var(--motion) ease, transform var(--motion) ease;
}

.sidebar-link .pi {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    color: var(--gold-2);
    transition: transform var(--motion) ease;
}

.sidebar-link:hover {
    background: rgba(198, 163, 90, .16);
    color: var(--gold-2);
    transform: translateX(2px);
}

.sidebar-link:hover .pi { transform: scale(1.08); }

.sidebar-link.active {
    background: rgba(198, 163, 90, .24);
    color: #fff8ea;
    font-weight: 600;
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: -.65rem;
    top: 18%;
    bottom: 18%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
}

.sidebar-logout { color: #fecaca; }
.sidebar-logout .pi { color: #fca5a5; }
.sidebar-logout:hover { background: rgba(185, 28, 28, .22); color: #fff; }

body.has-sidebar .portal-shell {
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - var(--topbar-h));
    display: flex;
    flex-direction: column;
}

body.has-sidebar .portal-shell > main { flex: 1; width: 100%; }

body.has-sidebar main.container,
body.has-sidebar .footer .container {
    max-width: none;
    margin: 0;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.sidebar-backdrop { display: none; }

body.has-sidebar .nav-toggle { margin-left: 0; margin-right: .25rem; }

@media (max-width: 900px) {
    body.has-sidebar .nav-toggle { display: inline-block; }
    body.has-sidebar .nav {
        display: flex;
        width: auto;
        flex-direction: row;
        background: none;
        padding: 0;
        margin-left: auto;
    }
    body.has-sidebar .nav-account { width: auto; }
    body.has-sidebar .nav-account-menu {
        position: absolute;
        width: auto;
        box-shadow: 0 12px 28px rgba(20, 36, 31, .16);
    }
    .portal-sidebar {
        transform: translateX(-105%);
        transition: transform var(--motion-slow) cubic-bezier(.22, 1, .36, 1);
        z-index: 60;
    }
    body.sidebar-open .portal-sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: var(--topbar-h) 0 0 0;
        z-index: 55;
        background: rgba(8, 40, 32, .35);
        backdrop-filter: blur(2px);
    }
    body.has-sidebar .portal-shell { margin-left: 0; }
}

/* ——— Détail demande : onglets (Détail / Documents / Document Contrat) ——— */
.detail-page-tabs {
    justify-content: flex-start;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--line);
}
.detail-doc-tabs { justify-content: flex-start; }
.detail-tab-count {
    display: inline-block;
    min-width: 1.4rem;
    margin-left: .3rem;
    padding: 0 .4rem;
    border-radius: 999px;
    font-size: .72rem;
    line-height: 1.35rem;
    text-align: center;
    background: var(--brand-soft);
    color: var(--brand);
}
.benef-tab.active .detail-tab-count {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}
.detail-doc-pane {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .75rem;
    background: #fff;
    overflow-x: auto;
}
.detail-contrat-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: .85rem;
    align-items: start;
}
.detail-contrat-list {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .5rem;
    background: var(--bg-soft);
}
.detail-contrat-list input[type="search"] { width: 100%; margin-bottom: .5rem; }
.detail-contrat-items {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    max-height: 70vh;
    overflow-y: auto;
}
.detail-contrat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    width: 100%;
    padding: .45rem .6rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: .82rem;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--motion) ease, background var(--motion) ease;
}
.detail-contrat-item:hover { border-color: rgba(11, 92, 74, .3); background: #f3faf7; }
.detail-contrat-item.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}
.detail-contrat-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-contrat-preview {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .65rem;
    background: #fff;
    overflow-x: auto;
}
.detail-contrat-item {
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
}
.detail-contrat-item .av-contrat-doc-tag { margin-left: 0; white-space: normal; }
.detail-contrat-item-name { max-width: 100%; }
@media (max-width: 900px) {
    .detail-contrat-layout { grid-template-columns: 1fr; }
    .detail-contrat-items { max-height: 260px; }
}
