:root {
    --gh-bg: #f6f7f1;
    --gh-side-bg: #ffffff;
    --gh-panel: #ffffff;
    --gh-ink: #1c2b22;
    --gh-sub: #6d7266;
    --gh-accent: #3f6b52;
    --gh-accent-dark: #1b2e24;
    --gh-line: #dde1d1;
    --gh-tag-bg: #e3ede4;
    --gh-warn-bg: #f5ecd6;
    --gh-warn-ink: #8a6c2f;
    --gh-mono: ui-monospace, Menlo, Consolas, monospace;
}

html, body {
    background: var(--gh-bg);
    color: var(--gh-ink);
}

body {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── APP SHELL ── */
body:has(.sidebar) {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
}

.sidebar ~ * {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--gh-side-bg);
    border-right: 1px solid var(--gh-line);
    padding: 1.4rem 1.1rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    box-sizing: border-box;
}

.sidebar .brand {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--gh-accent-dark);
    margin-bottom: 1.8rem;
    text-decoration: none;
    display: block;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    flex: 1;
}

.sidebar nav a {
    display: block;
    font-size: .82rem;
    color: #596155;
    padding: .55rem .65rem;
    border-radius: 4px;
    text-decoration: none;
}

.sidebar nav a:hover {
    background: var(--gh-tag-bg);
    color: var(--gh-accent-dark);
}

.sidebar nav .group-label {
    font-size: .64rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--gh-sub);
    padding: .9rem .65rem .2rem;
    margin: 0;
}

.sidebar nav .sub a {
    padding-left: 1.3rem;
}

.sidebar .who {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gh-line);
    font-size: .75rem;
    color: var(--gh-sub);
}

.sidebar .who b {
    display: block;
    color: var(--gh-ink);
    font-size: .85rem;
    font-weight: 600;
}

.sidebar .who > span {
    display: block;
    margin-bottom: .6rem;
}

.sidebar .who-links a {
    font-size: .78rem;
    color: var(--gh-accent);
    text-decoration: none;
    margin-right: .8rem;
}

.sidebar .who-links a.is-danger {
    color: #a24a3d;
}

.sidebar .who-links a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    body:has(.sidebar) {
        flex-direction: column;
        align-items: stretch;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: .8rem 1rem;
    }

    .sidebar .brand {
        margin-bottom: 0;
        margin-right: 1.2rem;
    }

    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: .1rem .3rem;
    }

    .sidebar nav .group-label {
        padding: 0;
        margin-left: .4rem;
    }

    .sidebar nav .sub {
        display: contents;
    }

    .sidebar nav .sub a {
        padding-left: .65rem;
    }

    .sidebar .who {
        margin: 0 0 0 auto;
        padding-top: 0;
        border-top: none;
        text-align: right;
    }
}

/* ── PAGE PANEL (contenu principal) ── */
.main-card {
    background-color: var(--gh-panel);
    border: 1px solid var(--gh-line);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(27, 46, 36, .06);
    box-sizing: border-box;
    padding: 2rem 2.4rem 2.6rem;
    width: 90%;
    max-width: 1100px;
    margin: 2rem auto;
}

.main-card.is-transparent {
    background-color: transparent;
    border: none;
}

@media (max-width: 768px) {
    .main-card {
        width: 100%;
        border-radius: 0;
        padding: 1.6rem;
    }
}

.main-card .header {
    text-align: center;
}

.main-card .header .title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-weight: 400;
    color: var(--gh-ink);
}

.main-card .header hr {
    background: var(--gh-line);
    height: 1px;
    border-top: 2px solid var(--gh-accent);
    max-width: 64px;
    margin: 1rem auto 1.8rem;
}

.main-card img {
    border-radius: 8px;
}

.image-crop {
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ── TABLES ── */
.main-card table.table {
    background: transparent;
    font-size: .88rem;
}

.main-card table.table thead th {
    text-align: left;
    font-size: .66rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gh-sub);
    border-bottom: 2px solid var(--gh-accent-dark) !important;
    background: transparent;
}

.main-card table.table td {
    border-bottom-color: var(--gh-line);
    vertical-align: middle;
}

