/* =========================================
   1. CORE VARIABLES (High Contrast Mode)
   ========================================= */
:root {
    /* Backgrounds */
    --bg-body: #E8E9EB;
    --bg-sidebar-dark: #1C1C1E;
    /* GLASS SETTINGS */
    --bg-card: rgba(255, 255, 255, 0.75);
    --border-glass: 1px solid rgba(255, 255, 255, 0.8);
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --hover-bg-card: rgba(255, 255, 255, 0.85);
    --hover-bg-table: rgba(255, 255, 255, 0.6);
    --pinned-col-bg: rgba(255, 255, 255, 0.9);
    --pinned-col-hover: #fff;
    --bg-input: #fff;
    --bg-input-focus: #fff;
    --bg-toolbar: rgba(255, 255, 255, 0.7);
    --bg-table-header: #F4F4F5;
    --bg-panel-solid: #F2F2F7;
    --btn-primary-bg: #1C1C1E;
    --btn-primary-text: #fff;
    /* TEXT COLORS */
    --text-main: #1C1C1E;
    --text-muted: #636366;
    /* ACCENTS */
    --accent-blue: #007AFF;
    /* STATUS COLORS */
    --status-verified-bg: #E1F8E6; --status-verified-text: #34C759;
    --status-pending-bg: #FFF2D6; --status-pending-text: #FF9F0A;
    --status-problem-bg: #FFE5E5; --status-problem-text: #FF3B30;
    --status-received-bg: #E0F5FF; --status-received-text: #007AFF;
    /* TRANSITIONS */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-dark {
    color-scheme: dark;
    --bg-body: #121212;
    --bg-card: rgba(30, 30, 30, 0.75);
    --border-glass: 1px solid rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --hover-bg-card: rgba(50, 50, 50, 0.85);
    --hover-bg-table: rgba(255, 255, 255, 0.05);
    --pinned-col-bg: rgba(40, 40, 40, 0.95);
    --pinned-col-hover: #333;
    --bg-input: #2C2C2E;
    --bg-input-focus: #3A3A3C;
    --bg-toolbar: rgba(44, 44, 46, 0.7);
    --bg-table-header: #2C2C2E;
    --bg-panel-solid: #1C1C1E;
    --btn-primary-bg: #F2F2F7;
    --btn-primary-text: #1C1C1E;
    --text-main: #F2F2F7;
    --text-muted: #8E8E93;
    
    /* Soften status badge backgrounds for dark mode readability */
    --status-verified-bg: rgba(52, 199, 89, 0.15);
    --status-pending-bg: rgba(255, 159, 10, 0.15);
    --status-problem-bg: rgba(255, 59, 48, 0.15);
    --status-received-bg: rgba(0, 122, 255, 0.15);
}

/* --- THEME-DARK OVERRIDES FOR INLINE HTML/JS STYLES --- */
    /* Target common inline hex AND rgb computed styles */
    body.theme-dark [style*="background: #fff"],
    body.theme-dark [style*="background:#fff"],
    body.theme-dark [style*="background: white"],
    body.theme-dark [style*="background: rgb(255, 255, 255)"],
    body.theme-dark [style*="linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%)"],
    body.theme-dark [style*="linear-gradient(135deg, rgb(253, 251, 251) 0%, rgb(235, 237, 238) 100%)"] {
        background: var(--bg-card) !important;
        color: var(--text-main) !important;
    }

    /* Catch Light Blue/Unread Notifications and Active User Cards */
    body.theme-dark [style*="background:#F0F8FF"],
    body.theme-dark [style*="background: #F0F8FF"],
    body.theme-dark [style*="background:#E0F5FF"],
    body.theme-dark [style*="background: #E0F5FF"] {
        background: var(--status-received-bg) !important;
        color: var(--text-main) !important;
    }

    /* Catch Light Yellow Warning/Queue Backgrounds */
body.theme-dark [style*="background: #FFF9E6"],
body.theme-dark [style*="background:#FFF9E6"],
body.theme-dark [style*="background: #FFF8E1"],
body.theme-dark [style*="background:#FFF8E1"],
body.theme-dark [style*="background: #FFFBE6"],
body.theme-dark [style*="background:#FFFBE6"] {
    background: var(--status-pending-bg) !important;
    color: var(--text-main) !important;
}

body.theme-dark [style*="background: #F2F2F7"],
body.theme-dark [style*="background:#F2F2F7"],
body.theme-dark [style*="background: rgb(242, 242, 247)"],
body.theme-dark [style*="background: #FAFAFA"],
body.theme-dark [style*="background:#FAFAFA"],
body.theme-dark [style*="background: rgb(250, 250, 250)"],
body.theme-dark [style*="background: #F9F9F9"],
body.theme-dark [style*="background:#F9F9F9"],
body.theme-dark [style*="background: rgb(249, 249, 249)"],
body.theme-dark [style*="background: #F4F4F5"],
body.theme-dark [style*="background:#F4F4F5"],
body.theme-dark [style*="background: rgb(244, 244, 245)"],
body.theme-dark [style*="background: #E5E5EA"],
body.theme-dark [style*="background:#E5E5EA"],
body.theme-dark [style*="background: rgb(229, 229, 234)"],
body.theme-dark .submission-history-item {
    background: var(--bg-panel-solid) !important;
    border-color: var(--border-glass) !important;
    color: var(--text-main) !important;
}

/* Specific fix for internal Recruitment Hub tables */
body.theme-dark #batchCardsContainer table tr[style*="background:#fff"],
body.theme-dark #batchCardsContainer table tr[style*="background: #fff"] {
    background-color: var(--bg-card) !important;
}

/* Fix table date dividers and inline groups */
body.theme-dark .glass-table tr[style*="background"] td,
body.theme-dark .glass-table tr[style*="background"] th {
    color: var(--text-main) !important;
}

/* Fix Inline Text Colors that clash with dark backgrounds */
body.theme-dark [style*="color:#333"],
body.theme-dark [style*="color: #333"],
body.theme-dark [style*="color: rgb(51, 51, 51)"],
body.theme-dark [style*="color:#1C1C1E"],
body.theme-dark [style*="color: #1C1C1E"],
body.theme-dark [style*="color: rgb(28, 28, 30)"] {
    color: var(--text-main) !important;
}
body.theme-dark [style*="color:#107C10"],
body.theme-dark [style*="color: #107C10"],
body.theme-dark [style*="color: rgb(16, 124, 16)"] {
    color: #34C759 !important; /* Lighter green for dark mode visibility */
}

/* Fix "0 Results" badge specifically */
body.theme-dark #dynamicResultBadgeContainer div[style*="background: #F2F2F7"],
body.theme-dark #dynamicResultBadgeContainer div[style*="background: rgb(242, 242, 247)"] {
    background: var(--bg-panel-solid) !important;
    border-color: var(--border-glass) !important;
    color: var(--text-main) !important;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0; padding: 0;
    overflow: hidden;
    position: absolute; /* Prepares body for scaling */
    top: 0; right: 0; bottom: 0; left: 0;
}

/* --- ACCORDION UI CLEANUP --- */
details > summary::-webkit-details-marker {
    display: none;
}
details > summary {
    list-style: none;
}
details[open] > summary i.fa-chevron-down {
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}
details:not([open]) > summary i.fa-chevron-down {
    transform: rotate(0deg);
    transition: transform 0.2s ease;
}

/* =========================================
   2. LOGIN SCREEN
   ========================================= */
