@import url('https://fonts.googleapis.com/css2?family=Kantumruy+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0f2b5c;
    --primary-light: #1e4287;
    --primary-dark: #0a1c3d;
    --accent-gold: #e5a93b;
    --accent-gold-hover: #f3b952;
    --accent-blue: #0088ff;
    --accent-teal: #00c9a7;
    --accent-danger: #e63946;
    --accent-warning: #f77f00;
    --accent-success: #2a9d8f;

    --bg-dark: #0b132b;
    --bg-surface: #1c2541;
    --bg-card: rgba(28, 37, 65, 0.75);
    --bg-card-hover: rgba(40, 52, 90, 0.85);

    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;

    --border-color: rgba(255, 255, 255, 0.12);
    --border-glow: rgba(229, 169, 59, 0.3);

    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 20px rgba(229, 169, 59, 0.25);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kantumruy Pro', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(15, 43, 92, 0.4) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(229, 169, 59, 0.15) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* Layout */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(11, 19, 43, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-fast);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}

.emblem-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-gold), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    box-shadow: var(--shadow-glow);
}

.header-titles h1 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.header-titles p {
    font-size: 12px;
    color: var(--accent-gold);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    position: relative;
}

.nav-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    transition: var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, var(--primary-light), rgba(30, 66, 135, 0.4));
    border-left: 4px solid var(--accent-gold);
    box-shadow: 0 4px 15px rgba(15, 43, 92, 0.4);
}

.nav-item.active i {
    color: var(--accent-gold);
}

/* Sidebar Subnav Active Highlighting */
.sidebar-subnav {
    margin-left: 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.subnav-link {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-fast);
    border: 1px solid transparent;
}

.subnav-link i {
    font-size: 13px;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.subnav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.subnav-link.active-subnav {
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(229, 169, 59, 0.35), rgba(15, 43, 92, 0.7)) !important;
    border: 1px solid var(--accent-gold) !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(229, 169, 59, 0.3);
}

.subnav-link.active-subnav i {
    color: var(--accent-gold) !important;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(10, 28, 61, 0.6);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-tag {
    font-size: 11px;
    color: var(--accent-gold);
}

.btn-logout {
    color: var(--accent-danger);
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: rgba(230, 57, 70, 0.15);
}

/* Mobile UI Components (Desktop defaults) */
.mobile-nav-toggle {
    display: none;
}
.mobile-sidebar-close {
    display: none;
}
.sidebar-backdrop {
    display: none;
}
.mobile-bottom-nav {
    display: none;
}
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.user-avatar-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold), #c98e29);
    border: 2px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(229, 169, 59, 0.4);
}
.user-avatar-circle span {
    font-size: 14px;
    font-weight: 700;
    color: #0b132b;
}
.user-dropdown-container {
    position: relative;
}
.user-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    width: 165px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(14px);
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
    z-index: 1000;
    overflow: hidden;
    padding: 4px 0;
}
.dropdown-item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    text-decoration: none;
    transition: var(--transition-fast);
}
.dropdown-item-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.dropdown-divider {
    border-top: 1px solid var(--border-color);
    margin: 3px 0;
}
.dropdown-logout {
    color: #ff6b6b !important;
}
.dropdown-logout:hover {
    background: rgba(230, 57, 70, 0.15) !important;
}

body.sidebar-locked,
body.modal-open {
    overflow: hidden !important;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100vw - 280px);
}