.main-card table.table.is-striped tbody tr:not(.is-selected):nth-child(even) {
    background-color: #fafaf6;
}

/* ── STATUS PILLS ── */
.pill {
    display: inline-block;
    font-size: .7rem;
    padding: .2rem .55rem;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: .02em;
}

.pill.ok {
    background: var(--gh-tag-bg);
    color: var(--gh-accent-dark);
}

.pill.wait {
    background: var(--gh-warn-bg);
    color: var(--gh-warn-ink);
}

/* Statut neutre non actionnable (ex: "Votre rang", "Rang système") */
.pill.muted {
    background: var(--gh-bg);
    border: 1px solid var(--gh-line);
    color: var(--gh-ink);
    font-weight: 500;
}

/* ── ÉVÉNEMENTS À VENIR (accueil) ── */
.section-label {
    font-size: .66rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--gh-sub);
    margin: 0 0 .8rem;
}

.event-list {
    border-top: 1px solid var(--gh-line);
}

.event-row {
    display: flex;
    gap: 1.2rem;
    align-items: baseline;
    padding: .9rem 0;
    border-bottom: 1px solid var(--gh-line);
}

.event-when {
    flex-shrink: 0;
    width: 8rem;
    font-family: var(--gh-mono);
    font-size: .82rem;
    color: var(--gh-accent-dark);
}

.event-main {
    min-width: 0;
}

.event-title {
    font-size: .92rem;
    font-weight: 600;
}

.event-location {
    font-size: .78rem;
    color: var(--gh-sub);
}

.event-empty {
    padding: .9rem 0;
    border-bottom: 1px solid var(--gh-line);
    color: var(--gh-sub);
    font-size: .88rem;
}

.section-more {
    margin: 1rem 0 0;
    text-align: right;
}

.section-more a {
    font-size: .82rem;
    color: var(--gh-accent);
    text-decoration: none;
    border-bottom: 1px solid var(--gh-accent);
    padding-bottom: 1px;
}

/* ── BOUTONS ──
   Un seul bouton plein et affirmé par écran (l'action principale, is-primary/
   is-success) ; tout le reste (actions de ligne dans les tableaux) reste en
   fantôme pour ne pas transformer chaque rangée en mur de blocs colorés. */
.button {
    border-radius: 3px;
    border-width: 1.5px;
    box-shadow: none !important;
    font-weight: 600;
    transition: background-color .15s, color .15s, border-color .15s;
}

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

.button[disabled] {
    opacity: .5;
}

/* Neutre : Annuler, Fermer... */
.button:not(.is-primary):not(.is-success):not(.is-info):not(.is-warning):not(.is-danger):not(.is-dark) {
    background: var(--gh-panel);
    border-color: var(--gh-line);
    color: var(--gh-ink);
}

.button:not(.is-primary):not(.is-success):not(.is-info):not(.is-warning):not(.is-danger):not(.is-dark):hover {
    border-color: var(--gh-sub);
    background: var(--gh-bg);
}

/* Action principale : pleine, affirmée */
.button.is-primary,
.button.is-success {
    background: var(--gh-accent-dark);
    border-color: var(--gh-accent-dark);
    color: #fff;
}

.button.is-primary:hover,
.button.is-success:hover {
    background: var(--gh-accent);
    border-color: var(--gh-accent);
    color: #fff;
}

.button.is-primary:not(.is-small),
.button.is-success:not(.is-small) {
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .78rem;
    padding-left: 1.3rem;
    padding-right: 1.3rem;
}

/* Actions secondaires (lignes de tableau) : fantômes, colorées par la bordure/le texte */
.button.is-info,
.button.is-warning,
.button.is-danger,
.button.is-dark {
    background: transparent;
}

.button.is-info {
    border-color: #55708a;
    color: #55708a;
}

.button.is-info:hover {
    background: #55708a;
    color: #fff;
}

.button.is-warning {
    border-color: var(--gh-warn-ink);
    color: var(--gh-warn-ink);
}

.button.is-warning:hover {
    background: var(--gh-warn-ink);
    color: #fff;
}

.button.is-danger {
    border-color: #a24a3d;
    color: #a24a3d;
}

.button.is-danger:hover {
    background: #a24a3d;
    color: #fff;
}