#loginSection {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0; /* Bulletproof Fullscreen */
    display: flex; justify-content: center; align-items: center;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f7 100%);
    z-index: 1000;
}
.login-card {
    background: rgba(255, 255, 255, 0.95); padding: 40px; border-radius: 24px;
    box-shadow: var(--shadow-soft); width: 400px; text-align: center; backdrop-filter: blur(20px);
}
.login-logo { width: 80px; height: 80px; object-fit: contain; border-radius: 50%; margin-bottom: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.login-card .form-group { text-align: left; margin-bottom: 15px; }
.login-card label { display: block; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 5px; font-weight: 600; margin-left: 2px; }
.login-card input {
    width: 100%; padding: 12px 15px; background: #F9F9F9; border: 1px solid #D1D1D6; border-radius: 12px;
    outline: none; transition: all 0.2s; font-size: 1rem; color: var(--text-main);
}
.login-card input:focus { background: #fff; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(0,122,255,0.1); }
.password-input-wrapper { position: relative; width: 100%; }
.password-toggle-icon { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: #8E8E93; cursor: pointer; padding: 5px; }
.login-card-footer { margin-top: 30px; padding-top: 20px; border-top: 1px solid #F2F2F4; font-size: 0.75rem; color: #C7C7CC; }
/* =========================================
   3. UNIFIED DARK SIDEBAR
   ========================================= */
.app-layout { 
    position: absolute; top: 0; right: 0; bottom: 0; left: 0; /* Bulletproof Fullscreen */
    display: flex; width: 100%; height: 100%; 
}
.main-sidebar {
    width: 260px;
    background-color: #1C1C1E;
    color: #FFFFFF;
    display: flex; flex-direction: column;
    padding: 0; z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 25px 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}
.brand-logo { width: 32px; height: 32px; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.brand-logo img { width: 80%; height: 80%; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.5px; color: #fff; }
.sidebar-user { padding: 20px; display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 36px; height: 36px; background: rgba(255, 255, 255, 0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center;
color: var(--accent-blue); }
.user-name { display: block; font-weight: 600; font-size: 0.9rem; }
.user-status { display: block; font-size: 0.7rem; color: #34C759; }
.sidebar-nav { padding: 10px 15px; flex-grow: 1; overflow-y: auto; }

/* Custom Dark Scrollbar for Sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: #1C1C1E; 
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- SYSTEM-WIDE GLOBAL SCROLLBAR ADAPTATION --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-corner {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(142, 142, 147, 0.3); /* #8E8E93 with opacity */
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(142, 142, 147, 0.6);
}
body.theme-dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}
body.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-section-title { font-size: 0.7rem; text-transform: uppercase; color: #8E8E93; letter-spacing: 1px; margin: 20px 0 10px 5px; font-weight: 700; }
.nav-link {
    width: 100%; padding: 12px 15px; margin-bottom: 4px; border: none; background: transparent;
    color: #D1D1D6; display: flex; align-items: center; gap: 12px; border-radius: 10px;
    cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.2s; text-align: left;
}
.nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-link.active { background: var(--accent-blue); color: #fff; box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3); }
.sidebar-footer { padding: 15px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.nav-link.logout:hover { background: rgba(255, 59, 48, 0.15); color: #FF3B30; }
/* =========================================
   4. MAIN CONTENT AREA
   ========================================= */
.main-content {
    flex-grow: 1; padding: 30px 40px; overflow-y: auto; position: relative; -webkit-overflow-scrolling: touch;
}
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; gap: 20px; flex-wrap: nowrap; }
.header-titles h1 { font-size: 2rem; font-weight: 700; margin: 0; color: var(--text-main); white-space: nowrap; }
.header-titles p { color: var(--text-muted); margin: 5px 0 0 0; }
.header-search { background: var(--bg-input); padding: 10px 15px; border-radius: 12px; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.03);
width: 350px; flex-shrink: 1; transition: box-shadow 0.2s; border: var(--border-glass); color: var(--text-main); }
.header-search:focus-within { box-shadow: 0 4px 15px rgba(0,0,0,0.08); border-color: var(--accent-blue); }
.header-search input { border: none; outline: none; width: 100%; min-width: 0; text-overflow: ellipsis; font-family: 'Inter', sans-serif; font-size: 0.95rem; background: transparent; color: var(--text-main); }

/* Push only the desktop search bar down to prevent banner overlap */
#desktopHeaderSearch { margin-top: 0; }
/* =========================================
   5. CARDS & GRID SYSTEMS
   ========================================= */
.cards-grid { display: grid; gap: 20px; margin-bottom: 20px; }
.five-col-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; }

/* NEW: Side-by-Side Split Layout for Dashboard */
.dashboard-split-layout { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 25px; 
    align-items: stretch; /* UPDATED: Forces the table and chart cards to be equal height */
}
.chart-wrapper {
    padding: 20px 20px 20px 20px !important; /* Adjusted padding for better breathing room */
    display: flex;
    flex-direction: column;
}
.chart-wrapper .canvas-container {
    flex-grow: 1;
    min-height: 250px;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* NEW: Custom 3-Column Legend Directory */
.custom-chart-legend {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #E5E5EA;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #636366;
    font-weight: 600;
}
.legend-color-box {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}

.glass-card {
    background: var(--bg-card); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-radius: 20px; padding: 20px; border: var(--border-glass); box-shadow: var(--shadow-soft);
    transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.hover-lift:hover { transform: translateY(-5px); box-shadow: var(--shadow-soft); background: var(--hover-bg-card); }
.full-width { width: 100%; }
.stat-card { display: flex; align-items: center; gap: 15px; padding: 25px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.normal { background: #E5E5EA; color: #636366; }
.stat-icon.success { background: var(--status-verified-bg); color: var(--status-verified-text); }
.stat-icon.primary { background: var(--status-received-bg); color: var(--status-received-text); }
.stat-icon.warning { background: #FFF9E6; color: #FF9F0A; }
.stat-icon.info { background: #E5F1FF; color: #007AFF; }
.stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; white-space: nowrap; }
.stat-number { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text-main); line-height: 1; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.card-header-row h4 { font-size: 1.1rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px; color: var(--text-main); }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4);
} 70% { box-shadow: 0 0 0 10px rgba(52, 199, 89, 0);
} 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } }
.pulse-animation { animation: pulse-green 2s infinite; }
/* =========================================
   6. REFINED ANALYTICS & CHARTS (v11.3.0)
   ========================================= */
.charts-grid-layout { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr)); 
    gap: 25px; 
    margin-top: 20px; 
    align-items: start; 
}

.analytics-country-card {
    display: flex;
    flex-direction: column;
    padding: 0 !important; /* Managed by internal sections */
    overflow: hidden;
    min-height: 500px;
}

.analytics-card-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background: rgba(0,0,0,0.01);
}

.analytics-card-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.analytics-chart-container {
    padding: 20px;
    height: 300px; /* Fixed height for consistency */
    position: relative;
}

.analytics-table-section {
    border-top: 1px solid #E5E5EA;
    background: #fff;
    flex-grow: 1;
}

.analytics-table-section .glass-table {
    width: 100%;
    margin: 0;
    min-width: 100%; /* No horizontal scroll for summary tables */
}

.analytics-table-section th {
    background: #FAFAFA;
    font-size: 0.7rem;
    padding: 10px 15px;
}

.analytics-table-section td {
    padding: 10px 15px;
    font-size: 0.85rem;
}
/* =========================================
   7. LISTS, TABLES & FILTERS
   ========================================= */
.glass-toolbar {
    background: var(--bg-toolbar); backdrop-filter: blur(10px); padding: 12px; border-radius: 16px;
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 15px; align-items: flex-start;
    margin-bottom: 20px; border: var(--border-glass);
    position: relative; 
    z-index: 50; /* NEW: Keeps dropdowns above the grid list */
}
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-muted); }
.filter-select {
    background-color: var(--bg-input); border: var(--border-glass);
    padding: 8px 12px; border-radius: 10px; outline: none; font-size: 0.85rem; color: var(--text-main);
    min-width: 140px; flex: 1 1 auto; transition: all 0.2s ease;
}
.filter-select:focus { border-color: var(--accent-blue); background-color: var(--bg-input-focus); }
.filter-badge {
    display: flex; align-items: center; gap: 6px; background: var(--accent-blue); color: #fff;
    padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 122, 255, 0.2); animation: fadeIn 0.2s ease;
}
.filter-badge i { cursor: pointer; opacity: 0.8; margin-left: 4px; }
.filter-badge i:hover { opacity: 1; }
.view-toggles { display: flex; background: #E5E5EA; border-radius: 8px; padding: 2px; }
.icon-btn {
    width: 32px; height: 32px; border: none; background: transparent; border-radius: 6px;
    cursor: pointer; color: #636366; display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.icon-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-main); }
.icon-btn.active { background: #fff; color: var(--accent-blue); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.grid-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.applicant-card { cursor: pointer; transition: all 0.3s; }
.card-content { padding: 20px; display: flex; flex-direction: column; height: 100%; }
.card-name { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-main); }
.applicant-card:hover .card-name { color: var(--accent-blue); }
.card-role { font-size: 0.85rem; color: var(--text-muted); margin: 5px 0 15px 0; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.card-divider { height: 1px; background: #E5E5EA; margin: 10px -20px 15px -20px; }
.status-badge { padding: 4px 10px; border-radius: 6px; font-weight: 700; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px; }
.status-received { background-color: var(--status-received-bg); color: var(--status-received-text); }

.table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-width: thin;
    box-sizing: border-box;
}

#auditLogTable th {
    position: sticky;
    top: 0;
    background: #F4F4F5;
    z-index: 20;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Force Activity Log text to wrap globally and prevent horizontal stretching */
#auditLogTable td:nth-child(4), #auditLogTable th:nth-child(4),
#auditLogTable td:nth-child(5), #auditLogTable th:nth-child(5) {
    white-space: normal !important;
    word-break: break-word;
    vertical-align: top;
    line-height: 1.5;
}
#auditLogTable td:nth-child(4) { min-width: 150px; }
#auditLogTable td:nth-child(5) { min-width: 350px; }

.glass-table { width: 100%; min-width: 800px; border-collapse: collapse; }
.glass-table th { text-align: left; padding: 15px; color: var(--text-main); font-weight: 700; font-size: 0.8rem; border-bottom: var(--border-glass); background: var(--bg-table-header);
white-space: nowrap; }
.glass-table td { padding: 15px; border-bottom: var(--border-glass); font-size: 0.9rem; color: var(--text-main); white-space: nowrap; vertical-align: middle; transition: background 0.2s ease; }
.glass-table tr:hover td { background: var(--hover-bg-table); }

/* PINNED LAST COLUMN UI (PINNING FOR DASHBOARD TABLES) */
.glass-table th:last-child, .glass-table td:last-child { position: sticky; right: 0; z-index: 10; border-left: var(--border-glass); }
.glass-table th:last-child { background: var(--bg-card); }
.glass-table td:last-child { background: var(--pinned-col-bg); backdrop-filter: blur(5px); transition: background 0.2s ease; }
.glass-table tr:hover td:last-child { background: var(--pinned-col-hover); box-shadow: -5px 0 10px rgba(0,0,0,0.05); }

/* FORCE DARK MODE ON PINNED COLUMNS & ROGUE DROPDOWNS TO OVERRIDE JS */
body.theme-dark .glass-table th:last-child, 
body.theme-dark .glass-table td:last-child {
    background: var(--bg-card) !important;
}
body.theme-dark select {
    background-color: var(--bg-input) !important;
    color: var(--text-main) !important;
    border-color: var(--border-glass) !important;
}

/* BATCH DETAILS SPECIAL TABLE FIX */
#batchCardsContainer .glass-table {
    min-width: 100% !important; /* Prevents overflow inside the card */
}

/* Force the action column to wrap to content size only */
#batchCardsContainer .glass-table th:last-child,
#batchCardsContainer .glass-table td:last-child {
    width: 1% !important;
    white-space: nowrap !important;
    position: static !important; /* Disable sticky for recruitment hub sub-tables */
    background: transparent !important;
    box-shadow: none !important;
    border-left: 1px solid #eee !important;
}

/* --- NEW: 70/30 SIDE-BY-SIDE BATCH DRAWER LAYOUT --- */
.batch-drawer-split {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.batch-drawer-table-module {
    flex: 0 0 calc(70% - 10px);
    min-width: 0; /* Prevents flex flex-grow blowouts */
}

.batch-drawer-notes-module {
    flex: 0 0 calc(30% - 10px);
    min-width: 0;
    background: #FAFAFA;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #E5E5EA;
}

.batch-date-divider {
    text-align: center;
    margin: 25px 0 15px 0;
    position: relative;
    width: 100%;
    clear: both;
}
.batch-date-divider span {
    background: var(--bg-panel-solid);
    padding: 4px 15px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); position: relative; z-index: 2; border: var(--border-glass);
}
.batch-date-divider div {
    position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border-glass); z-index: 1;
}

.batch-card {
    background: var(--bg-card); border-radius: 12px; border: var(--border-glass); padding: 20px; margin-bottom: 15px; transition: all 0.2s ease;
}
.batch-card:last-child { margin-bottom: 0; }
.batch-card:hover { box-shadow: var(--shadow-soft); transform: translateY(-2px); background: var(--hover-bg-card); }
.batch-card .status-badge, .batch-card .button, .batch-card .action-btn { flex-shrink: 0; white-space: nowrap; }

/* INTERACTIVE NAME LINKS IN HUB */
.hub-name-link {
    color: var(--text-main);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: #E5E5EA;
    white-space: nowrap;
    transition: color 0.2s;
}
.hub-name-link:hover {
    color: var(--accent-blue);
}

/* DECISION FINALIZED UI (v11.9.0) */
.decision-finalized {
    display: inline-flex;
    align-items: center;
    color: #8E8E93;
    font-size: 0.75rem;
    font-style: italic;
    font-weight: 600;
    background: rgba(142, 142, 147, 0.05);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px dashed #D1D1D6;
    white-space: nowrap;
}

.decision-finalized i {
    color: #D1D1D6;
    margin-right: 6px;
}
/* =========================================
   8. UTILITIES & SCORE HEATMAPS
   ========================================= */
.score-badge { padding: 4px 10px; border-radius: 8px; color: #fff; font-weight: 800; font-size: 0.85rem; text-align: center; display: inline-block; min-width: 40px; }
.score-high { background: linear-gradient(135deg, #34C759 0%, #248A3D 100%); }
.score-mid { background: linear-gradient(135deg, #FF9F0A 0%, #E67E00 100%); }
.score-low { background: linear-gradient(135deg, #FF3B30 0%, #D02B20 100%); }
.action-btn { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; border: 1px solid transparent; background: transparent;
cursor: pointer; color: var(--text-main); font-size: 0.85rem; font-weight: 600; transition: all 0.2s; }
.action-btn:hover { background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transform: translateY(-1px); }
.button { border-radius: 10px; padding: 12px 24px; font-weight: 600; border: none; cursor: pointer; transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease; display: inline-flex; align-items: center;
justify-content: center; gap: 8px; }
.button:active { transform: scale(0.98); }
.button-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); }
.button-primary:hover:not(:disabled) { opacity: 0.8; transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.button-success { background: var(--status-verified-text); color: #fff; }
.action-buttons { display: flex; gap: 8px; justify-content: flex-end; }
.delete-btn { width: 32px; height: 32px; border-radius: 6px; border: none; background: rgba(255, 59, 48, 0.1); color: #FF3B30; cursor: pointer;
display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.delete-btn:hover { background: #FF3B30; color: white; }
.edit-btn { width: 32px; height: 32px; border-radius: 6px; border: none; background: rgba(0, 122, 255, 0.1); color: #007AFF; cursor: pointer;
display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.edit-btn:hover { background: #007AFF; color: white; }

/* --- TARGET SLOTS UI UTILITIES --- */
/* Hides the default up/down arrows on the number input for a cleaner look */
input[type="number"].glass-input::-webkit-outer-spin-button,
input[type="number"].glass-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"].glass-input {
    -moz-appearance: textfield;
    text-align: center;
    font-weight: 700;
}
/* =========================================
   9. MODALS, DRAWERS & FORMS
   ========================================= */
.modal { 
    display: none; position: fixed; z-index: 4000; top: 0; bottom: 0; left: 0; right: 0; /* Bulletproof Pinning */
    background-color: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
}
.modal-content { background: var(--bg-card); margin: 5vh auto; width: 90%; max-width: 900px; border-radius: 24px; box-shadow: 0 25px 50px rgba(0,0,0,0.2); display: flex;
flex-direction: column; max-height: 85vh; overflow: hidden; border: var(--border-glass); }
.modal-content.modal-sm { max-width: 600px; }
.modal-header { display: flex; justify-content: space-between; padding: 25px 30px; border-bottom: var(--border-glass); align-items: center; background: transparent; z-index: 10;
flex-shrink: 0; }
.modal-header h2 { margin: 0; font-size: 1.5rem; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
.close-button { font-size: 1.8rem; cursor: pointer; color: #8E8E93; transition: color 0.2s; }
.close-button:hover { color: #FF3B30; }

/* --- NEW: ISOLATED SLIM MODAL HEADERS (TEAM SCHEDULE) --- */
.modal-header.schedule-slim-header {
    padding: 15px 20px !important;
    min-height: auto;
}
.modal-header.schedule-slim-header h2,
.modal-header.schedule-slim-header h3 {
    font-size: 1.15rem !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-header.schedule-slim-header .close-button {
    padding: 10px; /* Protects the thumb tap-target size on mobile */
    margin: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body { padding: 30px; overflow-y: auto; flex-grow: 1; scrollbar-width: thin; background: transparent; }
.modal-footer { padding: 20px 30px; border-top: var(--border-glass); display: flex; justify-content: flex-end; gap: 10px; background-color: transparent;
border-radius: 0 0 24px 24px; z-index: 10; flex-shrink: 0; }
.form-section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-main); font-weight: 800; margin: 20px 0 12px 0;
border-bottom: 2px solid var(--accent-blue); padding-bottom: 5px; width: fit-content; }
.input-label { display: block; font-size: 0.8rem; font-weight: 700; color: #333; margin-bottom: 6px; margin-left: 2px; }
.settings-input-group { display: flex; gap: 15px; margin-bottom: 15px; }

/* CONTAINMENT FOR INPUTS */
.settings-input-group input, .glass-select, .glass-textarea, .glass-input { 
    width: 100%; padding: 12px; border: var(--border-glass); border-radius: 10px; background: var(--bg-input); outline: none;
    font-size: 0.95rem; color: var(--text-main); transition: all 0.2s ease; font-family: 'Inter', sans-serif; 
    box-sizing: border-box; 
}
.glass-textarea { resize: vertical; min-height: 80px; box-sizing: border-box; width: 100%; max-width: 100%; }
.settings-input-group input:focus, .glass-select:focus, .glass-textarea:focus, .glass-input:focus { border-color: var(--accent-blue); background: var(--bg-input-focus); }
::placeholder { color: #A1A1A6; opacity: 1; }
.glass-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
background-repeat: no-repeat; background-position: right 15px center; background-size: 16px; }

/* REQUIREMENT INDICATOR */
.input-label span[style*="color: #FF3B30"] {
    font-weight: 800;
    margin-left: 2px;
}

/* --- DATA CATALOG UI OVERHAUL --- */
/* Subtle Trash Icon (Restored) */
.delete-btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    color: #FF3B30;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.6;
}

.delete-btn-icon:hover {
    background: #FFE5E5;
    opacity: 1;
}

.settings-page-layout {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    margin-top: 20px;
}

.settings-sidebar {
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.settings-nav-btn {
    padding: 12px 15px;
    border: none;
    background: transparent;
    text-align: left;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #636366;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-nav-btn i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.settings-nav-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main);
}

.settings-nav-btn.active {
    background: #fff;
    color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.settings-main-content {
    flex-grow: 1;
    padding: 0 !important; /* Managed by internal headers */
    overflow: hidden;
    min-height: 500px;
}

/* iOS Style Toggle Switch for Data Catalog */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #D1D1D6;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background-color: #AF52DE; /* Purple for Public Visibility */
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

#enableActivityPresence:checked + .toggle-slider,
#enableAdminHeartbeat:checked + .toggle-slider {
    background-color: #34C759; /* Green for System Prefs */
}

#maintApplyForm:checked + .toggle-slider,
#maintWalkinForm:checked + .toggle-slider,
#maintAvailabilityForm:checked + .toggle-slider,
#maintClinicForm:checked + .toggle-slider,
#maintHelpForm:checked + .toggle-slider,
#maintMedicalForm:checked + .toggle-slider {
    background-color: #FF9500 !important; /* Orange for Maintenance Mode */
}

/* Ensure Settings table has a clean boundary */
#settingsTableContainer {
    border-radius: 0 0 20px 20px;
    background: var(--bg-card);
}

@media (max-width: 768px) {
    .settings-page-layout {
        flex-direction: column;
        gap: 0;
    }
    .settings-main-content {
        width: 100%;
    }
}

/* Modern Section Headers (Enhanced for Forms) */
.form-section-title {
    font-size: 0.85rem !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-main);
    font-weight: 800;
    margin: 0 0 15px 0 !important;
    border: none !important; 
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title i {
    color: var(--accent-blue);
    font-size: 1.1rem;
}

/* NEW: Section Blocking Container */
.form-group-block {
    background: rgba(0, 0, 0, 0.02); /* Subtle contrast against white modal */
    border: 1px solid #E5E5EA;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group-block:hover {
    border-color: #D1D1D6;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

/* Thematic Sync for Dark Mode */
body.theme-carbon .form-group-block {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.form-section-title::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    background: #E5E5EA;
}

.detail-pane { 
    position: fixed; top: 0; bottom: 0; /* Bulletproof Vertical Pinning */
    right: -500px; width: 450px; background: var(--bg-card); z-index: 8500;
    transition: right 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,0.15); 
}
.detail-pane.visible { right: 0; }

#detailOverlay { 
    display: none; position: fixed; top: 0; bottom: 0; left: 0; right: 0; /* Bulletproof Pinning */
    background: rgba(0,0,0,0.3); z-index: 8499; backdrop-filter: blur(2px);
    transition: opacity 0.3s; opacity: 0; 
}
                                                                            
/* --- RESTRUCTURED 2-ROW HEADER WITH FIXED HEIGHT --- */
.detail-header { 
    display: flex; flex-direction: column; justify-content: center; gap: 12px; 
    padding: 25px; border-bottom: var(--border-glass); background: var(--bg-card); z-index: 10;
    flex-shrink: 0; 
    min-height: 120px; /* Enforces consistent height per applicant */
}
.detail-header h2 {
    white-space: normal; /* Allow long names to wrap naturally */
    word-break: break-word;
    line-height: 1.2;
    margin: 0;
}
.detail-header-row-1 { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; gap: 10px; }
.detail-header-row-2 { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 10px; }

/* --- TRUNCATION FOR LONG POSITIONS --- */
.detail-subtitle-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 250px; /* Leaves room for the action buttons */
    color:#888; 
    font-size:0.9rem; 
    font-weight:500;
}
/* ------------------------------------------ */

.detail-body { padding: 30px; overflow-y: auto; flex-grow: 1; scrollbar-width: thin; padding-bottom: 150px; background: var(--bg-panel-solid); }
.detail-section { margin-bottom: 30px; background: var(--bg-card); padding: 20px; border-radius: 16px; border: var(--border-glass); box-shadow: var(--shadow-soft); }

/* --- CONTAINMENT STRATEGY FOR DETAIL GRID --- */
.detail-section div[style*="grid"] > div {
    min-width: 0; /* Critical for flex/grid text wrapping */
    overflow-wrap: break-word;
    word-break: break-word;
}
.detail-section p {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}
/* ------------------------------------------- */

.detail-nav-btn { background: var(--bg-panel-solid); border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--text-main); display: flex; align-items: center;
justify-content: center; transition: all 0.2s; }
.detail-nav-btn:hover { background: var(--hover-bg-card); color: var(--accent-blue); }
.detail-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.history-block { background: var(--bg-input); border: var(--border-glass); padding: 15px; border-radius: 8px; font-size: 0.9rem; line-height: 1.6; color: var(--text-main); white-space: pre-line;
max-height: 300px; overflow-y: auto; overflow-wrap: break-word; word-break: break-word; }
/* =========================================
   10. AI CHAT INTERFACE - FIXED
   ========================================= */
.chat-interface {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    padding: 0 !important;
    overflow: hidden;
    background: rgba(255,255,255,0.5);
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}
.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(255,255,255,0.4);
    scroll-behavior: smooth;
}
.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
}
.message-bubble.bot { align-self: flex-start; background: #fff; color: #000; border-bottom-left-radius: 4px; display: flex; gap: 10px; align-items: flex-start; }
.message-bubble.user { align-self: flex-end; background: var(--accent-blue); color: #fff; border-bottom-right-radius: 4px; }
.msg-avatar { width: 24px; height: 24px; background: #000; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.7rem;
flex-shrink: 0; }
.chat-input-area { padding: 15px; background: #fff; border-top: 1px solid rgba(0,0,0,0.05); display: flex; gap: 10px; align-items: center; }
.chat-input-area input { flex-grow: 1; padding: 12px; border-radius: 20px; border: 1px solid #E5E5E5; background: #F2F2F7; outline: none; transition: all 0.2s;
font-size: 0.95rem; }
.chat-input-area input:focus { background: #fff; border-color: var(--accent-blue); }
.chat-input-area button { width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--accent-blue); color: #fff; cursor: pointer; transition: transform 0.2s;
display: flex; align-items: center; justify-content: center; }
.chat-input-area button:hover { transform: scale(1.1); }

.name-link-highlight {
    background: rgba(0, 122, 255, 0.1);
    color: var(--accent-blue);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-block;
    transition: background 0.2s;
}

.name-link-highlight:hover {
    background: rgba(0, 122, 255, 0.2);
    text-decoration: underline;
}

/* =========================================
   11. VIEW SWITCHING & ANIMATIONS
   ========================================= */
.view-container { display: none; opacity: 0; transform: translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease; }
.view-container.active { display: block; opacity: 1; transform: translateY(0); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   12. MEDIA QUERIES (DESKTOP ZOOM & MOBILE)
   ========================================= */
/* --- DESKTOP 80% ZOOM FIX --- */
@media (min-width: 769px) {
    body {
        zoom: 0.8;
        -moz-transform: scale(0.8);
        -moz-transform-origin: top left;
        width: 125vw;
        height: 125vh;
    }
    .mobile-element { display: none !important; }
}

@media (max-width: 1200px) {
    .five-col-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-split-layout { grid-template-columns: 1fr; gap: 20px; } /* NEW: Snaps to vertical stack on half-screen/tablet */
}

/* --- MOBILE SPECIFIC CSS UPDATE --- */
@media (max-width: 768px) {
    .desktop-element, .desktop-element-flex { display: none !important; }
    .mobile-element { display: flex !important; }
    .app-layout { flex-direction: column; }

    /* SEAMLESS HEADER STYLES */
    .mobile-header {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 60px;
        background: transparent;
        backdrop-filter: none;
        box-shadow: none !important;
        border: none !important;
        display: flex; justify-content: space-between; align-items: center;
        padding: 15px 20px 5px 20px;
        z-index: 10;
    }
    .mobile-logo { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--text-main); line-height: 1; }
    .mobile-logo img { height: 32px; width: 32px; object-fit: cover; border-radius: 50%; display: block; }
    
    /* Header Actions grouping Settings & Logout */
    .mobile-header-actions { display: flex; gap: 15px; align-items: center; }
    #mobileSettingsBtn { background: none; border: none; color: var(--text-main); font-size: 1.2rem; cursor: pointer; }
    #mobileLogoutBtn { background: none; border: none; color: #FF3B30; font-size: 1.2rem; cursor: pointer; }
    
    /* SEAMLESS SEARCH STYLES */
    .mobile-search-container {
        position: relative;
        width: 100%;
        background: transparent;
        padding: 5px 20px 15px 20px;
        box-shadow: none;
        display: none;
    }
    .mobile-search-container .header-search {
        background: #fff;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
        border: 1px solid rgba(0,0,0,0.05);
    }
    
    /* OFF-CANVAS MENU STYLES */
    #mobileMenuOverlay {
        display: none; /* Overridden by .mobile-element, but kept for fallback */
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 5999;
        opacity: 0;
        pointer-events: none; /* <--- NEW: Lets clicks pass through the invisible shield */
        transition: opacity 0.3s ease;
    }
    #mobileMenuOverlay.visible {
        display: block;
        opacity: 1;
        pointer-events: auto; /* <--- NEW: Captures clicks again when the menu is open */
    }
    .main-sidebar {
        display: flex !important; /* Overrides any desktop-element hiding */
        position: fixed !important;
        top: 0;
        bottom: 0;
        left: -300px;
        width: 260px !important;
        z-index: 6000 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }
    .main-sidebar.open {
        left: 0;
    }

    /* MAIN CONTENT SCALING (Less "Big") */
    .main-content {
        padding: 10px 10px !important;
        padding-bottom: 110px !important;
    }
    .header-titles h1 { font-size: 1.5rem; }
    
    /* CARD SIZING OPTIMIZATIONS */
    .glass-card { padding: 15px; } 
    .stat-card { padding: 15px; gap: 12px; } 
    .stat-icon { width: 40px; height: 40px; font-size: 1.2rem; }
    .stat-number { font-size: 1.3rem; }
    .card-name { font-size: 1rem; }
    .card-role { font-size: 0.75rem; margin: 4px 0 10px 0; }

    /* FILTERS - HORIZONTAL SCROLL (RIBBON) */
    .glass-toolbar { 
        flex-direction: column; 
        gap: 10px; 
        align-items: stretch; 
        padding: 12px 10px; 
    }
    .toolbar-left { 
        flex-direction: column; 
        align-items: stretch; 
        width: 100%; 
        gap: 10px; 
    }
    
    .filter-group { 
        display: flex !important; 
        flex-direction: row !important; 
        flex-wrap: nowrap !important; 
        overflow-x: auto !important; 
        -webkit-overflow-scrolling: touch;
        gap: 10px !important; 
        padding-bottom: 5px; 
        align-items: center;
        width: 100%;
        scrollbar-width: none; /* Hide scrollbar Firefox */
    }
    .filter-group::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */
    
    .filter-select { 
        flex: 0 0 auto !important; 
        width: 140px !important; 
        min-width: 140px !important; 
        padding: 8px 10px; 
        font-size: 0.85rem; 
    }
    
    #sortApplicants {
        flex: 0 0 auto !important; 
        width: 160px !important; 
        min-width: 160px !important;
    }
    
    #clearFiltersBtn {
        flex: 0 0 auto !important;
    }
    
    .toolbar-right { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
    .toolbar-right .button { padding: 8px 12px; font-size: 0.8rem; flex-grow: 1; text-align: center; }
    .view-toggles { justify-content: center; width: 100%; margin-top: 5px; }

/* Bottom Nav */
    .mobile-bottom-nav {
        position: fixed; bottom: 0; left: 0; width: 100%;
        background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0,0,0,0.05); z-index: 5000;
        display: flex; justify-content: space-between;
        padding-top: 12px; padding-bottom: max(15px, env(safe-area-inset-bottom));
        box-shadow: 0 -5px 20px rgba(0,0,0,0.05); height: auto;
    }
    /* UPDATED: Changed width: 20% to flex: 1 to auto-fill space when Chat is hidden */
    .nav-btn { flex: 1; font-size: 0.65rem; font-weight: 600; color: #8E8E93; background: none; border: none; display: flex; flex-direction: column; align-items: center;
    gap: 4px; }
    .nav-btn.active { color: var(--accent-blue); }
    .nav-btn i { font-size: 1.25rem; margin-bottom: 0; }
    
    /* Modals & Chat */
    .modal-content { width: 100% !important; height: 100% !important; max-height: 100vh !important; margin: 0 !important; border-radius: 0 !important; }
    .modal-header { padding-top: max(20px, env(safe-area-inset-top)); }

    /* FIX: MOBILE CHAT HEIGHT */
    #chatView {
        display: flex;
        flex-direction: column;
        height: calc(100dvh - 150px) !important;
    }
    .chat-interface { height: 100%; border-radius: 20px; margin: 0; }

    /* COLLAPSE SPLIT DESKTOP GRIDS TO VERTICAL STACK */
    .dashboard-split-layout { grid-template-columns: 1fr; gap: 15px; }
    .batch-drawer-split { flex-direction: column; gap: 15px; }
    .batch-drawer-table-module, .batch-drawer-notes-module { flex: 1 1 auto; width: 100%; }
    
    .charts-grid-layout { grid-template-columns: 1fr; }
    .five-col-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

    .dashboard-split-layout { grid-template-columns: 1fr; gap: 15px; }
    .charts-grid-layout { grid-template-columns: 1fr; }
    .five-col-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .five-col-grid > .glass-card:first-child { grid-column: 1 / -1; }
    .detail-pane { width: 100%; right: -100%; }
    input, select, textarea { font-size: 16px !important; }
    
    /* --- TABLE SCROLLING & WRAPPING FIXES --- */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }
    
    .glass-table { min-width: 900px !important; } 
    
    .glass-table td, .glass-table th {
        font-size: 0.8rem;
        padding: 12px 10px;
        white-space: normal !important; /* Allow text to wrap natively */
    }
    
    /* Disable sticky last column on mobile completely */
    .glass-table th:last-child, 
    .glass-table td:last-child,
    .glass-table tr th:last-child,
    .glass-table tr td:last-child { 
        position: static !important; 
        right: auto !important;
        box-shadow: none !important; 
        border-left: none !important; 
        background: transparent !important; 
        backdrop-filter: none !important;
    }
    
    /* Force Activity Log details to wrap instead of stretching infinitely */
    #auditLogTable td:nth-child(5), 
    #auditLogTable th:nth-child(5) { 
        min-width: 300px; 
        white-space: normal !important;
        word-break: break-word;
    }

    /* --- NEW: USER ACCESS FORM STACKING FIX --- */
    #userManagementModal .modal-body > div:last-child > div {
        flex-direction: column !important;
    }
    #newUserUid, #newUserEmail, #newUserRole, #saveUserBtn {
        width: 100% !important;
        flex: none !important;
        margin-bottom: 5px; /* Add slight breathing room between stacked inputs */
    }

    /* --- FORM & DETAIL PANE MOBILE FIXES FOR EXTENDED FIELDS --- */
    .settings-input-group { flex-direction: column !important; gap: 10px; }
    .detail-section > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

    /* Override Desktop Expansion for Mobile */
    #applicantTableContainer .table-responsive {
        max-height: calc(100vh - 350px) !important; /* Leaves room for bottom nav */
    }

    /* ==================================================== */
    /* --- FILE LEAVE MODAL MOBILE OVERHAUL --- */
    /* ==================================================== */
    
    /* 1. BOTTOM SHEET ARCHITECTURE */
    #fileLeaveModal .modal-content {
        height: auto !important; 
        max-height: 90dvh !important; 
        margin-top: auto !important;  
        margin-bottom: 0 !important;
        border-radius: 24px 24px 0 0 !important; 
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15) !important;
    }

    /* Drag handle */
    #fileLeaveModal .modal-header::before {
        content: "";
        display: block;
        width: 40px;
        height: 5px;
        background: #D1D1D6;
        border-radius: 5px;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
    }

    #fileLeaveModal .modal-header {
        padding-top: 25px !important; 
        border-bottom: none !important; 
    }

    /* 2. STACK THE DATES & INPUT ERGONOMICS (WITH WEB-KIT BUG FIXES) */
    /* Target the container holding the date wrappers */
    #fileLeaveModal .modal-body > div:has(#leaveStartDate),
    #fileLeaveModal .modal-body > div:nth-child(3) {
        display: flex !important;
        flex-direction: column !important; 
        gap: 15px !important;
        width: 100% !important;      /* iOS Bug Fix */
        max-width: 100% !important;  /* iOS Bug Fix */
        min-width: 0 !important;     /* iOS Bug Fix: allows flex children to shrink below content size */
        box-sizing: border-box !important;
    }

    /* Target the specific divs holding the inputs to kill the inline flex: 1 */
    #fileLeaveModal .modal-body > div:has(#leaveStartDate) > div,
    #fileLeaveModal .modal-body > div:nth-child(3) > div {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Matches Shift Matrix heights, prevents iOS auto-zoom, and forces box-sizing */
    #fileLeaveModal .glass-input, 
    #fileLeaveModal .glass-select, 
    #fileLeaveModal .glass-textarea {
        font-size: 16px !important; 
        padding: 10px 12px !important; 
        min-height: 44px !important; 
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important; /* Critical for WebKit padding containment */
    }

    /* 3. POLISH THE DATE PILLS */
    #leaveDatesList {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scrollbar-width: none;
        padding-bottom: 5px;
    }
    #leaveDatesList::-webkit-scrollbar { display: none; }
    #leaveDatesList > div {
        flex-shrink: 0;
        border-radius: 20px !important; 
        background: rgba(0, 122, 255, 0.05) !important;
        border-color: rgba(0, 122, 255, 0.2) !important;
        color: var(--accent-blue) !important;
    }

    /* 4. THE SIGNATURE VAULT */
    #fileLeaveModal .signature-panel {
        background: #1C1C1E !important; 
        border: none !important;
        border-radius: 16px !important;
        padding: 20px !important;
    }
    #fileLeaveModal .signature-panel .input-label,
    #fileLeaveModal .signature-panel p {
        color: #fff !important;
    }
    #fileLeaveModal .signature-panel p { opacity: 0.7; }
    
    #fileLeaveModal .signature-panel .button {
        color: #fff !important;
    }

    #fileLeaveModal .signature-panel input[type="password"] {
        background: rgba(255,255,255,0.1) !important;
        color: #fff !important;
        border-color: rgba(255,255,255,0.2) !important;
        text-align: center;
        letter-spacing: 5px;
    }
    #fileLeaveModal .signature-panel input[type="password"]:focus {
        border-color: #34C759 !important; 
        background: rgba(255,255,255,0.15) !important;
    }
    
    /* Apply identical dark-mode styling to the Manager's Review Signature Panel */
    #reviewLeaveModal .signature-panel {
        background: #1C1C1E !important; 
        border: none !important;
        border-radius: 16px !important;
        padding: 20px !important;
    }
    #reviewLeaveModal .signature-panel .input-label,
    #reviewLeaveModal .signature-panel p {
        color: #fff !important;
    }
    #reviewLeaveModal .signature-panel p { opacity: 0.7; }
    
    #reviewLeaveModal .signature-panel .button {
        color: #fff !important;
    }

    #reviewLeaveModal .signature-panel input[type="password"] {
        background: rgba(255,255,255,0.1) !important;
        color: #fff !important;
        border-color: rgba(255,255,255,0.2) !important;
        text-align: center;
        letter-spacing: 5px;
    }
    #reviewLeaveModal .signature-panel input[type="password"]:focus {
        border-color: #34C759 !important; 
        background: rgba(255,255,255,0.15) !important;
    }

    /* 5. THUMB-ZONE FOOTER */
    #fileLeaveModal .modal-footer {
        flex-direction: column-reverse !important; 
        gap: 10px !important;
        padding: 15px 20px 25px 20px !important; 
    }
    #fileLeaveModal .modal-footer .button {
        width: 100% !important;
        justify-content: center !important;
        padding: 14px !important; 
        font-size: 1rem !important;
    }
    #fileLeaveModal .modal-footer .button:not(.button-primary) {
        background: transparent !important; 
        border: none !important;
        color: #8E8E93 !important;
        padding: 10px !important;
    }

    /* ==================================================== */
    /* --- MANAGE LEAVES MODAL MOBILE OVERHAUL --- */
    /* ==================================================== */

    /* 1. BOTTOM SHEET ARCHITECTURE */
    #manageLeavesModal .modal-content {
        height: auto !important; 
        max-height: 95dvh !important; 
        margin-top: auto !important;  
        margin-bottom: 0 !important;
        border-radius: 20px 20px 0 0 !important; 
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15) !important;
    }

    #manageLeavesModal .modal-header {
        padding: 15px 20px 10px 20px !important; /* Minimized height */
        border-bottom: none !important; 
    }
    
    #manageLeavesModal .modal-header h3 {
        font-size: 1.1rem !important;
    }

    /* 2. HEADER TABS & FLOATING ACTION BUTTON (FAB) */
    #manageLeavesModal .pane-tabs-header {
        padding: 0 15px 10px 15px !important;
        border-bottom: none !important;
        gap: 6px !important; 
    }

    /* Convert Pending and History to 50/50 segmented pills */
    #tabBtnLeavesPending, #tabBtnLeavesResolved {
        flex: 1 1 45% !important;
        padding: 8px !important;
        font-size: 0.8rem !important;
        border-radius: 8px !important;
        background: #F2F2F7 !important;
        border: 1px solid #E5E5EA !important;
        color: #8E8E93 !important;
    }
    
    #tabBtnLeavesPending.active, #tabBtnLeavesResolved.active {
        background: #fff !important;
        color: var(--accent-blue) !important;
        border-color: var(--accent-blue) !important;
        box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1) !important;
    }

    /* Convert "Tag Manual Leave" into a Floating Action Button (FAB) */
    #manageLeavesModal .pane-tabs-header button:nth-child(3) {
        position: fixed !important;
        bottom: 25px !important;
        right: 25px !important;
        width: 52px !important;
        height: 52px !important;
        border-radius: 50% !important;
        padding: 0 !important;
        font-size: 0 !important; 
        background: #FF9500 !important;
        box-shadow: 0 6px 20px rgba(255, 149, 0, 0.4) !important;
        z-index: 9999 !important;
        display: block !important; /* Kills flex behavior that interferes with centering */
    }
    
    /* PERFECT CENTERING FIX FOR FONT-AWESOME ICON */
    #manageLeavesModal .pane-tabs-header button:nth-child(3) i {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        font-size: 1.4rem !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #fff !important;
        line-height: 1 !important;
    }

    /* Hide "Import Legacy" and "Export CSV" on mobile to declutter */
    #manageLeavesModal .pane-tabs-header button:nth-child(4),
    #manageLeavesModal .modal-content > div:nth-child(3) button.action-btn {
        display: none !important;
    }

    /* 3. COMPACT FILTERS DRAWER */
    #manageLeavesModal .modal-content > div:nth-child(3) {
        display: flex !important; 
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important; /* THE FIX: Kills the inline overflow-x causing the cut-off */
        padding: 15px !important;
        background: #FAFAFA !important;
        border-bottom: 1px solid #E5E5EA !important;
        border-top: 1px solid #E5E5EA !important;
    }
    
    #manageLeavesModal .modal-content > div:nth-child(3) > div:first-child {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 12px !important; 
        align-items: stretch !important;
        box-sizing: border-box !important;
    }

    #manageLeavesStaffFilter {
        max-width: 100% !important;
        width: 100% !important;
        padding: 10px 12px !important;
        font-size: 16px !important; 
        min-height: 44px !important; 
        box-sizing: border-box !important;
    }

    /* Fixed Date Alignment (Stacked Label, 50/50 Inputs) */
    #manageLeavesModal .modal-content > div:nth-child(3) > div:first-child > div:not(.desktop-element) {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 8px !important; 
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Forces "DATES:" to take its own line */
    #manageLeavesModal .modal-content > div:nth-child(3) > div:first-child > div:not(.desktop-element) span:first-child {
        width: 100% !important;
        margin-bottom: -2px !important;
        font-size: 0.75rem !important;
        font-weight: 700 !important;
    }

    #manageLeavesStartDate, #manageLeavesEndDate {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 10px 12px !important;
        font-size: 16px !important; 
        min-height: 44px !important; 
        box-sizing: border-box !important;
    }

    /* 4. TABLE TO CARDS CONVERSION (Grid Layout for Max Compactness) */
    #manageLeavesModal .table-responsive {
        padding: 8px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important; 
        width: 100% !important;
    }

    #manageLeavesModal .glass-table, 
    #manageLeavesModal .glass-table tbody, 
    #manageLeavesModal .glass-table tr, 
    #manageLeavesModal .glass-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #manageLeavesModal .glass-table {
        min-width: 0 !important; /* CRITICAL FIX: Destroys the global 900px table min-width */
        max-width: 100% !important;
    }

    #manageLeavesModal .glass-table thead {
        display: none !important;
    }

    /* The Ultra-Compact Card Container */
    #manageLeavesModal .glass-table tr {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: auto auto auto auto auto !important;
        gap: 2px !important; /* Ultra-tight spacing between data points */
        background: #fff !important;
        border: 1px solid #E5E5EA !important;
        border-radius: 12px !important; 
        padding: 10px !important; /* Tight internal padding */
        margin-bottom: 8px !important; /* Tight external spacing between cards */
        box-shadow: 0 2px 4px rgba(0,0,0,0.02) !important;
        overflow: hidden !important;
    }

    /* Reset TD styling */
    #manageLeavesModal .glass-table td {
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        white-space: normal !important;
        line-height: 1.2 !important; /* Tightened text line height */
        word-break: break-word !important; /* Prevents long text blowout */
    }

    /* Row 1: Name (Left) */
    #manageLeavesModal .glass-table td:nth-child(2) {
        grid-column: 1 / 2 !important; 
        grid-row: 1 / 2 !important;
        font-size: 0.95rem !important; 
        font-weight: 800 !important;
    }

    /* Row 1 & 2: Status Badge & Processed By (Right aligned, spans 2 rows) */
    #manageLeavesModal .glass-table td:nth-child(5) {
        grid-column: 2 / 3 !important; 
        grid-row: 1 / 3 !important; 
        display: flex !important; 
        flex-direction: column !important; 
        align-items: flex-end !important;
        gap: 2px !important; /* Tight gap */
    }
    #manageLeavesModal .glass-table td:nth-child(5) > div { 
        margin-top: 0 !important; 
        text-align: right !important; 
    }

    /* Row 2: Leave Type Badge (Left) */
    #manageLeavesModal .glass-table td:nth-child(3) {
        grid-column: 1 / 2 !important; 
        grid-row: 2 / 3 !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Row 3: Date Filed (Left) */
    #manageLeavesModal .glass-table td:nth-child(1) {
        grid-column: 1 / 2 !important; 
        grid-row: 3 / 4 !important;
        font-size: 0.75rem !important;
        color: #8E8E93 !important;
    }
    #manageLeavesModal .glass-table td:nth-child(1)::before {
        content: "Filed: "; 
    }

    /* Row 4: Requested/Approved Dates (Full Width) */
    #manageLeavesModal .glass-table td:nth-child(4) {
        grid-column: 1 / -1 !important; 
        grid-row: 4 / 5 !important;
        font-size: 0.75rem !important; /* Scaled down */
        margin-top: 2px !important;
        padding-top: 6px !important;
        border-top: 1px dashed #E5E5EA !important;
    }

    /* Row 5: Action Button (Full Width) */
    #manageLeavesModal .glass-table td:nth-child(6) {
        grid-column: 1 / -1 !important; 
        grid-row: 5 / 6 !important;
        margin-top: 4px !important;
    }
    #manageLeavesModal .glass-table td:nth-child(6) button {
        width: 100% !important;
        justify-content: center !important;
        padding: 8px !important; /* Slimmer button */
        font-size: 0.8rem !important;
        border-radius: 8px !important;
    }

    /* 5. MY LEAVES HISTORY COMPRESSION (Staff Side) */
    #myLeavesModal .modal-body {
        padding: 15px !important;
    }
    .leave-history-card {
        padding: 12px !important;
        border-radius: 12px !important;
        margin-bottom: 8px !important;
    }
    .leave-history-card > div:first-child {
        margin-bottom: 8px !important;
        padding-bottom: 8px !important;
    }
    .leave-history-card strong {
        font-size: 0.75rem !important;
    }

    /* ==================================================== */
    /* --- FULL SCREEN MODALS & ANIMATIONS --- */
    /* ==================================================== */
    
    @keyframes slideUpFromBottom {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    @keyframes slideDownToBottom {
        from { transform: translateY(0); }
        to { transform: translateY(100%); }
    }

    /* 1. Remove the dark overlay blur/color on mobile for stacked modals */
    #myLeavesModal,
    #fileLeaveModal,
    #manageLeavesModal,
    #reviewLeaveModal {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* 2. Force the inner white card to act as a 100% full screen page */
    #myLeavesModal .mobile-fullscreen-modal,
    #fileLeaveModal .mobile-fullscreen-modal,
    #manageLeavesModal .mobile-fullscreen-modal,
    #reviewLeaveModal .mobile-fullscreen-modal {
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: #fff !important; /* Ensures lower modals don't bleed through */
        animation: slideUpFromBottom 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards !important;
        box-shadow: none !important;
    }
    
    /* 3. Dynamic class added by JS for the smooth slide-out exit animation */
    #myLeavesModal .mobile-fullscreen-modal.slide-down-exit,
    #fileLeaveModal .mobile-fullscreen-modal.slide-down-exit,
    #manageLeavesModal .mobile-fullscreen-modal.slide-down-exit,
    #reviewLeaveModal .mobile-fullscreen-modal.slide-down-exit {
        animation: slideDownToBottom 0.3s cubic-bezier(0.8, 0.2, 0.8, 1) forwards !important;
    }
    
    /* Hide the top drag-handles since they are now full-screen native pages */
    .mobile-fullscreen-modal .modal-header::before {
        display: none !important;
    }

} /* <-- THIS SHOULD BE THE FINAL CLOSING BRACE FOR @media (max-width: 768px) */

