:root {
    --bg: #060911;
    --bg-2: #080D18;
    --bg-rgb: 6, 9, 17;
    --bg-2-rgb: 8, 13, 24;
    --card: #0C1322;
    --card-2: #101A2E;
    --card-3: #14213A;
    --card-rgb: 12, 19, 34;
    --card-2-rgb: 16, 26, 46;
    --card-3-rgb: 20, 33, 58;
    --line: #1A2540;
    --line-2: #223052;

    --blue: #1D4FD8;
    --blue-2: #2E6BE6;
    --blue-3: #5B8FF0;
    --blue-rgb: 29, 79, 216;
    --blue-2-rgb: 46, 107, 230;
    --blue-3-rgb: 91, 143, 240;
    --blue-glow: rgba(var(--blue-2-rgb), 0.28);

    /* Couleur de texte utilisée sur les fonds pleins en accent (.btn, .avatar,
       .org-select-btn:hover) — blanc par défaut, surchargée en sombre par les
       thèmes à accent clair (ex. theme-lssd.css, doré) pour rester lisible (WCAG AA). */
    --accent-text: #fff;

    --white: #EAF0FA;
    --text: #9FB0C9;
    --dim: #5D6F8C;

    --ok: #34D399;
    --ok-bg: rgba(52, 211, 153, 0.1);
    --warn: #FBBF24;
    --danger: #F26D6D;
    --danger-bg: rgba(242, 109, 109, 0.1);

    --r: 14px;
    --r-sm: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) var(--bg-2);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-2);
}

::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border: 2px solid var(--bg-2);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dim);
}

body {
    min-height: 100vh;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(1100px 640px at 12% -6%, rgba(var(--blue-rgb), 0.14), transparent 62%),
        radial-gradient(900px 700px at 92% 18%, rgba(var(--blue-2-rgb), 0.09), transparent 58%),
        radial-gradient(1000px 800px at 15% 92%, rgba(var(--blue-3-rgb), 0.07), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue-3);
    text-decoration: none;
}

h1, h2, h3, b, strong {
    color: var(--white);
    font-weight: 600;
}

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

/* ---------- Formulaires ---------- */

.label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dim);
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="email"],
input[type="date"],
input[type="week"],
input[type="time"],
input[type="number"],
select {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 15px;
    color: var(--white);
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
    background-position: calc(100% - 19px) 21px, calc(100% - 13px) 21px;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
}

input[type="date"],
input[type="week"],
input[type="time"],
input[type="number"] {
    color-scheme: dark;
}

