@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #f4f6f8;
    --surface-color: #ffffff;
    --primary-color: #10445d;
    --primary-hover: #0c3346;
    --secondary-color: #e68a00;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --border-color: #d0d7de;
    --accent-glow: rgba(230, 138, 0, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.95);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Glassmorphism Sidebar */
.sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.nav-menu {
    padding: 20px 0;
    list-style: none;
    margin: 0;
}

.nav-item {
    padding: 0 16px;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-link:hover {
    background: rgba(16, 68, 93, 0.08);
    /* faint petrol blue */
    color: var(--primary-color);
    transform: translateX(5px);
}

.nav-link.active {
    background: rgba(16, 68, 93, 0.12);
    color: var(--primary-color);
    box-shadow: inset 3px 0 0 var(--secondary-color);
}

.nav-link svg {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 40px;
    box-sizing: border-box;
    background: radial-gradient(circle at top right, rgba(16, 68, 93, 0.03) 0%, transparent 40%);
}

/* Dashboard Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 0 15px rgba(230, 138, 0, 0.1);
    border-color: var(--secondary-color);
}

.dashboard-card:hover::before {
    opacity: 1;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Tables */
.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.modern-table th {
    background: rgba(16, 68, 93, 0.04);
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.modern-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.modern-table tbody tr {
    transition: background 0.2s ease;
}

.modern-table tbody tr:hover {
    background: rgba(16, 68, 93, 0.02);
}

/* Status Badges */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: inline-block;
}

.badge-pending {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.badge-progress {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.badge-completed {
    background: rgba(46, 160, 67, 0.15);
    color: #2ea043;
    border: 1px solid rgba(46, 160, 67, 0.3);
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 68, 93, 0.2);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-accent:hover {
    background: #cc7a00;
    color: white;
    box-shadow: 0 4px 15px rgba(230, 138, 0, 0.3);
    transform: translateY(-1px);
}

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

.btn-outline-primary:hover,
.btn-check:checked+.btn-outline-primary {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Animated Login Background */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-layout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #f4f6f8, #eef1f5, #e0e6ed, #ffffff);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    z-index: 9999;
    overflow: hidden;
    padding: 20px;
}

.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1), 0 0 30px rgba(16, 68, 93, 0.08);
    position: relative;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.modern-input {
    background: rgba(255, 255, 255, 1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.modern-input:focus {
    background: #ffffff;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(230, 138, 0, 0.2);
    color: var(--text-primary);
    outline: none;
}

/* ===== Mobile Header Toolbar ===== */
.mobile-header-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin: -15px -15px 20px -15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.mobile-hamburger-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-hamburger-btn:hover,
.mobile-hamburger-btn:active {
    background: rgba(16, 68, 93, 0.08);
}

.mobile-hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--primary-color, #10445d);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Base Bottom Nav for Tablets & Phones */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1030;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav a,
.bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary, #64748b);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.bottom-nav a svg,
.bottom-nav button svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    margin-bottom: 2px;
    transition: transform 0.2s;
}

.bottom-nav a.active,
.bottom-nav a:hover,
.bottom-nav button.active {
    color: var(--secondary-color, #e68a00);
}

.bottom-nav a.active svg {
    transform: translateY(-2px);
}

/* ───────────────────────────────────────────────────────────────────────── */
/* TABLET & MOBILE VIEWPORT: SCREEN WIDTH <= 991.98px                        */
/* ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    /* Main Layout */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        min-height: 100vh;
        padding: 16px 16px 95px 16px !important;
        background: #f8fafc !important;
    }

    /* Off-Canvas Sliding Sidebar */
    .sidebar {
        width: 285px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1050 !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2) !important;
        background: #ffffff !important;
    }

    .sidebar.sidebar-open {
        transform: translateX(0) !important;
    }

    /* Backdrop */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(16, 68, 93, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1045;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    /* Horizontal Scroll Bar for Tabs, Filters & Statuses */
    .scrollable-horizontal-bar,
    .tab-scroll-container,
    .status-tabs-scroll,
    .nav-tabs,
    .nav-pills,
    .d-flex.flex-wrap.gap-2.mb-4.p-2 {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 6px 2px !important;
        gap: 8px !important;
        scrollbar-width: thin !important;
        scrollbar-color: rgba(16, 68, 93, 0.25) transparent !important;
        max-width: 100% !important;
    }

    .scrollable-horizontal-bar::-webkit-scrollbar,
    .tab-scroll-container::-webkit-scrollbar,
    .status-tabs-scroll::-webkit-scrollbar,
    .nav-tabs::-webkit-scrollbar,
    .nav-pills::-webkit-scrollbar,
    .d-flex.flex-wrap.gap-2.mb-4.p-2::-webkit-scrollbar {
        height: 4px !important;
    }

    .scrollable-horizontal-bar::-webkit-scrollbar-thumb,
    .tab-scroll-container::-webkit-scrollbar-thumb,
    .status-tabs-scroll::-webkit-scrollbar-thumb,
    .nav-tabs::-webkit-scrollbar-thumb,
    .nav-pills::-webkit-scrollbar-thumb {
        background: rgba(16, 68, 93, 0.25) !important;
        border-radius: 4px !important;
    }

    .scrollable-horizontal-bar .btn,
    .tab-scroll-container .btn,
    .status-tabs-scroll .btn,
    .nav-tabs .nav-link,
    .nav-pills .nav-link,
    .d-flex.flex-wrap.gap-2.mb-4.p-2 .btn {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        font-size: 0.82rem !important;
        padding: 6px 14px !important;
    }

    /* Responsive Tables Across All Pages */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        background: var(--surface-color, #ffffff) !important;
        border: 1px solid var(--border-color, #e2e8f0) !important;
        border-radius: 12px !important;
        margin-bottom: 1rem !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03) !important;
        position: relative !important;
    }

    .table-responsive table,
    .table-responsive .modern-table {
        width: 100% !important;
        min-width: 780px !important; /* CRITICAL: ensures table doesn't crush into 1 column on mobile/tablet */
        margin-bottom: 0 !important;
    }

    .table-responsive th,
    .table-responsive td {
        white-space: nowrap !important;
        padding: 10px 14px !important;
        font-size: 0.83rem !important;
        vertical-align: middle !important;
    }

    /* Buttons inside tables stay neatly grouped */
    .table-responsive td .btn-group,
    .table-responsive td .d-flex {
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
    }

    /* Form Controls Touch Optimization */
    .form-control,
    .form-select {
        font-size: 15px !important;
        min-height: 40px !important;
        border-radius: 8px !important;
    }

    .btn {
        min-height: 38px;
        border-radius: 8px;
    }

    /* Stack toolbars cleanly */
    .d-flex.justify-content-between.mb-4,
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .d-flex.justify-content-between.mb-4 > .d-flex,
    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* Row layouts on tablet / mobile */
    .row {
        margin-left: -8px;
        margin-right: -8px;
    }
    .row > [class*="col-"] {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* ───────────────────────────────────────────────────────────────────────── */
/* MOBILE PHONES VIEWPORT: SCREEN WIDTH <= 575.98px                          */
/* ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .main-content {
        padding: 12px 12px 90px 12px !important;
    }

    .mobile-header-toolbar {
        margin: -12px -12px 16px -12px;
        padding: 8px 12px;
    }

    /* Compact 2x2 Dashboard Cards */
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .dashboard-card {
        padding: 12px !important;
        border-radius: 12px !important;
    }

    .card-title {
        font-size: 0.65rem !important;
        margin-bottom: 4px !important;
    }

    .card-value {
        font-size: 1.4rem !important;
        margin-bottom: 4px !important;
    }

    /* Hero Banners Header */
    .card-body.p-4 {
        padding: 16px !important;
    }

    /* Modal as Bottom Sheet on Mobile */
    .modal-dialog {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .modal-content {
        border-radius: 20px 20px 0 0 !important;
        max-height: 90vh !important;
        border: none !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15) !important;
    }

    .modal-header {
        padding: 14px 18px !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    .modal-body {
        padding: 14px 18px !important;
        overflow-y: auto !important;
    }

    .modal-footer {
        padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        border-top: 1px solid #e2e8f0 !important;
    }
}

/* ===== Responsive Table Wrapper (Desktop) ===== */
@media (min-width: 992px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        margin-bottom: 1rem;
        border-radius: 16px;
        border: 1px solid var(--border-color);
        position: relative;
        box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    }

    .table-responsive .modern-table {
        border: none;
        margin-bottom: 0;
    }
}

/* ===== Light Theme Color Fixes ===== */
/* Fix invisible backgrounds: rgba(255,255,255,0.05) → visible on light bg */
[style*="rgba(255,255,255,0.05)"] {
    background-color: rgba(16, 68, 93, 0.04) !important;
}

/* Fix invisible borders: rgba(255,255,255,0.1) → visible on light bg */
[style*="rgba(255,255,255,0.1)"] {
    border-color: var(--border-color) !important;
}

/* Fix rgba(255,255,255,0.02) backgrounds */
[style*="rgba(255,255,255,0.02)"] {
    background-color: rgba(16, 68, 93, 0.02) !important;
}

/* Ensure all modal content text is readable */
.modal-content {
    color: var(--text-primary);
}

.modal-header {
    color: var(--text-primary);
}

.modal-body {
    color: var(--text-primary);
}

/* Ensure form labels and text are dark */
.form-label, label {
    color: var(--text-primary);
}

.form-control, .form-select {
    color: var(--text-primary);
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

/* Fix card components */
.card {
    background: var(--surface-color);
    color: var(--text-primary);
}

.card-header, .card-body, .card-footer {
    color: var(--text-primary);
}

/* Ensure all badge text is readable */
.badge {
    min-height: auto;
}

/* Fix user avatar circles - visible on light bg */
[style*="border-radius: 50%"][style*="rgba(255,255,255"] {
    background-color: rgba(16, 68, 93, 0.06) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Ensure nav tabs and pills are readable */
.nav-tabs .nav-link {
    color: var(--text-secondary);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: var(--surface-color);
    border-color: var(--border-color) var(--border-color) var(--surface-color);
}

/* Fix dropdown menus */
.dropdown-menu {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.dropdown-item {
    color: var(--text-primary);
}

.dropdown-item:hover {
    background-color: rgba(16, 68, 93, 0.06);
}

/* Fix "Not Authorized" page */
[style*="color: white"][style*="text-align: center"] {
    color: var(--text-primary) !important;
}

/* Fix list group items */
.list-group-item {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Fix accordion */
.accordion-button {
    color: var(--text-primary);
    background-color: var(--surface-color);
}

/* Ensure strong, bold, heading tags are visible */
strong, b, h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

/* Fix pagination text */
.page-link {
    color: var(--primary-color);
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

/* Improve dashboard card subtitle text */
.dashboard-card .text-secondary {
    color: var(--text-secondary) !important;
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║            MOBILE BOTTOM NAVIGATION BAR                         ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    display: flex;
    align-items: stretch;
    z-index: 900;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.07), 0 -1px 4px rgba(0,0,0,0.04);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    text-decoration: none !important;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 8px 2px 6px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), fill 0.22s ease;
}

.bottom-nav-item span {
    line-height: 1;
    transition: color 0.22s ease;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active svg {
    transform: scale(1.18) translateY(-1px);
}

/* Animated top indicator pill */
.bottom-nav-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 0 4px 4px;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item.active::after {
    transform: translateX(-50%) scaleX(1);
}

/* Touch press effect */
.bottom-nav-item:active svg {
    transform: scale(0.9);
    transition: transform 0.1s ease;
}

/* ── Add padding so content doesn't hide behind bottom nav ── */
@media (max-width: 768px) {
    .main-content {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║            BOTTOM SHEET — MORE MENU                             ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bottom-sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.bottom-more-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 28px 28px 0 0;
    z-index: 1060;
    padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(105%);
    transition: transform 0.38s cubic-bezier(0.34, 1.08, 0.64, 1);
    max-height: 82vh;
    overflow-y: auto;
    box-shadow: 0 -12px 50px rgba(0, 0, 0, 0.14);
    -webkit-overflow-scrolling: touch;
}

.bottom-more-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 44px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin: 4px auto 18px;
    flex-shrink: 0;
}

.bottom-sheet-section-title {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    padding: 0 4px;
}

/* 4-column grid */
.bottom-sheet-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.bottom-sheet-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 14px 6px 10px;
    border-radius: 16px;
    color: var(--text-primary);
    text-decoration: none !important;
    font-size: 0.62rem;
    font-weight: 700;
    text-align: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    border: none;
    background: none;
    line-height: 1.3;
}

.bsni-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease;
}

.bsni-icon svg {
    width: 22px;
    height: 22px;
}

.bottom-sheet-nav-item:active .bsni-icon {
    transform: scale(0.9);
}

.bottom-sheet-nav-item:active {
    transform: scale(0.96);
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║            MOBILE HEADER TOOLBAR — PREMIUM                      ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.mobile-header-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    margin: -15px -15px 20px -15px;
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.05);
}

.mobile-header-logo {
    display: flex;
    align-items: center;
}

/* Hamburger button */
.mobile-hamburger-btn {
    width: 40px;
    height: 40px;
    background: rgba(16, 68, 93, 0.07);
    border: none;
    border-radius: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-hamburger-btn:active {
    background: rgba(16, 68, 93, 0.15);
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║            PAGE ENTRANCE ANIMATION                              ║
   ╚══════════════════════════════════════════════════════════════════╝ */

@keyframes mobilePageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991.98px) {
    /* Animate the main page content in */
    .main-content > *:not(.mobile-header-toolbar) {
        animation: mobilePageIn 0.3s ease forwards;
    }

    /* Stagger children for card grids */
    .card-grid .dashboard-card:nth-child(1) { animation-delay: 0.03s; }
    .card-grid .dashboard-card:nth-child(2) { animation-delay: 0.06s; }
    .card-grid .dashboard-card:nth-child(3) { animation-delay: 0.09s; }
    .card-grid .dashboard-card:nth-child(4) { animation-delay: 0.12s; }
    .card-grid .dashboard-card:nth-child(5) { animation-delay: 0.15s; }
    .card-grid .dashboard-card:nth-child(6) { animation-delay: 0.18s; }

    /* Touch active state feedback */
    .dashboard-card:active {
        transform: scale(0.98);
        transition: transform 0.12s ease;
    }

    .table-responsive tbody tr:active {
        background: rgba(16, 68, 93, 0.04) !important;
    }
}

@keyframes mobileModalIn {
    from { transform: translateY(50px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Responsive Modal Scaling & Zoom Adaptability for Laptop/Mobile Screens */
.modal-dialog {
    max-width: 95vw;
    margin: 1.25rem auto;
}

@media (min-width: 992px) {
    .modal-dialog.modal-xl {
        max-width: 1140px;
    }
    .modal-dialog.modal-lg {
        max-width: 860px;
    }
}

.modal-content {
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    max-height: calc(92vh - 130px);
}

/* Modal Form Grid Baseline Alignment & Uniform Inputs System */
.form-label-header {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    margin-bottom: 6px !important;
    font-size: 0.81rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
    line-height: 1.15 !important;
}

.form-control-aligned,
.form-select-aligned,
.input-group-aligned {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
}

.input-group-aligned .form-control,
.input-group-aligned .form-select,
.input-group-aligned .btn,
.input-group-aligned .input-group-text {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
}

.form-help-aligned {
    min-height: 18px !important;
    margin-top: 4px !important;
    font-size: 0.72rem !important;
    color: #64748b !important;
}