:root {
    --bg-1: #f6f7fb;
    --bg-2: #eaf0f9;
    --ink: #0f172a;
    --muted: #6b7280;
    --accent: #0ea5e9;
    --accent-2: #22c55e;
    --card: rgba(255, 255, 255, 0.92);
    --border: rgba(15, 23, 42, 0.08);
    --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

body.app-ui {
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
    color: var(--ink);
    min-height: 100vh;
}

body.app-ui::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 10% 10%, rgba(14, 165, 233, 0.12), transparent 45%),
        radial-gradient(circle at 90% 20%, rgba(34, 197, 94, 0.12), transparent 45%),
        radial-gradient(circle at 70% 90%, rgba(99, 102, 241, 0.08), transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.sidebar {
    background: linear-gradient(160deg, #0b1220 0%, #0f1a2e 45%, #111827 100%);
    color: #e2e8f0;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.2);
}

.sidebar-header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-section-title {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.65rem;
    color: rgba(226, 232, 240, 0.5);
    margin: 0 0 0.5rem 0.2rem;
}

.sidebar-nav {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-radius: 0.7rem;
    color: #e2e8f0;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
    position: relative;
}
.nav-link:hover {
    background: rgba(148, 163, 184, 0.15);
    color: #fff;
    transform: translateX(2px);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(226, 232, 240, 0.8);
}

.nav-icon svg {
    width: 18px;
    height: 18px;
}

.nav-link.active {
    background: rgba(14, 165, 233, 0.2);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.45);
}

.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    position: sticky;
    top: 0;
    z-index: 20;
}

.content-wrap {
    padding-bottom: 3rem;
}

.panel,
.content-wrap .shadow-sm {
    background: var(--card) !important;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.panel:hover,
.content-wrap .shadow-sm:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: auto -40% -60% -40%;
    height: 160%;
    background: radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.25), transparent 50%);
    opacity: 0.8;
    pointer-events: none;
}

.stat-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
}

.stat-icon svg {
    width: 18px;
    height: 18px;
}

button,
.btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 60%, #0369a1 100%);
    color: #fff;
}

button.bg-slate-900,
a.bg-slate-900 {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 70%, #0f172a 100%) !important;
}

button.bg-slate-800,
a.bg-slate-800 {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 0.75rem;
    outline: none;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(14, 165, 233, 0.8);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

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

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

.table-wrap tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.08);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.9rem;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.2);
    animation: slideIn 0.35s ease, fadeOut 0.3s ease 3.7s forwards;
}

.toast.success { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.toast.error { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.toast.info { background: linear-gradient(135deg, #1d4ed8, #38bdf8); }

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(20px); }
}

.reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: fadeUp 0.6s ease forwards;
}

@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}

.print-body .panel {
    background: #fff !important;
    box-shadow: none;
}

.print-card {
    border: 1px solid #e2e8f0;
}

.no-print {
    display: flex;
}

.a4-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 10mm;
}

.fiche-form {
    background: #fff !important;
}

.fiche-header-slim {
    display: grid;
    grid-template-columns: 120px 1fr 120px;
    align-items: center;
    gap: 0.9rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
}

.fiche-logo,
.fiche-flag {
    width: 110px;
    height: auto;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.fiche-header-center {
    text-align: center;
}

.fiche-header-strong .fiche-title {
    font-size: 1rem;
    letter-spacing: 0.14em;
}

.fiche-title-compact {
    font-size: 0.85rem;
    letter-spacing: 0.18em;
}

.fiche-title {
    font-size: 0.95rem;
    letter-spacing: 0.18em;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.fiche-subtitle {
    font-size: 2.4rem;
    font-weight: 800;
    margin-top: 0.15rem;
    letter-spacing: 0.1em;
    line-height: 1.1;
    color: rgba(139, 3, 3, 0.948);
}

.fiche-meta {
    color: #64748b;
    font-size: 0.9rem;
}

.fiche-band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.9rem;
    margin-bottom: 0.9rem;
}

.band-title {
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.band-matricule {
    font-weight: 700;
    font-size: 0.95rem;
}

.fiche-grid {
    display: grid;
    grid-template-columns: 1.75fr 0.75fr;
    gap: 1.1rem;
}

.fiche-fields .row {
    display: grid;
    grid-template-columns: 220px 1fr;
    align-items: end;
    gap: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.4rem 0;
    font-size: 0.85rem;
}

.fiche-fields .row span {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: #64748b;
}

.fiche-fields .row strong {
    font-weight: 600;
}

.fiche-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.photo-card {
    border: none;
    padding: 0;
}

.photo-card .photo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid #0f172a;
}

.photo-card .placeholder {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    border: 3px dashed #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    background: #f8fafc;
}

.qr-card {
    border: none;
    padding: 0;
    text-align: center;
    background: transparent;
}

.qr-img {
    width: 150px;
    height: 150px;
    display: block;
}

.fiche-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    margin-top: 0.3rem;
}

.section-title {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #1e293b;
    margin-bottom: 0.6rem;
}

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

.chip {
    background: #e2e8f0;
    color: #334155;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.chips .empty {
    color: #64748b;
    font-size: 0.85rem;
}

.fiche-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.2rem;
}

.fiche-location {
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: #475569;
}

.sign-block .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.sign-line {
    margin-top: 2.2rem;
    border-bottom: 2px solid #0f172a;
}

.fiche-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #64748b;
}

.member-card-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
}

.member-card {
    width: 54mm;
    height: 86mm;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
}

.member-card svg {
    width: 100%;
    height: 100%;
    display: block;
}

@media print {
    html, body {
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body.app-ui {
        background: #fff !important;
    }
    body.app-ui::before {
        display: none !important;
    }
    .panel {
        box-shadow: none !important;
    }
    .no-print {
        display: none !important;
    }
    @page {
        size: A4;
        margin: 8mm;
    }
    .a4-page {
        width: 210mm;
        min-height: 297mm;
        padding: 8mm;
        margin: 0 auto;
        border: none;
        box-shadow: none;
        page-break-inside: avoid;
    }
    .member-card-page {
        padding: 0;
    }
    .member-card {
        margin: 0 auto;
        box-shadow: none !important;
    }
    .fiche-header-strong .fiche-title {
        font-size: 1.05rem;
    }
    .fiche-title-compact {
        font-size: 0.9rem;
    }
    .fiche-title {
        font-size: 1rem;
    }
    .fiche-subtitle {
        font-size: 2.5rem;
    }
    .fiche-meta {
        font-size: 0.95rem;
    }
}
