/* ============================================================
   Central France RP — Site officiel
   Thème: dark + violet néon (#953dc1)
   ============================================================ */

:root {
    --bg-0: #07060c;
    --bg-1: #0d0a17;
    --bg-2: #14101f;
    --bg-3: #1c172b;
    --surface: rgba(28, 23, 43, 0.7);
    --surface-hi: rgba(40, 32, 60, 0.85);
    --border: rgba(149, 61, 193, 0.18);
    --border-hi: rgba(149, 61, 193, 0.45);
    --text: #ece9f4;
    --text-dim: #a39db7;
    --text-faint: #6d6781;
    --primary: #953dc1;
    --primary-hi: #b35dde;
    --primary-glow: rgba(149, 61, 193, 0.55);
    --accent: #e879f9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(149, 61, 193, 0.35);
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-0);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(149, 61, 193, 0.18), transparent 60%),
        radial-gradient(ellipse 60% 40% at 100% 110%, rgba(232, 121, 249, 0.08), transparent 60%),
        radial-gradient(ellipse 50% 30% at 0% 50%, rgba(149, 61, 193, 0.06), transparent 60%);
    background-attachment: fixed;
}

a { color: var(--primary-hi); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 0.5em;
    color: var(--text);
    line-height: 1.15;
}

h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); }
h3 { font-size: 1.4rem; }

p { color: var(--text-dim); }

::selection { background: var(--primary); color: white; }

/* ───── Utilitaires ───── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 880px; margin: 0 auto; padding: 0 1.5rem; }

.text-center { text-align: center; }
.text-gradient {
    background: linear-gradient(135deg, var(--primary-hi) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.3em 0.8em;
    border-radius: 999px;
    background: rgba(149, 61, 193, 0.12);
    border: 1px solid var(--border-hi);
    color: var(--primary-hi);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.badge-success { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.4); color: #4ade80; }
.badge-warning { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); color: #fbbf24; }
.badge-danger  { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); color: #f87171; }
.badge-neutral { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.1); color: var(--text-dim); }

/* ───── Boutons ───── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--primary-glow);
    color: white;
}

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}
.btn-ghost:hover {
    border-color: var(--border-hi);
    background: var(--surface-hi);
    color: var(--text);
}

.btn-discord {
    background: #5865f2;
    color: white;
    box-shadow: 0 4px 14px rgba(88, 101, 242, 0.4);
}
.btn-discord:hover {
    background: #4752c4;
    transform: translateY(-2px);
    color: white;
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; color: white; transform: translateY(-2px); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; transform: translateY(-2px); }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ───── Header / Navigation ───── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    background: rgba(7, 6, 12, 0.7);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 2rem;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.logo:hover { color: var(--text); }
.logo img {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 0 20px var(--primary-glow);
}
.nav { display: flex; gap: 0.4rem; align-items: center; flex: 1; justify-content: center; }
.nav a {
    color: var(--text-dim);
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    transition: all 0.2s;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.active { color: var(--primary-hi); background: rgba(149, 61, 193, 0.1); }

.nav-actions { display: flex; gap: 0.6rem; align-items: center; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem 0.4rem 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.88rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}
.user-chip:hover { border-color: var(--border-hi); color: var(--text); }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }
.user-chip-tag-staff { background: rgba(149, 61, 193, 0.18); padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.7rem; color: var(--primary-hi); font-weight: 700; text-transform: uppercase; }

.menu-toggle { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; color: var(--text); cursor: pointer; }

/* ───── Hero ───── */
.hero {
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 1.5rem 4rem;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 50% 50%, rgba(149, 61, 193, 0.25), transparent 70%),
        linear-gradient(180deg, transparent 60%, var(--bg-0) 100%);
    pointer-events: none;
    z-index: 0;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(149, 61, 193, 0.07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(149, 61, 193, 0.07) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black, transparent);
    pointer-events: none;
    z-index: 0;
}

.hero-content { position: relative; z-index: 1; max-width: 880px; }

