:root {
    --sidebar-width: 270px;
    --sidebar-bg: #0f172a;
    --sidebar-bg-alt: #1e293b;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(37, 99, 235, 0.18);
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --body-bg: #f4f6fb;
    --card-border: #e8edf5;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius-lg: 1rem;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--body-bg);
    font-family: Inter, 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #0f172a;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #111827 100%);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
}

.sidebar-brand {
    padding: 1.35rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.sidebar-brand h5 {
    color: #fff;
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.sidebar-brand small {
    color: #94a3b8;
    font-size: 0.75rem;
}

.sidebar-section-label {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 1rem 1.5rem 0.5rem;
}

.sidebar-nav {
    padding: 0.25rem 0 1.5rem;
}

.sidebar-nav .nav-link {
    color: #cbd5e1;
    padding: 0.72rem 1rem;
    margin: 0.15rem 0.85rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
    width: 20px;
    opacity: 0.95;
}

/* Main layout */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    padding: 0.9rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
}

.topbar-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: #fff;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.content-area {
    padding: 1.5rem;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.page-header h1,
.page-header h4 {
    margin-bottom: 0.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-header .subtitle,
.page-header .text-muted {
    color: var(--text-muted) !important;
}

.breadcrumb-lite {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.breadcrumb-lite a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Cards */
.card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: #fff;
    overflow: hidden;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    padding: 1rem 1.25rem;
    color: #0f172a;
}

.card-footer {
    background: #fafbfd;
    border-top: 1px solid var(--card-border);
}

.filter-card .card-body {
    padding: 1.25rem;
}

.form-card .card-header {
    background: linear-gradient(180deg, #fff, #fafbfd);
}

/* Stat cards */
.stat-card {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    background: #fff;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .card-body {
    padding: 1.15rem 1.25rem;
}

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

.stat-card-premium::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08), transparent 70%);
    pointer-events: none;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

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

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.dashboard-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: 1.1rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.dashboard-hero .hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.dashboard-hero .hero-text {
    color: rgba(255, 255, 255, 0.82);
    max-width: 640px;
}

.dashboard-hero .hero-stat {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
}

/* Tables */
.table-responsive {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 0.85rem 1rem;
    vertical-align: middle;
}

.table thead th {
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover > tbody > tr:hover {
    background-color: #f8fbff;
}

.table-danger,
.table-danger > td,
.table-danger > th {
    --bs-table-bg: #fff5f5;
}

/* Badges */
.badge {
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.42em 0.65em;
    border-radius: 999px;
}

/* Buttons */
.btn {
    border-radius: 0.7rem;
    font-weight: 600;
    padding: 0.5rem 0.95rem;
}

.btn-sm {
    border-radius: 0.55rem;
    padding: 0.32rem 0.7rem;
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #1d4ed8, #1e40af);
    border-color: #1e40af;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-success {
    background: #fff;
}

.action-btn-group .btn {
    margin-left: 0.25rem;
}

/* Forms */
.form-label {
    font-weight: 600;
    color: #334155;
    font-size: 0.88rem;
    margin-bottom: 0.4rem;
}

.form-control,
.form-select {
    border: 1px solid #dbe3ef;
    border-radius: 0.7rem;
    padding: 0.62rem 0.85rem;
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0.5rem 0 0.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 18px;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.empty-state h6 {
    color: #334155;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.85rem;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

/* Login */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 30%),
        linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 430px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.1rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.login-card .card-body {
    padding: 2rem;
}

/* Utilities */
.text-money {
    font-variant-numeric: tabular-nums;
}

.sidebar-toggle {
    display: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 999;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* Notifications */
.notification-menu {
    width: 360px;
    max-height: 420px;
    overflow: hidden;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    white-space: normal;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-border);
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.06);
}

.notification-item:hover {
    background: rgba(37, 99, 235, 0.08);
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tiny {
    font-size: 0.72rem;
}

.notification-count {
    font-size: 0.65rem;
    min-width: 18px;
}
