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

:root {
    /* Tokyo Dark Palette - Enhanced for Mobile & Desktop */
    --bg-main: #1a1b26;
    --bg-card: #24283b;
    --bg-dark: #16161e;
    --bg-secondary: #24283b;
    --bg-surface: #1f2335;
    --bg-sidebar: #1a1b26;

    --primary: #7aa2f7;
    --primary-hover: #89b4fa;
    --secondary: #bb9af7;
    
    --text-main: #a9b1d6;
    --text-bright: #c0caf5;
    --text-muted: #565f89;
    --text-secondary: #9aa5ce;
    
    --success: #9ece6a;
    --error: #f7768e;
    --warning: #e0af68;
    
    --border: #414868;
    --border-color: #414868;
    
    --radius: 16px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Glassmorphism */
    --glass-bg: rgba(36, 40, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);

    /* Compatibility Aliases for Older Codebases */
    --surface-color: var(--bg-surface);
    --primary-color: var(--primary);
    --secondary-color: var(--secondary);
    --success-color: var(--success);
    --error-color: var(--error);
    --warning-color: var(--warning);
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    /* display: flex; REMOVED to fix Dashboard Layout */
    /* justify-content: center; REMOVED */
    /* align-items: center; REMOVED */
    padding: 0;
    /* Changed from 20px to 0 for full screen app */
}

.container {
    width: 100%;
    max-width: 1100px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 3rem;
    display: grid;
    gap: 3rem;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    /* Important for sticky */
}

/* Sticky Upload Section for Side-by-Side Verification */
@media (min-width: 1024px) {
    .upload-section {
        position: sticky;
        top: 2rem;
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
        padding-right: 1rem;
        /* Space for scrollbar */
    }
}

@media (max-width: 900px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1.5rem;
    }
}

/* Upload Section */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(122, 162, 247, 0.1);
    transform: translateY(-2px);
}

.upload-zone.has-file {
    border-color: var(--success);
    background: rgba(158, 206, 106, 0.1);
}

.upload-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.upload-zone:hover .upload-icon {
    color: var(--primary);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.preview-thumb {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Form Section */
h2 {
    color: var(--text-bright);
    margin-top: 0;
}

h3 {
    color: var(--primary);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: #1f2335;
    color: var(--text-bright);
    transition: var(--transition);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(122, 162, 247, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 10px;
    background-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: #1a1b26;
    box-shadow: 0 4px 12px rgba(122, 162, 247, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(122, 162, 247, 0.4);
}

.btn-primary:disabled {
    background: var(--border);
    color: var(--text-muted);
    transform: none;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-success {
    background: var(--success);
    color: #1a1b26;
    box-shadow: 0 4px 12px rgba(158, 206, 106, 0.3);
}

.btn-success:hover {
    background: #89b458;
    transform: translateY(-2px);
}

/* Status & Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
}

/* Toast Notifications */
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(26, 27, 38, 0.3);
    border-radius: 50%;
    border-top-color: #1a1b26;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Blur effect for disabled form */
.form-disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: blur(1px);
    transition: var(--transition);
}

.form-active {
    opacity: 1;
    pointer-events: all;
    filter: none;
}

/* Image Zoom Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 1200px;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    animation: zoom 0.3s;
}

@keyframes zoom {
    from {
        transform: scale(0)
    }

    to {
        transform: scale(1)
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

/* Make preview images clickable */
.preview-image {
    cursor: zoom-in;
    transition: transform 0.2s;
}

.preview-image:hover {
    transform: scale(1.02);
}

/* Camera UI */
.btn-camera {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-camera:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.camera-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
}

.main-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #000;
    touch-action: none;
    /* Prevent browser handling of gestures */
}

#cameraFeed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-controls {
    position: absolute;
    bottom: 2rem;
    display: flex;
    gap: 1rem;
    z-index: 1001;
}

#captureBtn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0;
    font-size: 0;
    border: 4px solid #fff;
    background: rgba(255, 255, 255, 0.3);
}

#captureBtn:active {
    background: #fff;
}

/* =========================================
   Verification Dashboard Styles
   ========================================= */