.top-bar {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(11, 19, 43, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title span {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 260px;
}

.search-box input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: rgba(28, 37, 65, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-main);
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(229, 169, 59, 0.2);
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), #c98e29);
    color: #0b132b;
    box-shadow: 0 4px 15px rgba(229, 169, 59, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-gold-hover), var(--accent-gold));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 169, 59, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-gold {
    background: linear-gradient(135deg, var(--accent-gold), #c98e29) !important;
    color: #0b132b !important;
    box-shadow: 0 4px 15px rgba(229, 169, 59, 0.35) !important;
    font-weight: 700 !important;
}

.btn-gold:hover, .btn-gold:focus, .btn-gold:active, .btn-gold:visited {
    background: linear-gradient(135deg, var(--accent-gold-hover), var(--accent-gold)) !important;
    color: #0b132b !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 169, 59, 0.5) !important;
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-teal), #1f7a6f);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 201, 167, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-danger), #b02a37);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Content Container */
.content-body {
    padding: 32px;
    flex: 1;
}

/* Metric Cards Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-fast);
}

.metric-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-gold);
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.metric-icon.blue { background: linear-gradient(135deg, #0088ff, #0055b3); }
.metric-icon.gold { background: linear-gradient(135deg, var(--accent-gold), #b87e1a); }
.metric-icon.teal { background: linear-gradient(135deg, var(--accent-teal), #167a68); }
.metric-icon.purple { background: linear-gradient(135deg, #8a2be2, #4a148c); }
.metric-icon.red { background: linear-gradient(135deg, var(--accent-danger), #8b0000); }

.metric-info .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.metric-info .value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.metric-info .subtext {
    font-size: 11px;
    color: var(--accent-teal);
    margin-top: 2px;
}

/* Glass Panels & Cards */
.panel {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-soft);
    scroll-margin-top: 85px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title i {
    color: var(--accent-gold);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.custom-table th {
    background: #0a1c3d;
    color: var(--accent-gold);
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-glow);
    white-space: nowrap;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: var(--transition-fast);
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Badges */
.badge {
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-primary { background: rgba(0, 136, 255, 0.25); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.5); }
.badge-gold { background: rgba(229, 169, 59, 0.25); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.5); }
.badge-success { background: rgba(42, 157, 143, 0.25); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.5); }
.badge-danger { background: rgba(230, 57, 70, 0.25); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.5); }
.badge-secondary { background: rgba(255, 255, 255, 0.15); color: #e2e8f0; border: 1px solid rgba(255, 255, 255, 0.25); }

/* Badges inside active buttons (Ultra-High Contrast) */
.btn-gold .badge,
.btn-primary .badge {
    background: #0f172a !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    font-size: 12px !important;
    padding: 2px 9px !important;
}

.btn-secondary .badge {
    background: rgba(229, 169, 59, 0.2) !important;
    color: #fbbf24 !important;
    font-weight: 700 !important;
    border: 1px solid rgba(251, 191, 36, 0.5) !important;
    font-size: 12px !important;
    padding: 2px 9px !important;
}

/* Select Option Text Styling (Bold Black Numbers) */
select option {
    color: #000000 !important;
    background-color: #ffffff !important;
    font-weight: 700 !important;
}

/* Grid Columns */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* Charts Wrapper */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Modal Form Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    transform: translateY(20px);
    transition: var(--transition-fast);
}