textarea {
    width: 100%;
    min-height: 80px;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 15px;
    color: var(--white);
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    outline: none;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:hover {
    border-color: var(--line-2);
}

textarea:focus {
    border-color: var(--blue-2);
    box-shadow: 0 0 0 4px var(--blue-glow);
}

input::placeholder,
textarea::placeholder {
    color: #3A4A67;
}

input:hover,
select:hover {
    border-color: var(--line-2);
}

input:focus,
select:focus {
    border-color: var(--blue-2);
    box-shadow: 0 0 0 4px var(--blue-glow);
}

input[readonly] {
    color: var(--dim);
    background: var(--card);
    cursor: not-allowed;
}

input[type="file"] {
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

input[type="file"]::file-selector-button {
    padding: 7px 13px;
    margin-right: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--card-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
    background: var(--card-3);
}

input.invalid {
    border-color: var(--danger);
}

.field {
    margin-bottom: 15px;
}

.field-error {
    display: block;
    margin-top: 7px;
    font-size: 13px;
    color: var(--danger);
}

.hint {
    display: block;
    margin-top: 7px;
    font-size: 13px;
    color: var(--dim);
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
    gap: 0 20px;
}

.row-3 .btn {
    min-width: 160px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 19px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--accent-text);
    background: linear-gradient(135deg, rgba(var(--blue-2-rgb), 0.55), rgba(var(--blue-rgb), 0.55));
    border: 1px solid rgba(var(--blue-3-rgb), 0.4);
    border-radius: var(--r-sm);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 18px rgba(var(--blue-rgb), 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn svg {
    flex: none;
    width: 16px;
    height: 16px;
}

.btn:hover {
    background: linear-gradient(135deg, rgba(var(--blue-2-rgb), 0.75), rgba(var(--blue-rgb), 0.72));
    border-color: rgba(var(--blue-3-rgb), 0.65);
    box-shadow: 0 8px 26px rgba(var(--blue-rgb), 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-ghost {
    color: var(--text);
    background: rgba(var(--card-2-rgb), 0.55);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-ghost:hover {
    color: var(--white);
    background: rgba(var(--card-3-rgb), 0.7);
    box-shadow: none;
}

.btn-danger {
    color: var(--danger);
    background: rgba(242, 109, 109, 0.12);
    border: 1px solid rgba(242, 109, 109, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-danger:hover {
    color: #fff;
    background: rgba(194, 69, 63, 0.78);
    border-color: rgba(242, 109, 109, 0.5);
    box-shadow: none;
}

.btn-sm {
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 500;
}

.btn-icon {
    padding: 7px 11px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 22px;
    font-size: 15.5px;
}

.btn-discord {
    color: #fff;
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.62), rgba(64, 78, 237, 0.62));
    border-color: rgba(114, 137, 246, 0.45);
    box-shadow: 0 4px 18px rgba(64, 78, 237, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn-discord:hover {
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.85), rgba(64, 78, 237, 0.82));
    border-color: rgba(114, 137, 246, 0.7);
    box-shadow: 0 10px 30px rgba(64, 78, 237, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-discord svg {
    width: 19px;
    height: 19px;
}

/* ---------- Notices ---------- */

.notice {
    max-width: 880px;
    margin: 0 auto 18px;
    padding: 11px 15px;
    font-size: 14.5px;
    border-radius: var(--r-sm);
}

.notice-ok {
    color: #7DE2BB;
    background: var(--ok-bg);
    border: 1px solid rgba(52, 211, 153, 0.24);
}

.notice-error {
    color: #F5A0A0;
    background: var(--danger-bg);
    border: 1px solid rgba(242, 109, 109, 0.26);
}

.notice-line {
    max-width: none;
}

/* ---------- Pages publiques ---------- */

.auth {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 48px 20px;
}

.auth-box {
    width: 100%;
    max-width: 440px;
}

.auth-head {
    margin-bottom: 32px;
    text-align: center;
}

.auth-head img {
    width: 84px;
    height: 84px;
    margin-bottom: 20px;
}

.auth-head h1 {
    font-size: 24px;
    letter-spacing: -0.015em;
}

.auth-head p {
    margin-top: 6px;
    color: var(--dim);
}

.auth-panel {
    width: 100%;
    max-width: 460px;
    padding: 30px 28px;
    background: rgba(var(--card-rgb), 0.58);
    border: 1px solid var(--line);
    border-radius: 16px;
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.auth-hex {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    margin: 0 auto 20px;
    overflow: hidden;
    background: linear-gradient(160deg, var(--card-2), var(--bg-2));
    border: 1px solid var(--line-2);
    border-radius: 20px;
    box-shadow: 0 0 0 1px rgba(var(--blue-2-rgb), 0.14), 0 16px 34px rgba(0, 0, 0, 0.4);
}

.auth-hex img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-hex-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue-3);
    box-shadow: 0 0 14px 4px rgba(var(--blue-2-rgb), 0.6);
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--dim);
}

.auth-status-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 8px 2px rgba(52, 211, 153, 0.5);
}

.auth-actions-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    max-width: none;
    margin-top: 24px;
}

.auth-actions-row .btn {
    flex: none;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--dim);
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.auth-actions-row .btn:hover {
    color: var(--text);
    background: none;
    box-shadow: none;
}

.auth-actions-row .btn + .btn {
    padding-left: 10px;
    border-left: 1px solid var(--line);
}

.auth-lead {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dim);
    text-align: center;
}

.auth-hint {
    margin-top: 14px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--dim);
    text-align: center;
}

.auth-foot {
    margin-top: 24px;
    text-align: center;
}

.auth-foot a {
    font-size: 13px;
    color: var(--dim);
}

.auth-foot a:hover {
    color: var(--text);
}

.auth-head-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--card-2);
    border: 1px solid var(--line);
    color: var(--blue-2);
}

.auth-head-icon svg {
    width: 36px;
    height: 36px;
}

