/* Feuille de style du Web : écrite à la main, sans bibliothèque. Mêmes couleurs que la
   PWA, mais pensée pour un grand écran. */

:root {
    color-scheme: light dark;

    --green: #15803d;
    --green-strong: #166534;
    --red: #b91c1c;
    --amber: #b45309;
    --ink: #0f172a;
    --muted: #475569;
    --line: #cbd5e1;
    --page: #f1f5f9;
    --surface: #ffffff;
    --info-bg: #ecfdf5;
    --error-bg: #fef2f2;
    --focus: #1d4ed8;

    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --green: #22c55e;
        --green-strong: #16a34a;
        --red: #f87171;
        --amber: #fbbf24;
        --ink: #f1f5f9;
        --muted: #94a3b8;
        --line: #334155;
        --page: #0b1220;
        --surface: #162033;
        --info-bg: #10291c;
        --error-bg: #2d1518;
        --focus: #93c5fd;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--page);
}

h1, h2, p {
    margin: 0;
}

h1 {
    font-size: 1.625rem;
    line-height: 1.25;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.25rem;
    line-height: 1.25;
}

a {
    color: var(--green);
    font-weight: 600;
}

/* --- Structure --- */

.app-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding: 0.625rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}

.brand img {
    border-radius: 7px;
}

.app-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 60rem;
    margin: 0 auto;
    padding: 1.5rem;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card-narrow {
    width: 100%;
    max-width: 28rem;
    margin: 2rem auto 0;
}

.card-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.eyebrow {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.hint {
    font-size: 0.9375rem;
    color: var(--muted);
}

/* --- Formulaires --- */

form {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

label {
    font-weight: 600;
}

input:not([type="hidden"]) {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: inherit;
    background: var(--page);
    border: 1.5px solid var(--line);
    border-radius: 10px;
}

.code-input {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.5rem 1.125rem;
    font: inherit;
    font-weight: 700;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}

.button-primary {
    margin-top: 0.375rem;
    color: #ffffff;
    background: var(--green-strong);
    border-color: var(--green-strong);
}

@media (prefers-color-scheme: dark) {
    .button-primary {
        color: #052e16;
    }
}

/* Les actions d'une carte : plus discrètes que le bouton principal d'un formulaire. */
.button-small {
    min-height: 36px;
    padding: 0.25rem 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Ce qui retire, révoque ou désactive. */
.button-danger {
    color: var(--red);
    border-color: var(--red);
}

.button:disabled {
    opacity: 0.6;
    cursor: default;
}

.link {
    padding: 0.375rem 0;
    font: inherit;
    font-weight: 600;
    color: var(--green);
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
}

.secondary-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 1.5rem;
}

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

/* --- Tableau des réponses --- */

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

thead th {
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

tbody th {
    font-weight: 600;
}

td {
    font-variant-numeric: tabular-nums;
}

.summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    font-size: 0.875rem;
    font-weight: 700;
    border: 1.5px solid currentColor;
    border-radius: 999px;
}

.badge-present {
    color: var(--green);
}

.badge-absent {
    color: var(--red);
}

.badge-maybe {
    color: var(--amber);
}

.badge-waitlist {
    color: var(--amber);
}

/* Un accompagnant suit le membre qui l'amène, en retrait. */
.attendee-guest {
    padding-left: 1.5rem;
    font-weight: 400;
}

.attendee-host {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--muted);
}

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

/* --- Messages --- */

.message {
    padding: 0.75rem 0.875rem;
    border-radius: 10px;
    font-size: 0.9375rem;
}

.message-info {
    background: var(--info-bg);
}

.message-error {
    background: var(--error-bg);
    color: var(--red);
    font-weight: 600;
}

/* --- Erreur imprévue de l'application --- */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    padding: 0.875rem 1.5rem;
    color: #ffffff;
    background: #7f1d1d;
}

#blazor-error-ui a {
    color: #ffffff;
    font-weight: 700;
}

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

/* --- Indicateur du direct --- */

.live::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.375rem;
    border-radius: 50%;
    background: currentColor;
}

.live-on {
    color: var(--green);
    font-weight: 600;
}

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

/* --- Tableau de bord (EF-DSH-01, EF-DSH-04) --- */

.dashboard-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.dashboard-filter[aria-pressed="true"] {
    color: #fff;
    background: var(--amber);
    border-color: var(--amber);
}

