/* =====================================================================
   Disponibilités SPV — feuille de styles
   Aucun style inline n'est utilisé (CSP style-src 'self').
   ===================================================================== */

:root {
    --ink: #1c2433;
    --ink-soft: #3a4557;
    --muted: #5d6878;
    --navy: #17243b;
    --navy-2: #22334f;
    --red: #b8261c;
    --red-dark: #951d15;
    --paper: #eef1f5;
    --surface: #ffffff;
    --line: #d9dee6;
    --line-soft: #e8ecf1;
    --focus: #2f6fdb;

    --attente-fg: #8a5200; --attente-bg: #fff1d6;
    --valide-fg: #17683a;  --valide-bg: #dff2e6;
    --refuse-fg: #a3231a;  --refuse-bg: #fbe3e0;
    --annule-fg: #566173;  --annule-bg: #e9edf2;

    --radius: 6px;
    --radius-lg: 10px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
}
a { color: var(--navy-2); }
a:hover { color: var(--red); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0 0 .75rem; }
code { font-size: .95em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.t-right { text-align: right; }
.t-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   Structure
   ------------------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 1rem;
    height: 60px; padding: 0 1.25rem;
    background: var(--navy); color: #fff;
    border-bottom: 3px solid var(--red);
}
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { width: 30px; height: 30px; color: var(--red); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1rem; letter-spacing: .01em; }
.brand-text small { font-size: .78rem; color: #b8c3d6; }
.topbar-user { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-name { font-weight: 600; font-size: .92rem; }
.user-role { font-size: .78rem; color: #b8c3d6; }

.nav-toggle {
    display: none; width: 40px; height: 40px; padding: 9px 8px;
    background: transparent; border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius);
    cursor: pointer; flex-direction: column; justify-content: space-between;
}
.nav-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; }

.shell { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
    width: 240px; flex: none;
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 1rem .75rem 2rem;
}
.nav-section + .nav-section { margin-top: 1.25rem; }
.nav-heading { margin: 0 0 .35rem .6rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.nav-link {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: .5rem .6rem; border-radius: var(--radius);
    color: var(--ink); text-decoration: none; font: inherit; font-size: .95rem;
    background: none; border: 0; text-align: left; cursor: pointer;
}
.nav-link:hover { background: var(--paper); color: var(--ink); }
.nav-link.is-active { background: var(--navy); color: #fff; }
.nav-count {
    min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px;
    background: var(--red); color: #fff; font-size: .78rem; font-weight: 700; text-align: center;
}
.nav-logout { color: var(--red); }
.nav-overlay { display: none; }

.main { flex: 1; min-width: 0; padding: 1.5rem 2rem 4rem; max-width: 1280px; }

.page-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.25rem;
}
.page-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; }
.page-sub { margin: .2rem 0 0; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem; margin-bottom: 1.25rem;
}
.card-narrow { max-width: 560px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.card-title { font-size: 1.05rem; font-weight: 650; }
.empty { color: var(--muted); margin: .25rem 0; }
.empty-state { text-align: center; padding: 2.5rem 1.25rem; }
.empty-state h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--red); margin: 0; }
.hint { color: var(--ink-soft); margin-bottom: 1rem; }

