:root {
    --sidebar-width: 250px;
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --primary-light: #a29bfe;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --info: #74b9ff;
    --sidebar-bg: #0f0f1a;
    --sidebar-text: #b2b2cc;
    --card-radius: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================
   SIDEBAR
   ============================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-header .logo-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header .logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #fd79a8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-header h4 {
    color: #fff;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.sidebar-header small {
    color: #6c6c8a;
    font-size: 0.7rem;
    display: block;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar .nav {
    flex: 1;
    padding: 6px 0;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #2d2d4a; border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #3d3d5a; }
.sidebar { scrollbar-width: thin; scrollbar-color: #2d2d4a transparent; }

.sidebar .nav-section-label {
    padding: 12px 20px 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #5a5a7a;
    font-weight: 600;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 10px 18px;
    border-radius: 0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
    white-space: nowrap;
}

.sidebar .nav-link:hover {
    background: linear-gradient(90deg, rgba(108,92,231,0.1) 0%, transparent 100%);
    color: #e0e0f0;
    border-left-color: rgba(108,92,231,0.4);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(108,92,231,0.18) 0%, transparent 100%);
    color: #d0d0ff;
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar .nav-link i:first-child {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.sidebar .nav-link .bi-chevron-down {
    font-size: 0.65rem;
    transition: transform 0.2s;
    margin-left: auto;
    opacity: 0.6;
}

.sidebar .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar .sub-link {
    padding: 7px 16px 7px 38px;
    font-size: 0.82rem;
    color: #9a9aba;
    border-left: none;
}

.sidebar .sub-link:hover {
    color: #d0d0e8;
    background: rgba(255,255,255,0.03);
}

.sidebar .sub-link.active {
    color: #c8c8ff;
    background: rgba(108,92,231,0.08);
}

.sidebar .nav-divider {
    border-color: rgba(255,255,255,0.06);
    margin: 6px 18px;
}

/* Smooth collapse transitions for sub-menus */
.sidebar .collapse { transition: height 0.25s ease; }
.sidebar .collapsing { transition: height 0.25s ease; }

/* Badge inside nav-link */
.sidebar .nav-link .badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ============================
   TOP HEADER
   ============================ */
.top-header {
    background: #fff;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 99;
}

.top-header .brand-mobile {
    display: none;
    align-items: center;
    gap: 10px;
}

.top-header .brand-mobile .logo-icon-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #fd79a8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

.top-header .brand-mobile span {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2d3436;
}

.user-info-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info-bar .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #fd79a8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-info-bar .user-details {
    line-height: 1.2;
}

.user-info-bar .user-details .user-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: #2d3436;
}

.user-info-bar .user-details .user-meta {
    font-size: 0.7rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wallet-badge {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.notif-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f5f6fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #636e72;
    font-size: 1.05rem;
    transition: all 0.2s;
}

.notif-btn:hover {
    background: #e8e8f0;
    color: #2d3436;
}

.notif-btn .badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

/* ============================
   MAIN CONTENT
   ============================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================
   GRADIENT STAT CARDS
   ============================ */
.grad-card {
    border: none;
    border-radius: var(--card-radius);
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s;
}

.grad-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.grad-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12) !important;
}

.grad-card .card-body {
    padding: 1.2rem 1.4rem;
    position: relative;
    z-index: 1;
}

.grad-card .card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.grad-card .card-label {
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}

.grad-card .card-value {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.grad-purple { background: linear-gradient(135deg, #6c5ce7, #a29bfe); }
.grad-green { background: linear-gradient(135deg, #00b894, #55efc4); }
.grad-blue { background: linear-gradient(135deg, #0984e3, #74b9ff); }
.grad-orange { background: linear-gradient(135deg, #e17055, #fab1a0); }
.grad-pink { background: linear-gradient(135deg, #fd79a8, #e84393); }
.grad-teal { background: linear-gradient(135deg, #00cec9, #81ecec); }
.grad-yellow { background: linear-gradient(135deg, #fdcb6e, #ffeaa7); color: #2d3436; }
.grad-red { background: linear-gradient(135deg, #d63031, #ff7675); }

/* ============================
   SERVICE GRID
   ============================ */
.service-grid .service-card {
    border: 1px solid #eee;
    border-radius: 14px;
    transition: all 0.25s;
    cursor: pointer;
    background: #fff;
}

.service-grid .service-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.07);
    border-color: var(--primary);
}

.service-grid .service-card .svc-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin: 0 auto 8px;
}

.service-grid .service-card .card-body {
    padding: 16px 10px;
}

.service-grid .service-card h6 {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0;
    color: #2d3436;
}

/* ============================
   TABLES
   ============================ */
.table > thead {
    border-top: none;
    background: #f8f9fc;
}

.table > thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6c757d;
    padding: 10px 12px;
    border-bottom: 2px solid #e8e8f0;
}

.table > tbody > tr:hover {
    background: #f0f0ff;
}

.table td {
    font-size: 0.85rem;
    vertical-align: middle;
    padding: 10px 12px;
}

.table-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.table-status.success { background: #e8faf0; color: #00b894; }
.table-status.failed { background: #fde8e8; color: #e17055; }
.table-status.pending { background: #fef5e7; color: #fdcb6e; }

/* ============================
   DATA TABLES
   ============================ */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(108,92,231,0.15);
}

/* ============================
   CARDS
   ============================ */
.card {
    border-radius: var(--card-radius);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 14px 20px;
}

.card-header h6 {
    font-weight: 600;
    font-size: 0.92rem;
}

.card-body {
    padding: 1.2rem;
}

/* ============================
   BUTTONS
   ============================ */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

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

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

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

/* ============================
   FORMS
   ============================ */
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(108,92,231,0.15);
}

.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid #e0e0e8;
    font-size: 0.88rem;
}

/* ============================
   BADGES
   ============================ */
.badge {
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
}

.badge-role-admin { background: #e17055; color: #fff; }
.badge-role-master_distributor { background: #fdcb6e; color: #2d3436; }
.badge-role-distributor { background: #74b9ff; color: #fff; }
.badge-role-retailer { background: #00b894; color: #fff; }

/* ============================
   PAGINATION
   ============================ */
.page-link {
    color: var(--primary);
    border-radius: 8px !important;
    margin: 0 2px;
    border: none;
    font-size: 0.85rem;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

.page-item.disabled .page-link {
    background: transparent;
    color: #ccc;
}

/* ============================
   ALERTS
   ============================ */
.alert {
    border-radius: 12px;
    border: none;
}

/* ============================
   SECTION TITLES
   ============================ */
.section-title {
    font-weight: 700;
    font-size: 1rem;
    color: #2d3436;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary);
}

/* ============================
   MODAL
   ============================ */
.modal-header {
    border-bottom: 1px solid #f0f0f0;
}

.modal-footer {
    border-top: 1px solid #f0f0f0;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
        transition: margin-left 0.3s ease;
        box-shadow: none;
    }
    .sidebar.active {
        margin-left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    .sidebar.active::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: -1;
    }
    .main-content {
        margin-left: 0;
    }
    .top-header .brand-mobile {
        display: flex;
    }
    .top-header .user-info-bar .user-details {
        display: none;
    }
    .grad-card .card-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .top-header {
        padding: 0 12px;
    }
    .top-header .user-info-bar {
        gap: 8px;
    }
    .wallet-badge {
        font-size: 0.78rem;
        padding: 4px 10px;
    }
}

/* ============================
   PAN CARD FIND
   ============================ */
.pan-card {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    background: #fff;
    border: none;
}
.pan-success { background: #f0fdf4; border-left: 4px solid #22C55E; }
.pan-failed { background: #fef2f2; border-left: 4px solid #EF4444; }
.pan-icon-wrap {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 1.5rem;
}
.pan-icon-success { background: #dcfce7; color: #22C55E; }
.pan-icon-failed { background: #fee2e2; color: #EF4444; }
.pan-input {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 1.1rem;
    letter-spacing: 2px;
    transition: border-color .2s;
}
.pan-input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.pan-btn {
    background: #2563EB;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    transition: all .2s;
}
.pan-btn:hover { background: #1d4ed8; transform: translateY(-1px); }
.pan-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.pan-label { font-size: .85rem; color: #64748b; font-weight: 500; }
.pan-value { font-weight: 700; color: #1e293b; }
.pan-divider { border-color: #e2e8f0; opacity: .5; }
.pan-badge-success {
    background: #dcfce7; color: #166534;
    padding: 4px 16px; border-radius: 20px;
    font-size: .82rem; font-weight: 600;
}
.pan-badge-failed {
    background: #fee2e2; color: #991b1b;
    padding: 4px 16px; border-radius: 20px;
    font-size: .82rem; font-weight: 600;
}
.pan-action-btn {
    border-radius: 8px; padding: 8px 20px;
    font-size: .9rem; font-weight: 500;
    transition: all .2s;
}
.pan-action-btn:hover { transform: translateY(-1px); }
.pan-spinner {
    width: 40px; height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563EB;
    border-radius: 50%;
    animation: pan-spin .7s linear infinite;
}
@keyframes pan-spin { to { transform: rotate(360deg); } }
.pan-validation li { font-size: .85rem; color: #64748b; padding: 2px 0; }
.pan-validation li::marker { color: #22C55E; }

/* Print */
@media print {
    body * { visibility: hidden; }
    #receiptArea, #receiptArea * { visibility: visible; }
    #receiptArea { position: fixed; top: 0; left: 0; width: 100%; padding: 20px; }
    .no-print { display: none !important; }
}

/* ============================
   FUND REQUEST
   ============================ */
.bank-detail-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

/* ============================
   UTILITY
   ============================ */
.fs-7 { font-size: 0.82rem; }
.fs-8 { font-size: 0.72rem; }
.cursor-pointer { cursor: pointer; }