/* =========================================
   13. LOADING SCREEN
   ========================================= */
.loader-overlay {
    position: fixed; top: 0; bottom: 0; left: 0; right: 0; /* Bulletproof Pinning */
    background: rgba(232, 233, 235, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.loader-content {
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
}

.logo-pulse {
    width: 80px; height: 80px; background: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 122, 255, 0.15);
    animation: pulseLogo 2s infinite ease-in-out;
}

.logo-pulse img { width: 50px; height: 50px; object-fit: contain; }

.spinner-track {
    width: 150px; height: 4px; background: #E5E5EA; border-radius: 4px; overflow: hidden;
    position: relative;
}

.spinner-bar {
    width: 50%; height: 100%; background: #007AFF; border-radius: 4px;
    position: absolute; left: -50%;
    animation: slideBar 1.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.loader-content p {
    font-family: 'Inter', sans-serif; font-weight: 600; color: #8E8E93; font-size: 0.9rem;
    margin: 0; animation: blinkText 1.5s infinite;
}

@keyframes pulseLogo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(0, 122, 255, 0.25); } }
@keyframes slideBar { 0% { left: -50%; width: 30%; } 50% { left: 30%; width: 60%; } 100% { left: 100%; width: 10%; } }
@keyframes blinkText { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* =========================================
   14. REMARK LEDGER (VERSION 8.0)
   ========================================= */
.remark-feed {
    background: var(--bg-panel-solid);
    border: var(--border-glass);
    border-radius: 12px;
    padding: 15px;
    max-height: 315px; /* Increased by 25% for better visibility */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.remark-bubble {
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: 10px;
    padding: 12px;
    box-shadow: var(--shadow-soft);
    animation: fadeIn 0.3s ease;
}

.remark-author {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.remark-text {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.remark-timestamp {
    display: block;
    font-size: 0.7rem;
    color: #8E8E93;
    margin-top: 6px;
    text-align: right;
}

.remark-input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-card);
    padding: 15px;
    border-radius: 12px;
    border: var(--border-glass);
}

.remark-input-area textarea {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    border: var(--border-glass);
    background: var(--bg-input);
    color: var(--text-main);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease;
}

.remark-input-area textarea:focus {
    border-color: var(--accent-blue);
}

.remark-input-area button {
    align-self: flex-end;
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* =========================================
   15. VERSION 8.0 UI EXPANSION & SECURITY
   ========================================= */
/* Dynamic List View Expansion */
.list-view-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-height: 0;
}

#applicantTableContainer {
    width: 100%;
    max-width: 100%;
    padding: 0 !important; 
    overflow: hidden !important; /* Hard clip to respect the border-radius */
    background: var(--bg-card);
    border-radius: 20px;
    border: var(--border-glass);
    box-shadow: var(--shadow-soft);
    box-sizing: border-box;
    display: block; /* Dropping flexbox here stops infinite expansion bugs */
}

/* Forces the table to stay inside the card and scroll both vertically and horizontally */
#applicantTableContainer .table-responsive {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 260px) !important; /* EXTENDED: Decreased subtraction to stretch the table further down */
    overflow-y: auto !important; 
    overflow-x: auto !important; 
    display: block !important; 
    scrollbar-width: thin;
    box-sizing: border-box;
}

