:root {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    --bg: #f3f6f7;
    --surface: #ffffff;
    --surface-2: #f7f9fa;
    --text: #172126;
    --muted: #68767d;
    --border: #d9e1e4;

    --accent: #2d7580;
    --accent-hover: #256570;
    --accent-soft: #e4f0f2;

    --danger: #ad3939;
    --danger-bg: #fde7e7;
}

html[data-effective-theme="dark"] {
    --bg: #101519;
    --surface: #181e23;
    --surface-2: #20272d;
    --text: #eef3f5;
    --muted: #9ca9af;
    --border: #303a40;

    --accent: #72b7c1;
    --accent-hover: #8ac8d0;
    --accent-soft: #1d3338;

    --danger: #ef9b9b;
    --danger-bg: #3c2225;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    color: var(--text);
    background:
        radial-gradient(
            circle at 85% 0%,
            color-mix(
                in srgb,
                var(--accent) 8%,
                transparent
            ),
            transparent 32rem
        ),
        var(--bg);
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}


/* Login */

.login-page {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 24px;
}

.login-card {
    width: min(100%, 390px);

    padding: 28px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;

    box-shadow:
        0 18px 60px rgba(0, 0, 0, .08);
}

.login-brand,
.brand {
    display: flex;
    gap: 11px;
    align-items: center;
}

.login-brand > div:last-child,
.brand > div:last-child {
    display: grid;
    gap: 1px;
}

.login-brand span,
.brand span {
    color: var(--muted);
    font-size: 11px;
}

.brand-mark {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    color: #fff;
    background:
        linear-gradient(
            135deg,
            #367f88,
            #245e68
        );

    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
}

.login-heading {
    margin: 34px 0 22px;
}

.login-heading h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.login-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.login-form {
    display: grid;
    gap: 15px;
}

label {
    display: grid;
    gap: 6px;

    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

input {
    width: 100%;

    padding: 11px 12px;

    color: var(--text);
    background: var(--surface-2);

    border: 1px solid var(--border);
    border-radius: 9px;

    outline: none;
}

input:focus {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--accent) 13%,
            transparent
        );
}

.primary-button {
    padding: 11px 14px;

    color: #fff;
    background: #2d7580;

    border: 0;
    border-radius: 9px;

    font-weight: 700;
    cursor: pointer;
}

.primary-button:hover {
    background: #256570;
}

.error-message {
    margin-bottom: 15px;
    padding: 10px 12px;

    color: var(--danger);
    background: var(--danger-bg);

    border-radius: 8px;

    font-size: 12px;
}


/* Header */

.topbar {
    min-height: 68px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 0 28px;

    background:
        color-mix(
            in srgb,
            var(--surface) 91%,
            transparent
        );

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(12px);
}

.brand {
    text-decoration: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.theme-button {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    padding: 0;

    color: var(--text);
    background: var(--surface-2);

    border: 1px solid var(--border);
    border-radius: 9px;

    cursor: pointer;
}

.account-chip {
    min-height: 38px;

    display: grid;
    align-content: center;

    padding: 4px 11px;

    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.account-chip span {
    color: var(--muted);
    font-size: 9px;
}

.account-chip strong {
    font-size: 11px;
}

.logout-button {
    min-height: 38px;

    padding: 0 11px;

    color: var(--muted);
    background: transparent;

    border: 1px solid var(--border);
    border-radius: 9px;

    cursor: pointer;
}


/* Portal */

.portal-shell {
    width: min(1120px, calc(100% - 40px));

    margin: 0 auto;
    padding: 54px 0;
}

.portal-heading {
    margin-bottom: 25px;
}

.eyebrow {
    color: var(--accent);

    font-size: 11px;
    font-weight: 750;

    text-transform: uppercase;
    letter-spacing: .08em;
}

.portal-heading h1 {
    margin: 7px 0 0;

    font-size:
        clamp(27px, 4vw, 39px);

    letter-spacing: -.035em;
}

.service-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(280px, 1fr)
        );

    gap: 14px;
}

.service-card {
    min-height: 190px;

    display: flex;
    gap: 18px;

    padding: 22px;

    color: inherit;
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 15px;

    text-decoration: none;

    box-shadow:
        0 8px 28px rgba(0, 0, 0, .035);

    transition:
        transform .15s ease,
        border-color .15s ease,
        box-shadow .15s ease;
}

a.service-card:hover {
    transform: translateY(-2px);

    border-color:
        color-mix(
            in srgb,
            var(--accent) 60%,
            var(--border)
        );

    box-shadow:
        0 14px 34px rgba(0, 0, 0, .07);
}

.service-icon {
    flex: 0 0 48px;

    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    color: var(--accent);
    background: var(--accent-soft);

    border-radius: 12px;

    font-size: 11px;
    font-weight: 800;
}

.service-content {
    min-width: 0;

    display: flex;
    flex: 1;
    flex-direction: column;
}

