html,
body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    max-width: 100%;
}

* {
    box-sizing: border-box;
}

a,
.btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding: 0.75rem; /* Reduced padding for mobile */
    overflow-x: hidden;
    max-width: 100vw;
    flex-grow: 1;
}

/* Optimized container usage - ZERO PADDING on desktop */
.container-fluid {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Mobile padding for container-fluid */
@media (max-width: 991px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Desktop - NO PADDING for container-fluid */
@media (min-width: 992px) {
    .container-fluid {
        padding-left: 0; /* ZERO padding on desktop */
        padding-right: 0; /* ZERO padding on desktop */
    }
}

/* ===== OPTIMIZED SIDEBAR AND PAGE LAYOUT ===== */

/* Page Layout - Flex-based for optimal space usage */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Sidebar - Optimized for better space utilization */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px; /* Aligned with actual rendered width */
    height: 100vh;
    background: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll in sidebar */
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

/* Hide sidebar completely on mobile */
@media (max-width: 991px) {
    .sidebar {
        display: none !important;
    }
}

/* Show sidebar on desktop with consistent breakpoint */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
        position: fixed;
        display: block !important;
    }

    /* Main content area - PERFECT FIX: Zero margin with fixed sidebar overlay */
    main {
        margin-left: 0px !important; /* Perfect solution - no gap! */
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        width: 100vw !important; /* Full width with sidebar overlay */
        max-width: 100vw !important; /* Prevent overflow */
        overflow-x: hidden;
        padding-left: 0 !important; /* Clean layout */
        position: relative; /* Proper positioning */
        left: 0 !important; /* Start at left edge */
    }
}

/* Navigation Scrollable Area - Optimized */
.nav-scrollable {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 0.75rem 0; /* Reduced padding for more space */
}