/* Solid Sticky Header to prevent data overlap during scrolling */
#mainApplicantTable th {
    position: sticky;
    top: 0;
    background: var(--bg-table-header); 
    z-index: 20;
    box-shadow: var(--shadow-soft);
    border-bottom: var(--border-glass);
}

/* Security: Immutable Owner Row Styling */
.locked-user-row {
    background-color: rgba(175, 82, 222, 0.05) !important; /* Subtle purple tint indicating Super Admin Lock */
    border-left: 4px solid #AF52DE !important;
}

.locked-user-row td {
    opacity: 0.95;
}

.locked-badge {
    color: #8E8E93;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-style: italic;
    background: rgba(0,0,0,0.05);
    padding: 4px 8px;
    border-radius: 6px;
}

/* --- WORKSPACE MAXIMIZATION (v8.3.0) --- */
.maximized-workspace {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 3000 !important; /* Above sidebar, below detail pane (3500) */
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 30px 40px !important;
    background-color: var(--bg-body) !important; /* Matches your dashboard background */
    overflow-y: auto !important;
}

/* Maximize Toggle Button Styling */
.maximize-toggle-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-smooth);
}

.maximize-toggle-btn:hover {
    background: #fff;
    color: var(--accent-blue);
    box-shadow: var(--shadow-soft);
}

