:root {
    --bs-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --primary-color: #2563EB;
    --primary-hover: #1D4ED8;
    --sidebar-bg: #0B132B;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-text: #94A3B8;
    --sidebar-divider: #1E293B;
    --content-bg: #F8FAFC;
    --border-color: #E2E8F0;
}

body {
    font-family: var(--bs-font-sans-serif);
    background-color: var(--content-bg);
    color: #1E293B;
    font-size: 0.8125rem;
    overflow-x: hidden;
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.app-sidebar {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    background-color: var(--sidebar-bg);
    flex-shrink: 0;
    transition: margin-left 0.25s ease-in-out;
    z-index: 1040;
    overflow-x: hidden;
}

.app-sidebar.sidebar-collapsed {
    margin-left: -250px;
}

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

.sidebar-brand .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #2563EB;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.sidebar-nav-container {
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 60px);
}

.sidebar-item {
    margin-bottom: 3px;
    width: 100%;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
    cursor: pointer;
    width: 100%;
}

.sidebar-link:hover,
.sidebar-link:hover i {
    color: #FFFFFF;
    background-color: var(--sidebar-hover);
}

.sidebar-link.active {
    color: #FFFFFF;
    background-color: rgba(37, 99, 235, 0.2);
    font-weight: 600;
}

.sidebar-link.active i {
    color: #38BDF8;
}

.sidebar-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    color: #64748B;
    flex-shrink: 0;
}

.sidebar-submenu-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 3px 0 6px 0;
}

.sidebar-subitem-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.48rem 0.75rem 0.48rem 1.75rem;
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.15s ease-in-out;
    width: 100%;
}

.submenu-bullet {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #64748B;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-subitem-text {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
    word-break: break-word;
}

.sidebar-subitem-link:hover {
    color: #FFFFFF;
    background-color: var(--sidebar-hover);
}

.sidebar-subitem-link:hover .submenu-bullet {
    background-color: #38BDF8;
    transform: scale(1.25);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.sidebar-subitem-link.active {
    background-color: #2563EB !important;
    color: #FFFFFF !important;
    font-weight: 600;
}

.sidebar-subitem-link.active .submenu-bullet {
    background-color: #FFFFFF !important;
    transform: scale(1.25);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

/* ==========================================================================
   Top Header Bar
   ========================================================================== */
.app-topbar {
    height: 60px;
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-toggle-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    cursor: pointer;
}

.topbar-toggle-btn:hover {
    background-color: #F1F5F9;
    color: #0F172A;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0F172A;
    margin: 0;
    line-height: 1.2;
}

.topbar-breadcrumb {
    font-size: 0.725rem;
    color: #64748B;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 0.35rem;
}

.topbar-breadcrumb li+li::before {
    content: "/";
    padding-right: 0.35rem;
    color: #94A3B8;
}

.user-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    white-space: nowrap;
    transition: background-color 0.15s;
}

.user-profile-badge:hover {
    background-color: #F1F5F9;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #2563EB;
    color: #FFFFFF;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0F172A;
    white-space: nowrap;
}

/* ==========================================================================
   Filter Card & Bar
   ========================================================================== */
.filter-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.125rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.875rem;
}

.filter-col {
    flex: 1 1 150px;
    min-width: 140px;
}

.filter-col-period,
.filter-col-merchant {
    flex: 1 1 170px;
    min-width: 160px;
}

.filter-col-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.35rem;
    display: block;
}

.filter-control {
    font-size: 0.8125rem;
    font-weight: 500;
    height: 36px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    padding: 0.375rem 0.65rem;
    color: #0F172A;
    background-color: #FFFFFF;
    width: 100%;
}