.dashboard {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-activity {
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-left-width: 0.375rem;
    border-radius: 0.5rem;
}

/* À risque : un liseré, la mention « À traiter » et la raison en mots — pas seulement une couleur. */
.dashboard-risky {
    border-left-color: var(--amber);
}

.dashboard-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.dashboard-title {
    font-size: 1.0625rem;
    font-weight: 600;
}

.badge-risk {
    color: var(--amber);
    font-weight: 700;
}

.dashboard-next {
    margin: 0.375rem 0;
}

.dashboard-state {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-present {
    font-weight: 600;
}

.dashboard-risks {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
    font-weight: 600;
}

/* --- Navigation --- */

.app-nav {
    display: flex;
    flex: 1;
    gap: 1.25rem;
    margin-left: 1rem;
}

.app-nav a {
    color: var(--ink);
    text-decoration: none;
}

.app-nav a:hover {
    text-decoration: underline;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.page-header .button-primary {
    margin-top: 0;
}

.breadcrumb {
    font-size: 0.9375rem;
}

a.button {
    text-decoration: none;
}

/* --- Activités --- */

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.activity-list h2 a {
    color: var(--ink);
}

.description {
    white-space: pre-line;
}

/* --- Formulaire d'activité --- */

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: none;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.625rem 1rem;
}

legend {
    margin-bottom: 0.375rem;
    padding: 0;
    font-weight: 600;
}

.optional {
    font-weight: 400;
    color: var(--muted);
}

textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: inherit;
    background: var(--page);
    border: 1.5px solid var(--line);
    border-radius: 10px;
}

textarea {
    resize: vertical;
}

[aria-invalid="true"] {
    border-color: var(--red);
}

.field-error {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--red);
}

.days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.day {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.375rem 0.875rem;
    font-weight: 400;
    background: var(--page);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
}

.day:has(input:checked) {
    font-weight: 700;
    border-color: var(--green-strong);
}

.day input[type="checkbox"] {
    width: 1.125rem;
    min-height: 0;
    height: 1.125rem;
    padding: 0;
    accent-color: var(--green-strong);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
    margin-top: 0.375rem;
}

.form-actions .button-primary {
    margin-top: 0;
}

/* --- Séances : liste et calendrier --- */

.view-switch,
.month-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.view-switch a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.375rem 1rem;
    color: var(--ink);
    text-decoration: none;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 10px;
}

.view-switch a[aria-current="page"] {
    color: #ffffff;
    background: var(--green-strong);
    border-color: var(--green-strong);
}

@media (prefers-color-scheme: dark) {
    .view-switch a[aria-current="page"] {
        color: #052e16;
    }
}

.session-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.session-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1rem;
    padding: 0.625rem 0;
    border-top: 1px solid var(--line);
}

.session-date {
    min-width: 13rem;
    font-weight: 700;
}

.session-date::first-letter {
    text-transform: uppercase;
}

.calendar {
    table-layout: fixed;
}

.calendar th,
.calendar td {
    padding: 0.375rem;
    text-align: left;
    vertical-align: top;
    border: 1px solid var(--line);
}

.calendar thead th {
    text-align: center;
}

.calendar abbr {
    text-decoration: none;
}

.calendar td {
    height: 4.25rem;
}

.calendar-empty {
    background: var(--page);
}

.calendar-day {
    display: block;
    font-size: 0.875rem;
    color: var(--muted);
}

.calendar-session {
    background: color-mix(in srgb, var(--green-strong) 14%, transparent);
}

.calendar-session .calendar-day {
    font-weight: 700;
    color: var(--ink);
}

.calendar-time {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
}

.calendar-past {
    background: none;
}

.calendar-past .calendar-time {
    font-weight: 400;
    color: var(--muted);
}

/* --- Annuler une séance, modifier l'horaire --- */

.session-actions {
    display: flex;
    gap: 1rem;
    margin-left: auto;
}

.session-when {
    margin-top: 0;
}

.session-when::first-letter {
    text-transform: uppercase;
}

.session-place {
    font-size: 0.9375rem;
    color: var(--muted);
}

.session-reason {
    flex-basis: 100%;
    font-size: 0.9375rem;
    color: var(--muted);
}

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

.change-summary {
    margin: 0;
    padding-left: 1.25rem;
}

/* --- Membres de la plateforme --- */

.member-actions {
    display: flex;
    /* En ligne : chaque bouton a la largeur de son texte, pas celle de la carte. */
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 0.5rem;
}

/* --- Liste ordonnée des remplaçants (RM-17) --- */

.backup-list {
    list-style: none;
    margin: 0.75rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.backup-list > li {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
}

.backup-list > li[draggable="true"] {
    cursor: grab;
}

.backup-list > li.dragging {
    opacity: 0.5;
}

.backup-list .member-actions {
    margin-top: 0;
}

.backup-rank {
    min-width: 1.75rem;
    font-weight: 700;
    text-align: center;
    color: var(--muted);
}

.backup-name {
    flex: 1 1 12rem;
}

/* --- Statuts des personnes inscrites (RM-15) --- */

.inline-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.inline-field select {
    width: auto;
}

/* Les accompagnants inscrits d'un membre, sous sa carte. */
.member-guests {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0.75rem 0 0 0.875rem;
    border-top: 1px solid var(--line);
    border-left: 3px solid var(--line);
}

.member-guests li + li {
    margin-top: 0.75rem;
}

.status-requests ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.status-requests li + li {
    margin-top: 0.875rem;
}

/* Une absence déclarée après l'échéance de réponse (RM-10). */
.badge-late {
    color: var(--amber);
    border-style: dashed;
}

.history-change {
    white-space: nowrap;
}

/* Un choix parmi quelques-uns, dans un formulaire : la cible fait toute la ligne. */
.choice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    font-weight: 400;
    cursor: pointer;
}