/* Ensure the table expands fully when maximized */
.maximized-workspace .table-responsive {
    max-height: calc(100vh - 180px) !important;
}
/* --- WORKSPACE SEARCH STYLING --- */
.workspace-header-actions {
    display: none; /* Hidden by default on the dashboard */
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* Show only when the parent has the .maximized-workspace class */
.maximized-workspace .workspace-header-actions {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.workspace-search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: var(--border-glass);
    border-radius: 12px;
    padding: 8px 15px;
    width: 350px;
    flex-shrink: 1;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    color: var(--text-main);
}

.workspace-search-bar i {
    color: #8E8E93;
    margin-right: 10px;
}

.workspace-search-bar input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
}

.workspace-search-bar:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(0,122,255,0.1);
}
/* --- SYNC NOTIFICATION BAR STYLING --- */
.sync-toast-bar {
    position: fixed;
    top: -60px; /* Start hidden above screen */
    left: 0;
    right: 0;
    height: 50px;
    background: var(--accent-blue);
    color: white;
    z-index: 4500; /* Above everything except modals */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.sync-toast-bar.visible {
    top: 0;
}

.sync-toast-content {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.sync-refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.sync-refresh-btn:hover {
    background: white;
    color: var(--accent-blue);
}

.sync-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
}

/* Universal Outage Broadcast Banner Animations */
#globalBroadcastBanner {
    animation: pulse-broadcast 2s infinite;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes pulse-broadcast {
    0% { box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(255, 149, 0, 0.6); background-color: #FF9F0A; }
    100% { box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3); }
}

/* NEW: FESTIVE BANNER STYLING FOR BIRTHDAYS */
.festive-banner {
    background: linear-gradient(135deg, #FF2D55 0%, #FF9500 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    animation: festive-pulse 3s infinite;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@keyframes festive-pulse {
    0% { box-shadow: 0 4px 15px rgba(255, 45, 85, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(255, 45, 85, 0.6); }
    100% { box-shadow: 0 4px 15px rgba(255, 45, 85, 0.3); }
}

/* Adjust main content top padding when bar is visible on desktop */
@media (min-width: 769px) {
    .sync-toast-bar {
        left: 260px; /* Aligns with sidebar */
    }
}

/* =========================================
   16. HYBRID PRESENCE SYSTEM (v9.3.0)
   ========================================= */

/* --- SIDEBAR PRESENCE LIST --- */
.presence-section {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto; /* Pushes the presence area above the footer */
}

.presence-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.presence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
}

.presence-user {
    position: relative;
    width: 32px;
    height: 32px;
    background: #2C2C2E;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: help;
    transition: transform 0.2s ease;
}

.presence-user:hover {
    transform: scale(1.1);
    z-index: 10;
}

.presence-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: #34C759;
    border: 2px solid #1C1C1E; /* Match Sidebar Background */
    border-radius: 50%;
}

/* --- DETAIL PANE COLLISION NOTICE --- */
.collision-notice {
    background: rgba(255, 159, 10, 0.1);
    color: #FF9F0A;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: none; /* Controlled by JS */
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 159, 10, 0.2);
    animation: fadeIn 0.3s ease;
}

/* --- SETTINGS TOGGLE STYLING --- */
.presence-toggle-container {
    display: flex; 
    gap: 30px; 
    background: #F2F2F7; 
    padding: 20px; 
    border-radius: 16px; 
    flex-wrap: wrap;
    margin-top: 10px;
}

.presence-toggle-item {
    display: flex; 
    align-items: center; 
    gap: 12px; 
    cursor: pointer;
}

.presence-toggle-item input[type="checkbox"] {
    width: 20px; 
    height: 20px; 
    cursor: pointer;
    accent-color: var(--accent-blue);
}

.presence-toggle-label {
    display: block; 
    font-size: 0.9rem; 
    font-weight: 700;
}

.presence-toggle-subtext {
    display: block; 
    font-size: 0.75rem; 
    color: #8E8E93;
}

/* --- MOBILE RESPONSIVENESS FOR PRESENCE --- */
@media (max-width: 768px) {
    .presence-section {
        display: none !important; /* Hide sidebar presence on mobile to save space */
    }
    
    .presence-toggle-container {
        flex-direction: column;
        gap: 15px;
    }
}

/* =========================================
   17. WELFARE TICKET SYSTEM (v10.1.2)
   ========================================= */