.service-content h2 {
    margin: 2px 0 7px;
    font-size: 18px;
}

.service-content p {
    margin: 0;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.5;
}

.service-link {
    display: flex;
    align-items: center;
    gap: 7px;

    margin-top: auto;

    color: var(--accent);

    font-size: 12px;
    font-weight: 750;
}

.service-disabled {
    opacity: .62;
}

.service-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coming-badge {
    padding: 3px 6px;

    color: var(--muted);
    background: var(--surface-2);

    border: 1px solid var(--border);
    border-radius: 6px;

    font-size: 9px;
    font-weight: 750;
}

@media (max-width: 700px) {
    .topbar {
        padding: 0 14px;
    }

    .account-chip {
        display: none;
    }

    .portal-shell {
        width: min(
            100% - 24px,
            1120px
        );

        padding-top: 34px;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   Administration globale
   ============================================================ */

.admin-shell {
    width: min(1440px, calc(100% - 36px));
    margin: 0 auto;
    padding: 30px 0 45px;
}

.admin-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.admin-heading h1 {
    margin: 5px 0 0;
    font-size: 30px;
    letter-spacing: -.025em;
}

.service-filters {
    display: flex;
    gap: 5px;
    padding: 4px;

    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.service-filters a {
    padding: 7px 11px;

    color: var(--muted);

    border-radius: 7px;

    font-size: 11px;
    font-weight: 700;

    text-decoration: none;
}

.service-filters a.active {
    color: var(--text);
    background: var(--surface);

    box-shadow:
        0 1px 4px rgba(0, 0, 0, .08);
}


.global-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.global-stat {
    padding: 14px 16px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 11px;
}

.global-stat span {
    color: var(--muted);
    font-size: 11px;
}

.global-stat strong {
    display: block;
    margin-top: 3px;

    color: var(--accent);
    font-size: 25px;
}

.global-stat-danger strong {
    color: var(--danger);
}


.global-admin-layout {
    display: grid;
    grid-template-columns:
        minmax(0, 2.15fr)
        minmax(310px, .85fr);

    gap: 14px;
    align-items: start;
}


.global-panel {
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 13px;

    padding: 16px;
}

.global-panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin-bottom: 12px;
}

.global-panel-heading h2 {
    margin: 0;
    font-size: 16px;
}

.global-panel-heading p {
    margin: 3px 0 0;

    color: var(--muted);

    font-size: 10px;
}


.global-admin-side {
    display: grid;
    gap: 12px;
}


.global-pending-list {
    display: grid;
    gap: 6px;
}

.global-pending-item {
    width: 100%;

    display: grid;
    gap: 4px;

    padding: 10px;

    text-align: left;

    color: var(--text);
    background: var(--surface-2);

    border: 1px solid var(--border);
    border-radius: 9px;

    cursor: pointer;

    transition:
        border-color .15s ease,
        transform .15s ease;
}

.global-pending-item:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.global-pending-top {
    display: flex;
    gap: 6px;
    align-items: center;
}

.global-pending-item strong {
    font-size: 12px;
}

.pending-entity,
.pending-unit,
.pending-date {
    color: var(--muted);
    font-size: 10px;
}

.pending-entity {
    margin-left: auto;
}

.pending-reason-line {
    display: flex;
    gap: 6px;
    align-items: center;

    margin-top: 3px;

    font-size: 10px;
}


.service-mini,
.event-service {
    display: inline-grid;
    place-items: center;

    flex: 0 0 auto;

    min-width: 24px;
    height: 19px;

    padding: 0 5px;

    border-radius: 5px;

    font-size: 8px;
    font-weight: 800;
}

.service-effects {
    color: #dcefff;
    background: #235f93;
}

.service-oad {
    color: #ffedcd;
    background: #8a5a21;
}

.reservation-ref {
    color: var(--accent);

    font-size: 10px;
    font-weight: 750;
}


.global-reason {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    padding: 2px 5px;

    border-radius: 5px;

    font-size: 9px;
    font-weight: 750;
}

.global-reason.official {
    color: #dcefff;
    background: #205f9c;
}

.global-reason.personal {
    color: var(--text);
    background: var(--surface);

    border: 1px solid var(--border);
}


.grenade-icon {
    display: block;

    width: 7px;
    height: 11px;

    background: currentColor;

    -webkit-mask:
        url("/static/img/grenade-gendarmerie.svg")
        center / contain no-repeat;

    mask:
        url("/static/img/grenade-gendarmerie.svg")
        center / contain no-repeat;
}


.global-detail {
    min-height: 190px;
}

.global-detail h2 {
    margin: 9px 0 3px;

    font-size: 17px;
}

.global-detail-top {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 8px;
}

.global-detail-top > div {
    display: flex;
    gap: 6px;
    align-items: center;
}

.detail-entity {
    margin: 0 0 12px;

    color: var(--muted);

    font-size: 10px;
}


.global-detail-reason {
    display: flex;
    gap: 7px;
    align-items: flex-start;

    margin-bottom: 12px;
    padding: 9px;

    background: var(--surface-2);
    border-radius: 8px;

    font-size: 11px;
    line-height: 1.4;
}


.global-detail-dates {
    display: grid;
    grid-template-columns: repeat(3, 1fr);

    gap: 6px;
}

.global-detail-dates > div {
    display: grid;
    gap: 2px;

    padding: 7px;

    background: var(--surface-2);
    border-radius: 7px;
}

.global-detail-dates span,
.detail-label {
    color: var(--muted);
    font-size: 9px;
}

.global-detail-dates strong {
    font-size: 10px;
}


.global-requested-items {
    display: grid;
    gap: 4px;

    margin-top: 12px;
}

.global-requested-items > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;

    padding: 5px 0;

    border-bottom: 1px solid var(--border);

    font-size: 10px;
}


.detail-status {
    padding: 4px 7px;

    border-radius: 6px;

    font-size: 9px;
    font-weight: 750;
}

.detail-status.status-pending {
    color: #f2cb78;
    background: #3c311a;
}

.detail-status.status-approved {
    color: #9ae0b3;
    background: #1c3b29;
}

.detail-status.status-issued {
    color: #92ccef;
    background: #1d3546;
}

.detail-status.status-returned {
    color: var(--muted);
    background: var(--surface-2);
}

.detail-status.status-rejected,
.detail-status.status-cancelled {
    color: var(--danger);
    background: var(--danger-bg);
}


.global-detail-actions {
    display: grid;
    gap: 7px;

    margin-top: 14px;
    padding-top: 11px;

    border-top: 1px solid var(--border);
}

.global-detail-actions form {
    margin: 0;
}

.detail-reason-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
}