.button.is-dark {
    border-color: var(--gh-sub);
    color: var(--gh-sub);
}

/* ── MODALES ── */
.modal-card-head {
    background: var(--gh-panel);
    border-bottom: 2px solid var(--gh-accent-dark);
    padding: 1.1rem 1.6rem;
    box-shadow: none;
}

.modal-card-title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.15rem;
    color: var(--gh-ink);
}

.modal-card-body {
    padding: 1.6rem;
}

.modal-card-body .label {
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gh-sub);
    font-weight: 600;
}

.modal-card-body .help {
    color: var(--gh-sub);
}

.modal-card-foot {
    background: var(--gh-bg);
    border-top: 1px solid var(--gh-line);
    padding: 1rem 1.6rem;
}

/* Champs multiples dans un même .control (ex: date + heure) */
.control.field-group {
    display: flex;
    gap: .6rem;
}

.control.field-group .input {
    flex: 1;
    min-width: 0;
}

/* ── PERMISSIONS EN GRILLE (modales de rangs) ── */
.crud-row {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1.4rem;
}

.crud-row .checkbox,
.crud-row .radio {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .86rem;
    margin: 0 !important;
}

.crud-row .radio.has-text-grey-light {
    color: var(--gh-sub);
    opacity: .6;
}

/* ── ENCART D'INFO (façon mission-banner du site) ── */
.callout {
    background: var(--gh-tag-bg);
    border-left: 4px solid var(--gh-accent-dark);
    padding: .9rem 1.2rem;
    margin-bottom: 1.6rem;
    font-size: .84rem;
    color: var(--gh-ink);
}

.callout p {
    margin: 0;
}

.callout p + p {
    margin-top: .4rem;
}

.callout .legend {
    color: var(--gh-sub);
    letter-spacing: .02em;
}

/* ── GROUPES DE BOUTONS D'ACTION (tables) ── */
.main-card td .buttons {
    margin: 0;
    gap: .4rem;
    flex-wrap: nowrap;
}

/* ── LISTE DE DÉTAILS (modale détail d'événement) ── */
.detail-row {
    display: flex;
    gap: 1rem;
    padding: .55rem 0;
    border-bottom: 1px solid var(--gh-line);
}

.detail-row:last-of-type {
    border-bottom: none;
}

.detail-row .k {
    flex-shrink: 0;
    width: 90px;
    font-size: .66rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gh-sub);
    padding-top: .15rem;
}

.detail-row .v {
    font-size: .88rem;
    color: var(--gh-ink);
}

/* ── MODALES ÉVÉNEMENT : largeur confortable pour carte + formulaire ── */
#event-modal .modal-card,
#event-detail-modal .modal-card {
    width: 92%;
    max-width: 720px;
}

/* ── SECTIONS DE FORMULAIRE (création/édition d'événement) ── */
.form-section-title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-weight: 400;
    font-size: .85rem;
    color: var(--gh-accent-dark);
    margin: 1.5rem 0 .8rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--gh-line);
}

.form-section-title:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.field-row {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
}

.field-row > .field {
    flex: 1;
    min-width: 0;
}

.field-row > .field-checkbox {
    display: flex;
    align-items: center;
    padding-top: 1.6rem;
}

/* ── DÉTAIL D'ÉVÉNEMENT (calendrier) ── */
.event-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .7rem;
}

.event-detail-title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.25rem;
    color: var(--gh-ink);
    margin: 0;
}

.event-detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
}

.event-detail-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: var(--gh-bg);
    border: 1px solid var(--gh-line);
    border-radius: 999px;
    padding: .35rem .75rem;
    font-size: .8rem;
    color: var(--gh-ink);
}

.event-detail-chip svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--gh-sub);
}

.event-detail-description {
    font-size: .88rem;
    line-height: 1.55;
    color: var(--gh-ink);
    margin: 0 0 1.2rem;
    max-height: 9rem;
    overflow-y: auto;
    white-space: pre-wrap;
}

#detail-map {
    border: 1px solid var(--gh-line);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.event-detail-meta {
    font-size: .74rem;
    color: var(--gh-sub);
    margin: 1rem 0 0;
}

