:root {
    /* Brand Colors (Premium NGO Palette) */
    --primary-color: #1E3A8A;
    /* Deep Navy Blue for Trust/Authority */
    --primary-hover: #172554;
    --secondary-color: #059669;
    /* Earthy Forest Green for Impact/Growth */
    --accent-color: #D97706;
    --accent: #D97706;
    /* Warm Amber for Action/Humanity */
    --danger-color: #DC2626;

    /* Light Theme Defaults */
    --bg-base: #F8FAFC;
    --bg-surface: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #475569;
    --border-color: #E2E8F0;

    /* Spacing & Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Premium Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-glow: 0 0 20px rgba(30, 58, 138, 0.1);
}

[data-theme="dark"] {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --accent: #f59e0b;
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.05);
}

/* Form Controls */
.form-control {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-base);
    color: var(--text-main);
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    transition: var(--transition);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* Layout Utilities */
.container {
    padding-inline: 20px;
    margin-inline: auto;
    max-width: 1200px;
}

/* Typography & Gradients */
.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
    pointer-events: none;
}

[data-theme="dark"] .glass-card::before {
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.05), var(--shadow-glow);
}

/* Buttons */
.btn, a.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    gap: 8px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
    user-select: none;
}

.btn:focus, a.btn:focus, button.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

a.btn:hover, a.btn:visited, a.btn:active {
    text-decoration: none;
}

/* Primary Button */
.btn-primary, a.btn-primary, button.btn-primary {
    background: linear-gradient(135deg, var(--primary-color, #2563eb), var(--primary-hover, #1d4ed8)) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.btn-primary:hover, a.btn-primary:hover, button.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover, #1d4ed8), #1e40af) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.38);
}

/* Warning / Amber Action Button */
.btn-warning, a.btn-warning, button.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #ffffff !important;
    border: 1px solid rgba(217, 119, 6, 0.25) !important;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
}

.btn-warning:hover, a.btn-warning:hover, button.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.42);
}

/* Success Action Button */
.btn-success, a.btn-success, button.btn-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}

.btn-success:hover, a.btn-success:hover, button.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.38);
}

/* Danger Action Button */
.btn-danger, a.btn-danger, button.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.28);
}

.btn-danger:hover, a.btn-danger:hover, button.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.38);
}

