:root {
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-hover-color: #4338ca;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --sidebar-bg: #14152b;
    --sidebar-bg-active: #4f46e5;
    --sidebar-text: rgba(255, 255, 255, 0.65);
    --sidebar-text-active: #ffffff;
    --radius: 0.75rem;
}

body {
    background-color: #f3f4f8;
    font-family: var(--bs-body-font-family);
    color: #1f2330;
}

a {
    color: var(--bs-link-color);
}

a:hover {
    color: var(--bs-link-hover-color);
}

/* ---- Sidebar ---- */
.sidebar {
    --bs-offcanvas-width: 250px;
    width: 250px;
    background-color: var(--sidebar-bg) !important;
}

.sidebar .nav-link {
    border-radius: 8px;
    white-space: nowrap;
    color: var(--sidebar-text);
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.55rem 0.85rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link i {
    width: 1.25em;
    text-align: center;
    margin-right: 0.35rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text-active);
}

.sidebar .nav-link.active {
    background-color: var(--sidebar-bg-active);
    color: #fff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.sidebar .nav-section-label {
    text-transform: uppercase;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    margin: 1.1rem 0 0.4rem 0.6rem;
}

.sidebar .text-white-50:hover {
    color: rgba(255, 255, 255, 0.85) !important;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .sidebar {
        height: 100vh;
        position: sticky;
        top: 0;
        overflow-y: auto;
    }
}

/* ---- Topbar ---- */
.topbar {
    z-index: 1020;
    background-color: var(--sidebar-bg) !important;
}

/* ---- Cards ---- */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #eef0f5;
    border-top-left-radius: var(--radius) !important;
    border-top-right-radius: var(--radius) !important;
    font-weight: 600;
    padding: 0.9rem 1.1rem;
}

/* ---- Stat cards ---- */
.stat-card .card-body {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
}

.stat-card .display-6 {
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.2;
}

/* ---- Buttons ---- */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: #4338ca;
    --bs-btn-hover-border-color: #4338ca;
    --bs-btn-active-bg: #4338ca;
    --bs-btn-active-border-color: #4338ca;
}

/* ---- Tables ---- */
.table thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 600;
    border-bottom-width: 1px;
}

.table-light, .table > :not(caption) > * > * {
    background-color: transparent;
}

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

/* ---- Badges ---- */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.4em 0.65em;
    border-radius: 6px;
}

/* ---- Forms ---- */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #dde1ea;
}

.form-control:focus, .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
}

/* ---- Misc ---- */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
    main {
        max-width: 100vw;
    }
}