/* ---------- Écran de sélection de département (login.php) ---------- */

.auth-cinematic {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-skyline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 42%;
    background: repeating-linear-gradient(90deg, var(--line-2) 0, var(--line-2) 18px, transparent 18px, transparent 30px);
    -webkit-mask-image: linear-gradient(180deg, transparent, black 65%);
    mask-image: linear-gradient(180deg, transparent, black 65%);
    filter: blur(38px);
    opacity: 0.4;
}

.auth-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--blue-glow), transparent 60%);
}

.auth-fade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--bg) 0%, rgba(var(--bg-rgb), 0.85) 40%, var(--bg) 100%);
}

.auth-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1040px;
    padding: 20px 20px 0;
}

.auth-watermark {
    position: absolute;
    bottom: 0;
    left: 50%;
    z-index: -1;
    width: min(720px, 90%);
    transform: translateX(-50%);
    pointer-events: none;
}

.auth-watermark img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0.06;
}

.auth-badge {
    width: 72px;
    height: 72px;
    margin-bottom: 22px;
    padding: 12px;
    background: linear-gradient(160deg, var(--card-2), var(--bg-2));
    border: 1px solid var(--line-2);
    border-radius: 20px;
    box-shadow: 0 0 0 1px rgba(var(--blue-2-rgb), 0.14), 0 16px 34px rgba(0, 0, 0, 0.4);
}

.auth-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-kicker {
    margin-bottom: 30px;
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-3);
    letter-spacing: 4px;
    text-transform: uppercase;
}

.auth-title {
    max-width: 620px;
    margin: 0 0 14px;
    font-size: 40px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--white);
    letter-spacing: -0.02em;
    text-align: center;
}

.auth-subtitle {
    max-width: 460px;
    margin: 0 0 44px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--dim);
    text-align: center;
}

.org-select-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    width: 100%;
    max-width: 1180px;
}

@media (max-width: 980px) {
    .org-select-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .org-select-grid {
        grid-template-columns: 1fr;
    }
}

.org-select-card {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    background: rgba(var(--card-rgb), 0.55);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

a.org-select-card:hover {
    border-color: rgba(var(--blue-2-rgb), 0.4);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), 0 20px 48px rgba(0, 0, 0, 0.32);
    transform: translateY(-4px);
}

.org-select-card-disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.org-select-photo {
    position: relative;
    height: 128px;
    background: repeating-linear-gradient(135deg, var(--card-2) 0 10px, var(--bg-2) 10px 20px);
}

.org-select-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.org-select-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(var(--card-rgb), 0.92) 100%);
}

.org-select-photo-label {
    position: absolute;
    left: 14px;
    bottom: 10px;
    z-index: 1;
    font-family: monospace;
    font-size: 10px;
    color: var(--dim);
    letter-spacing: 1px;
}

.org-select-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 15px;
    padding: 22px;
}

.org-select-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    margin-top: -48px;
    color: var(--blue-3);
    background: rgba(var(--card-2-rgb), 0.85);
    border: 1px solid rgba(var(--blue-2-rgb), 0.32);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.org-select-icon svg {
    width: 20px;
    height: 20px;
}

.org-select-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.org-select-title {
    margin-bottom: 5px;
    font-size: 16.5px;
    font-weight: 600;
    color: var(--white);
    letter-spacing: -0.01em;
}

.org-select-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--dim);
}

.org-select-btn {
    display: block;
    margin-top: auto;
    padding: 11px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-align: center;
    background: rgba(var(--card-2-rgb), 0.6);
    border: 1px solid var(--line-2);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

a.org-select-card:hover .org-select-btn {
    color: var(--accent-text);
    background: linear-gradient(135deg, var(--blue-3), var(--blue-2));
    border-color: var(--blue-2);
}

.auth-footnote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding-top: 56px;
}

.auth-footnote-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--dim);
}

.auth-footnote-dot {
    flex: none;
    width: 6px;
    height: 6px;
    background: var(--blue-3);
    border-radius: 50%;
}

.auth-copyright {
    font-size: 11px;
    color: var(--dim);
    opacity: 0.7;
}

.staff-link {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--dim);
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.staff-link:hover {
    color: var(--text);
    background: var(--card-2);
    border-color: var(--blue-2);
}