.filter-control:focus {
    border-color: #2563EB;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.btn-apply {
    background-color: #2563EB;
    color: #FFFFFF;
    border: 1px solid #2563EB;
    font-size: 0.8125rem;
    font-weight: 600;
    height: 36px;
    padding: 0 1.125rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: background-color 0.15s;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-apply:hover {
    background-color: #1D4ED8;
    border-color: #1D4ED8;
    color: #FFFFFF;
}

.btn-clear {
    background-color: #FFFFFF;
    color: #475569;
    border: 1px solid #CBD5E1;
    font-size: 0.8125rem;
    font-weight: 500;
    height: 36px;
    padding: 0 0.875rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-clear:hover {
    background-color: #F8FAFC;
    border-color: #94A3B8;
    color: #0F172A;
}

.btn-icon-toggle {
    background-color: #FFFFFF;
    color: #64748B;
    border: 1px solid #CBD5E1;
    height: 36px;
    width: 36px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-icon-toggle:hover {
    background-color: #F8FAFC;
    color: #0F172A;
}

/* ==========================================================================
   Report Container & Header
   ========================================================================== */
.report-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem 1.25rem 1.5rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.report-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0F172A;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

/* ==========================================================================
   Table Action Bar (Search & Export)
   ========================================================================== */
.table-action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}

.table-search-input {
    height: 34px;
    font-size: 0.8125rem;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    padding: 0.35rem 0.75rem 0.35rem 2rem;
    width: 210px;
    background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394A3B8' class='bi bi-search' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E") no-repeat 0.65rem center;
}

.table-search-input:focus {
    border-color: #2563EB;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.btn-export-excel {
    background-color: #FFFFFF;
    color: #059669;
    border: 1px solid #10B981;
    font-size: 0.8125rem;
    font-weight: 600;
    height: 34px;
    padding: 0 0.875rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-export-excel:hover {
    background-color: #ECFDF5;
    border-color: #059669;
}

.btn-export-csv {
    background-color: #FFFFFF;
    color: #2563EB;
    border: 1px solid #3B82F6;
    font-size: 0.8125rem;
    font-weight: 600;
    height: 34px;
    padding: 0 0.875rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-export-csv:hover {
    background-color: #EFF6FF;
    border-color: #2563EB;
}

/* ==========================================================================
   KPI Data Table
   ========================================================================== */
.kpi-table-wrapper {
    overflow-x: auto;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background-color: #FFFFFF;
}

.kpi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.kpi-table thead th {
    background-color: #F8FAFC;
    color: #475569;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid #E2E8F0;
    cursor: pointer;
    user-select: none;
}

.kpi-table thead th:hover {
    background-color: #F1F5F9;
}

.kpi-table tbody td {
    padding: 0.55rem 0.75rem;
    color: #0F172A;
    border-bottom: 1px solid #F1F5F9;
}

.kpi-table tbody tr:hover {
    background-color: #F8FAFC;
}

.kpi-table tfoot td {
    background-color: #FFFFFF;
    color: #0F172A;
    font-weight: 700;
    padding: 0.65rem 0.75rem;
    border-top: 2px solid #CBD5E1;
    border-bottom: 1px solid #E2E8F0;
}

/* ==========================================================================
   Pagination Bar
   ========================================================================== */
.pagination-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.875rem;
}

.pagination-info {
    font-size: 0.775rem;
    color: #64748B;
}

.pagination-controls {
    display: flex;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-btn {
    border: 1px solid #E2E8F0;
    background-color: #FFFFFF;
    color: #475569;
    font-size: 0.75rem;
    height: 30px;
    min-width: 30px;
    padding: 0 0.5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #F1F5F9;
    border-color: #CBD5E1;
    color: #0F172A;
}

.pagination-btn.active {
    background-color: #2563EB !important;
    border-color: #2563EB !important;
    color: #FFFFFF !important;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ==========================================================================
   Autocomplete Dropdown (ServiceSelect / Combobox)
   ========================================================================== */
.autocomplete-menu {
    max-height: 220px;
    overflow-y: auto;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 1050;
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
}

.autocomplete-item {
    cursor: pointer;
    padding: 0.45rem 0.75rem;
    font-size: 0.8125rem;
    color: #1e293b;
    border: none;
    background-color: transparent;
    transition: background-color 0.1s, color 0.1s;
    user-select: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: var(--primary-color, #2563eb) !important;
    color: #ffffff !important;
}

/* ==========================================================================
   Mobile & Responsive Enhancements (Phones, Tablets & Desktop Browsers)
   ========================================================================== */

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(2px);
    z-index: 1045;
    transition: opacity 0.2s ease;
}

/* Tablets & Mobile (< 992px) */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1050 !important;
        margin-left: 0 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
    }

    .app-sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.5) !important;
    }

    .app-topbar {
        padding: 0 1rem;
        height: 56px;
    }

    .topbar-title {
        font-size: 0.95rem;
    }

    .topbar-breadcrumb {
        display: none !important;
    }
}

/* PC / Desktop (>= 992px) */
@media (min-width: 992px) {
    .app-sidebar {
        position: relative !important;
        transform: none !important;
        transition: margin-left 0.25s ease-in-out !important;
    }

    .app-sidebar.sidebar-collapsed {
        margin-left: -250px !important;
    }

    .sidebar-backdrop {
        display: none !important;
    }
}

/* Mobile Phones (< 768px) */
@media (max-width: 768px) {
    .filter-card {
        padding: 1rem 0.875rem;
        margin-bottom: 1rem;
    }

    .filter-grid {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
    }

    .filter-col,
    .filter-col-period,
    .filter-col-merchant {
        width: 100%;
        min-width: 100%;
        flex: 1 1 100%;
    }

    .filter-label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }

    .filter-control {
        height: 42px;
        font-size: 0.875rem;
    }

    .filter-col-actions {
        width: 100%;
        margin-left: 0;
        display: flex;
        gap: 0.5rem;
        margin-top: 0.25rem;
    }

    .filter-col-actions .btn-apply {
        flex: 1;
        height: 42px;
        font-size: 0.875rem;
        justify-content: center;
    }

    .filter-col-actions .btn-clear {
        height: 42px;
        padding: 0 1rem;
        font-size: 0.875rem;
        justify-content: center;
    }

    .filter-col-actions .btn-icon-toggle {
        height: 42px;
        width: 42px;
        flex-shrink: 0;
    }

    .report-card {
        padding: 1rem 0.875rem;
    }

    .table-action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.625rem;
    }

    .table-action-bar > div:first-child {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .table-search-input {
        width: 100% !important;
        height: 40px;
        font-size: 0.875rem;
    }

    .table-action-bar > div:last-child {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.35rem;
    }

    .btn-export-excel,
    .btn-export-csv {
        width: 100%;
        height: 38px;
        justify-content: center;
        padding: 0 0.4rem;
        font-size: 0.75rem;
    }

    .kpi-table-wrapper {
        border-radius: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .kpi-table th,
    .kpi-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
    }

    .pagination-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
    }

    .pagination-btn {
        height: 34px;
        min-width: 34px;
        font-size: 0.8125rem;
    }
}

/* Medium Tablets (576px to 768px) */
@media (min-width: 576px) and (max-width: 768px) {
    .filter-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .filter-col-actions {
        grid-column: span 2;
    }
}

.report-nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04) !important;
}