/* Secondary Button */
.btn-secondary, a.btn-secondary, button.btn-secondary {
    background: var(--bg-surface, #ffffff) !important;
    color: var(--text-main, #1e293b) !important;
    border: 1px solid var(--border-color, #e2e8f0) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover, a.btn-secondary:hover, button.btn-secondary:hover {
    background: var(--bg-secondary, #f8fafc) !important;
    border-color: #cbd5e1 !important;
    color: var(--text-main, #0f172a) !important;
}

/* Outline Buttons */
.btn-outline, a.btn-outline, button.btn-outline {
    background: transparent !important;
    color: var(--text-main, #334155) !important;
    border: 1.5px solid var(--border-color, #cbd5e1) !important;
}

.btn-outline:hover, a.btn-outline:hover, button.btn-outline:hover {
    border-color: var(--primary-color, #2563eb) !important;
    color: var(--primary-color, #2563eb) !important;
    background: rgba(37, 99, 235, 0.05) !important;
}

.btn-outline-danger, a.btn-outline-danger, button.btn-outline-danger {
    background: transparent !important;
    color: #dc2626 !important;
    border: 1.5px solid rgba(220, 38, 38, 0.35) !important;
}

.btn-outline-danger:hover, a.btn-outline-danger:hover, button.btn-outline-danger:hover {
    background: #fef2f2 !important;
    border-color: #dc2626 !important;
    color: #991b1b !important;
}

/* Button Sizing */
.btn-sm, a.btn-sm, button.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.82rem !important;
    border-radius: 6px !important;
}

.btn-lg, a.btn-lg, button.btn-lg {
    padding: 14px 28px !important;
    font-size: 1.05rem !important;
    border-radius: 10px !important;
}

/* Data Grids */
.data-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.data-grid th,
.data-grid td {
    padding: 16px 20px;
    text-align: start;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-grid th {
    background-color: rgba(0, 0, 0, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

[data-theme="dark"] .data-grid th {
    background-color: rgba(255, 255, 255, 0.02);
}

.data-grid th:first-child {
    border-top-left-radius: var(--radius-md);
}

.data-grid th:last-child {
    border-top-right-radius: var(--radius-md);
}

.data-grid tr:hover td {
    background-color: rgba(30, 58, 138, 0.02);
}

[data-theme="dark"] .data-grid tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-success {
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
}

.badge-warning {
    background: rgba(217, 119, 6, 0.15);
    color: #D97706;
}

.badge-info {
    background: rgba(30, 58, 138, 0.15);
    color: #1E3A8A;
}

.badge-secondary {
    background: rgba(71, 85, 105, 0.15);
    color: #475569;
}

[data-theme="dark"] .badge-success {
    color: #34d399;
}

[data-theme="dark"] .badge-warning {
    color: #fbbf24;
}

[data-theme="dark"] .badge-info {
    color: #60a5fa;
}

[data-theme="dark"] .badge-secondary {
    color: #94a3b8;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes blob {
    0% {
        transform: translate(0px, 0px) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }

    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

/* Stat Card specific classes */
.stat-icon-wrapper {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    position: relative;
    z-index: 1;
}

.stat-icon-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: inherit;
    filter: blur(10px);
    opacity: 0.5;
    z-index: -1;
}

.bg-primary-soft {
    background: rgba(30, 58, 138, 0.1);
    color: var(--primary-color);
}

.bg-warning-soft {
    background: rgba(217, 119, 6, 0.1);
    color: var(--accent-color);
}

.bg-success-soft {
    background: rgba(5, 150, 105, 0.1);
    color: var(--secondary-color);
}

[data-theme="dark"] .bg-primary-soft {
    background: rgba(96, 165, 250, 0.2);
    color: #93c5fd;
}

[data-theme="dark"] .bg-warning-soft {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

[data-theme="dark"] .bg-success-soft {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

/* Touch Target Sizing */
.btn,
.btn-sm {
    min-height: 44px;
}

.sidebar-nav a,
.dropdown-item,
.pagination a,
.pagination span {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Mobile-first: reduce card padding on smaller screens */
@media (max-width: 1024px) {
    .glass-card {
        padding: 24px;
    }

    .data-grid th,
    .data-grid td {
        padding: 12px 16px;
    }

    .content-area {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-inline-end: none;
        border-bottom: 1px solid var(--border-color);
        padding: 15px;
    }

    .topbar {
        padding-inline: 15px;
        flex-wrap: wrap;
        height: auto;
        padding-block: 15px;
    }

    .content-area {
        padding: 16px;
    }

    /* Make data tables scrollable horizontally */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .glass-card {
        padding: 20px;
    }

    .stat-icon-wrapper {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    /* Responsive table → card view */
    .data-grid thead {
        display: none;
    }

    .data-grid tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 16px;
        background: var(--bg-surface);
    }

    .data-grid td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border: none;
        gap: 12px;
        min-height: 44px;
    }

    .data-grid td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        flex-shrink: 0;
        white-space: nowrap;
    }

    .data-grid td:last-child {
        border-bottom: none;
    }

    .data-grid tr:hover td {
        background-color: transparent;
    }

    /* Action buttons in responsive table cells */
    .data-grid td .btn,
    .data-grid td .btn-sm,
    .data-grid td a.btn {
        width: 100%;
        justify-content: center;
    }

    /* Pagination spacing */
    ul.pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    ul.pagination li a,
    ul.pagination li span {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Responsive forms */
    .form-control {
        font-size: 16px;
        padding: 12px;
    }

    input,
    select,
    textarea {
        max-width: 100% !important;
    }

    form div[style*="display: flex"],
    form div[style*="display:flex"] {
        flex-wrap: wrap;
    }

    form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    form label {
        display: block;
        margin-bottom: 4px;
        font-size: 0.85rem;
    }
}

    /* Pagination spacing */
    ul.pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    ul.pagination li a,
    ul.pagination li span {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .glass-card {
        padding: 16px;
    }

    .content-area {
        padding: 12px;
    }

    .topbar {
        padding-inline: 10px;
        padding-block: 10px;
    }

    .data-grid tr {
        padding: 12px;
        margin-bottom: 12px;
    }

    .data-grid td {
        padding: 8px 0;
        font-size: 0.85rem;
        flex-wrap: wrap;
    }

    .data-grid td::before {
        font-size: 0.65rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .container {
        padding-inline: 12px;
    }

    .stat-icon-wrapper {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}


ul.pagination {
    display: flex;
    gap: 10px;
    list-style: none;
}

/* Sidebar collapsible sections */
.sidebar-section {
    margin-bottom: 1px;
}

.sidebar-section-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 15px;
    letter-spacing: 0.06em;
    border-radius: var(--radius-sm);
    transition: background 0.12s, color 0.12s;
    border-left: 3px solid transparent;
    margin-top: 6px;
}

.sidebar-section-header:hover {
    background: rgba(30, 58, 138, 0.06);
    color: var(--primary-color);
}

.sidebar-section-header .sidebar-section-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-section-header.collapsed .sidebar-section-chevron {
    transform: rotate(-90deg);
}

.sidebar-section-body {
    min-height: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 800px;
    opacity: 1;
    padding-left: 4px;
}

.sidebar-section-body.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Global Confirm Modal */
.confirm-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.65) !important;
    z-index: 10050 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 16px;
    box-sizing: border-box !important;
    margin: 0 !important;
}
.confirm-modal-overlay.active {
    display: flex !important;
}
.confirm-modal-window {
    background: var(--bg-surface, #ffffff);
    color: var(--text-main, #0f172a);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    width: 440px;
    max-width: 92vw;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35);
    animation: confirmModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    margin: auto;
    box-sizing: border-box;
}
@keyframes confirmModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.confirm-modal-body {
    padding: 18px 22px;
}
.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border-color, #e2e8f0);
}