/* ---------- Structure connectée ---------- */

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    flex: none;
    width: 268px;
    height: 100vh;
    padding: 24px 16px;
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 4px 10px 22px;
    border-bottom: 1px solid var(--line);
}

.brand img {
    width: 40px;
    height: 40px;
}

.brand-icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--card-2);
    color: var(--blue-2);
}

.brand-icon svg {
    width: 20px;
    height: 20px;
}

.brand span {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.brand b {
    font-size: 15px;
    letter-spacing: 0.02em;
}

.brand i {
    font-size: 12px;
    font-style: normal;
    color: var(--dim);
}

.nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.nav-group {
    margin-top: 10px;
}

.nav-group summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--dim);
    cursor: pointer;
    list-style: none;
    border-radius: var(--r-sm);
}

.nav-group summary:hover {
    color: var(--text);
    background: var(--card-2);
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary svg:first-of-type {
    flex: none;
    width: 14px;
    height: 14px;
}

.nav-group summary span {
    flex: 1;
}

.nav-group summary .chevron {
    flex: none;
    width: 13px;
    height: 13px;
    transition: transform 0.15s ease;
}

.nav-group[open] summary .chevron {
    transform: rotate(180deg);
}

.nav-group-links {
    padding-top: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 3px;
    padding: 11px 14px;
    font-size: 14.5px;
    color: var(--text);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link svg {
    flex: none;
    width: 17px;
    height: 17px;
    opacity: 0.75;
}

.nav-link.active svg {
    opacity: 1;
}

.nav-link:hover {
    color: var(--white);
    background: var(--card-2);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(var(--blue-2-rgb), 0.24), rgba(var(--blue-rgb), 0.24));
    border: 1px solid rgba(var(--blue-3-rgb), 0.3);
}

.sidebar-foot {
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.me {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 10px 14px;
}

.me-txt {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
}

.me-txt b {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.me-txt i {
    font-size: 12px;
    font-style: normal;
    color: var(--dim);
}

.signout {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--dim);
    border-radius: var(--r-sm);
}

.signout:hover {
    color: var(--danger);
    background: var(--card-2);
}

.main {
    flex: 1;
    min-width: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 38px 44px 60px;
}

.page-head {
    max-width: 880px;
    margin: 0 auto 24px;
}

.page-head h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.page-head h1 svg {
    flex: none;
    width: 24px;
    height: 24px;
    color: var(--blue-3);
}

.page-head p {
    margin-top: 6px;
    font-size: 15.5px;
    color: var(--dim);
}

/* ---------- Barre du haut (LSPD Mission Row / Vespucci) ---------- */

.appshell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(var(--bg-2-rgb), 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 14px 40px;
}

.topbar-brand {
    display: flex;
    flex: none;
    align-items: center;
    gap: 11px;
}

.topbar-brand img {
    width: 34px;
    height: 34px;
}

.topbar-brand span {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.topbar-brand b {
    font-size: 14.5px;
    letter-spacing: 0.02em;
}

.topbar-brand i {
    font-size: 11.5px;
    font-style: normal;
    color: var(--dim);
}

.topbar-menu {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.topbar-drop {
    position: relative;
    flex: none;
}

.topbar-drop summary {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.topbar-drop summary::-webkit-details-marker {
    display: none;
}

.topbar-drop summary svg:first-of-type {
    flex: none;
    width: 15px;
    height: 15px;
    opacity: 0.8;
}

.topbar-drop summary .chevron {
    flex: none;
    width: 12px;
    height: 12px;
    opacity: 0.55;
    transition: transform 0.15s ease;
}

.topbar-drop[open] summary .chevron {
    transform: rotate(180deg);
}

.topbar-drop summary:hover,
.topbar-drop[open] summary {
    color: var(--white);
    background: var(--card-2);
}

.topbar-drop summary.active {
    color: var(--blue-3);
}

.topbar-drop-panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    min-width: 236px;
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.topbar-drop-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    font-size: 14px;
    color: var(--text);
    border-radius: var(--r-sm);
}

.topbar-drop-link svg {
    flex: none;
    width: 16px;
    height: 16px;
    opacity: 0.75;
}

.topbar-drop-link:hover {
    color: var(--white);
    background: var(--card-2);
}

.topbar-drop-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(var(--blue-2-rgb), 0.24), rgba(var(--blue-rgb), 0.24));
}

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

.topbar-me {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-me .me-txt {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.topbar-me .me-txt b {
    overflow: hidden;
    max-width: 140px;
    font-size: 13.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-me .me-txt i {
    font-size: 11.5px;
    font-style: normal;
    color: var(--dim);
}

.topbar-logout {
    flex: none;
    white-space: nowrap;
}

.topmain {
    max-width: 1400px;
    margin: 0 auto;
    padding: 34px 28px 60px;
}

@media (max-width: 900px) {
    .topbar-inner {
        flex-wrap: wrap;
        row-gap: 10px;
        padding: 12px 18px;
    }

    .topbar-menu {
        order: 3;
        flex: 1 1 100%;
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .topbar-me .me-txt {
        display: none;
    }

    .topmain {
        padding: 26px 18px 60px;
    }
}

/* ---------- Cartes ---------- */

.card {
    max-width: 880px;
    margin: 0 auto 18px;
    padding: 20px 22px;
    background: rgba(var(--card-rgb), 0.62);
    border: 1px solid var(--line);
    border-radius: 14px;
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card.full {
    max-width: none;
}

.card-tight {
    padding: 13px 18px;
}

.card > h2 {
    margin-bottom: 18px;
    padding-bottom: 13px;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
}

.h2-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.h2-title svg {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--blue-3);
}

.card > h2 .muted {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 400;
    color: var(--dim);
}

.card > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 13px;
    font-size: 16px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    list-style: none;
}

.card > summary::-webkit-details-marker {
    display: none;
}

.card > summary:hover .h2-title {
    color: var(--blue-3);
}

.card-summary-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.card-summary-text .muted {
    font-size: 13px;
    font-weight: 400;
    color: var(--dim);
}

.card > summary .chevron {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--dim);
    transition: transform 0.15s ease;
}

details.card[open] > summary .chevron {
    transform: rotate(90deg);
}

details.card:not([open]) > summary {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

/* ---------- Avatar & badges ---------- */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 64px;
    height: 64px;
    overflow: hidden;
    font-size: 21px;
    font-weight: 700;
    color: var(--accent-text);
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, var(--blue-3), var(--blue));
    border-radius: 16px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar.sm {
    width: 38px;
    height: 38px;
    font-size: 13px;
    border-radius: 11px;
}

.avatar.lg {
    width: 88px;
    height: 88px;
    font-size: 28px;
    border-radius: 20px;
}

.avatar-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.avatar-form {
    flex: 1;
    min-width: 220px;
}

.avatar-form input[type="file"] {
    margin-bottom: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--white);
    background: var(--card-3);
    border: 1px solid var(--line-2);
    border-radius: 999px;
}

.pill svg {
    flex: none;
    width: 13px;
    height: 13px;
}

.pill-soft {
    font-weight: 500;
    color: var(--text);
    background: transparent;
}

.pill-ok {
    color: var(--ok);
    background: var(--ok-bg);
    border-color: rgba(52, 211, 153, 0.3);
}

.pill-off {
    color: var(--dim);
    background: transparent;
    border-color: var(--line-2);
}

.pill-danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(242, 109, 109, 0.3);
}

/* ---------- Fiche agent ---------- */

.identity {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.identity-txt h2 {
    font-size: 23px;
    letter-spacing: -0.015em;
}

.identity-txt .badge-no {
    margin-top: 2px;
    font-size: 13.5px;
    color: var(--dim);
    letter-spacing: 0.04em;
}

.identity-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.identity-spacer {
    flex: 1;
}

.identity-status {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.identity-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0 18px;
    border-bottom: 1px solid var(--line);
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 18px;
}

.detail-label {
    flex: none;
    width: 100px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dim);
}

.detail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 18px;
    padding-top: 18px;
}

.meta-item .k {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dim);
}