.choice input[type="radio"] {
    width: 1.125rem;
    min-height: 0;
    height: 1.125rem;
    padding: 0;
    accent-color: var(--green-strong);
}

/* --- Matrice des présences (J3-10) : une ligne par personne, une colonne par séance --- */

.matrix-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
}

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.matrix-legend .matrix-cell {
    margin-left: 0.5rem;
}

/* Vingt-quatre colonnes ne tiennent pas dans la colonne étroite des autres pages. */
.app-main:has(.matrix) {
    max-width: 110rem;
}

/* Le tableau défile dans sa carte ; les noms restent à gauche, les dates en haut. */
.matrix-table {
    max-height: 70vh;
    margin-top: 0.75rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
}

.matrix-table table {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.matrix-table thead th {
    min-width: 3.6rem;
    text-align: center;
    vertical-align: bottom;
    background: var(--surface);
    font-weight: 600;
    line-height: 1.25;
}

.matrix-table thead th a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.matrix-table thead th a:hover .matrix-date {
    text-decoration: underline;
}

.matrix-day {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
}

.matrix-date {
    display: block;
    white-space: nowrap;
}

.matrix-count {
    display: block;
    color: var(--green);
    font-size: 0.8rem;
}

.matrix-cancelled,
.matrix-cancelled .matrix-count {
    color: var(--muted);
}

.matrix-table .matrix-person {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 12rem;
    max-width: 18rem;
    text-align: left;
    background: var(--surface);
    font-weight: 600;
}

.matrix-table thead .matrix-person {
    z-index: 3;
}

.matrix-table td {
    padding: 2px;
    text-align: center;
}

.matrix-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    font-weight: 700;
    line-height: 1;
}

button.matrix-cell:not(:disabled) {
    cursor: pointer;
}

button.matrix-cell:not(:disabled):hover,
.matrix-active {
    border-color: currentColor;
}

button.matrix-cell:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.matrix-present {
    color: var(--green);
    background: color-mix(in srgb, var(--green) 14%, transparent);
}

/* RM-09 : la place a été relâchée à l'échéance — la case garde sa réponse, en pointillé. */
.matrix-released {
    outline: 2px dashed var(--amber);
    outline-offset: -3px;
}

.matrix-waitlist,
.matrix-maybe {
    color: var(--amber);
    background: color-mix(in srgb, var(--amber) 14%, transparent);
}

.matrix-absent {
    color: var(--red);
    background: color-mix(in srgb, var(--red) 12%, transparent);
}

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

/* En attente de la confirmation du serveur. */
.matrix-pending {
    opacity: 0.55;
}

.matrix-choice {
    padding: 0.6rem 0.75rem;
}

/* Le choix reçoit le clavier à l'ouverture : c'est son contenu qui montre où il est. */
.keyboard-choice:focus {
    outline: none;
}

.matrix-choice-title {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.matrix-choice-buttons {
    display: flex;
    gap: 0.4rem;
}

/* Compte rendu d'une liste d'adresses collée (EF-INV-03). */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.bulk-report {
    margin-bottom: 1rem;
}

.bulk-report th[scope="row"] {
    font-weight: normal;
    overflow-wrap: anywhere;
}

.bulk-skipped td {
    color: var(--muted);
}

/* J3-14 : une activité annulée, dans les listes. */
.badge-cancelled {
    color: var(--red);
}

/* Le transfert de propriété se déplie : deux gestes voulus avant de céder l'activité. */
.transfer {
    flex-basis: 100%;
}

.transfer summary {
    cursor: pointer;
    color: var(--green-strong);
    text-decoration: underline;
}

/* EF-BKP-06 : l'état de la cascade des remplaçants, pour l'organisateur. */
.cascade-status {
    font-weight: 600;
}

.cascade-offers {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.cascade-offer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-top: 1px solid var(--line);
}

.cascade-offer-name {
    font-weight: 600;
}

/* EF-BKP-04 : les interventions de l'organisateur sur la cascade. */
.cascade-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.cascade-candidates {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.cascade-candidate {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-top: 1px solid var(--line);
}

/* EF-BKP-05 : inviter quelqu'un d'autre, pour une séance seulement. */
.cascade-invite {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}