/* ---------------------------------------------------------------------
   Boutons, badges, alertes
   ------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 40px; padding: .45rem 1rem;
    font: inherit; font-weight: 600; font-size: .93rem; line-height: 1.2;
    border-radius: var(--radius); border: 1px solid transparent;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background-color .12s, border-color .12s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-soft); color: var(--ink); }
.btn-success { background: var(--valide-fg); color: #fff; }
.btn-success:hover:not(:disabled) { background: #11532e; color: #fff; }
.btn-danger { background: var(--surface); color: var(--red); border-color: #e7b6b1; }
.btn-danger:hover:not(:disabled) { background: var(--refuse-bg); color: var(--red-dark); }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .86rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; font-size: 1.35rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: .85rem; color: var(--red); text-decoration: underline; cursor: pointer; }

.badge {
    display: inline-block; padding: .12rem .55rem; border-radius: 999px;
    font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.badge-attente { background: var(--attente-bg); color: var(--attente-fg); }
.badge-valide  { background: var(--valide-bg);  color: var(--valide-fg); }
.badge-refuse  { background: var(--refuse-bg);  color: var(--refuse-fg); }
.badge-annule  { background: var(--annule-bg);  color: var(--annule-fg); }

.alert {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: .7rem 1rem; margin: 0 0 1rem; border-radius: var(--radius);
    border-left: 4px solid; background: var(--surface);
}
.alert-success { border-color: var(--valide-fg); background: var(--valide-bg); }
.alert-error   { border-color: var(--red); background: var(--refuse-bg); }
.alert-info    { border-color: var(--navy-2); background: #e4ebf6; }
.alert-warning { border-color: var(--attente-fg); background: var(--attente-bg); }
.alert-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.alert-close:hover { opacity: 1; }

.secret-box {
    border: 2px dashed var(--red); background: #fff; border-radius: var(--radius-lg);
    padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.secret-value code {
    display: inline-block; font-size: 1.4rem; letter-spacing: .08em; padding: .3rem .7rem;
    background: var(--paper); border-radius: var(--radius); user-select: all;
}

/* ---------------------------------------------------------------------
   Formulaires
   ------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > span { font-size: .86rem; font-weight: 600; color: var(--ink-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.help { color: var(--muted); font-size: .82rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="search"], select, textarea {
    width: 100%; min-height: 40px; padding: .45rem .65rem;
    font: inherit; font-size: 16px; color: var(--ink);
    background: #fff; border: 1px solid #c3cad5; border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid rgba(47,111,219,.25); outline-offset: 0; }
select:disabled { background: var(--paper); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; }
form.inline { display: inline; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .9rem; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .9rem; }
.filters .field { flex: 1 1 180px; }
.filters-actions { display: flex; gap: .5rem; }

.month-nav { display: flex; align-items: center; gap: .4rem; }
.month-label { min-width: 9.5rem; text-align: center; font-weight: 700; font-size: 1.05rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.tab {
    padding: .4rem .8rem; border-radius: 999px; text-decoration: none; font-size: .9rem; font-weight: 600;
    color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line);
}
.tab.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab-count { font-weight: 400; opacity: .75; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }

/* ---------------------------------------------------------------------
   Tableaux (empilés en cartes sur mobile)
   ------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: .82rem; font-weight: 600; color: var(--muted);
    padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: #f7f9fb;
}
.table td { padding: .65rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { white-space: nowrap; }
.table .actions .btn, .table .actions form { margin: .1rem 0 .1rem .25rem; }
.t-check { width: 2.5rem; }
.t-check input { width: 18px; height: 18px; }
.row-urgent td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.details .kv { display: inline-block; margin-right: .6rem; }
.details .kv b { color: var(--muted); font-weight: 600; }
.bulk-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Indicateurs
   ------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat {
    display: flex; flex-direction: column; gap: .2rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
}
.stat-value { font-size: 1.9rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .88rem; }
.meter { display: block; height: 6px; margin-top: .4rem; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--valide-fg); border-radius: 999px; transition: width .5s ease-out; }

/* ---------------------------------------------------------------------
   PLANNING — tableau de garde
   Chaque jour : une bande horaire 0h-24h + les cartes de créneaux.
   ------------------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .75rem; font-size: .85rem; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.lg { display: inline-block; width: 18px; height: 10px; border-radius: 2px; }
.lg-open { background: #fff; border: 2px solid var(--navy-2); }
.lg-full { background: var(--navy-2); }
.lg-mine { background: var(--red); }
.lg-closed { background: repeating-linear-gradient(135deg, #c3cad5 0 3px, #eef1f5 3px 6px); }

.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.plan-scale {
    display: grid; grid-template-columns: calc(88px + 1rem) repeat(4, 1fr);
    font-size: .75rem; color: var(--muted);
    padding: .4rem 1rem .3rem 0; border-bottom: 1px solid var(--line); background: #f7f9fb;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: sticky; top: 60px; z-index: 5;
}
.plan-scale span { grid-row: 1; }
.plan-scale span:nth-child(1) { grid-column: 2; }
.plan-scale span:nth-child(2) { grid-column: 3; }
.plan-scale span:nth-child(3) { grid-column: 4; }
.plan-scale span:nth-child(4) { grid-column: 5; }
.plan-scale span:nth-child(5) { grid-column: 5; justify-self: end; }

.plan-day { display: grid; grid-template-columns: 88px 1fr; border-bottom: 1px solid var(--line-soft); }
.plan-day:last-child { border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.plan-day.is-weekend { background: #f8f9fb; }
.plan-day.is-past { opacity: .55; }
.plan-day.is-today { box-shadow: inset 4px 0 0 var(--red); }
.plan-date {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding: .8rem .25rem; border-right: 1px solid var(--line-soft);
}
.plan-daynum { font-size: 1.6rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.plan-dayname { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.is-today .plan-daynum { color: var(--red); }
.plan-body { padding: .7rem 1rem .8rem; min-width: 0; }
.plan-none { color: var(--muted); font-size: .88rem; margin: .4rem 0 0; }

.timeline {
    position: relative; height: 12px; margin: .1rem 0 .7rem;
    border-radius: 3px;
    background:
        repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), #c9d0da calc(25% - 1px), #c9d0da 25%),
        repeating-linear-gradient(90deg, transparent 0, transparent calc(4.1667% - 1px), #e3e7ed calc(4.1667% - 1px), #e3e7ed 4.1667%),
        var(--paper);
}
.timeline-seg {
    position: absolute; top: 0; bottom: 0; left: 0; width: 0;
    border-radius: 3px; background: #fff; border: 2px solid var(--navy-2);
}
.timeline-seg.seg-full { background: var(--navy-2); }
.timeline-seg.seg-closed { background: repeating-linear-gradient(135deg, #c3cad5 0 3px, #eef1f5 3px 6px); border-color: #aab3c0; }
.timeline-seg.seg-mine { background: var(--red); border-color: var(--red-dark); }
.timeline-seg.seg-overflow { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.slot {
    position: relative; display: flex; flex-direction: column; gap: .3rem;
    padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface);
}
.slot-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem; padding-right: 1.8rem; }
.slot-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot-label { font-size: .85rem; color: var(--muted); }
.slot-meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .84rem; color: var(--ink-soft); }
.slot-count strong { font-size: 1rem; }
.slot-pending { color: var(--attente-fg); }
.slot-mine { display: flex; align-items: center; gap: .6rem; }
.slot.is-closed { background: repeating-linear-gradient(135deg, #fafbfc 0 8px, #f1f3f6 8px 16px); color: var(--muted); }
.slot.is-full:not(.is-mine-validee) .slot-state { font-weight: 600; color: var(--navy-2); }
.slot.is-mine-en_attente { border-color: var(--attente-fg); }
.slot.is-mine-validee { border-color: var(--valide-fg); box-shadow: inset 3px 0 0 var(--valide-fg); }
.slot.is-mine-refusee { border-color: #e7b6b1; }

.slot.is-selectable { cursor: pointer; border-color: #aeb8c7; transition: border-color .1s, background-color .1s; }
.slot.is-selectable:hover { border-color: var(--navy-2); }
.slot-check {
    position: absolute; top: .6rem; right: .6rem; width: 22px; height: 22px;
    border: 2px solid #9aa5b5; border-radius: 5px; background: #fff;
}
.slot.is-selected { border-color: var(--red); background: #fff6f5; box-shadow: 0 0 0 1px var(--red); }
.slot.is-selected .slot-check { background: var(--red); border-color: var(--red); }
.slot.is-selected .slot-check::after {
    content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
    border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.selection-bar {
    position: sticky; bottom: 1rem; z-index: 20;
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    margin-top: 1rem; padding: .75rem 1rem;
    background: var(--navy); color: #fff; border-radius: var(--radius-lg);
    box-shadow: 0 6px 24px rgba(23,36,59,.28);
}
.selection-count { font-weight: 600; margin-right: auto; }
.selection-bar .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }

/* Planning validé */
.roster { display: flex; flex-direction: column; gap: .75rem; }
.roster-day { display: grid; grid-template-columns: 88px 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.roster-day.is-weekend { background: #f8f9fb; }
.roster-day.is-today { box-shadow: inset 4px 0 0 var(--red); }
.roster-date { display: flex; flex-direction: column; align-items: center; padding: .8rem .25rem; border-right: 1px solid var(--line-soft); }
.roster-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; padding: .7rem 1rem; }
.roster-slot { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; background: #fff; }
.roster-slot.is-closed { opacity: .6; }
.roster-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem; margin-bottom: .35rem; }
.roster-count { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--valide-fg); }
.roster-count.is-short { color: var(--red); }
.roster-list { margin: 0; padding: 0; list-style: none; font-size: .92rem; }
.roster-list li { padding: .15rem 0; border-top: 1px dotted var(--line); }
.roster-list li:first-child { border-top: 0; }