.meta-item .v {
    margin-top: 6px;
    font-size: 17px;
    font-weight: 600;
    color: var(--white);
}

/* ---------- Liste des agents ---------- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    max-width: 880px;
    margin: 0 auto 16px;
}

.toolbar .count {
    font-size: 14px;
    color: var(--dim);
}

.rollcall-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.rollcall-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(var(--card-rgb), 0.55);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.rollcall-thumb {
    position: relative;
    height: 120px;
    background: repeating-linear-gradient(135deg, var(--card-2) 0 10px, var(--bg-2) 10px 20px);
}

.rollcall-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rollcall-thumb-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dim);
}

.rollcall-thumb-icon svg {
    width: 28px;
    height: 28px;
}

.rollcall-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.rollcall-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
}

.rollcall-title {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rollcall-actions {
    display: flex;
    gap: 8px;
}

.rollcall-actions form {
    flex: 1;
}

.rollcall-actions .btn {
    width: 100%;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    max-width: 880px;
    margin: 0 auto 16px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 880px;
    margin: 0 auto 18px;
    padding: 6px;
    background: rgba(var(--card-rgb), 0.5);
    border: 1px solid var(--line);
    border-radius: 14px;
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dim);
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.tab svg {
    flex: none;
    width: 16px;
    height: 16px;
}

.tab:hover {
    color: var(--text);
    background: rgba(var(--card-2-rgb), 0.6);
}

.tab.active {
    color: var(--text);
    background: var(--blue-2);
}

.thumb-btn {
    padding: 0;
    background: none;
    border: none;
    cursor: zoom-in;
    line-height: 0;
}

.thumb-btn img {
    display: block;
    width: 92px;
    height: 92px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    transition: opacity 0.15s ease;
}

.thumb-btn:hover img {
    opacity: 0.85;
}

.popover-image {
    width: auto;
    max-width: 92vw;
    max-height: 92vh;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.popover-image img {
    display: block;
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.org-block {
    margin-bottom: 22px;
}

.org-block:last-child {
    margin-bottom: 0;
}

.org-block-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.org-block-title svg {
    flex: none;
    width: 15px;
    height: 15px;
    color: var(--blue-3);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.search-field {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 9px;
    min-width: 220px;
    padding: 0 13px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field:focus-within {
    border-color: var(--blue-2);
    box-shadow: 0 0 0 4px var(--blue-glow);
}

.search-field svg {
    flex: none;
    width: 15px;
    height: 15px;
    color: var(--dim);
}

.search-field input[type="text"] {
    flex: 1;
    width: auto;
    padding: 10px 0;
    background: none;
    border: none;
    box-shadow: none;
}

.search-field input[type="text"]:focus {
    box-shadow: none;
}

.filter-form select {
    width: auto;
    min-width: 150px;
}

.agents {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.agent-card {
    display: flex;
    flex-direction: column;
    padding: 17px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.agent-card:hover {
    border-color: var(--line-2);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
}

.agent-top {
    display: flex;
    align-items: center;
    gap: 15px;
}

.agent-top .avatar {
    width: 52px;
    height: 52px;
    font-size: 17px;
    border-radius: 14px;
}

.agent-name {
    min-width: 0;
}

.agent-name b {
    display: block;
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-name span {
    font-size: 13px;
    color: var(--dim);
    letter-spacing: 0.04em;
}

.agent-status {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.agent-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.agent-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    font-size: 13.5px;
}

.agent-row .k {
    flex: none;
    color: var(--dim);
}

.agent-row .v {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    overflow: hidden;
    font-weight: 600;
    color: var(--white);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-row .v svg {
    flex: none;
    width: 14px;
    height: 14px;
    color: var(--dim);
}

.agent-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.agent-view {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
}

.agent-view svg {
    width: 14px;
    height: 14px;
}

.agent-view:hover {
    color: var(--white);
}

.agent-actions {
    display: flex;
    flex: none;
    gap: 8px;
}

.agent-actions form {
    display: contents;
}

/* ---------- Grades & divisions ---------- */