.hero h1 {
    font-size: clamp(3rem, 7vw, 5.5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: clamp(1.05rem, 1.6vw, 1.3rem);
    color: var(--text-dim);
    max-width: 640px;
    margin: 0 auto 2rem;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 4rem;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.hero-stat {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
}
.hero-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-hi);
    margin-bottom: 0.2rem;
}
.hero-stat-label {
    font-size: 0.78rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ───── Sections ───── */
.section { padding: 5rem 0; position: relative; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { margin-bottom: 0.6rem; }
.section-header p { color: var(--text-dim); max-width: 580px; margin: 0 auto; }
.section-eyebrow {
    color: var(--primary-hi);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.6rem;
    display: block;
}

/* ───── Cards / Grid ───── */
.grid { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

.card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0% 0%, rgba(149, 61, 193, 0.08), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.card:hover { border-color: var(--border-hi); transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card:hover::before { opacity: 1; }

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    font-size: 1.4rem;
    box-shadow: 0 8px 20px var(--primary-glow);
}
.card h3 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.card p { color: var(--text-dim); font-size: 0.95rem; margin: 0; }

/* CTA Banner */
.cta-banner {
    background: linear-gradient(135deg, rgba(149, 61, 193, 0.15) 0%, rgba(232, 121, 249, 0.1) 100%);
    border: 1px solid var(--border-hi);
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.cta-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(149, 61, 193, 0.2), transparent 70%);
    pointer-events: none;
}
.cta-banner > * { position: relative; }
.cta-banner h2 { margin-bottom: 0.6rem; }
.cta-banner p { font-size: 1.1rem; max-width: 560px; margin: 0 auto 1.8rem; }

/* ───── Forms ───── */
.form-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    max-width: 880px;
    margin: 0 auto;
}
.form-row { margin-bottom: 1.4rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-row label, .form-grid label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.form-row label .required { color: var(--accent); }
.form-row .hint { font-size: 0.8rem; color: var(--text-faint); margin-top: 0.3rem; }

.input, .textarea, select.input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.input:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(149, 61, 193, 0.18);
}
.textarea { resize: vertical; min-height: 110px; line-height: 1.6; font-family: inherit; }
.textarea-lg { min-height: 200px; }

.input.error, .textarea.error { border-color: var(--danger); }

.form-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-callout {
    background: rgba(149, 61, 193, 0.08);
    border: 1px solid var(--border-hi);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}
.form-callout strong { color: var(--text); }

/* ───── Page header (hero light) ───── */
.page-header {
    padding: 6rem 1.5rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 50% 60% at 50% 0%, rgba(149, 61, 193, 0.18), transparent 70%);
    pointer-events: none;
}
.page-header h1 { font-size: clamp(2.2rem, 4vw, 3.5rem); position: relative; }
.page-header p { color: var(--text-dim); max-width: 580px; margin: 0.8rem auto 0; position: relative; }

/* ───── Règlement ───── */
.rules-toc {
    position: sticky;
    top: 90px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3rem;
    backdrop-filter: blur(10px);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
.rules-toc h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 0.8rem; }
.rules-toc ul { list-style: none; padding: 0; margin: 0; }
.rules-toc li { margin-bottom: 0.2rem; }
.rules-toc a {
    display: block;
    padding: 0.4rem 0.7rem;
    color: var(--text-dim);
    border-radius: 6px;
    font-size: 0.88rem;
    transition: all 0.2s;
}
.rules-toc a:hover { background: rgba(149, 61, 193, 0.1); color: var(--text); }

.rules-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
    align-items: start;
}

.rule-section {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    scroll-margin-top: 90px;
}
.rule-section h2 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.rule-section h2 .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.rule-section ul, .rule-section ol { color: var(--text-dim); padding-left: 1.4rem; }
.rule-section li { margin-bottom: 0.6rem; line-height: 1.7; }
.rule-section li strong { color: var(--text); }
.rule-section p { color: var(--text-dim); }

/* ───── Login ───── */
.login-card {
    max-width: 440px;
    margin: 6rem auto 4rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-md);
}
.login-card .logo-big {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 16px;
    box-shadow: 0 0 40px var(--primary-glow);
}
.login-card h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.login-card p { margin-bottom: 2rem; }