/* Sidebar & Tab Badges */
.welfare-badge {
    background: #FF3B30;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
    box-shadow: 0 2px 5px rgba(255, 59, 48, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.caution-badge {
    background: #FFCC00;
    color: #1C1C1E;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(255, 204, 0, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.welfare-badge-mobile {
    position: absolute;
    top: 5px;
    right: 10px;
    background: #FF3B30;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 10px;
    z-index: 5;
}

.caution-badge-mobile {
    position: absolute;
    top: 5px;
    right: 32px; /* Offset so it doesn't overlap the red ticket badge */
    background: #FFCC00;
    color: #1C1C1E;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 10px;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(255, 204, 0, 0.4);
}

/* Expiry Ribbon Scrollbar Hide (WebKit) */
#expirationAlertScroll::-webkit-scrollbar {
    display: none;
}

/* Workspace Toggle Bar */
.workspace-toggle-bar {
    display: none; /* Only shown in Deployed view */
    background: var(--bg-panel-solid);
    padding: 4px;
    border-radius: 12px;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* Firefox */
    margin-bottom: 25px;
    border: var(--border-glass);
}

.workspace-toggle-bar::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.workspace-toggle-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: #8E8E93;
    transition: all 0.2s var(--ease-smooth);
    font-size: 0.85rem;
    display: inline-block;
}

.workspace-toggle-btn.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
}

/* Side Pane Tab System */
.pane-tabs-header {
    display: flex;
    border-bottom: var(--border-glass);
    background: var(--bg-card);
    padding: 0 10px; /* Reduced padding to fit 3 tabs gracefully */
    gap: 5px; /* Adds slight spacing between buttons */
}

.pane-tab-btn {
    padding: 15px 15px; /* Reduced internal padding */
    border: none;
    background: none;
    font-weight: 700;
    font-size: 0.85rem;
    color: #8E8E93;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    flex: 1; /* Forces the tabs to stretch and share the space evenly */
    text-align: center;
    white-space: nowrap; /* Prevents text from stacking */
}

.pane-tab-btn.active {
    color: var(--accent-blue);
}

.pane-tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 3px;
    background: var(--accent-blue);
    border-radius: 3px 3px 0 0;
}

/* Search results in Linker & Batch Endorsement Modals */
.linker-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #E5E5EA;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.linker-result-item:hover {
    background: #fff;
    transform: translateX(2px);
}

.linker-result-item:last-child { border-bottom: none; }

/* Ineligible / Disabled Search Results (Prevents Hover Effects) */
.linker-result-item[style*="not-allowed"] {
    background: #FAFAFA;
}

.linker-result-item[style*="not-allowed"]:hover {
    background: #FAFAFA;
    transform: none; /* Lock position */
    box-shadow: none;
}

/* --- V10.1.2 TICKET & CONTRACT TABLE EXPANSION FIXES --- */

/* ADDED FIX FOR OVERSHOOTING: Constrain the container */
#ticketHandlerContainer,
#expiringContractsContainer {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Clips elements trying to push past the border */
}

/* Force horizontal scrolling inside the wrapper */
#ticketHandlerContainer .table-responsive,
#expiringContractsContainer .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    display: block !important;
    scrollbar-width: thin;
    box-sizing: border-box;
}

/* Forces the table to allow horizontal scrolling instead of squishing columns */
#ticketHandlerTable,
#expiringContractsTable {
    min-width: 1050px; 
    width: 100%;
}

/* Adds text truncation so long employer/country names don't blow up the row height */
#ticketHandlerTable td,
#expiringContractsTable td {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ensures the Category badge doesn't get cut off */
#ticketHandlerTable td:nth-child(5) { 
    white-space: normal;
    min-width: 130px;
}

/* Ensures the Action buttons have enough breathing room */
#ticketHandlerTable td:last-child,
#expiringContractsTable td:last-child {
    white-space: nowrap;
    min-width: 160px; 
}

/* Ticket & Contract Workspace Search Bar Polish */
#ticketHandlerContainer .workspace-search-bar,
#expiringContractsContainer .workspace-search-bar {
    border-radius: 10px;
    border: 1px solid #D1D1D6;
    background: #FAFAFA;
}

/* =========================================
   18. INTERVIEW & ASSESSMENT MODULE
   ========================================= */
   
/* Interactive Rating Pill Selection */
.rating-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border: 1px solid #E5E5EA;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    margin-bottom: 2px;
}

/* Hover effect */
.rating-option:hover {
    background: #FAFAFA;
    border-color: #C7C7CC;
    transform: translateX(4px);
}

/* Dynamic color-coding when a specific score is selected */
.rating-option:has(input[value="1"]:checked) { 
    border-color: #FF3B30; 
    background: rgba(255, 59, 48, 0.05); 
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.15);
}
.rating-option:has(input[value="2"]:checked) { 
    border-color: #FF9500; 
    background: rgba(255, 149, 0, 0.05); 
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.15);
}
.rating-option:has(input[value="3"]:checked) { 
    border-color: #FFCC00; 
    background: rgba(255, 204, 0, 0.05); 
    box-shadow: 0 2px 8px rgba(255, 204, 0, 0.15);
}
.rating-option:has(input[value="4"]:checked) { 
    border-color: #34C759; 
    background: rgba(52, 199, 89, 0.05); 
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.15);
}
.rating-option:has(input[value="5"]:checked) { 
    border-color: #007AFF; 
    background: rgba(0, 122, 255, 0.05); 
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
}

/* Custom minimal scrollbar for the Interview Guide text block */
#assessGuideContent::-webkit-scrollbar {
    width: 6px;
}
#assessGuideContent::-webkit-scrollbar-track {
    background: #F2F2F7;
    border-radius: 10px;
}
#assessGuideContent::-webkit-scrollbar-thumb {
    background: #D1D1D6;
    border-radius: 10px;
}

/* --- Comm Skills Mini-Pill UI & Layout --- */
.comm-mini-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 32px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.comm-mini-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Compact Score Card for vertically stacked layout */
.compact-score-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: -5px; /* Pulls it slightly tighter to the AI score above it */
}

.compact-score-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

/* Ensure any remaining side-by-side profile grids stack neatly on mobile */
@media (max-width: 768px) {
    #profileTabContent > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}
/* =========================================
   19. PERFORMANCE KPI REFINEMENTS
   ========================================= */

/* Force single column for KPI cards to prevent 800px tables from squishing/scrolling */
#performanceKPIGrid.charts-grid-layout {
    grid-template-columns: 1fr !important;
    padding-bottom: 50px;
}

/* Ensure the card hover doesn't conflict with centering */
#performanceKPIGrid .glass-card:hover {
    transform: translateY(-5px);
}

/* =========================================
   20. DRAG AND DROP FILE UPLOAD
   ========================================= */
.file-drop-zone {
    transition: all 0.3s var(--ease-smooth);
    position: relative;
    border: 2px solid transparent; /* Prevents layout jump when border becomes dashed */
}

/* Active state when a file is hovering over the target */
.file-drop-zone.drag-over-active {
    border: 2px dashed var(--accent-blue) !important;
    background-color: rgba(0, 122, 255, 0.05) !important;
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.15);
    z-index: 20;
}

/* Visual overlay text that appears during drag */
.file-drop-zone.drag-over-active::after {
    content: "Drop file here to upload";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 14px; /* Matches the inner radius of the detail section */
    z-index: 10;
    pointer-events: none; /* Extremely important: Allows the drop event to pass through the text to the container below */
}

/* =========================================
   21. ACCOUNT-BASED CASE MANAGEMENT (IN-PROCESS)
   ========================================= */
/* Horizontal Scrolling Tab Bar */
#inProcessWorkspaceToggle {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
}
#inProcessWorkspaceToggle::-webkit-scrollbar { 
    display: none; /* WebKit */
}

/* Spreadsheet-style processing table overrides */
#processingApplicantTable th, 
#processingApplicantTable td {
    padding: 10px 12px;
    vertical-align: middle;
    border-right: 1px solid rgba(0,0,0,0.05); /* Subtle vertical column separator */
}

/* --- NEW: STICKY HEADER FOR IN-PROCESS SPREADSHEET --- */
#processingApplicantTable th {
    position: sticky;
    top: 0;
    background: var(--bg-table-header); /* Solid background to prevent rows from showing through */
    z-index: 20; /* Ensure it floats above the rows */
    box-shadow: var(--shadow-soft);
    border-bottom: var(--border-glass);
}

/* Ensure the sticky "Action" column overlaps correctly with the sticky top row */
#processingApplicantTable th:last-child {
    z-index: 30; /* Higher than regular headers so the top-right corner stays solid */
}

/* Remove the right border from the very last column to keep the edge clean */
#processingApplicantTable th:last-child,
#processingApplicantTable td:last-child {
    border-right: none;
}

/* FIX: Match the Action header background with the rest of the headers */
#processingApplicantTable th:last-child {
    background: var(--bg-table-header); /* Matched to the new solid sticky header */
    border-left: var(--border-glass); /* Match the internal separators */
}

/* Specific constraint for the Status column to trigger wrapping */
#processingApplicantTable td:nth-child(7) {
    min-width: 160px;
    max-width: 250px;
}

/* Allow the Status and Result dropdowns to stack vertically if squished */
.status-dropdown-container {
    width: 100%;
}

/* Inline Spreadsheet Dropdowns */
#processingApplicantTable select.glass-select {
    background-color: #F2F2F7;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    color: var(--text-main);
    text-overflow: ellipsis;
}

#processingApplicantTable select.glass-select:hover,
#processingApplicantTable select.glass-select:focus {
    background-color: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1);
}

/* Lacking document inline input styling */
#processingApplicantTable input.glass-input {
    background-color: transparent;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    color: var(--text-main);
}

#processingApplicantTable input.glass-input:hover,
#processingApplicantTable input.glass-input:focus {
    background-color: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1);
}
/* =========================================
   22. ACCOUNT-BASED SPREADSHEET LINKS
   ========================================= */
.processing-client-group a {
    transition: opacity 0.2s ease, color 0.2s ease;
}

.processing-client-group a:hover {
    opacity: 0.8;
    color: #0056b3 !important; /* Darker blue on hover */
    text-decoration: none !important;
}

/* FIX: Make the Employer Row background seamless across the sticky Action column */
.processing-client-group td:last-child {
    border-left: none !important;
    background: #F2F2F7 !important; /* Matches the inline style of the row */
}

/* =========================================
   23. ADMIN DOCUMENT LINKS (DYNAMIC ROWS)
   ========================================= */
#adminDocsList {
    margin-bottom: 5px;
}

#adminDocsList .form-group {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#adminDocsList .form-group:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #D1D1D6 !important;
}

/* Ensure the inputs inside the dynamic row don't overflow */
.doc-label-input, .doc-url-input {
    min-width: 0; /* Prevents flex flex-grow blowouts */
    padding: 10px 12px !important;
    font-size: 0.85rem !important;
}

/* Style for the disabled legacy CV labels */
.doc-label-input:disabled {
    background-color: #E5E5EA !important;
    color: #636366 !important;
    font-weight: 600;
    cursor: not-allowed;
    border: 1px solid transparent !important;
}

/* Ensure the delete button fits perfectly next to the inputs */
#adminDocsList .delete-btn {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid #FF3B30;
    transition: all 0.2s ease;
}

#adminDocsList .delete-btn:hover {
    background: #FF3B30;
    color: white;
}

/* =========================================
   24. DOCUMENT PORTFOLIO UNIFICATION
   ========================================= */
/* Restrain the height of the document list to prevent side pane blowout */
#fileListContainer {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
    margin-top: 15px;
}

/* Custom minimal scrollbar for the document list */
#fileListContainer::-webkit-scrollbar {
    width: 6px;
}

/* Fix dropdown text truncation */
#docTypeSelect {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: 65%; /* Allows it to take up most of the space but leaves room for the button */
}

/* =========================================
   25. BATCH UPLOAD STAGING QUEUE
   ========================================= */
.upload-queue-item {
    animation: fadeIn 0.3s ease;
}

.upload-queue-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.15);
    border-style: solid !important; /* Changes from dashed to solid on hover */
}

/* Custom shadow overrides for the Success and Fail states applied via JS */
.upload-queue-item[style*="rgba(52, 199, 89"] {
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.15) !important;
    transform: none; /* Locks position when finished */
}

.upload-queue-item[style*="rgba(255, 59, 48"] {
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.15) !important;
    transform: none;
}

/* =========================================
   26. CLICKABLE DOCUMENT ROWS
   ========================================= */
.document-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel-solid);
    padding: 12px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

/* Standard hover effect for functional links */
.document-list-item:hover {
    background: var(--hover-bg-card);
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.1);
    transform: translateY(-1px);
}

/* NEW: Suppress hover effects on disabled legacy placeholder rows */
.document-list-item[style*="border: 1px dashed #FF9500"]:hover {
    background: rgba(255, 149, 0, 0.05) !important;
    border-color: #FF9500 !important;
    box-shadow: none !important;
    transform: none !important;
}

.document-list-item i.fa-arrow-up-right-from-square {
    color: #8E8E93;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.document-list-item:hover i.fa-arrow-up-right-from-square {
    color: var(--accent-blue);
    opacity: 1;
}

/* =========================================
   27. DOCUMENT EXPIRATION DATES
   ========================================= */
/* Expiry Input UI adjustments for modals and queues */
input[type="date"].glass-input {
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
}

input[type="date"].glass-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

input[type="date"].glass-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Polish the Expiry Badge in the Portfolio Tab */
.document-list-item div > span {
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.document-list-item:hover div > span {
    background: #fff !important; /* Makes the badge pop when hovering over the row */
    border-color: rgba(0, 0, 0, 0.1);
}

/* =========================================
   28. SYSTEM HEALTH & BUG TICKETING
   ========================================= */
/* Sidebar Button Thematic Sync */
#reportIssueBtn:hover {
    background: rgba(255, 149, 0, 0.15) !important;
    color: #FF9500 !important;
}
#reportIssueBtn i {
    color: #FF9500;
}