.split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 18px;
    align-items: start;
}

.split .card {
    max-width: none;
    margin-bottom: 0;
}

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

/* ---------- Réorganisation pages ---------- */

#category-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-cat-card {
    margin-bottom: 0;
    transition: opacity 0.15s ease;
}

.nav-cat-card.dragging {
    opacity: 0.35;
}

.cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 13px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
    cursor: grab;
}

.cat-head:active {
    cursor: grabbing;
}

.cat-head-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
}

.cat-head-count {
    flex: none;
    font-size: 12.5px;
    color: var(--dim);
}

.nav-reorder-list {
    min-height: 44px;
    margin-bottom: 0;
}

.rank {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 10px 14px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    transition: opacity 0.15s ease;
}

.rank.dragging {
    opacity: 0.35;
}

.drag-handle {
    display: inline-flex;
    flex: none;
    color: var(--dim);
    cursor: grab;
}

.drag-handle svg {
    width: 16px;
    height: 16px;
}

.drag-handle:active {
    cursor: grabbing;
}

.rank-icon {
    display: inline-flex;
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--dim);
}

.rank-icon svg {
    width: 100%;
    height: 100%;
}

.rank .pos {
    flex: none;
    width: 26px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

.rank input[type="text"] {
    padding: 8px 11px;
    font-size: 14px;
}

.rank-discord-form {
    display: flex;
    flex: none;
    align-items: center;
    gap: 7px;
}

.rank-discord-form input[type="text"] {
    width: 128px;
    padding: 8px 11px;
    font-size: 13px;
}

.rank-discord-form select {
    width: 190px;
    padding: 8px 30px 8px 11px;
    font-size: 13px;
}

@media (max-width: 640px) {
    .rank {
        flex-wrap: wrap;
    }

    .rank-discord-form {
        flex-basis: 100%;
        margin-left: 38px;
    }

    .rank-discord-form input[type="text"],
    .rank-discord-form select {
        width: auto;
        flex: 1;
    }
}

.rank-btns {
    display: flex;
    flex: none;
    gap: 6px;
}

.org-thumb {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--dim);
    background: var(--bg-2);
    border-radius: 10px;
    overflow: hidden;
}