.alert {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: #86efac; }
.alert-info { background: rgba(149, 61, 193, 0.1); border: 1px solid var(--border-hi); color: var(--primary-hi); }

/* ───── Tables ───── */
.table-wrapper {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.table th, .table td {
    padding: 0.9rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    background: var(--bg-2);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: rgba(149, 61, 193, 0.05); cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .user-cell { display: flex; align-items: center; gap: 0.6rem; }
.table .user-cell img { width: 28px; height: 28px; border-radius: 50%; }

/* ───── Stats grid (admin) ───── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}
.stat-card-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 0.6rem; }
.stat-card-value { font-size: 2.2rem; font-weight: 800; }

/* ───── Filters ───── */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.filter-chip {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}
.filter-chip:hover { color: var(--text); border-color: var(--border-hi); }
.filter-chip.active { background: rgba(149, 61, 193, 0.18); color: var(--primary-hi); border-color: var(--border-hi); }

/* ───── Detail (admin candidature) ───── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}
.detail-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 90px;
}
.detail-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border);
}
.detail-user img { width: 56px; height: 56px; border-radius: 50%; }
.detail-user .username { font-weight: 700; font-size: 1.05rem; }
.detail-user .userid { font-size: 0.82rem; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; }

.field-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
}
.field-block .field-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin-bottom: 0.6rem; }
.field-block .field-value {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.7;
    color: var(--text);
    max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   Wrapping universel pour tous les contenus user-submitted.
   Évite les longs textes type "aaaaaaaa..." qui débordent du conteneur.
   ═══════════════════════════════════════════════════════════════ */
.input,
.textarea,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    box-sizing: border-box;
}

textarea,
.textarea {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.table td,
.table th {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.form-callout,
.alert,
.user-cell,
.history-list li {
    overflow-wrap: anywhere;
    word-break: break-word;
}

code, pre {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.history-list { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.history-list li {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-dim);
}
.history-list li:last-child { border-bottom: 0; }
.history-list .at { color: var(--text-faint); font-size: 0.78rem; }

/* ───── Permissions UI ───── */
.role-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    transition: border-color 0.2s;
}
.role-card:hover { border-color: var(--border-hi); }

.role-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-bottom: 1rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}
.role-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}
.role-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}
.role-id-mono {
    font-size: 0.78rem;
    color: var(--text-faint);
    font-family: 'JetBrains Mono', monospace;
}
.role-actions { margin-left: auto; display: flex; gap: 0.4rem; }

.perm-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}
.perm-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-hi);
    margin: 0 0 0.7rem;
}
.perm-list { display: flex; flex-direction: column; gap: 0.4rem; }

.perm-toggle {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 0.92rem;
    color: var(--text-dim);
    user-select: none;
}
.perm-toggle:hover { background: rgba(149, 61, 193, 0.08); color: var(--text); }
.perm-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.perm-toggle .checkbox {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid var(--border-hi);
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s;
    background: var(--bg-2);
    display: inline-block;
}
.perm-toggle .checkbox::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s;
}
.perm-toggle input:checked + .checkbox {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(149, 61, 193, 0.4);
}
.perm-toggle input:checked + .checkbox::after { opacity: 1; transform: scale(1); }
.perm-toggle .label-text { line-height: 1.3; }

.role-search-box {
    width: 100%;
    margin-bottom: 1rem;
}

.permissions-actions {
    position: sticky;
    bottom: 1rem;
    background: var(--bg-1);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    z-index: 5;
}