.pill.is-public {
    background: var(--gh-tag-bg);
    color: var(--gh-accent-dark);
}

.pill.is-private {
    background: #e6ecf1;
    color: #55708a;
}

.pill.status-pending {
    background: var(--gh-warn-bg);
    color: var(--gh-warn-ink);
}

.pill.status-confirmed {
    background: var(--gh-tag-bg);
    color: var(--gh-accent-dark);
}

.pill.status-rejected {
    background: #f3e1dd;
    color: #a24a3d;
}

/* ── EFFECTIFS (inscriptions à un événement, intranet seulement) ── */
.registrations-section {
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--gh-line);
}

.registrations-title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-weight: 400;
    font-size: .95rem;
    color: var(--gh-ink);
    margin: 0 0 .6rem;
}

.registrations-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--gh-line);
    overflow: hidden;
    margin-bottom: .5rem;
}

.registrations-progress-fill {
    height: 100%;
    width: 0;
    background: var(--gh-accent);
    border-radius: 999px;
    transition: width .3s ease;
}

.registrations-count {
    font-size: .8rem;
    color: var(--gh-sub);
    margin: 0 0 .8rem;
}

.registration-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--gh-line);
    font-size: .85rem;
}

.registration-row:last-child {
    border-bottom: none;
}

.registration-avatar {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--gh-tag-bg);
    color: var(--gh-accent-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 700;
    flex-shrink: 0;
}

.registration-name {
    flex: 1;
    min-width: 0;
}

.registration-row .button.is-small {
    font-size: .68rem;
    padding: .15rem .5rem;
    height: auto;
}

.registration-admin-add {
    margin-top: .8rem;
    padding: .7rem .8rem;
    background: var(--gh-bg);
    border: 1px dashed var(--gh-line);
    border-radius: 5px;
}

.registration-admin-add .field-group {
    gap: .6rem;
}

.registration-admin-add .select select {
    font-size: .8rem;
}

.registration-self-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-top: .8rem;
    padding: .6rem .8rem;
    background: var(--gh-tag-bg);
    border-radius: 5px;
    font-size: .84rem;
    color: var(--gh-accent-dark);
}

.registration-self-action .button.is-small {
    font-size: .72rem;
    padding: .2rem .6rem;
    height: auto;
}

/* ── BARRE D'OUTILS + LÉGENDE (calendrier) ── */
.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: .5rem 0 1rem;
}

.calendar-legend {
    display: flex;
    gap: 1.2rem;
    font-size: .8rem;
    color: var(--gh-sub);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.legend-dot {
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot-public {
    background: #3f6b52;
}

.legend-dot-private {
    background: #55708a;
}

/* ── CALENDRIER (FullCalendar) ── */
#calendar {
    --fc-border-color: var(--gh-line);
    --fc-page-bg-color: var(--gh-panel);
    --fc-neutral-bg-color: var(--gh-bg);
    --fc-today-bg-color: var(--gh-tag-bg);
    --fc-button-bg-color: var(--gh-panel);
    --fc-button-border-color: var(--gh-line);
    --fc-button-text-color: var(--gh-ink);
    --fc-button-hover-bg-color: var(--gh-tag-bg);
    --fc-button-hover-border-color: var(--gh-accent);
    --fc-button-active-bg-color: var(--gh-accent-dark);
    --fc-button-active-border-color: var(--gh-accent-dark);
    --fc-event-bg-color: var(--gh-accent);
    --fc-event-border-color: var(--gh-accent-dark);
    font-size: .88rem;
}

#calendar .fc-toolbar-title {
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.3rem;
}

#calendar .fc-button {
    text-transform: capitalize;
    box-shadow: none !important;
}

/* ── STAT TILES (optionnel, pages type tableau de bord) ── */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .9rem;
    margin-bottom: 2rem;
}

.stat-tile {
    background: var(--gh-panel);
    border: 1px solid var(--gh-line);
    border-radius: 5px;
    padding: .9rem 1.1rem;
}

.stat-tile b {
    display: block;
    font-family: var(--gh-mono);
    font-size: 1.4rem;
    color: var(--gh-accent-dark);
}

.stat-tile span {
    font-size: .66rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gh-sub);
}