#showSystemHealthBtn:hover {
    background: rgba(255, 59, 48, 0.15) !important;
    color: #FF3B30 !important;
}

/* Dual-Color Sidebar Notification Badges */
#sidebarBugsBadge {
    transition: transform 0.2s ease;
}
#sidebarSuggestionsBadge {
    transition: transform 0.2s ease;
}

/* Custom Status Badges for Bug Tracker */
.status-badge[style*="color:#34C759"] { /* FIXED */
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.15);
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.status-badge[style*="color:#FF3B30"] { /* NEW */
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.2);
    animation: pulse-red 2s infinite;
}

.status-badge[style*="color:#FF9500"] { /* USER ERROR / REVIEWING */
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.15);
    border: 1px solid rgba(255, 149, 0, 0.2);
}

@keyframes pulse-red { 
    0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.3); } 
    70% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); } 
}

/* Make long bug descriptions readable */
#systemBugsTable td:nth-child(5) {
    max-width: 350px;
    white-space: pre-wrap !important;
    word-break: break-word;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #333;
}

/* Ensure the suggestions feed cards don't overflow */
#healthTabSuggestions .glass-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#healthTabSuggestions .glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.1);
    border-color: #D1D1D6;
}

/* Staff Request Tracking History Formatting */
#myTicketsFeedContainer > div {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

#myTicketsFeedContainer > div:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border-color: #D1D1D6 !important;
}

/* =========================================
   29. SMART SEARCHABLE INPUTS
   ========================================= */
.smart-input-wrapper {
    position: relative;
    flex: 1 1 auto;
    min-width: 140px; 
    z-index: 100; /* NEW: Forces dropdown to overlap siblings */
}

/* Ensure the input acts like a text field even if mixed with select classes */
.smart-input-field {
    width: 100%;
    box-sizing: border-box;
    cursor: text !important;
}

/* The floating glass dropdown menu */
.smart-input-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: var(--border-glass);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    max-height: 250px;
    overflow-y: auto;
    z-index: 5000;
    display: none; /* Hidden by default, controlled by JS */
    padding: 6px;
}

/* Custom minimal scrollbar for the dropdown */
.smart-input-dropdown::-webkit-scrollbar {
    width: 6px;
}

/* The clickable options inside the dropdown */
.smart-input-option {
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

/* Hover effect */
.smart-input-option:hover {
    background: rgba(0, 122, 255, 0.08);
    color: var(--accent-blue);
    padding-left: 20px; /* Slight indent animation on hover */
}

/* =========================================
   30. FLOATING WIDGETS (STATUS & UPLOAD MANAGER)
   ========================================= */
.floating-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 3900; /* Just below modals */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.status-widget-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #fff;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.status-widget-fab:hover {
    transform: scale(1.05);
    background: #0056b3;
}

.status-widget-panel {
    width: 320px;
    padding: 15px;
    margin-bottom: 15px;
    display: none;
    transform-origin: bottom right;
    animation: scaleInBottomRight 0.2s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 122, 255, 0.2);
}

@keyframes scaleInBottomRight {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
    .floating-widget-container {
        bottom: 80px; /* Rides just above the mobile bottom nav */
        right: 20px;
    }
    
    /* NEW: Pushes the Global Upload Widget above the mobile bottom nav */
    #globalUploadWidget {
        bottom: 80px !important; 
        left: 20px !important;
        max-width: calc(100vw - 40px) !important;
    }
}

/* =========================================
   31. INLINE STATUS EDITOR (v11.10.0)
   ========================================= */

.inline-status-container {
    transition: transform 0.2s ease;
}

.inline-status-container:hover {
    transform: translateY(-1px);
}

.inline-status-select {
    padding: 4px 10px; 
    border-radius: 6px; 
    font-weight: 700; 
    text-transform: uppercase; 
    font-size: 0.7rem; 
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    background-image: none !important; /* Force remove default arrow */
    outline: none;
}

.inline-status-select:hover,
.inline-status-select:focus {
    border-color: rgba(0, 122, 255, 0.3);
    box-shadow: 0 2px 5px rgba(0, 122, 255, 0.1);
}

.inline-status-select:disabled {
    opacity: 0.7;
    cursor: not-allowed !important;
}

/* Animations for Saving Feedback */
.saving-status .saving-icon {
    display: block !important;
    animation: fadeIn 0.2s ease;
}

.saved-status .saved-icon {
    display: block !important;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: translateY(-50%) scale(0.5); opacity: 0; }
    70% { transform: translateY(-50%) scale(1.2); opacity: 1; }
    100% { transform: translateY(-50%) scale(1); opacity: 1; }
}

/* Override existing table styles so the dropdown arrow doesn't clip */
#mainApplicantTable td:nth-child(8) {
    overflow: visible !important;
}

/* =========================================
   32. TEAM DAILY REPORTS & CALENDAR MODULE
   ========================================= */

/* Ensure the management reporting table maintains crisp formatting */
#teamReportsTable {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 0;
}

/* Ensure sticky multi-row headers stack flawlessly on scroll */
#teamReportsTable thead th {
    position: sticky;
    top: 0;
    background: var(--bg-table-header);
    z-index: 30;
    box-shadow: var(--shadow-soft);
    border-bottom: var(--border-glass);
}

/* Calendar Date Partition Header Formatting */
#teamReportsTable tr[style*="background: #F2F2F7"] td {
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#teamReportsTable tr[style*="background: #F2F2F7"]:hover td {
    background-color: #E8E9EB !important;
}

/* --- THEMATIC HOLIDAY & WEEKEND BANNER STYLING --- */
/* Formats the full-width row injections dynamically targeting empty calendar blocks */
#teamReportsTable td[colspan="4"][style*="color: #34C759"] {
    background: linear-gradient(90deg, rgba(52, 199, 89, 0.05) 0%, rgba(52, 199, 89, 0.02) 50%, rgba(52, 199, 89, 0.05) 100%);
    border-top: 1px dashed rgba(52, 199, 89, 0.2);
    border-bottom: 1px solid #E5E5EA !important;
    letter-spacing: 0.3px;
    animation: fadeInSmooth 0.3s ease-out;
}

/* Restyle button focus inside date partition rows */
#teamReportsTable tr[style*="background: #F2F2F7"] .button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#teamReportsTable tr[style*="background: #F2F2F7"] .button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Custom fade animation for calendar row drawing */
@keyframes fadeInSmooth {
    from { opacity: 0; transform: scale(0.99); }
    to { opacity: 1; transform: scale(1); }
}

/* --- INDIVIDUAL LEAVE ROW POLISH --- */
/* Target rows showing Verified VL or SL flags to render high contrast blocks */
#teamReportsTable tr:has(span[style*="fa-bed"]) td {
    background-color: #FAFAFA;
}

#teamReportsTable tr:has(span[style*="fa-bed"]):hover td {
    background-color: #fff;
}

/* Formatting for the action column button on leave rows */
#teamReportsTable .action-btn[onclick*="removeStaffLeave"] {
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#teamReportsTable tr:hover .action-btn[onclick*="removeStaffLeave"] {
    opacity: 1;
}

/* --- MISSING SUBMISSION ALERT ROW STYLING --- */
/* Target missing submission warnings to optimize rapid UI management clicks */
#teamReportsTable tr[style*="background: rgba(255, 59, 48, 0.03)"] {
    transition: background-color 0.2s ease;
}

#teamReportsTable tr[style*="background: rgba(255, 59, 48, 0.03)"]:hover {
    background-color: rgba(255, 59, 48, 0.06) !important;
}

/* Ensure leave bypass buttons stretch efficiently without vertical overflow */
#teamReportsTable td button[title*="Leave"] {
    font-weight: 800;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Responsive grid formatting for management board headers */
@media (max-width: 768px) {
    #teamReportsTable td[colspan="4"] {
        padding: 15px 10px !important;
        font-size: 0.8rem !important;
        white-space: normal !important;
        line-height: 1.4;
    }
    
    #teamReportsTable tr[style*="background: #F2F2F7"] td > div {
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px;
    }
    
    #teamReportsTable tr[style*="background: #F2F2F7"] .button {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================
   33. MANPOWER REQUESTS (JOB ORDERS) 
   ========================================= */

/* Smooth hover transition for the nested Position rows */
#manpowerRequestsTbody tr {
    transition: background-color 0.2s ease;
}

#manpowerRequestsTbody tr:hover td {
    background-color: #FAFAFA !important;
}

/* Ensure the Country Header stands out cleanly without hover interference */
#manpowerRequestsTbody tr[style*="background: rgba(0, 122, 255"]:hover td {
    background-color: rgba(0, 122, 255, 0.08) !important;
}

/* Ensure the Employer Row Header stands out cleanly without hover interference */
#manpowerRequestsTbody tr[style*="background: #F9F9F9"]:hover td {
    background-color: #F2F2F7 !important;
}

/* --- THEME-DARK OVERRIDES FOR MANPOWER HOVER --- */
body.theme-dark #manpowerRequestsTbody tr:hover td {
    background-color: var(--hover-bg-table) !important;
}

body.theme-dark #manpowerRequestsTbody tr[style*="background: rgba(0, 122, 255"]:hover td {
    background-color: rgba(0, 122, 255, 0.15) !important;
}

body.theme-dark #manpowerRequestsTbody tr[style*="background: #F9F9F9"]:hover td {
    background-color: var(--bg-panel-solid) !important;
}

/* Visual containment for the input field to prevent layout shift */
#manpowerRequestsTbody .glass-input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#manpowerRequestsTbody .glass-input:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1);
}

/* =========================================
   34. FULL MONTH GRID CALENDAR
   ========================================= */
.calendar-wrapper {
    background: #FAFAFA;
    padding: 20px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-day-header {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: #8E8E93;
    text-transform: uppercase;
    padding-bottom: 10px;
}

.calendar-day {
    background: #fff;
    border: 1px solid #D1D1D6;
    border-radius: 12px;
    min-height: 100px; /* Taller for planner look */
    padding: 30px 8px 10px 8px; /* Room for absolute text at the top */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-smooth);
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.calendar-day.inactive {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.calendar-day .day-number {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    opacity: 0.7;
}

.calendar-day.holiday {
    background: rgba(255, 59, 48, 0.05);
    border-color: rgba(255, 59, 48, 0.3);
}

.calendar-day.holiday .day-number {
    color: #FF3B30;
    opacity: 1;
}

.calendar-day.today {
    border: 2px solid var(--accent-blue);
    background: rgba(0, 122, 255, 0.03);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.1);
}

.calendar-day.today .day-number {
    color: var(--accent-blue);
    opacity: 1;
}

.calendar-day .holiday-label {
    font-size: 0.7rem;
    font-weight: 800;
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    border: 1px solid rgba(255, 59, 48, 0.2);
    padding: 4px 6px;
    border-radius: 6px;
    text-transform: uppercase;
    text-align: center;
    width: 100%;
    word-break: break-word;
    line-height: 1.2;
    animation: fadeIn 0.3s ease;
}

/* Admin Interactivity */
.calendar-day.admin-clickable {
    cursor: pointer;
}

.calendar-day.admin-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 122, 255, 0.15);
    border-color: var(--accent-blue);
}

.calendar-day.admin-clickable.holiday:hover {
    box-shadow: 0 8px 15px rgba(255, 59, 48, 0.15);
    border-color: #FF3B30;
    background: rgba(255, 59, 48, 0.1);
}

@media (max-width: 768px) {
    .calendar-grid { gap: 5px; }
    .calendar-day { min-height: 65px; padding: 5px; border-radius: 8px; }
    .calendar-day .day-number { font-size: 1rem; margin-bottom: 4px; }
    .calendar-day-header { font-size: 0.65rem; }
    .calendar-day .holiday-label { font-size: 0.55rem; padding: 2px 4px; border-radius: 4px; }
}

/* =========================================
   35. VACATION LEAVE SYSTEM
   ========================================= */

.signature-panel {
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed #D1D1D6;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
}

.signature-panel input[type="password"] {
    font-family: monospace;
    letter-spacing: 2px;
    background: #fff;
}

.leave-history-card {
    background: #fff;
    border: 1px solid #E5E5EA;
    border-radius: 10px;
    padding: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.leave-history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.leave-sys-remark {
    background: #F2F2F7;
    border-left: 3px solid #8E8E93;
    padding: 8px 12px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #636366;
    border-radius: 4px;
    font-family: monospace;
}

/* =========================================
   36. EXECUTIVE DASHBOARD (VIP VIEW)
   ========================================= */
.exec-grid-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; margin-bottom: 25px; }
.exec-grid-charts { display: grid; grid-template-columns: 2fr 1.2fr; gap: 25px; }