/* ---------------------------------------------------------------------
   Administration : calendrier et édition de créneaux
   ------------------------------------------------------------------- */
.month-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.25rem 2rem; }
.month-tools .inline-form .field { min-width: 200px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.cal-head { background: #f7f9fb; padding: .45rem; text-align: center; font-size: .82rem; font-weight: 600; color: var(--muted); }
.cal-cell {
    position: relative; display: flex; flex-direction: column; gap: .2rem;
    min-height: 118px; padding: .45rem; background: var(--surface);
    color: var(--ink); text-decoration: none;
}
.cal-cell:hover { background: #f4f7fb; color: var(--ink); }
.cal-cell.is-out { background: #f7f9fb; }
.cal-cell.is-weekend { background: #fafbfc; }
.cal-cell.is-today .cal-num { color: #fff; background: var(--red); }
.cal-num { align-self: flex-start; font-weight: 700; font-size: .92rem; padding: 0 .35rem; border-radius: 4px; }
.cal-dayname { display: none; }
.cal-pending {
    position: absolute; top: .45rem; right: .45rem; min-width: 1.3rem; padding: 0 .3rem;
    background: var(--attente-bg); color: var(--attente-fg); border-radius: 999px; font-size: .75rem; font-weight: 700; text-align: center;
}
.cal-slot {
    display: flex; justify-content: space-between; gap: .3rem;
    font-size: .76rem; padding: .1rem .35rem; border-radius: 3px;
    background: #fff; border: 1px solid #aeb8c7; font-variant-numeric: tabular-nums;
}
.cal-slot b { font-weight: 700; }
.cal-slot.is-full { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.cal-slot.is-closed { background: var(--paper); color: var(--muted); text-decoration: line-through; }
.cal-empty { margin-top: auto; font-size: .78rem; color: var(--muted); }

.slot-edit { padding: .8rem 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: .5rem; }
.slot-edit:first-of-type { border-top: 0; }
.slot-edit.is-closed { opacity: .7; }
.slot-edit-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem; }
.slot-edit-form .field { flex: 1 1 130px; }
.slot-edit-form .field-sm { flex: 0 1 130px; }
.slot-edit-form .field-xs { flex: 0 1 100px; }
.slot-edit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; font-size: .88rem; color: var(--ink-soft); }
.slot-edit-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; }

.quick-select { display: flex; flex-wrap: wrap; gap: .4rem; }
.date-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem; }
.day-picks { display: flex; flex-wrap: wrap; gap: .4rem; }
.date-check { display: flex; align-items: center; gap: .35rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .86rem; cursor: pointer; background: #fff; }
.date-check:has(input:checked) { border-color: var(--red); background: #fff6f5; }
.date-check input { width: 16px; height: 16px; }

/* ---------------------------------------------------------------------
   Connexion
   ------------------------------------------------------------------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem;
    background: var(--navy);
    background-image: linear-gradient(180deg, var(--navy) 0, var(--navy) 55%, var(--paper) 55%);
}
.auth-card {
    width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--radius-lg);
    padding: 1.75rem 1.75rem 1.25rem; box-shadow: 0 12px 40px rgba(12,20,34,.25);
    border-top: 4px solid var(--red);
}
.auth-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.auth-brand .brand-mark { width: 40px; height: 40px; }
.auth-brand strong { display: block; font-size: 1.05rem; }
.auth-brand small { color: var(--muted); font-size: .85rem; }
.auth-title { font-size: 1.35rem; margin-bottom: 1rem; }
.auth-card .form { margin-bottom: 1rem; }

/* ---------------------------------------------------------------------
   Fenêtre de confirmation et notifications
   ------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    padding: 1rem; background: rgba(12,20,34,.55);
}
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: var(--radius-lg); padding: 1.25rem 1.35rem; box-shadow: 0 16px 48px rgba(0,0,0,.3); }
.modal-title { font-size: 1.1rem; margin-bottom: .6rem; }
.modal-body { margin-bottom: 1rem; }
.modal-body textarea { min-height: 80px; resize: vertical; margin-top: .5rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }

.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 110; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { padding: .7rem 1rem; border-radius: var(--radius); background: var(--navy); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast-error { background: var(--red); }
.toast-success { background: var(--valide-fg); }

/* ---------------------------------------------------------------------
   Tablette
   ------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .main { padding: 1.25rem 1.25rem 4rem; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------------
   Mobile : menu coulissant, tableaux en cartes, calendrier en liste
   ------------------------------------------------------------------- */
@media (max-width: 800px) {
    .nav-toggle { display: flex; }
    .topbar { padding: 0 .75rem; gap: .6rem; }
    .topbar-user { display: none; }
    .sidebar {
        position: fixed; top: 60px; bottom: 0; left: 0; z-index: 40;
        transform: translateX(-100%); transition: transform .2s ease-out; overflow-y: auto;
        box-shadow: 4px 0 24px rgba(0,0,0,.15);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .nav-overlay { display: block; position: fixed; inset: 60px 0 0 0; z-index: 35; background: rgba(12,20,34,.4); }
    .main { padding: 1rem .75rem 5rem; }
    .page-title { font-size: 1.35rem; }
    .field-row { grid-template-columns: 1fr; }

    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
    .table-stack td { padding: .2rem 0; border: 0; text-align: left; }
    .table-stack td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); }
    .table-stack .t-right, .table-stack .t-num { text-align: left; }
    .table-stack .actions { white-space: normal; padding-top: .4rem; }
    .table-stack .actions .btn, .table-stack .actions form { margin: .2rem .3rem .2rem 0; }

    .plan-scale { display: none; }
    .plan-day, .roster-day { grid-template-columns: 58px 1fr; }
    .plan-daynum { font-size: 1.3rem; }
    .plan-body { padding: .6rem .6rem .7rem; }
    .roster-slots { padding: .6rem; }
    .slots, .roster-slots { grid-template-columns: 1fr; }
    .selection-bar { bottom: .5rem; }

    .cal { display: flex; flex-direction: column; background: transparent; border: 0; gap: .4rem; }
    .cal-head, .cal-cell.is-out { display: none; }
    .cal-cell { min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); }
    .cal-dayname { display: inline; font-weight: 400; color: var(--muted); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}