:root {
    --primary-color: #1b4332;
    --primary-dark: #081c15;
    --primary-light: #2d6a4f;
    --primary-accent: #40916c;
    --primary-subtle: #d8f3dc;
    --republique-blue: #002654;
    --republique-red: #ce1126;
    --bg-body: #f4f6f9;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 280px;
    --header-height: 70px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0d2818 0%, #081c15 100%);
    color: #ffffff;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-badge {
    background: linear-gradient(135deg, #2d6a4f, #52b788);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(45, 106, 79, 0.4);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: #95d5b2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #74c69d;
    padding: 0.75rem 0.75rem 0.25rem 0.75rem;
    font-weight: 700;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.9rem;
    color: #d8f3dc;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(3px);
}

.menu-item.active {
    background: linear-gradient(135deg, #2d6a4f 0%, #40916c 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.35);
}

.menu-item i {
    font-size: 1.15rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header Bar */
.app-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.4rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.header-search input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(64, 145, 108, 0.15);
}

.header-search i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Scope Badge & Selector */
.scope-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
}

.scope-selector select {
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

/* Content Container */
.page-content {
    padding: 2rem;
    flex: 1;
}

/* Cards */
.custom-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.custom-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.card-title-pro {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

/* Stat Cards */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background: #d8f3dc; color: #1b4332; }
.stat-icon.warning { background: #fef3c7; color: #b45309; }
.stat-icon.danger { background: #fee2e2; color: #b91c1c; }
.stat-icon.info { background: #e0f2fe; color: #0369a1; }
.stat-icon.purple { background: #f3e8ff; color: #6b21a8; }

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

/* Badges */
.badge-role {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-weight: 600;
}

.badge-cdg { background: #1b4332; color: #ffffff; }
.badge-col { background: #002654; color: #ffffff; }
.badge-agent { background: #64748b; color: #ffffff; }

.badge-statut-arrete {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-weight: 600;
}

.statut-brouillon { background: #f1f5f9; color: #475569; }
.statut-instruction { background: #fef3c7; color: #92400e; }
.statut-valide { background: #dcfce7; color: #166534; }
.statut-signe { background: #dbeafe; color: #1e40af; }
.statut-prefecture { background: #ede9fe; color: #5b21b6; }
.statut-rejete { background: #fee2e2; color: #991b1b; }

/* Tables */
.table-pro {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-pro th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table-pro td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

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

.table-pro tr:hover td {
    background-color: #f8fafc;
}

/* Timeline */
.career-timeline {
    position: relative;
    padding-left: 2rem;
    margin-top: 1rem;
}

.career-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: #cbd5e1;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-accent);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--primary-accent);
}

/* Official Arrêté Paper View (A4 document styling) */
.arrete-paper-container {
    background: #525659;
    padding: 2.5rem 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: center;
}

.arrete-paper {
    background: #ffffff;
    width: 210mm;
    min-height: 297mm;
    padding: 20mm 20mm;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-family: 'Merriweather', Georgia, serif;
    color: #111827;
    line-height: 1.6;
    font-size: 11pt;
    position: relative;
}

.arrete-header {
    text-align: center;
    border-bottom: 2px solid #111827;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.marianne-band {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 0.75rem;
}

.marianne-band .flag {
    display: flex;
    height: 24px;
    width: 36px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.marianne-band .flag .f-blue { width: 12px; background: #002654; }
.marianne-band .flag .f-white { width: 12px; background: #ffffff; }
.marianne-band .flag .f-red { width: 12px; background: #ce1126; }

.republique-text {
    font-family: 'Cinzel', serif;
    font-size: 13pt;
    letter-spacing: 0.15em;
    font-weight: 700;
    text-transform: uppercase;
}

.collectivite-header-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14pt;
    font-weight: 800;
    text-transform: uppercase;
    color: #1b4332;
    margin-top: 0.5rem;
}

.arrete-numero-box {
    margin: 1.5rem 0;
    text-align: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 12pt;
    border: 1px solid #000;
    padding: 0.5rem;
    background: #f9fafb;
}

.arrete-visas {
    margin: 1.5rem 0;
    font-size: 10.5pt;
    text-align: justify;
}

.arrete-visas p {
    margin-bottom: 0.4rem;
}

.arrete-arrete-title {
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 14pt;
    font-weight: 800;
    margin: 2rem 0 1.5rem 0;
    letter-spacing: 0.1em;
}

.arrete-article {
    margin-bottom: 1.2rem;
    text-align: justify;
}

.arrete-article strong {
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-decoration: underline;
}

.arrete-signature-block {
    margin-top: 3rem;
    display: flex;
    justify-content: flex-end;
}

.arrete-signature-box {
    width: 250px;
    text-align: center;
}

.arrete-cachet {
    height: 100px;
    border: 2px dashed #94a3b8;
    border-radius: 8px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 9pt;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Print CSS */
@media print {
    body {
        background: #ffffff !important;
    }
    .app-sidebar, .app-header, .btn, .no-print {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
    }
    .page-content {
        padding: 0 !important;
    }
    .arrete-paper-container {
        background: transparent !important;
        padding: 0 !important;
    }
    .arrete-paper {
        width: 100% !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
}