.detail-reason-form input {
    padding: 7px 8px;
    font-size: 10px;
}

.admin-primary,
.admin-danger {
    min-height: 32px;

    padding: 6px 10px;

    border-radius: 7px;

    font-size: 10px;
    font-weight: 750;

    cursor: pointer;
}

.admin-primary {
    color: #fff;
    background: #2d7580;

    border: 1px solid #2d7580;
}

.admin-danger {
    color: var(--danger);
    background: var(--danger-bg);

    border: 1px solid
        color-mix(
            in srgb,
            var(--danger) 45%,
            var(--border)
        );
}


.admin-service-link {
    display: block;

    padding: 10px;

    text-align: center;

    color: var(--muted);
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 9px;

    font-size: 10px;
    font-weight: 700;

    text-decoration: none;
}


.calendar-service-legend {
    display: flex;
    gap: 10px;

    color: var(--muted);

    font-size: 9px;
}

.calendar-service-legend span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-service {
    width: 8px;
    height: 8px;

    border-radius: 2px;
}

.legend-service.effects {
    background: #337db4;
}

.legend-service.oad {
    background: #a76d2a;
}


/* FullCalendar */

.global-event-content {
    display: flex;
    align-items: center;
    gap: 4px;

    min-width: 0;
}

.event-title {
    min-width: 0;

    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.event-official {
    width: 17px;
    height: 17px;

    display: grid;
    place-items: center;

    flex: 0 0 17px;

    color: #fff;
    background: #287ac5;

    border-radius: 5px;
}

.event-official .grenade-icon {
    width: 9px;
    height: 13px;
}

.event-personal {
    width: 7px;
    height: 7px;

    flex: 0 0 7px;

    border-radius: 50%;
    background: #fff;
}


.fc-event.status-pending {
    background: #624b18 !important;
    color: #ffe8ad !important;
    border-color: #806322 !important;
}

.fc-event.status-approved {
    background: #285b3d !important;
    color: #dcf7e6 !important;
    border-color: #34764f !important;
}

.fc-event.status-issued {
    background: #244d69 !important;
    color: #dcefff !important;
    border-color: #326a90 !important;
}

.fc-event.service-oad {
    outline:
        2px solid
        color-mix(
            in srgb,
            #b9792e 65%,
            transparent
        );
}


.admin-alert {
    margin-bottom: 12px;
    padding: 9px 12px;

    border-radius: 8px;

    font-size: 11px;
    font-weight: 650;
}

.admin-alert-error {
    color: var(--danger);
    background: var(--danger-bg);
}

.admin-alert-success {
    color: #83d9a5;
    background: #1c3a29;
}

.empty-copy {
    color: var(--muted);

    font-size: 10px;
    line-height: 1.5;
}

.admin-error-copy {
    color: var(--danger);
    font-size: 11px;
}


@media (max-width: 950px) {
    .global-admin-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .admin-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .service-filters {
        width: 100%;

        overflow-x: auto;
    }

    .global-stats {
        grid-template-columns: 1fr 1fr;
    }

    .global-detail-dates {
        grid-template-columns: 1fr;
    }
}
