:root {
    --emerald: #10b981;
    --emerald-dark: #059669;
    --emerald-light: #d1fae5;
    --emerald-soft: #ecfdf5;
    --sidebar-width: 260px;
    --gray-soft: #f8f9fa;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --white: #ffffff;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f3f4f6;
    color: var(--text-dark);
}

body.login-page {
    background-color: var(--emerald-soft);
}

.login-icon {
    width: 64px;
    height: 64px;
    background-color: var(--emerald-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1.75rem;
    color: var(--emerald-dark);
}

.text-emerald { color: var(--emerald-dark) !important; }

.btn-emerald {
    background-color: var(--emerald);
    border-color: var(--emerald);
    color: white;
}
.btn-emerald:hover {
    background-color: var(--emerald-dark);
    border-color: var(--emerald-dark);
    color: white;
}

.btn-outline-emerald {
    border-color: var(--emerald);
    color: var(--emerald);
}
.btn-outline-emerald:hover {
    background-color: var(--emerald);
    color: white;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--white);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background-color: var(--emerald);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.2;
}
.sidebar-brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.4rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.sidebar-nav .nav-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--emerald-soft);
    color: var(--emerald-dark);
}

.sidebar-nav .nav-link.active {
    background-color: var(--emerald-light);
    color: var(--emerald-dark);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--emerald);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.page-content {
    padding: 1.5rem;
    flex: 1;
}

.stat-card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.stat-icon.green { background-color: var(--emerald-light); color: var(--emerald-dark); }
.stat-icon.blue { background-color: #dbeafe; color: #1d4ed8; }
.stat-icon.amber { background-color: #fef3c7; color: #d97706; }
.stat-icon.purple { background-color: #ede9fe; color: #7c3aed; }

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-clean {
    background-color: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-clean .card-header-clean {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    background-color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-clean {
    margin: 0;
    font-size: 0.875rem;
}

.table-clean thead th {
    background-color: var(--gray-soft);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.table-clean tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    color: var(--text-dark);
}

.table-clean tbody tr:last-child td { border-bottom: none; }
.table-clean tbody tr:hover td { background-color: var(--emerald-soft); }

.badge-juz {
    background-color: var(--emerald-light);
    color: var(--emerald-dark);
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
}

.badge-nilai {
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
}

.progress-bar-emerald {
    background-color: var(--emerald);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control, .form-select {
    font-size: 0.875rem;
    border-color: var(--border-color);
    border-radius: 8px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.btn {
    font-size: 0.875rem;
    border-radius: 8px;
}

.btn-sm { font-size: 0.78rem; }

.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.rank-1 { background-color: #fef3c7; color: #d97706; }
.rank-2 { background-color: #f1f5f9; color: #475569; }
.rank-3 { background-color: #fce7f3; color: #be185d; }
.rank-other { background-color: var(--gray-soft); color: var(--text-muted); }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
}