.verification-body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-dark);
    font-family: 'Inter', sans-serif;
}

.verification-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* --- Left Panel: Evidence --- */
.evidence-panel {
    flex: 1;
    background: #0f172a;
    /* Darker background for images */
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    position: relative;
    min-width: 350px;
    max-width: none;
    overflow: hidden;
    /* Prevent overflow */
}

.panel-header {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.image-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.image-viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    /* Important for flexbox shrinking */
}

.image-tabs {
    display: flex;
    background: #1e293b;
    padding: 0.5rem;
    gap: 0.5rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
}

.main-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #000;
    touch-action: none;
    /* Prevent browser handling of gestures */
    width: 100%;
    height: 100%;
}

.pan-zoom-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease-out;
    transform-origin: center;
}

.no-image {
    color: #64748b;
    font-size: 0.9rem;
}

/* --- Right Panel: Data --- */
.data-panel {
    flex: 1;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    min-width: 500px;
    border-left: 1px solid var(--border);
}

.status-badge {
    background: var(--bg-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.verification-form {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.form-section h3 {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.family-member-block {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.family-member-block h4 {
    margin-top: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.action-bar {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.confidence-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.buttons {
    display: flex;
    gap: 1rem;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: var(--bg-dark);
    color: var(--text-main);
}

.success-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.success-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* State Messages */
.state-message {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 0.5rem;
    min-height: 60px;
    max-height: 80px;
}

.state-message p {
    margin: 0;
    font-size: 0.85rem;
}

.state-message i {
    font-size: 1.5rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}




*,
*::before,
*::after {
    box-sizing: border-box;
}

/* --- Global Navigation Sidebar --- */
.app-container,
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background: var(--bg-main);
}

.sidebar {
    width: 250px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s ease;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* --- Scrollbar Styling for Sidebar --- */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(122, 162, 247, 0.2);
    border-radius: 10px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(122, 162, 247, 0.4);
}

/* Collapsed state via body class */
body.sidebar-collapsed .sidebar {
    width: 60px;
}

body.sidebar-collapsed .sidebar .sidebar-title {
    display: none;
}

body.sidebar-collapsed .sidebar .nav-item a {
    justify-content: center;
    font-size: 0;
    padding: 0.75rem 0.25rem;
    /* Reduced padding for thinner bar */
}

body.sidebar-collapsed .sidebar .nav-item a .nav-icon {
    margin-right: 0;
    font-size: 1.25rem;
    /* Slightly adjust icon size if needed */
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
    /* Push to right of header if flex */
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

/* Ensure current main-content matches expanded sidebar by default */
.main-content {
    flex: 1;
    margin-left: 266px;
    /* 250px + 16px gap */
    background: var(--bg-main);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Adjust main content when body has sidebar-collapsed class */
body.sidebar-collapsed .main-content {
    margin-left: 76px;
    /* 60px + 16px gap */
}

.sidebar-header {
    margin-bottom: 2rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    /* Check height consistency */
}

/* Hide header title in collapsed mode if not handled above */
body.sidebar-collapsed .sidebar .sidebar-header {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed .sidebar .sidebar-toggle {
    margin: 0;
}

/* Adjusted for Standardized HTML structure */
.sidebar-title,
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

.nav-links,
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-top: 1rem;
}

/* Selector changed from .nav-item a to a.nav-item */
a.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    font-weight: 500;
}

a.nav-item:hover,
a.nav-item.active {
    background: rgba(122, 162, 247, 0.1);
    color: var(--primary);
}

/* Adjust collapsed state selectors */
body.sidebar-collapsed .sidebar a.nav-item {
    justify-content: center;
    font-size: 0;
    padding: 0.75rem 0.25rem;
}

body.sidebar-collapsed .sidebar a.nav-item .nav-icon {
    margin-right: 0;
    font-size: 1.25rem;
}

.nav-icon {
    margin-right: 0.75rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* .main-content moved to general layout */

/* --- Split View Layout --- */
.split-container {
    display: flex;
    height: calc(100vh - 4rem);
    /* Adjust for header/padding */
    gap: 1rem;
    margin-top: 1rem;
    overflow: hidden;
}

.list-pane {
    width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.list-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.search-bar {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-main);
}

.list-content {
    flex: 1;
    overflow-y: auto;
}

.list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.list-item:hover,
.list-item.selected {
    background: rgba(122, 162, 247, 0.1);
    border-left: 3px solid var(--primary);
}

.list-item-title {
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 0.25rem;
}

.list-item-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.details-pane {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}



@media (max-width: 1024px) {
    .verification-container {
        flex-direction: column;
    }

    .evidence-panel {
        height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .data-panel {
        height: 60vh;
        min-width: 0;
    }
}

/* =========================================
   Eligibility Status Styles
   ========================================= */

.eligibility-message {
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.eligibility-message.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.eligibility-status {
    padding: 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.eligibility-status i {
    font-size: 2rem;
}

.eligibility-status.eligible {
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid #10b981;
    color: #10b981;
}

.eligibility-status.eligible i {
    color: #10b981;
}

.eligibility-status.disqualified {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid #ef4444;
    color: #ef4444;
}

.eligibility-status.disqualified i {
    color: #ef4444;
}

.eligibility-status.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 2px solid #f59e0b;
    color: #f59e0b;
}

.eligibility-status.warning i {
    color: #f59e0b;
}

.eligibility-status strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.eligibility-status p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.matching-records-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.matching-record-card {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 1rem;
    transition: var(--transition);
}

.matching-record-card:hover {
    background: rgba(31, 41, 55, 0.7);
    border-color: rgba(239, 68, 68, 0.5);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.record-header strong {
    color: #ef4444;
    font-size: 1rem;
}

.match-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.record-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.record-details div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.record-details i {
    color: var(--text-muted);
    width: 14px;
    font-size: 0.8rem;
}

/* Correction Toggle Styles */
.input-wrapper {
    position: relative;
    width: 100%;
}

.correction-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
    z-index: 5;
    font-size: 0.9rem;
}

.correction-toggle:hover {
    color: var(--error);
}

.correction-toggle.active {
    color: var(--error);
}

.form-control.flagged {
    border-color: var(--error);
    box-shadow: 0 0 0 1px var(--error);
}

/* Ensure inputs have space for the toggle */
.form-control {
    padding-right: 35px !important;
}


/* =========================================
   Eligibility Status Styles
   ========================================= */

.eligibility-message {
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.eligibility-message.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.eligibility-status {
    padding: 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.eligibility-status i {
    font-size: 2rem;
}

.eligibility-status.eligible {
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid #10b981;
    color: #10b981;
}

.eligibility-status.eligible i {
    color: #10b981;
}

.eligibility-status.disqualified {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid #ef4444;
    color: #ef4444;
}

.eligibility-status.disqualified i {
    color: #ef4444;
}

.eligibility-status.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 2px solid #f59e0b;
    color: #f59e0b;
}

.eligibility-status.warning i {
    color: #f59e0b;
}

.eligibility-status strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.eligibility-status p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.matching-records-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.matching-record-card {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 1rem;
    transition: var(--transition);
}

.matching-record-card:hover {
    background: rgba(31, 41, 55, 0.7);
    border-color: rgba(239, 68, 68, 0.5);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.record-header strong {
    color: #ef4444;
    font-size: 1rem;
}

.match-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.record-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.record-details div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.record-details i {
    color: var(--text-muted);
    width: 14px;
    font-size: 0.8rem;
}

/* Correction Toggle Styles */
.input-wrapper {
    position: relative;
    width: 100%;
}

.correction-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
    z-index: 5;
    font-size: 0.9rem;
}

.correction-toggle:hover {
    color: var(--error);
}

.correction-toggle.active {
    color: var(--error);
}

.form-control.flagged {
    border-color: var(--error);
    box-shadow: 0 0 0 1px var(--error);
}

/* Ensure inputs have space for the toggle */
.form-control {
    padding-right: 35px !important;
}

/* --- Executive Dashboard Styles --- */
.header-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* =========================================
   Eligibility Status Styles
   ========================================= */

.eligibility-message {
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.eligibility-message.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.eligibility-status {
    padding: 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.eligibility-status i {
    font-size: 2rem;
}

.eligibility-status.eligible {
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid #10b981;
    color: #10b981;
}

.eligibility-status.eligible i {
    color: #10b981;
}

.eligibility-status.disqualified {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid #ef4444;
    color: #ef4444;
}

.eligibility-status.disqualified i {
    color: #ef4444;
}

.eligibility-status.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 2px solid #f59e0b;
    color: #f59e0b;
}

.eligibility-status.warning i {
    color: #f59e0b;
}

.eligibility-status strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.eligibility-status p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.matching-records-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.matching-record-card {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 1rem;
    transition: var(--transition);
}

.matching-record-card:hover {
    background: rgba(31, 41, 55, 0.7);
    border-color: rgba(239, 68, 68, 0.5);
}

.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.record-header strong {
    color: #ef4444;
    font-size: 1rem;
}

.match-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.record-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.record-details div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.record-details i {
    color: var(--text-muted);
    width: 14px;
    font-size: 0.8rem;
}

/* Correction Toggle Styles */
.input-wrapper {
    position: relative;
    width: 100%;
}

.correction-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: var(--transition);
    z-index: 5;
    font-size: 0.9rem;
}

.correction-toggle:hover {
    color: var(--error);
}

.correction-toggle.active {
    color: var(--error);
}

.form-control.flagged {
    border-color: var(--error);
    box-shadow: 0 0 0 1px var(--error);
}

/* Ensure inputs have space for the toggle */
.form-control {
    padding-right: 35px !important;
}

/* --- Executive Dashboard Styles --- */
.header-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-bright);
    margin: 0;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-item label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-value {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.filter-value i {
    color: var(--primary);
    font-size: 0.8rem;
}

.actions-group {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.btn-refresh.small {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Top Metrics Grid */
.top-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    /* transition: transform 0.2s; */
}

/* .metric-card:hover {
    transform: translateY(-2px);
} */

.metric-header {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.metric-value-large {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 0.5rem;
}

.metric-trend {
    font-size: 0.85rem;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-label {
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.metric-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.text-error {
    color: var(--error) !important;
}

/* Small Chart in Card */
.chart-card-small {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.small-chart-wrapper {
    position: relative;
    height: 80px;
    width: 100%;
    margin-top: auto;
}

/* Main Charts Grid */
.main-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-bright);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
}

.chart-wrapper-large {
    position: relative;
    height: 300px;
    width: 100%;
}


.scrollable-body {
    max-height: 250px;
    overflow-y: auto;
}

.table-wrapper {
    overflow-x: auto;
    height: 300px;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
}

.simple-table th {
    text-align: left;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
}

.simple-table td {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-size: 0.9rem;
}

.text-center {
    text-align: center;
}

@media (max-width: 1024px) {
    .top-metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .main-charts-grid {
        grid-template-columns: 1fr;
    }
}

:root {
    --shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Compatibility Mappings for Standardized Dashboard */
    --bg-surface: var(--bg-card);
    --bg-sidebar: var(--bg-card);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --border-color: var(--border);
}


/* ... existing styles ... */

@media (max-width: 600px) {
    .top-metrics-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .actions-group {
        width: 100%;
        justify-content: space-between;
        margin-top: 1rem;
    }
}

/* =========================================
   Standardized Dashboard Styles (Restored)
   ========================================= */

/* Compact Stats */
.stats-grid.compact {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
    grid-template-columns: repeat(4, 1fr);
}

.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease, border 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.primary-gradient::before {
    background: var(--primary);
}

.success-gradient::before {
    background: var(--success);
}

.error-gradient::before {
    background: var(--error);
}

.info-gradient::before {
    background: var(--secondary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-bright);
    /* Mapped to bright */
    margin-bottom: 0;
}

.stat-icon-bg {
    font-size: 2rem;
    opacity: 0.05;
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
}

/* Dense Grid Layout */
.dashboard-grid.dense {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: start;
}

.section-label {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 0.25rem;
    border-left: 3px solid var(--primary);
    padding-left: 0.5rem;
}

.content-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    grid-column: span 1;
    transition: background-color 0.3s ease;
}

.content-card.double-width {
    grid-column: span 2;
}

.content-card.full-width {
    grid-column: span 4;
}

/* Tile Card Styles */
.tile-card {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem 1rem;
    min-height: 140px;
}

.tile-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.tile-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
    line-height: 1.1;
}

.tile-value.giant-text {
    font-size: 2.5rem;
    color: var(--text-bright);
}

.tile-value.warning-text {
    color: var(--secondary);
}

.tile-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-header.small {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header.small h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-bright);
    font-weight: 600;
}

.card-body {
    padding: 0.75rem;
    flex: 1;
}

.card-body.no-padding {
    padding: 0;
}

.chart-wrapper.small {
    position: relative;
    width: 100%;
    min-height: 200px;
    max-height: 220px;
}

.chart-wrapper.medium {
    position: relative;
    width: 100%;
    min-height: 300px;
    max-height: 350px;
}

/* Compact Header */
.top-header.compact {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.header-titles h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-bright);
}

.header-titles .subtitle {
    color: var(--text-muted);
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Responsive adjustments for restored styles */
@media (max-width: 600px) {

    /* Global Layout */
    .app-layout,
    .main-content {
        margin-left: 0 !important;
        padding: 0.75rem !important;
        padding-bottom: 80px !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* 1. Center Title Absolutely */
    header.top-header,
    .top-header.compact,
    .mobile-centered {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        justify-content: center !important;
        width: 100% !important;
        padding: 1rem 0 !important;
        margin: 0 0 1rem 0 !important;
    }

    .header-titles,
    .header-titles h1,
    .header-titles .subtitle {
        text-align: center !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .header-actions {
        justify-content: center !important;
        width: 100% !important;
        margin-top: 1rem !important;
    }

    /* 2. Square Tiles - Force 2 Columns */
    .dashboard-grid.dense,
    .stats-grid.compact,
    .mobile-square-grid,
    .dashboard-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    /* Target stat cards and recruitment tiles specifically */
    .stat-card,
    .tile-card,
    .dashboard-grid .content-card,
    .dashboard-grid.dense .content-card {
        grid-column: span 1 !important;
        aspect-ratio: 1 / 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0.5rem !important;
        margin: 0 !important;
        min-height: auto !important;
    }

    /* Keep table/wide cards readable */
    .double-width,
    .full-width {
        grid-column: span 2 !important;
        aspect-ratio: auto !important;
        min-height: 120px !important;
    }

    /* 3. Responsive Charts */
    .chart-wrapper.small {
        min-height: 100px !important;
        max-height: 140px !important;
    }

    .chart-wrapper.medium {
        min-height: 160px !important;
        max-height: 200px !important;
    }

    /* 4. Font Consistency */
    .tile-value,
    .stat-value {
        font-size: 1.25rem !important;
    }

    .tile-value.giant-text {
        font-size: 1.5rem !important;
    }

    .tile-label,
    .stat-label {
        font-size: 0.55rem !important;
        font-weight: 700 !important;
        margin-bottom: 2px !important;
    }
}

/* Glassmorphism Polish */
.stat-card,
.content-card,
.tile-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

/* Transitions */
.main-content {
    transition: transform 0.3s ease;
}

/* Hide mobile action bar on desktop */
.mobile-action-bar {
    display: none;
}

/* =========================================
   FINAL DEFINITIVE MOBILE LAYOUT OVERRIDES
   ========================================= */

@media (max-width: 768px) {

    /* 1. Global Reset */
    html,
    body {
        overflow-x: hidden !important;
        width: 100vw !important;
        position: relative !important;
    }

    .app-layout,
    .app-container,
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        /* Start with 0 padding */
        padding-bottom: 90px !important;
        display: block !important;
        width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        min-height: auto !important;
    }

    /* 2. Sliding Sidebar (Mobile Mode) */
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        /* Start at 0 but shifted by transform */
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        z-index: 100000 !important;
        /* Highest priority */
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: translateX(-100%) !important;
        /* Hidden by default */
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        background: #1a1b26 !important;
        /* Tokyo Dark Main */
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.8) !important;
        margin-left: 0 !important;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0) !important;
        /* Slide in */
    }

    /* Overlay for sidebar */
    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 99999;
    }

    /* 3. Mobile Header & Dedicated Toggle */
    .top-header {
        position: relative !important;
        /* Anchor for absolute children */
        flex-direction: column !important;
        padding: 1rem 0.5rem !important;
        margin-bottom: 1rem !important;
        align-items: flex-start !important;
        background: rgba(36, 40, 59, 0.9) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }


    .header-titles {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }

    .header-titles h1 {
        font-size: 1.25rem !important;
        margin: 0 !important;
    }

    .header-titles .subtitle {
        display: none !important;
    }

    .sidebar-toggle-btn {
        display: flex !important;
        position: absolute !important;
        left: 1rem !important;
        top: 1rem !important;
        z-index: 1000 !important;
        width: 44px !important;
        height: 44px !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(122, 162, 247, 0.1) !important;
        border: 1px solid rgba(122, 162, 247, 0.3) !important;
        border-radius: 12px !important;
        color: #7aa2f7 !important;
        font-size: 1.2rem !important;
        flex-shrink: 0 !important;
        cursor: pointer !important;
    }

    .mobile-only-btn {
        display: flex !important;
    }

    /* 4. Dashboard Grid - Strict Vertical Stacking Rules */
    .dashboard-grid,
    .stats-grid,
    .mobile-square-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        /* Exactly 2 cols for tiles */
        gap: 0.75rem !important;
        width: 100% !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* Tiles in 2 columns */
    .dashboard-grid .stat-card,
    .dashboard-grid .tile-card,
    .dashboard-grid .content-card.tile-card {
        grid-column: span 1 !important;
        aspect-ratio: 1 / 1 !important;
        width: 100% !important;
        min-height: 110px !important;
        padding: 0.5rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* CHARTS: MAXIMUM SPECIFICITY - Force Full Width (Span 2) */
    .dashboard-grid .content-card.double-width.chart-card,
    .dashboard-grid .content-card.double-width,
    .dashboard-grid .content-card.full-width,
    .dashboard-grid .content-card.chart-card,
    .dashboard-grid .content-card.wide-card,
    .dashboard-grid .content-card:not(.tile-card),
    .dashboard-grid.dense .content-card.double-width,
    .dashboard-grid.dense .content-card.full-width,
    .dashboard-grid.dense .content-card.chart-card {
        grid-column: 1 / -1 !important;
        /* Span all columns */
        width: 100% !important;
        min-height: 280px !important;
        aspect-ratio: auto !important;
        display: block !important;
        padding: 1rem !important;
        max-width: 100% !important;
    }

    /* Section labels also full width */
    .dashboard-grid .section-label,
    .section-label.full-width {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
        padding: 0.25rem 0 0.25rem 0.5rem !important;
        font-size: 0.7rem !important;
        border-left: none !important;
        /* Remove blue vertical line */
    }

    /* 5. Typography Scale */
    .tile-value,
    .stat-value {
        font-size: 1.5rem !important;
    }

    .tile-label,
    .stat-label {
        font-size: 0.7rem !important;
        text-transform: uppercase;
    }

    /* 6. Fix Horizontal Scroll on Charts */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    .chart-wrapper,
    .chart-wrapper.small,
    .chart-wrapper.medium {
        min-height: 220px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 7. Ensure card bodies don't overflow */
    .card-body {
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* 8. Hide header actions on mobile - they'll be in bottom bar */
    .header-actions {
        display: none !important;
    }

    /* 9. Bottom Action Bar for Mobile */
    .mobile-action-bar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: rgba(36, 40, 59, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding: 0.75rem 1rem !important;
        display: flex !important;
        justify-content: center !important;
        gap: 0.75rem !important;
        z-index: 9998 !important;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5) !important;
    }

    .mobile-action-bar .btn-action {
        flex: 1 !important;
        max-width: 120px !important;
        padding: 0.75rem 1rem !important;
        border-radius: 12px !important;
        font-size: 0.85rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }
}

/* =========================================
   Mobile Bottom Navigation Menu
   ========================================= */

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 27, 38, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(122, 162, 247, 0.2);
    padding: 0.5rem 0;
    display: none;
    justify-content: space-around;
    align-items: center;
    z-index: 100000;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.5);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.3s ease;
    border-radius: 12px;
    min-width: 60px;
    position: relative;
}

.mobile-bottom-nav .nav-item .nav-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    transition: transform 0.3s ease;
}

.mobile-bottom-nav .nav-item .nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--primary);
    background: rgba(122, 162, 247, 0.1);
}

.mobile-bottom-nav .nav-item.active .nav-icon {
    transform: scale(1.1);
}

.mobile-bottom-nav .nav-item:active {
    transform: scale(0.95);
}

/* Show only on mobile */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
    }

    /* Hide the old mobile action bar if it exists */
    .mobile-action-bar,
    .dashboard-actions-footer {
        display: none !important;
    }
}

/* Hide on desktop */
.mobile-only-flex {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only-flex {
        display: flex !important;
    }
}

/* --- Auth UI Sidebar --- */
.sidebar-auth {
    margin-top: auto;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

body.sidebar-collapsed .sidebar-auth {
    align-items: center;
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

body.sidebar-collapsed .auth-status span {
    display: none;
}

.auth-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.auth-dot.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.btn-auth {
    width: 100%;
    padding: 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-auth:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

body.sidebar-collapsed .btn-auth {
    width: 36px;
    height: 36px;
    padding: 0;
}

/* --- Mobile Header Auth --- */
.mobile-header-auth {
    position: absolute !important;
    right: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: none !important;
    z-index: 1001;
}

.glass-header {
    position: relative !important;
    /* Anchor for mobile login */
}

@media (max-width: 768px) {
    .mobile-header-auth {
        display: flex !important;
    }

    /* Create the 'Black Space' gutters on both sides for centering and swipe gestures */
    .glass-container {
        padding: 0 !important;
        padding-left: 20px !important;
        /* Centering */
        padding-right: 20px !important;
        /* Swipe area */
        margin: 0 !important;
    }


    .graph-layout {
        padding: 0 !important;
    }

    /* Ensure other pages (Dashboard, etc.) still have some breathing room 
       but prioritize the graph's full-width fit where requested */
    .dashboard-grid {
        padding: 0.5rem !important;
    }

    /* Fixed Split View for Members/POL Map on Mobile */
    .split-container {
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
        padding-bottom: 20px !important;
    }

    .list-pane {
        width: 100% !important;
        height: 400px !important;
        /* Fixed height to allow scrolling to details */
        flex-basis: auto !important;
    }

    .details-pane {
        width: 100% !important;
        min-height: 500px !important;
        margin-top: 1rem !important;
        padding: 1.5rem !important;
        /* Slightly tighter on mobile */
    }
}



/* --- Mobile Bottom Nav Dropdowns --- */
.nav-item-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bottom-nav-dropdown {
    position: absolute;
    bottom: 80px;
    /* Above the nav bar */
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 35, 50, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(122, 162, 247, 0.3);
    border-radius: 16px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.bottom-nav-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Little tail for dropdown */
.bottom-nav-dropdown::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(30, 35, 50, 0.95);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: rgba(122, 162, 247, 0.15);
    color: var(--primary);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

/* =========================================
   Premium Confirmation Modal
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(16, 16, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 90%;
    max-width: 480px;
    padding: 2.5rem;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.8),
                0 0 0 1px inset rgba(255, 255, 255, 0.05); /* Inner border for depth */
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.modal-header i {
    font-size: 2.2rem;
    color: var(--warning);
    background: rgba(224, 175, 104, 0.1);
    padding: 1rem;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(224, 175, 104, 0.15);
}

.modal-header h3 {
    font-size: 1.6rem;
    margin: 0;
    color: var(--text-bright);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.85rem 1.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-bright);
    border-color: rgba(255, 255, 255, 0.15);
}

.modal-btn-confirm {
    background: var(--success);
    color: #1a1b26;
    box-shadow: 0 8px 20px rgba(158, 206, 106, 0.3);
}

.modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(158, 206, 106, 0.4);
    background: #a9de73;
}