/* Desktop content padding - ZERO GAP SOLUTION */
@media (min-width: 992px) {
    .content {
        padding: 0 !important; /* ZERO padding to eliminate gap completely */
        margin: 0 !important; /* ZERO margin to eliminate gap completely */
        flex-grow: 1;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .top-row {
        margin-left: 0; /* Remove extra margin, handled by main element */
        padding: 0.25rem 0.5rem; /* Minimal padding to match content */
        background: #fff;
        border-bottom: 1px solid #e5e7eb;
        position: sticky;
        top: 0;
        z-index: 50;
        width: 100%;
        box-sizing: border-box;
        /* Add right margin to prevent overlap with Quick Actions sidebar */
        margin-right: 320px; /* 300px sidebar width + 20px buffer */
    }
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Dashboard Cards */
.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

.text-xs {
    font-size: 0.7rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

/* Login Page Styles */
.vh-100 {
    height: 100vh !important;
}

.card {
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15) !important;
}

.card-body {
    padding: 1.25rem;
}

/* Navigation improvements */
.navbar-brand {
    font-weight: bold;
}

/* Navigation Styles - Mobile and Desktop */
.mobile-nav .nav-item {
    margin-bottom: 0.5rem;
}

.mobile-nav .nav-link {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    color: #374151;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 44px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-nav .nav-link:hover,
.mobile-nav .nav-link:focus {
    background: #f3f4f6;
    color: #2563eb;
    text-decoration: none;
}

.mobile-nav .nav-link.active {
    background: #eff6ff;
    color: #2563eb;
    border-left: 3px solid #2563eb;
}

.mobile-nav .nav-link i,
.mobile-nav .nav-link .bi {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== ADVANCED SPACE OPTIMIZATION IMPROVEMENTS ===== */

/* Navigation optimizations for maximum space efficiency */
.mobile-nav .nav-item {
    margin-bottom: 0.125rem; /* Reduced from 0.25rem on desktop */
}

.mobile-nav .nav-link {
    padding: 0.625rem 1rem; /* Optimized padding for desktop */
    margin: 0 0.5rem; /* Reduced horizontal margin */
    border-radius: 4px; /* Slightly smaller radius for tighter fit */
    font-size: 0.875rem; /* Optimized font size */
    gap: 0.75rem; /* Reduced gap between icon and text */
    line-height: 1.2; /* Tighter line height for more compact appearance */
}

.mobile-nav .nav-link.active {
    background: #eff6ff;
    color: #2563eb;
    border-left: 3px solid #2563eb;
    border-radius: 4px;
}

.mobile-nav .nav-link:hover,
.mobile-nav .nav-link:focus {
    background: #f3f4f6;
    color: #2563eb;
}

.mobile-nav .nav-link i,
.mobile-nav .nav-link .bi {
    width: 16px; /* Reduced icon width */
    font-size: 0.9rem; /* Smaller icons for more space */
}

/* Card optimizations for better space utilization */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); /* Lighter shadow */
    border: 1px solid rgba(0, 0, 0, 0.05); /* Thinner border */
}

.card-body {
    padding: 0.875rem; /* Reduced from 1.25rem for more content space */
}

/* Table optimizations */
.table th,
.table td {
    padding: 0.5rem 0.75rem; /* Reduced table cell padding */
    vertical-align: middle;
}

.table-sm th,
.table-sm td {
    padding: 0.375rem 0.5rem; /* Even more compact for small tables */
}

/* Form optimizations */
.form-control,
.form-select {
    padding: 0.5rem 0.75rem; /* Slightly reduced form control padding */
    font-size: 0.9rem; /* Slightly smaller form text */
}

.form-control-sm,
.form-select-sm {
    padding: 0.375rem 0.5rem; /* More compact small form controls */
    font-size: 0.825rem;
}

/* Button optimizations */
.btn {
    padding: 0.5rem 1rem; /* Optimized button padding */
    font-size: 0.9rem; /* Slightly smaller button text */
    line-height: 1.3;
}

.btn-sm {
    padding: 0.375rem 0.75rem; /* More compact small buttons */
    font-size: 0.8rem;
}

/* Modal optimizations */
.modal-header {
    padding: 0.875rem 1rem; /* Reduced modal header padding */
}

.modal-body {
    padding: 0.875rem 1rem; /* Reduced modal body padding */
}

.modal-footer {
    padding: 0.75rem 1rem; /* Reduced modal footer padding */
}

/* Utility classes for space management */
.p-compact { padding: 0.5rem !important; }
.px-compact { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.py-compact { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.m-compact { margin: 0.5rem !important; }
.mx-compact { margin-left: 0.5rem !important; margin-right: 0.5rem !important; }
.my-compact { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }

/* Offcanvas Mobile Menu - Optimized width */
.offcanvas {
    max-width: 250px; /* Match sidebar width */
}

.offcanvas-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem; /* Reduced padding for more space */
}

.offcanvas-body {
    padding: 0.75rem 1rem; /* Reduced padding for more space */
}

/* Mobile Menu Toggle - Only visible on mobile */
.mobile-menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #374151;
    padding: 0.5rem;
    border-radius: 6px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Hide hamburger menu on desktop */
@media (min-width: 992px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    /* Force hide any navbar-toggler checkboxes on desktop */
    .navbar-toggler,
    input[type="checkbox"][title="Navigation menu"] {
        display: none !important;
    }
}

.mobile-menu-toggle:hover {
    background: #f3f4f6;
}

.mobile-menu-toggle:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ===== SPACE-OPTIMIZED MOBILE-FIRST DASHBOARD STYLES ===== */

/* Mobile Header - Reduced padding */
.mobile-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem; /* Reduced from 1rem */
    position: sticky;
    top: 0;
    z-index: 100;
}

.mobile-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Mobile brand with optimized sizing */
.mobile-brand {
    font-size: 1.125rem; /* Slightly reduced for more space */
    font-weight: 700;
    color: #2563eb;
    margin: 0;
}

.mobile-logout-btn {
    background: none;
    border: none;
    font-size: 1.125rem; /* Slightly reduced */
    color: #6b7280;
    padding: 0.375rem; /* Reduced padding */
    border-radius: 6px;
    min-width: 40px; /* Reduced from 44px */
    min-height: 40px; /* Reduced from 44px */
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.mobile-logout-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Dashboard Header - Optimized spacing */
.dashboard-header {
    padding: 0.75rem; /* Reduced from 1rem */
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    margin: -0.75rem -0.75rem 1rem -0.75rem; /* Adjusted for new content padding */
    overflow-x: hidden;
}

.business-health-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 0.25rem; /* Reduced gap */
    font-weight: 600;
}

.health-status i {
    margin-left: 0.25rem;
}

.health-good {
    color: #10b981;
}

.health-warning {
    color: #f59e0b;
}

.health-critical {
    color: #ef4444;
}

.date-info {
    font-size: 0.8rem; /* Slightly smaller for more space */
    opacity: 0.9;
    margin-right: 0.25rem; /* Reduced margin */
    display: flex;
    align-items: center;
    gap: 0.375rem; /* Reduced gap */
}

/* Section Titles */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

/* Metrics Section */
.metrics-section {
    margin-bottom: 2rem;
}

.metrics-scroll-container {
    display: flex;
    gap: 1rem;
    padding: 0 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.metrics-scroll-container::-webkit-scrollbar {
    display: none;
}

.metric-card {
    min-width: 280px;
    max-width: 320px;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    scroll-snap-align: start;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.metric-primary {
    border-left-color: #2563eb;
}

.metric-success {
    border-left-color: #16a34a;
}

.metric-warning {
    border-left-color: #ea580c;
}

.metric-info {
    border-left-color: #0891b2;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.metric-primary .metric-icon {
    background: #2563eb;
}

.metric-success .metric-icon {
    background: #16a34a;
}

.metric-warning .metric-icon {
    background: #ea580c;
}

.metric-info .metric-icon {
    background: #0891b2;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0.25rem 0;
}

.metric-change {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    display: inline-block;
}

.metric-change.positive {
    background: #dcfce7;
    color: #166534;
}

.metric-change.negative {
    background: #fee2e2;
    color: #991b1b;
}

.metric-change.neutral {
    background: #f3f4f6;
    color: #374151;
}

/* Charts Section */
.charts-section {
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0 1rem 1.5rem 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.chart-summary {
    font-size: 0.875rem;
}

.trend-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.trend-indicator.positive {
    color: #16a34a;
}

.trend-indicator.negative {
    color: #dc2626;
}

.collection-rate {
    color: #16a34a;
    font-weight: 600;
}

.chart-wrapper {
    position: relative;
    height: 200px;
}

/* Activity Section */
.activity-section {
    margin-bottom: 6rem;
    /* Space for bottom nav */
}

.activity-feed {
    padding: 0 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.125rem;
}

.activity-icon.primary {
    background: #2563eb;
}

.activity-icon.success {
    background: #16a34a;
}

.activity-icon.warning {
    background: #ea580c;
}

.activity-icon.danger {
    background: #dc2626;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.875rem;
}

.activity-details {
    color: #6b7280;
    font-size: 0.8125rem;
    margin: 0.125rem 0;
}

.activity-time {
    color: #9ca3af;
    font-size: 0.75rem;
}

.activity-amount {
    font-weight: 700;
    font-size: 0.875rem;
}

.activity-amount.primary {
    color: #2563eb;
}

.activity-amount.success {
    color: #16a34a;
}

.activity-amount.danger {
    color: #dc2626;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    text-decoration: none;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 8px;
    margin: 0 0.25rem;
    transition: all 0.2s ease;
    min-height: 44px;
    /* Touch target */
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
    color: #2563eb;
    background: #eff6ff;
    text-decoration: none;
}

.bottom-nav-item.primary {
    background: #2563eb;
    color: white;
}

.bottom-nav-item.primary:hover,
.bottom-nav-item.primary:focus {
    background: #1d4ed8;
    color: white;
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

/* Desktop Sidebar */
.desktop-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: white;
    border-left: 1px solid #e5e7eb;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-action:hover,
.sidebar-action:focus {
    background: #e2e8f0;
    color: #334155;
    text-decoration: none;
    transform: translateY(-1px);
}

.sidebar-action.primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.sidebar-action.primary:hover,
.sidebar-action.primary:focus {
    background: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
}

.status-indicators {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.875rem;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.success {
    background: #dcfce7;
    color: #166534;
}

.status-time {
    color: #6b7280;
    font-size: 0.8125rem;
}

/* Responsive Layout Adjustments */
@media (min-width: 1024px) {
    .dashboard-header {
        margin: -1.5rem -1.5rem 2rem -1.5rem;
        padding: 1.5rem;
    }

    .section-title {
        padding: 0;
    }

    .metrics-scroll-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
        padding: 0;
        overflow: visible;
    }

    .metric-card {
        min-width: auto;
    }

    .chart-container {
        margin: 0 0 1.5rem 0;
    }

    .activity-feed {
        padding: 0;
    }

    .activity-section {
        margin-bottom: 2rem;
        margin-right: 300px;
        /* Space for sidebar */
    }

    .charts-section {
        margin-right: 300px;
        /* Space for sidebar */
    }

    .metrics-section {
        margin-right: 300px;
        /* Space for sidebar */
    }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    .metric-card {
        min-height: 120px;
    }

    .activity-item {
        min-height: 72px;
    }

    .bottom-nav-item {
        min-height: 56px;
        padding: 0.75rem 0.5rem;
    }
}

/* Safe Area Support for iOS */
@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
}

/* DataGrid and Search Input Improvements */
.input-group-text {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
}

.input-group-text i {
    font-size: 0.875rem;
}

/* Improve search input focus state */
.input-group:focus-within .input-group-text {
    border-color: #86b7fe;
    background-color: #e7f1ff;
    color: #0d6efd;
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
    .dashboard-header {
        background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    }
}

/* Additional Space-efficient utility classes */
.compact-form .form-group {
    margin-bottom: 0.75rem; /* Reduced from default 1rem */
}

.compact-form .form-control {
    padding: 0.375rem 0.5rem; /* Slightly reduced padding */
}

.compact-table th,
.compact-table td {
    padding: 0.5rem 0.75rem; /* More compact than default */
}

.compact-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.minimal-gap {
    gap: 0.25rem;
}

.tight-spacing > * + * {
    margin-top: 0.5rem; /* Reduced spacing between elements */
}

/* Maximize content width utility */
.full-width-content {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Additional responsive spacing adjustments */
@media (min-width: 992px) {
    .desktop-compact {
        padding: 0.5rem 0.75rem;
    }

    .desktop-full-width {
        width: calc(100vw - 260px); /* Account for sidebar width */
    }

    /* Eliminate any remaining gaps on desktop */
    .main-content-desktop {
        margin-left: 0;
        padding-left: 0;
        width: calc(100% - 260px);
    }
}

/* Zero gap utilities for maximum space efficiency */
.no-gap {
    gap: 0;
}

.no-margin {
    margin: 0 !important;
}

.no-padding {
    padding: 0 !important;
}

.min-padding {
    padding: 0.25rem !important;
}

.micro-margin {
    margin: 0.125rem !important;
}

/* ===== QUICK ACTIONS SIDEBAR LAYOUT FIXES ===== */

/* When desktop sidebar is present (only on dashboard), adjust main content */
@media (min-width: 992px) {
    /* Only apply margin adjustment on pages with desktop-sidebar */
    body:has(.desktop-sidebar) .top-row {
        margin-right: 320px !important; /* 300px sidebar width + 20px buffer */
        width: calc(100% - 320px) !important;
    }
    
    /* Alternative: Use a specific class for dashboard pages */
    .dashboard-page .top-row {
        margin-right: 320px !important; /* 300px sidebar width + 20px buffer */
        width: calc(100% - 320px) !important;
    }
    
    /* Ensure desktop sidebar appears above other content */
    .desktop-sidebar {
        z-index: 200; /* Higher than top-row z-index of 50 */
    }
}

/* ===== MENU ALIGNMENT FIXES ===== */

/* Fix sidebar menu icon and text alignment */
.sidebar .nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important; /* Consistent spacing between icon and text */
    padding: 0.75rem 1rem !important;
    white-space: nowrap !important;
}

.sidebar .nav-link i,
.sidebar .nav-link .bi {
    width: 1.25rem !important; /* Fixed width for consistent alignment */
    text-align: center !important;
    flex-shrink: 0 !important; /* Prevent icon from shrinking */
}