.org-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.org-thumb svg {
    width: 18px;
    height: 18px;
}

.org-row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.org-row-name {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--white);
}

.org-row-text .muted {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 13px;
    color: var(--text);
    background: rgba(var(--card-2-rgb), 0.55);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

/* Sans cette règle, un <svg> avec viewBox mais sans width/height explicites
   retombe sur la taille de remplacement par défaut du navigateur (~300x150)
   selon le contexte — d'où des icônes énormes/incohérentes d'un bouton à
   l'autre (déjà vu sur .pill). Toujours 15px, quel que soit le SVG dedans. */
.iconbtn svg {
    flex: none;
    width: 15px;
    height: 15px;
}

.iconbtn:hover {
    color: var(--white);
    background: rgba(var(--card-3-rgb), 0.7);
    border-color: var(--line-2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.28);
    transform: translateY(-1px);
}

.iconbtn:active {
    transform: translateY(0);
}

.iconbtn.active {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(242, 109, 109, 0.35);
}

/* Repos coloré : distingue au premier coup d'œil approuver (vert) de
   rejeter/supprimer (rouge) plutôt que quatre carrés gris identiques. */
.iconbtn.ok {
    color: var(--ok);
    background: var(--ok-bg);
    border-color: rgba(52, 211, 153, 0.32);
}

.iconbtn.ok:hover {
    color: #fff;
    background: #1FA875;
    border-color: #1FA875;
}

.iconbtn.danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(242, 109, 109, 0.32);
}

.iconbtn.danger:hover {
    color: #fff;
    background: #C0453F;
    border-color: #C0453F;
}