.exec-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.7) 100%);
    border: 1px solid rgba(255,255,255,0.8);
    box-shadow: 0 15px 35px rgba(0,0,0,0.05), inset 0 0 0 1px rgba(255,255,255,0.5);
    opacity: 0;
    transform: translateY(30px);
    animation: execSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.exec-card-title { font-size: 0.85rem; font-weight: 800; color: #8E8E93; text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.exec-number { font-size: 4rem; font-weight: 800; color: #1C1C1E; line-height: 1; margin-bottom: 15px; letter-spacing: -2px; }
.exec-subtitle { font-size: 0.85rem; color: #636366; font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* The Inline Pipeline Quality Bar */
.exec-pipeline-bar { display: flex; height: 8px; background: #E5E5EA; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.exec-bar-segment { height: 100%; transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1); }
.exec-bar-segment.high { background: #34C759; }
.exec-bar-segment.mid { background: #FF9500; }

@keyframes execSlideUp {
    to { opacity: 1; transform: translateY(0); }
}

/* Staggered load delays for visual elegance */
.exec-stagger-1 { animation-delay: 0.1s; }
.exec-stagger-2 { animation-delay: 0.2s; }
.exec-stagger-3 { animation-delay: 0.3s; }
.exec-stagger-4 { animation-delay: 0.4s; }
.exec-stagger-5 { animation-delay: 0.5s; }

@media (max-width: 1024px) {
    .exec-grid-charts { grid-template-columns: 1fr; }
}

/* =========================================
   37. GLOBAL TEXT TRANSFORMS (UPPERCASE NAMES)
   ========================================= */
.card-name, 
.hub-name-link, 
.detail-header h2,
#mainApplicantTable tbody td:nth-child(3), 
#mainApplicantTable tbody td:nth-child(4), /* Applicant List - Employer */
#mainApplicantTable tbody td:nth-child(5), /* Applicant List - Position */
.applicant-card p, /* Applicant Grid - Position & Employer */
.detail-subtitle-text, /* Detail Pane Profile - Position & Employer */
#processingApplicantTable tbody td:nth-child(3), /* In-Process Docs - Position */
#manpowerRequestsTbody tr[style*="background: #F9F9F9"] td:first-child, /* Sourcing List - Employer */
#manpowerRequestsTbody tr[style*="background: #fff"] td:first-child, /* Sourcing List - Position */
#positionSummaryTbody td:first-child, /* Position Summary - Position */
#recentTable tbody td:nth-child(1),
#recentTable tbody td:nth-child(2), /* Dashboard Recent - Position */
#submittedPoolTable tbody td:nth-child(1),
#submittedPoolTable tbody td:nth-child(2), /* Submitted Pool - Employer */
#submittedPoolTable tbody td:nth-child(3), /* Submitted Pool - Position */
#ticketHandlerTbody td:nth-child(2),
#ticketHandlerTbody td:nth-child(3), /* Welfare Tickets - Employer */
.linker-result-item > div > div:first-child,
.linker-result-item > div > div:nth-child(2) /* Linker Modal - Position */ {
    text-transform: uppercase !important;
}

/* =========================================
   38. NOTIFICATIONS & MENTIONS UI
   ========================================= */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #E5E5EA;
    border-radius: 12px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 9500;
    display: none;
    padding: 5px;
    margin-bottom: 5px;
}

.mention-dropdown::-webkit-scrollbar { width: 6px; }
.mention-dropdown::-webkit-scrollbar-track { background: transparent; }
.mention-dropdown::-webkit-scrollbar-thumb { background: #D1D1D6; border-radius: 10px; }

.mention-item {
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, padding-left 0.2s;
}

.mention-item:hover {
    background: rgba(0, 122, 255, 0.08);
    padding-left: 20px;
}

.mention-text {
    color: var(--accent-blue);
    font-weight: 700;
}

.mention-highlight {
    color: var(--accent-blue);
    font-weight: 700;
    background: rgba(0, 122, 255, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
    display: inline-block;
    margin: 0 2px;
}

/* =========================================
   TEAM SCHEDULE MOBILE OVERHAUL
   ========================================= */
.mobile-matrix-tabs::-webkit-scrollbar { display: none; }
.matrix-tab-btn { padding: 8px 16px; background: #fff; border: 1px solid #D1D1D6; border-radius: 20px; font-size: 0.85rem; font-weight: 600; color: #636366; white-space: nowrap; transition: all 0.2s ease; cursor: pointer; }
.matrix-tab-btn.active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

/* NEW: Persistent indicator for the current calendar week */
.matrix-tab-btn.is-current-week { border: 2px solid var(--accent-blue); color: var(--accent-blue); font-weight: 800; }
.matrix-tab-btn.is-current-week.active { color: #fff; }

.matrix-card { background: #fff; border: 1px solid #E5E5EA; border-radius: 12px; padding: 12px 15px; display: flex; flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.matrix-card-pos { font-size: 0.9rem; font-weight: 800; color: #1C1C1E; text-transform: uppercase; margin: 0; flex-shrink: 0; }
.matrix-card select { flex-grow: 1; max-width: 60%; }

.mobile-calendar-dots { display: none; }

@media (max-width: 768px) {
    .desktop-matrix-table { display: none !important; }
    #mobileShiftMatrixContainer { display: flex !important; }
    
    /* EDGE TO EDGE CONTAINERS */
    .schedule-card-wrapper {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        box-shadow: none !important;
        margin-left: -20px !important;
        margin-right: -20px !important;
        width: calc(100% + 40px) !important;
    }

    /* HEADER STACKING - Mobile Only */
    .schedule-header-responsive {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 15px !important;
    }
    .schedule-right-controls {
        flex-direction: column !important;
        width: 100% !important;
        gap: 15px !important;
    }
    .schedule-actions-group, 
    .schedule-nav-group, 
    .schedule-title-group {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }
    
    /* MATRIX COMPRESSION & FONTS - Mobile Only */
    .matrix-card { padding: 8px 12px !important; }
    .matrix-card-pos { font-size: 0.75rem !important; }
    .mobile-schedule-matrix-input { font-size: 0.75rem !important; padding: 6px 10px !important; }

    /* SIDE-BY-SIDE BUTTONS - Mobile Only */
    .mobile-side-by-side { width: 100% !important; flex-wrap: nowrap !important; }
    .mobile-side-by-side .button { flex: 1 !important; padding-left: 5px !important; padding-right: 5px !important; font-size: 0.75rem !important; justify-content: center !important; }

    /* Calendar Rules */
    .calendar-day-text-item { display: none !important; }
    .mobile-calendar-dots { display: flex !important; justify-content: center; gap: 4px; margin-top: auto; padding-top: 5px; flex-wrap: wrap;}
    .calendar-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;}
    #mobileCalendarAgenda { display: flex !important; }
    
    /* Agenda Item Pills */
    .agenda-item { background: #fff; border: 1px solid #E5E5EA; border-left: 4px solid var(--accent-blue); padding: 12px 15px; border-radius: 8px; font-size: 0.85rem; color: #1C1C1E; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
    .agenda-item.holiday { border-left-color: #FF3B30; background: #FFF5F5; }
    .agenda-item.vl { border-left-color: #34C759; }
    .agenda-item.sl { border-left-color: #FF9500; }
    .agenda-item.bday { border-left-color: #FF2D55; background: rgba(255, 45, 85, 0.05); }
}

    /* ==================================================== */
    /* --- GENERAL MOBILE VIEW CLEANUP --- */
    /* ==================================================== */
    
    /* 1. Remove "FMW ATS" text from mobile header */
    .mobile-logo span {
        display: none !important;
    }

    /* 2. Remove Settings button from mobile header */
    #mobSettingsBtn {
        display: none !important;
    }

    /* 3. Remove giant empty space at the bottom of the screen */
    .main-content > .mobile-element[style*="height: 100px"] {
        display: none !important;
    }

    /* 4. Force hide any search bar leaking into the Team Schedule tab */
    body:has(#scheduleView.active) #mobileSearchContainer,
    #scheduleView .workspace-search-bar {
        display: none !important;
    }

/* =========================================
   DARK MODE: FINAL MODULE PATCHES
   ========================================= */

/* 1. Team Schedule Calendar Override */

/* Nuke the white background from the calendar wrapper and header */
body.theme-dark .calendar-container,
body.theme-dark .calendar-wrapper,
body.theme-dark .calendar-grid,
body.theme-dark .calendar-body,
body.theme-dark .calendar-inner,
body.theme-dark .calendar-header {
    background: transparent !important;
    border-color: var(--border-glass) !important;
}

/* Catch any rogue inline white containers inside the schedule tab */
body.theme-dark div[id*="alendar"] [style*="background: #fff"],
body.theme-dark div[id*="alendar"] [style*="background:#fff"],
body.theme-dark div[id*="alendar"] [style*="background: white"] {
    background: transparent !important;
}

/* Ensure days of the week headers (SUN, MON) are readable */
body.theme-dark .calendar-weekday,
body.theme-dark .calendar-day-header,
body.theme-dark .calendar-header div {
    color: var(--text-muted) !important;
}

/* Fix the individual day cells */
body.theme-dark .calendar-day,
body.theme-dark .calendar-cell {
    background: var(--bg-card) !important;
    border-color: var(--border-glass) !important;
    color: var(--text-main) !important;
}

body.theme-dark .calendar-day:hover {
    background: var(--hover-bg-card) !important;
}

/* Aggressively catch the light-red "Today" cell (handles both upper/lowercase) */
body.theme-dark .calendar-day.today,
body.theme-dark .calendar-day.current-day,
body.theme-dark [style*="FFE5E5"],
body.theme-dark [style*="ffe5e5"],
body.theme-dark [style*="rgb(255, 229, 229)"] {
    background: var(--status-problem-bg) !important;
    border-color: rgba(255, 59, 48, 0.4) !important;
}

/* Force the blue "TODAY" text and date number to match dark mode */
body.theme-dark .calendar-day.today *,
body.theme-dark .calendar-day.current-day *,
body.theme-dark [style*="FFE5E5"] *,
body.theme-dark [style*="ffe5e5"] * {
    color: var(--text-main) !important;
}

/* 2. Activity Logs Table Header Override */
body.theme-dark #activityLogTable th,
body.theme-dark #activityLogsTable th,
body.theme-dark #systemActivityTable th,
body.theme-dark table[id*="ctivity"] th,
body.theme-dark table[id*="Log"] th {
    background: var(--bg-table-header) !important;
    color: var(--text-main) !important;
    border-bottom: var(--border-glass) !important;
}

/* Ensure the log container itself isn't bleeding white */
body.theme-dark .activity-log-container {
    background: transparent !important;
}

/* 3. Support & Feedback Hub Textareas (Catch-All) */
body.theme-dark textarea {
    background-color: var(--bg-input) !important;
    color: var(--text-main) !important;
    border-color: var(--border-glass) !important;
}

body.theme-dark textarea:focus {
    background-color: var(--bg-input-focus) !important;
    border-color: var(--accent-blue) !important;
}

/* 4. Interview Recap Notes Container & Rogue Uppercase HEX Catch-All */
body.theme-dark [style*="background: #FFFFFF"],
body.theme-dark [style*="background:#FFFFFF"],
body.theme-dark [style*="background: #ffffff"],
body.theme-dark [style*="background:#ffffff"],
body.theme-dark [style*="background: #FFF"],
body.theme-dark [style*="background:#FFF"],
body.theme-dark [style*="background-color: #fff"],
body.theme-dark [style*="background-color:#fff"],
body.theme-dark [style*="background-color: #ffffff"],
body.theme-dark [style*="background-color: white"],
body.theme-dark td[style*="background: white"],
body.theme-dark td[style*="background:#fff"],
body.theme-dark .recap-container,
body.theme-dark .recap-notes-wrapper,
body.theme-dark .interview-recap-box,
body.theme-dark .batch-notes-container,
body.theme-dark .notes-panel {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
    border-color: var(--border-glass) !important;
}

/* Ensure the title text "INTERVIEW RECAP NOTES" stays readable */
body.theme-dark .recap-container h4,
body.theme-dark .recap-notes-wrapper h4,
body.theme-dark .interview-recap-box h4 {
    color: var(--text-muted) !important;
}

/* 5. The Ultimate Recap Container Failsafe (Parent Selector) */
body.theme-dark div:has(> .remark-feed),
body.theme-dark div:has(> .remark-input-area),
body.theme-dark td:has(.remark-input-area),
body.theme-dark div:has(> h4:contains("INTERVIEW RECAP NOTES")),
body.theme-dark .batch-recap-panel,
body.theme-dark .recap-sidebar,
body.theme-dark .interview-notes-sidebar,
body.theme-dark td.recap-column {
    background: var(--bg-panel-solid) !important;
    background-color: var(--bg-panel-solid) !important;
    border-color: var(--border-glass) !important;
}

/* Ensure the header text above the text box is readable */
body.theme-dark div:has(> .remark-input-area) h4,
body.theme-dark td:has(.remark-input-area) h4 {
    color: var(--text-muted) !important;
}

/* 6. The Final Boss: Batch Drawer Notes Module */
body.theme-dark .batch-drawer-notes-module {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
    border-color: var(--border-glass) !important;
}

/* =========================================
   HALLOWEEN MASCOT & EFFECTS
   ========================================= */
.halloween-mascot {
    position: absolute;
    bottom: -6px;
    right: -6px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 50;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    animation: floatMascot 3s ease-in-out infinite;
}
.halloween-mascot:hover {
    transform: scale(1.3) rotate(10deg);
    animation: none;
}

@keyframes floatMascot {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-4px) rotate(5deg); }
}

.trick-wobble {
    animation: spookyWobble 0.5s ease-in-out 2;
}
@keyframes spookyWobble {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-5px) rotate(-1deg); }
    75% { transform: translateX(5px) rotate(1deg); }
}

.spooky-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    font-size: 1.5rem;
    animation: popAndFade 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes popAndFade {
    0% { transform: translate(0, 0) scale(0.5); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(1.5) rotate(var(--rot)); opacity: 0; }
}