.modal-backdrop.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    color: var(--accent-danger);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(11, 19, 43, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(229, 169, 59, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Alert Flashes */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(42, 157, 143, 0.25);
    border: 1px solid rgba(42, 157, 143, 0.5);
    color: #85e3d2;
}

.alert-danger {
    background: rgba(230, 57, 70, 0.25);
    border: 1px solid rgba(230, 57, 70, 0.5);
    color: #ff9999;
}

/* ===================================================
   RESPONSIVE DESIGN FOR ANDROID & IOS (MOBILE & TABLET)
   =================================================== */

/* Tablet & Mobile Landscape / Medium Screens (<= 992px) */
@media (max-width: 992px) {
    .app-container {
        position: relative;
        overflow-x: hidden;
    }

    /* Off-canvas Sidebar Navigation Drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 290px;
        max-width: 84vw;
        height: 100vh;
        height: 100dvh;
        z-index: 1200;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(11, 19, 43, 0.97) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.85);
    }

    /* Mobile Backdrop Overlay */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: rgba(5, 10, 25, 0.75);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 1100;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Close Button inside Sidebar Header */
    .mobile-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid var(--border-color);
        color: var(--accent-gold);
        font-size: 16px;
        cursor: pointer;
        margin-left: auto;
        flex-shrink: 0;
        transition: var(--transition-fast);
    }

    .mobile-sidebar-close:active {
        background: rgba(230, 57, 70, 0.25);
        color: #ff6b6b;
    }

    /* Main Content Full Width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw;
        min-height: 100vh;
        overflow-x: hidden;
    }

    /* Top Bar Header on Medium Screens */
    .top-bar {
        padding: 0 16px;
        height: 64px;
        padding-top: env(safe-area-inset-top);
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: rgba(28, 37, 65, 0.85);
        border: 1px solid var(--border-glow);
        border-radius: var(--radius-sm);
        color: var(--accent-gold);
        font-size: 18px;
        cursor: pointer;
        flex-shrink: 0;
        transition: var(--transition-fast);
    }

    .mobile-nav-toggle:active {
        transform: scale(0.95);
        background: rgba(229, 169, 59, 0.2);
    }

    .page-title h2 {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .search-box {
        width: 180px;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .content-body {
        padding: 20px 16px 40px 16px;
    }
}

/* Mobile Devices & Phones (Android & iOS) (<= 768px) */
@media (max-width: 768px) {
    /* Touch Target Sizing */
    button, a, input, select, textarea {
        touch-action: manipulation;
    }

    /* iOS Safari Input Auto-zoom Prevention: font size MUST be >= 16px */
    .form-control,
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
        padding: 10px 12px;
    }

    /* Header & Top Bar on Phones */
    .top-bar {
        padding: 0 12px;
        height: 60px;
        padding-top: env(safe-area-inset-top);
    }

    .top-actions {
        gap: 8px;
    }

    .district-badge {
        display: none !important;
    }

    .search-box {
        display: none; /* Hide global search in top bar on small screens to avoid congestion */
    }

    .user-name .user-display-name {
        display: none; /* Compact avatar-only on phones */
    }

    .user-profile-badge {
        padding: 4px 8px 4px 4px !important;
        gap: 4px !important;
    }

    .user-dropdown-menu {
        right: 4px;
        top: 48px;
        width: 155px;
    }

    /* Content Area with Bottom Padding for Bottom Nav */
    .content-body {
        padding: 16px 12px calc(80px + env(safe-area-inset-bottom)) 12px !important;
    }

    /* Mobile Bottom Navigation Bar (Dock) */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: calc(58px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(11, 19, 43, 0.94);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-glow);
        align-items: center;
        justify-content: space-around;
        z-index: 990;
        box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.6);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        flex: 1;
        height: 100%;
        background: none;
        border: none;
        cursor: pointer;
        transition: var(--transition-fast);
        padding: 4px 0;
    }

    .bottom-nav-item i {
        font-size: 17px;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .bottom-nav-item.active {
        color: var(--accent-gold);
    }

    .bottom-nav-item.active i {
        color: var(--accent-gold);
        transform: translateY(-2px);
        filter: drop-shadow(0 2px 6px rgba(229, 169, 59, 0.5));
    }

    .bottom-nav-item:active {
        transform: scale(0.92);
    }

    /* Metrics Grid on Phones */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }

    .metric-card {
        padding: 12px 10px;
        gap: 10px;
        border-radius: var(--radius-sm);
    }

    .metric-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
        border-radius: 8px;
    }

    .metric-info .label {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .metric-info .value {
        font-size: 18px;
    }

    .metric-info .subtext {
        font-size: 10px;
        line-height: 1.25;
    }

    /* Panels & Headers */
    .panel {
        padding: 16px 12px;
        margin-bottom: 16px;
        border-radius: var(--radius-md);
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .panel-header .btn {
        width: 100%;
        justify-content: center;
    }

    .panel-title {
        font-size: 14px;
        line-height: 1.4;
    }

    /* Buttons & Toolbars */
    .btn {
        padding: 9px 14px;
        font-size: 12.5px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 11.5px;
    }

    /* Responsive Table container with inertia scroll */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border-color);
        margin-bottom: 12px;
    }

    .custom-table {
        font-size: 12px;
        min-width: 580px; /* Ensures table columns don't crunch below legible size */
    }

    .custom-table th,
    .custom-table td {
        padding: 10px 10px;
    }

    /* Modals for Mobile Phones */
    .modal-box {
        width: 95vw;
        max-width: 95vw;
        max-height: 88vh;
        max-height: 88dvh;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h3 {
        font-size: 15px;
    }

    .modal-body {
        padding: 16px 14px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .modal-footer {
        padding: 12px 14px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    /* Flash Alerts */
    .alert {
        padding: 10px 14px;
        font-size: 12px;
        margin-bottom: 14px;
    }
}

/* Small Phones (iPhone SE, small Androids <= 480px) */
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .page-title h2 {
        font-size: 13.5px;
        max-width: 50vw;
    }

    .sidebar {
        width: 275px;
        max-width: 86vw;
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #missionPrintArea, #missionPrintArea * {
        visibility: visible;
    }
    #missionPrintArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
    .modal-backdrop {
        background: transparent !important;
        position: static !important;
    }
    .modal-header, .modal-footer, .sidebar, .header, .panel {
        display: none !important;
    }
}