.add-row {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.empty {
    padding: 28px 24px;
    color: var(--dim);
    text-align: center;
    background: var(--card);
    border: 1px dashed var(--line-2);
    border-radius: 14px;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chip:hover {
    border-color: var(--line-2);
    color: var(--white);
}

.chip input {
    width: 14px;
    height: 14px;
    accent-color: var(--blue-2);
    cursor: pointer;
}

.chip:has(input:checked) {
    color: #fff;
    background: rgba(var(--blue-2-rgb), 0.16);
    border-color: rgba(var(--blue-2-rgb), 0.5);
}

/* ---------- Paie : semaines, stats, entrées ---------- */

.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.week-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.stat-tile {
    padding: 14px 16px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.stat-tile-accent {
    background: rgba(var(--blue-2-rgb), 0.1);
    border-color: rgba(var(--blue-2-rgb), 0.32);
}

.stat-k {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dim);
}

.stat-v {
    margin-top: 5px;
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
}

.entry-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.entry-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 13px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.entry-row form {
    display: contents;
}

.entry-row .date {
    flex: none;
    width: 92px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

.entry-row .date.wide {
    width: 210px;
}

.entry-row .amount {
    flex: 1;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--white);
}

.entry-row .entry-edit {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
}

.entry-edit span {
    flex: none;
    font-size: 13px;
    color: var(--dim);
}

.entry-edit input[type="number"] {
    flex: none;
    width: 76px;
    padding: 8px 10px;
    font-size: 13.5px;
}

.entry-edit input[type="text"] {
    flex: 1;
    width: auto;
    padding: 8px 10px;
    font-size: 13.5px;
}

.entry-row .note {
    flex: 2;
    overflow: hidden;
    font-size: 13.5px;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    font-size: 13.5px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.data-table th {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--dim);
}

.data-table td {
    color: var(--white);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: var(--bg-2);
}

.disclosure {
    border-bottom: 1px solid var(--line);
}

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

.disclosure summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 2px;
    cursor: pointer;
    list-style: none;
}

.disclosure summary::-webkit-details-marker {
    display: none;
}

.disclosure-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--white);
}

.disclosure-title svg {
    flex: none;
    width: 17px;
    height: 17px;
    color: var(--blue-3);
}

.disclosure-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--dim);
}

.disclosure-meta .chevron {
    flex: none;
    width: 15px;
    height: 15px;
    transition: transform 0.15s ease;
}

.disclosure[open] .chevron {
    transform: rotate(90deg);
}

.disclosure-body {
    padding: 2px 2px 18px;
}

.rate-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.rate-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 13px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.rate-name {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--white);
}

.rate-input {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.rate-input span {
    font-size: 13px;
    color: var(--dim);
}

.rate-input input {
    width: 84px;
    padding: 9px 0;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--white);
    text-align: right;
    background: none;
    border: none;
    outline: none;
}

.select-check {
    margin-bottom: 16px;
}

.select-check summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    font-size: 15px;
    color: var(--white);
    cursor: pointer;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    list-style: none;
    transition: border-color 0.15s ease;
}

.select-check summary::-webkit-details-marker {
    display: none;
}

.select-check summary:hover {
    border-color: var(--line-2);
}

.select-check[open] summary {
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    border-bottom-color: transparent;
}

.select-check .chevron {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--dim);
    transition: transform 0.15s ease;
}

.select-check[open] .chevron {
    transform: rotate(180deg);
}

.select-check-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2px;
    padding: 8px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--r-sm) var(--r-sm);
}

.select-check-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    font-size: 14.5px;
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.select-check-option:hover {
    color: var(--white);
    background: var(--card-3);
}

.select-check-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--blue-2);
    cursor: pointer;
}

.backlink {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 14.5px;
    color: var(--dim);
}

.backlink:hover {
    color: var(--white);
}

/* ---------- Popovers (créations en fenêtre, API popover native) ---------- */

[popover] {
    margin: auto;
}

[popover]::backdrop {
    background: rgba(3, 6, 12, 0.66);
    backdrop-filter: blur(3px);
}

.popover-card {
    width: min(560px, 92vw);
    max-height: 86vh;
    overflow-y: auto;
    padding: 22px 24px;
    color: var(--text);
    background: rgba(var(--card-rgb), 0.72);
    border: 1px solid var(--line);
    border-radius: 16px;
    backdrop-filter: blur(26px) saturate(140%);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.popover-card[popover]:popover-open {
    animation: popover-in 0.15s ease;
}

@keyframes popover-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.popover-head h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
}

.popover-head h3 svg {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--blue-3);
}

@media (max-width: 900px) {
    .shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }

    .main {
        padding: 32px 20px 60px;
    }

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

    .identity {
        flex-wrap: wrap;
    }
}

/* ---------- Espace Administration (admin.php, admin-login.php) ---------- */

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.admin-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.admin-card:hover {
    border-color: var(--line-2);
    background: var(--card-2);
}

.admin-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--card-2);
    color: var(--blue-3);
}

.admin-card-icon svg {
    width: 20px;
    height: 20px;
}

.admin-card-label {
    font-size: 14.5px;
    font-weight: 600;
}

.admin-card-desc {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--dim);
}

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