@media (max-width: 600px) {
    .perm-groups { grid-template-columns: 1fr; }
    .role-header { flex-wrap: wrap; }
    .role-actions { margin-left: 0; width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   /admin/permissions — design en TUILES TOGGLE (très visuel)
   ═══════════════════════════════════════════════════════════════ */

.perm-search {
    background: var(--bg-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    padding: 0.7rem 1rem !important;
    margin-bottom: 1.2rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    flex-wrap: wrap !important;
}
.perm-search .input { flex: 1 !important; min-width: 200px !important; }
.perm-search-counter {
    color: var(--text-faint) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

/* Container global */
.perm-sections {
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem !important;
}

/* Header de section (titre + actions) */
.perm-section {
    display: block !important;
}
.perm-section-head {
    display: flex !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    padding: 0 0.5rem 0.8rem !important;
    border-bottom: 2px solid rgba(149, 61, 193, 0.18) !important;
    margin-bottom: 1rem !important;
    flex-wrap: wrap !important;
}
.perm-section.has-checked .perm-section-head {
    border-bottom-color: rgba(149, 61, 193, 0.45) !important;
}
.perm-section-icon {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    display: grid !important;
    place-items: center !important;
    background: linear-gradient(135deg, rgba(149, 61, 193, 0.3), rgba(232, 121, 249, 0.15)) !important;
    border: 1px solid rgba(149, 61, 193, 0.35) !important;
    border-radius: 12px !important;
    font-size: 1.3rem !important;
}
.perm-section-text { flex: 1 !important; min-width: 200px !important; }
.perm-section-title {
    margin: 0 !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.7rem !important;
    flex-wrap: wrap !important;
}
.perm-section-counter {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    background: var(--bg-3) !important;
    color: var(--text-dim) !important;
    padding: 0.2rem 0.65rem !important;
    border-radius: 999px !important;
    font-variant-numeric: tabular-nums !important;
}
.perm-section.has-checked .perm-section-counter {
    background: rgba(149, 61, 193, 0.25) !important;
    color: var(--primary-hi, #b066d8) !important;
}
.perm-section-hint {
    margin: 0.35rem 0 0 !important;
    font-size: 0.85rem !important;
    color: var(--text-faint) !important;
    line-height: 1.45 !important;
    max-width: 720px !important;
}
.perm-section-actions {
    display: flex !important;
    gap: 0.4rem !important;
    align-items: center !important;
}

/* Grille de tuiles */
.perm-tiles {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 0.75rem !important;
}

/* Tuile permission individuelle */
.perm-tile {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    padding: 0.9rem 1.1rem !important;
    background: var(--bg-2) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.18s ease !important;
    user-select: none !important;
    position: relative !important;
    overflow: hidden !important;
}
.perm-tile:hover {
    border-color: rgba(149, 61, 193, 0.4) !important;
    transform: translateY(-1px) !important;
    background: var(--bg-3) !important;
}
.perm-tile input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* État ON */
.perm-tile:has(input:checked) {
    background: linear-gradient(135deg, rgba(149, 61, 193, 0.18), rgba(232, 121, 249, 0.08)) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 16px rgba(149, 61, 193, 0.22) !important;
}

.perm-tile-body {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
}
.perm-tile-label {
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    color: var(--text) !important;
    line-height: 1.35 !important;
    word-break: break-word !important;
}
.perm-tile:has(input:checked) .perm-tile-label {
    font-weight: 600 !important;
}
.perm-tile-key {
    font-family: ui-monospace, 'JetBrains Mono', monospace !important;
    font-size: 0.72rem !important;
    color: var(--text-faint) !important;
    opacity: 0.7 !important;
    word-break: break-all !important;
}

/* Switch toggle visuel */
.perm-tile-switch {
    flex: 0 0 46px !important;
    width: 46px !important;
    height: 26px !important;
    background: var(--bg-3) !important;
    border-radius: 999px !important;
    position: relative !important;
    transition: background 0.2s ease !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35) !important;
}
.perm-tile-switch-knob {
    position: absolute !important;
    top: 3px !important;
    left: 3px !important;
    width: 20px !important;
    height: 20px !important;
    background: #888 !important;
    border-radius: 50% !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) !important;
}
.perm-tile:has(input:checked) .perm-tile-switch {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 12px rgba(149, 61, 193, 0.4) !important;
}
.perm-tile:has(input:checked) .perm-tile-switch-knob {
    left: 23px !important;
    background: white !important;
    box-shadow: 0 2px 6px rgba(149, 61, 193, 0.5) !important;
}

/* Fallback pour navigateurs sans :has() (Firefox < 121) — on utilise input:checked direct */
.perm-tile input:checked ~ .perm-tile-switch {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 12px rgba(149, 61, 193, 0.4) !important;
}
.perm-tile input:checked ~ .perm-tile-switch .perm-tile-switch-knob {
    left: 23px !important;
    background: white !important;
    box-shadow: 0 2px 6px rgba(149, 61, 193, 0.5) !important;
}

@media (max-width: 600px) {
    .perm-tiles { grid-template-columns: 1fr !important; }
    .perm-section-head { gap: 0.6rem !important; }
    .perm-section-actions { width: 100% !important; justify-content: flex-end !important; }
}

/* ───── Footer ───── */
.footer {
    margin-top: 6rem;
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
    background: var(--bg-1);
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}
.footer-brand { max-width: 360px; }
.footer-brand p { color: var(--text-faint); font-size: 0.9rem; }
.footer-cols { display: flex; gap: 3rem; flex-wrap: wrap; }
.footer-col h5 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin: 0 0 1rem; }
.footer-col a { display: block; color: var(--text-dim); padding: 0.25rem 0; font-size: 0.92rem; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 0.85rem;
    text-align: center;
}

/* ───── Toast ───── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.toast {
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-sm);
    background: var(--bg-3);
    border: 1px solid var(--border-hi);
    color: var(--text);
    font-size: 0.92rem;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.25s ease, toastOut 0.25s ease 4s forwards;
    min-width: 240px;
    max-width: 360px;
}
.toast.success { border-color: rgba(34, 197, 94, 0.5); }
.toast.error { border-color: rgba(239, 68, 68, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(20px); } }

/* ───── Animations d'apparition ───── */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ───── Responsive ───── */
@media (max-width: 900px) {
    .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; padding: 1rem; gap: 0.2rem; background: var(--bg-1); border-bottom: 1px solid var(--border); }
    .nav.open { display: flex; }
    .nav a { width: 100%; }
    .menu-toggle { display: inline-flex; }
    .rules-layout { grid-template-columns: 1fr; }
    .rules-toc { position: static; max-height: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-side { position: static; }
    .header-inner { gap: 0.6rem; }
    .form-card { padding: 1.5rem; }
    .footer-cols { gap: 1.5rem; }
    .footer-inner { flex-direction: column; }
}

@media (max-width: 540px) {
    .hero { min-height: 80vh; padding: 4rem 1rem 3rem; }
    .container, .container-narrow { padding: 0 1rem; }
    .section { padding: 3rem 0; }
    .table th:not(:first-child):not(:last-child), .table td:not(:first-child):not(:last-child) { display: none; }
}
