/* ═══════════════════════════════════════════════════════════════ */
/* StaffHub — Company Dashboard Styles (Mobile-Optimized)        */
/* ═══════════════════════════════════════════════════════════════ */


/* ─────────────────────────────────────────────────────────────
   1. CSS CUSTOM PROPERTIES
   ───────────────────────────────────────────────────────────── */
:root {
    --primary:           #1a73e8;
    --primary-dark:      #1557b0;
    --primary-light:     #e8f0fe;
    --secondary:         #5f6368;
    --success-color:     #0d9488;
    --warning-color:     #f59e0b;
    --danger-color:      #dc2626;
    --info-color:        #3b82f6;
    --purple-color:      #7c3aed;
    --bg-color:          #f0f2f5;
    --card-bg:           #ffffff;
    --text-color:        #1f2937;
    --text-muted:        #6b7280;
    --border-color:      #e5e7eb;
    --sidebar-bg:        #0f172a;
    --sidebar-text:      #94a3b8;
    --sidebar-active:    #1a73e8;
    --header-height:     64px;
    --sidebar-width:     260px;
    --transition:        0.25s ease;
}


/* ─────────────────────────────────────────────────────────────
   2. RESET & BASE
   ───────────────────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    /* Prevent iOS bounce / pull-to-refresh on body */
    -webkit-overflow-scrolling: touch;
}
/* ── Attendance sortable columns ─────────────────────────── */
.att-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.att-sortable:hover {
    background: #f0f4ff;
}
.att-sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
    color: #94a3b8;
    vertical-align: middle;
    transition: color 0.15s;
}
.att-sortable.sort-asc  .att-sort-icon,
.att-sortable.sort-desc .att-sort-icon {
    color: #1a73e8;
    font-weight: 700;
}
.att-sortable.sort-asc  .att-sort-icon::after { content: ' ▲'; }
.att-sortable.sort-desc .att-sort-icon::after { content: ' ▼'; }
.att-sortable.sort-asc  .att-sort-icon,
.att-sortable.sort-desc .att-sort-icon { font-size: 0; } /* hide ↕, show pseudo-content only */
.att-sortable.sort-asc  .att-sort-icon::after,
.att-sortable.sort-desc .att-sort-icon::after { font-size: 0.7rem; }

/* ─────────────────────────────────────────────────────────────
   3. MODAL — CRITICAL Z-INDEX & DISPLAY
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    z-index: 99999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    overflow-y: auto !important;
}

.modal-overlay.active {
    display: flex !important;
}

.modal {
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    width: 100% !important;
    max-width: 600px !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    z-index: 100000 !important;
    margin: auto !important;
}

.modal-large {
    max-width: 800px !important;
}

#editStaffModal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 9999 !important;
    justify-content: center !important;
    align-items: center !important;
}

#editStaffModal.active,
#editStaffModal[style*="display: flex"] {
    display: flex !important;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e8eaed;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #202124;
    line-height: 1.3;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #5f6368;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s;
    /* Bigger touch target */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.modal-close:hover { color: #202124; }
.modal-close:active { background: #f1f3f4; }

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar       { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: #f1f3f4; border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: #dadce0; border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: #bdc1c6; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #e8eaed;
    flex-shrink: 0;
}

.detail-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.detail-row:last-child { border-bottom: none; }
.detail-row .label { font-weight: 500; color: #5f6368; font-size: 0.875rem; }
.detail-row .value { color: #202124; font-size: 0.9375rem; word-break: break-word; }

/* Form styling inside specific modals */
#addStaffModal h3,
#bulkUploadModal h3 {
    color: #1a73e8;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e8f0fe;
    font-size: 1.1rem;
    font-weight: 600;
}

#addStaffModal h3:first-of-type,
#bulkUploadModal h3:first-of-type { margin-top: 0; }


/* ─────────────────────────────────────────────────────────────
   4. HEADER
   ───────────────────────────────────────────────────────────── */
.dashboard-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    /* 44px minimum touch target */
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.logo img { height: 76px; width: auto; }

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-bell:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.user-info { display: flex; flex-direction: column; align-items: flex-end; }
.user-name  { font-weight: 600; font-size: 0.9rem; color: var(--text-color); }
.company-name { font-size: 0.75rem; color: var(--text-muted); }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}

.btn-logout:hover {
    background: #fef2f2;
    border-color: var(--danger-color);
    color: var(--danger-color);
}


/* ─────────────────────────────────────────────────────────────
   5. LAYOUT — CONTAINER, SIDEBAR, MAIN
   ───────────────────────────────────────────────────────────── */
.dashboard-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    background: var(--sidebar-bg);
    z-index: 900;
    transition: var(--transition);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-overlay { display: none; }
.sidebar-content  { padding: 1rem 0; }

.nav-menu { list-style: none; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    /* Minimum touch target */
    min-height: 44px;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: #e2e8f0; }

.nav-item.active {
    background: rgba(26, 115, 232, 0.15);
    color: #60a5fa;
    border-left-color: var(--primary);
}

.nav-item i { width: 20px; text-align: center; font-size: 1rem; }

.nav-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: 100%;
}

.content-section { display: none; }

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ─────────────────────────────────────────────────────────────
   6. SECTION HEADER & HEADER ACTIONS
   ───────────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.25rem 0;
}

.section-header > div h1 { margin: 0 0 0.25rem 0; font-size: 1.75rem; color: #202124; }
.section-header > div p  { margin: 0; color: #5f6368; font-size: 0.9rem; }
.section-header p        { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }
.section-header .btn     { flex-shrink: 0; white-space: nowrap; }
.date                    { font-size: 0.85rem; color: var(--text-muted); }

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}


/* ─────────────────────────────────────────────────────────────
   7. STAT CARDS
   ───────────────────────────────────────────────────────────── */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-blue   .stat-icon { background: #dbeafe; color: #2563eb; }
.stat-green  .stat-icon { background: #d1fae5; color: #059669; }
.stat-orange .stat-icon { background: #fef3c7; color: #d97706; }
.stat-purple .stat-icon { background: #ede9fe; color: #7c3aed; }

.stat-info h3 { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-info p  { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }


/* ─────────────────────────────────────────────────────────────
   8. PENDING SUMMARY
   ───────────────────────────────────────────────────────────── */
.pending-summary { margin-bottom: 2rem; }

.pending-summary h2,
.on-duty-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.pending-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.pending-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.pending-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.12);
}

.pending-card:active {
    transform: scale(0.98);
}

.pending-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.pending-info h4 { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.pending-info p  { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }


/* ─────────────────────────────────────────────────────────────
   9. ACTIVITY CARDS
   ───────────────────────────────────────────────────────────── */
.activity-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.activity-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.activity-card:active {
    transform: scale(0.98);
}

.activity-card.has-activity {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.activity-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.activity-info h4 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: #0f172a;
}

.activity-info p {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}


/* ─────────────────────────────────────────────────────────────
   10. PENDING REQUESTS CONTAINER
   ───────────────────────────────────────────────────────────── */
#pendingRequestsContainer {
    display: none;
    padding: 1rem;
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 10px;
}

#pendingRequestsContainer .pending-requests-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: #92400e;
}

#pendingRequestsContainer h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}


/* ─────────────────────────────────────────────────────────────
   11. LINK STAFF BUTTON
   ───────────────────────────────────────────────────────────── */
.btn-link-staff {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 44px;
}

.btn-link-staff:hover { background: #1e293b; }


/* ─────────────────────────────────────────────────────────────
   12. ON DUTY LIST
   ───────────────────────────────────────────────────────────── */
.on-duty-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.on-duty-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--success-color);
}

.on-duty-avatar {
    width: 40px;
    height: 40px;
    background: #d1fae5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #059669;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.on-duty-details h4 { font-size: 0.9rem; font-weight: 600; }
.on-duty-details p  { font-size: 0.78rem; color: var(--text-muted); }


/* ─────────────────────────────────────────────────────────────
   13. FILTER BAR
   ───────────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-group { flex: 1; min-width: 200px; }


/* ─────────────────────────────────────────────────────────────
   14. FORM CONTROLS & LAYOUT
   ───────────────────────────────────────────────────────────── */
.form-control {
    padding: 0.75rem;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 1rem; /* 16px prevents iOS zoom on focus */
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-control:disabled {
    background-color: #f8f9fa;
    color: #80868b;
    cursor: not-allowed;
}

.form-control:invalid:not(:placeholder-shown) { border-color: #d93025; }
.form-control:valid:not(:placeholder-shown)   { border-color: #1e8e3e; }
.form-control::placeholder { color: #9aa0a6; opacity: 1; }

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    appearance: none;
}

select.form-control:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a73e8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #5f6368;
    margin-bottom: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8eaed;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.form-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}


/* ─────────────────────────────────────────────────────────────
   15. BUTTONS
   ───────────────────────────────────────────────────────────── */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    min-height: 44px;
    /* Prevent text selection on double-tap */
    -webkit-user-select: none;
    user-select: none;
}

.btn i { font-size: 1rem; }

.btn-primary   { background: #1a73e8; color: white; }
.btn-primary:hover  { background: #1765cc; box-shadow: 0 2px 8px rgba(26,115,232,0.3); }
.btn-primary:active { background: #1557b0; transform: scale(0.97); }

.btn-secondary { background: #f1f3f4; color: #5f6368; }
.btn-secondary:hover { background: #e8eaed; }
.btn-secondary:active { background: #dadce0; }

.btn-success   { background: #1e8e3e; color: white; }
.btn-success:hover  { background: #188038; box-shadow: 0 2px 8px rgba(30,142,62,0.3); }

.btn-danger    { background: #d93025; color: white; }
.btn-danger:hover   { background: #c5221f; box-shadow: 0 2px 8px rgba(217,48,37,0.3); }

.btn-sm      { padding: 0.5rem 1rem; font-size: 0.875rem; min-height: 36px; }
.btn-block   { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }


/* ─────────────────────────────────────────────────────────────
   16. STATUS BADGES
   ───────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active     { background: #d1fae5; color: #065f46; }
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-suspended  { background: #fee2e2; color: #991b1b; }
.badge-terminated { background: #f1f5f9; color: #475569; }
.badge-rejected   { background: #f1f3f4; color: #5f6368; }
.badge-unknown    { background: #f1f3f4; color: #80868b; }
.badge-approved   { background: #d1fae5; color: #065f46; }
.badge-completed  { background: #dbeafe; color: #1e40af; }
.badge-info       { background: #d1ecf1; color: #0c5460; }


/* ─────────────────────────────────────────────────────────────
   17. DATA TABLES
   ───────────────────────────────────────────────────────────── */
.data-table-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Scroll hint shadow */
    background:
        linear-gradient(to right, white 30%, rgba(255,255,255,0)),
        linear-gradient(to right, rgba(255,255,255,0), white 70%) 100% 0,
        radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.08), rgba(0,0,0,0)),
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), rgba(0,0,0,0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

.data-table { width: 100%; border-collapse: collapse; }

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody tr:hover       { background: #f9fafb; }
.data-table tbody tr:last-child td { border-bottom: none; }


/* ─────────────────────────────────────────────────────────────
   18. APPROVAL CARDS
   ───────────────────────────────────────────────────────────── */
.approval-list { display: flex; flex-direction: column; gap: 1rem; }

.approval-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    transition: var(--transition);
}

.approval-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.approval-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.approval-card-header h4 { font-size: 1rem; font-weight: 600; }

.approval-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.approval-detail { display: flex; flex-direction: column; }
.approval-detail .label  { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; }
.approval-detail .value  { font-size: 0.9rem; font-weight: 500; margin-top: 0.15rem; }

.approval-card-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}


/* ─────────────────────────────────────────────────────────────
   19. SUMMARY CARDS
   ───────────────────────────────────────────────────────────── */
.attendance-summary,
.timesheet-overview,
.advance-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.15rem;
    text-align: center;
}

.summary-card h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 0.35rem; }
.summary-card p  { font-size: 1.5rem; font-weight: 700; color: var(--primary); }


/* ─────────────────────────────────────────────────────────────
   20. REPORT CARDS
   ───────────────────────────────────────────────────────────── */
.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.report-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.report-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.report-card i     { font-size: 2rem; color: var(--primary); margin-bottom: 0.75rem; }
.report-card h3    { font-size: 1rem; margin-bottom: 0.35rem; }
.report-card p     { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; }

.report-output {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.report-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f9fafb;
    border-bottom: 1px solid var(--border-color);
}

.report-content { padding: 1.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }


/* ─────────────────────────────────────────────────────────────
   21. POLICIES LIST
   ───────────────────────────────────────────────────────────── */
.policies-list { display: flex; flex-direction: column; gap: 1rem; }

.policy-card-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
}

.policy-card-item h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.policy-card-item .policy-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.policy-ack-stats { display: flex; align-items: center; gap: 1rem; font-size: 0.82rem; }

.ack-bar { flex: 1; height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; }
.ack-fill { height: 100%; background: var(--success-color); border-radius: 3px; transition: width 0.5s ease; }


/* ─────────────────────────────────────────────────────────────
   22. POLICY MANAGEMENT PANEL
   ───────────────────────────────────────────────────────────── */
.policy-management-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.policy-list-panel {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
}

.policy-search-bar { position: relative; margin-bottom: 1rem; }
.policy-search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; }

.policy-search-input {
    width: 100%;
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem; /* 16px prevents iOS zoom */
}

.policy-filters  { margin-bottom: 1rem; }
.policy-list-items { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.policy-list-item {
    padding: 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.policy-list-item:hover  { background: #f8fafc; border-color: #1a73e8; }
.policy-list-item.active { background: #e8f0fe; border-color: #1a73e8; }

.policy-item-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 0.5rem; }
.policy-item-name   { font-weight: 600; font-size: 0.9375rem; color: #0f172a; margin: 0; }
.policy-item-version { background: #e8f0fe; color: #1a73e8; padding: 0.125rem 0.5rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.policy-item-meta   { display: flex; gap: 1rem; font-size: 0.8125rem; color: #64748b; }
.policy-item-type   { display: inline-block; background: #f1f5f9; padding: 0.125rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 500; margin-top: 0.5rem; }

.policy-preview-panel {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: calc(100vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.policy-preview-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #94a3b8; }
.policy-preview-empty i { font-size: 4rem; margin-bottom: 1rem; }

.policy-preview-header { border-bottom: 2px solid #e2e8f0; padding-bottom: 1rem; margin-bottom: 1.5rem; }
.policy-preview-title  { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.policy-preview-title h2 { margin: 0; font-size: 1.5rem; color: #0f172a; }
.policy-version-badge  { background: #1a73e8; color: white; padding: 0.25rem 0.75rem; border-radius: 16px; font-size: 0.875rem; font-weight: 600; }
.policy-preview-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.policy-preview-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.metadata-item  { display: flex; flex-direction: column; }
.metadata-label { font-size: 0.75rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.metadata-value { font-size: 0.9375rem; color: #0f172a; font-weight: 600; word-break: break-word; }

.policy-preview-description { margin-bottom: 1.5rem; }
.policy-preview-description h4 { font-size: 1rem; color: #0f172a; margin-bottom: 0.5rem; }
.policy-preview-description p  { color: #64748b; line-height: 1.6; }

.policy-document-preview { margin-top: 1.5rem; }

.file-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-zone:hover   { border-color: #1a73e8; background: #f8fafc; }
.file-upload-zone i       { font-size: 2.5rem; color: #1a73e8; margin-bottom: 0.5rem; }
.file-upload-zone p       { margin: 0.5rem 0; color: #0f172a; font-weight: 500; }
.file-upload-zone small   { color: #64748b; font-size: 0.8125rem; }

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.selected-file-info i    { font-size: 1.5rem; color: #16a34a; }
.selected-file-info span { flex: 1; color: #0f172a; font-weight: 500; word-break: break-all; }

.btn-remove-file { background: none; border: none; color: #dc2626; cursor: pointer; padding: 0.25rem 0.5rem; border-radius: 4px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.btn-remove-file:hover { background: #fee2e2; }


/* ─────────────────────────────────────────────────────────────
   23. LEAVE BALANCES
   ───────────────────────────────────────────────────────────── */
.leave-balance-table th,
.leave-balance-table td  { vertical-align: middle; }

.balance-ok       { background: #d1fae5; color: #065f46; }
.balance-low      { background: #fef3c7; color: #92400e; }
.balance-critical { background: #fee2e2; color: #991b1b; }

.lb-preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}


/* ─────────────────────────────────────────────────────────────
   24. UNIFORM CATALOG
   ───────────────────────────────────────────────────────────── */
.catalog-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: box-shadow 0.2s;
}

.catalog-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }

.catalog-card-header   { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.catalog-card-title    { font-weight: 700; font-size: 1rem; color: #0f172a; }
.catalog-card-category { background: #e8f0fe; color: #1a73e8; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 9999px; white-space: nowrap; }
.catalog-card-desc     { font-size: 0.8125rem; color: #64748b; line-height: 1.5; }

.catalog-sizes      { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.catalog-size-badge {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.catalog-size-badge .size-label { font-size: 0.875rem; }
.catalog-size-badge .size-price { font-size: 0.75rem; color: #1a73e8; font-weight: 700; }

.catalog-card-actions  { display: flex; gap: 0.5rem; margin-top: auto; flex-wrap: wrap; }
.catalog-card-inactive { opacity: 0.55; }
.catalog-card-inactive .catalog-card-title::after { content: ' (Inactive)'; font-size: 0.75rem; color: #94a3b8; font-weight: 400; }

.catalog-stock-pill { display: inline-flex; align-items: center; gap: 0.25rem; padding: 3px 10px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.stock-ok  { background: #d1fae5; color: #065f46; }
.stock-low { background: #fef3c7; color: #92400e; }
.stock-out { background: #fee2e2; color: #991b1b; }

.size-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 0.375rem; flex-wrap: wrap; }
.size-row input,
.size-row select { flex: 1; min-width: 0; }

.btn-remove-size       { background: none; border: none; color: #dc2626; cursor: pointer; padding: 0.5rem; border-radius: 4px; flex-shrink: 0; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.btn-remove-size:hover { background: #fee2e2; }

#bspTableBody td          { vertical-align: middle; }
#bspTableBody input[type="number"] { width: 90px; padding: 0.375rem 0.5rem; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 0.875rem; }
#bspTableBody input.bsp-changed    { border-color: #1a73e8; background: #e8f0fe; }


/* ─────────────────────────────────────────────────────────────
   25. ROSTER MODULE  (#roster-section .rs-*)
   ───────────────────────────────────────────────────────────── */
#roster-section { padding: 0; }
#roster-section * { box-sizing: border-box; }

#roster-section .rs-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    background: #fff;
    padding: 0 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#roster-section .rs-tabs::-webkit-scrollbar { display: none; }

#roster-section .rs-tab {
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.15s;
    font-family: inherit;
    position: relative;
}

#roster-section .rs-tab:hover { color: #1e293b; }
#roster-section .rs-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

#roster-section .rs-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

#roster-section .rs-badge-warn { background: #fef3c7; color: #92400e; }
#roster-section .rs-badge-info { background: #dbeafe; color: #1e40af; }

#roster-section .rs-panel { display: none; padding: 16px; animation: rsFadeIn 0.2s ease; }
#roster-section .rs-panel.active { display: block; }

@keyframes rsFadeIn { from { opacity: 0; } to { opacity: 1; } }

#roster-section .rs-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 14px;
}

#roster-section .rs-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
#roster-section .rs-card-title  { font-size: 15px; font-weight: 700; color: #0f172a; margin: 0; }

#roster-section .rs-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.15s;
    min-height: 36px;
}

#roster-section .rs-btn-primary  { background: #2563eb; color: #fff; border-color: #2563eb; }
#roster-section .rs-btn-primary:hover { background: #1d4ed8; }
#roster-section .rs-btn-success  { background: #16a34a; color: #fff; border-color: #16a34a; }
#roster-section .rs-btn-success:hover { background: #15803d; }
#roster-section .rs-btn-danger   { background: #fff1f2; color: #e11d48; border-color: #fecdd3; }
#roster-section .rs-btn-danger:hover  { background: #ffe4e6; }
#roster-section .rs-btn-outline  { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
#roster-section .rs-btn-outline:hover { background: #e2e8f0; }
#roster-section .rs-btn-sm       { padding: 5px 10px; font-size: 11px; }
#roster-section .rs-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#roster-section .rs-form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
#roster-section .rs-label      { font-size: 12px; font-weight: 600; color: #475569; }

#roster-section .rs-input,
#roster-section .rs-select {
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px; /* Prevents iOS zoom */
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s;
}

#roster-section .rs-input:focus,
#roster-section .rs-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

#roster-section .rs-grid-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

#roster-section .rs-week-nav {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

#roster-section .rs-week-nav button {
    padding: 6px 12px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    font-family: inherit;
    transition: background 0.1s;
    min-height: 36px;
}

#roster-section .rs-week-nav button:hover { background: #f1f5f9; }

#roster-section .rs-week-label {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    border-left: 1.5px solid #e2e8f0;
    border-right: 1.5px solid #e2e8f0;
    white-space: nowrap;
    min-width: 180px;
    text-align: center;
}

#roster-section .rs-grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
}

#roster-section .rs-grid {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 12px;
}

#roster-section .rs-grid thead th {
    background: #f8fafc;
    padding: 8px 6px;
    font-weight: 700;
    color: #475569;
    text-align: center;
    border-bottom: 1.5px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 2;
}

#roster-section .rs-grid thead th:first-child {
    text-align: left;
    padding-left: 12px;
    min-width: 160px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: #f1f5f9;
}

#roster-section .rs-grid tbody td {
    padding: 4px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    vertical-align: middle;
}

#roster-section .rs-grid tbody td:first-child {
    text-align: left;
    padding-left: 12px;
    font-weight: 600;
    color: #334155;
    background: #fafbfd;
    position: sticky;
    left: 0;
    z-index: 1;
    border-right: 1.5px solid #e2e8f0;
}

#roster-section .rs-site-label  { font-size: 12px; font-weight: 700; color: #0f172a; line-height: 1.2; }
#roster-section .rs-shift-label { font-size: 10px; color: #64748b; font-weight: 500; }
#roster-section .rs-day-header  { font-size: 11px; line-height: 1.3; }
#roster-section .rs-today       { background: #eff6ff; }
#roster-section .rs-cell        { min-height: 32px; display: flex; align-items: center; justify-content: center; }

#roster-section .rs-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#roster-section .rs-chip-assigned { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
#roster-section .rs-chip-assigned:hover { background: #bbf7d0; }
#roster-section .rs-chip-open     { background: #fef3c7; color: #92400e; border: 1px dashed #fcd34d; }
#roster-section .rs-chip-open:hover { background: #fde68a; }
#roster-section .rs-chip-conflict { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
#roster-section .rs-chip-leave    { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; cursor: default; font-style: italic; }

#roster-section .rs-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.45);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#roster-section .rs-modal-overlay.visible { display: flex; }

#roster-section .rs-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    animation: rsSlideUp 0.2s ease;
    -webkit-overflow-scrolling: touch;
}

@keyframes rsSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

#roster-section .rs-modal-title   { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0 0 16px 0; }
#roster-section .rs-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

#roster-section .rs-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

#roster-section .rs-tmpl-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    transition: border-color 0.15s;
}

#roster-section .rs-tmpl-card:hover { border-color: #cbd5e1; }
#roster-section .rs-tmpl-name  { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
#roster-section .rs-tmpl-time  { font-size: 12px; color: #475569; margin-bottom: 8px; }
#roster-section .rs-tmpl-hours { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; background: #dbeafe; color: #1e40af; }

#roster-section .rs-period-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

#roster-section .rs-period-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    transition: border-color 0.15s;
}

#roster-section .rs-period-card:hover { border-color: #cbd5e1; }

#roster-section .rs-period-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#roster-section .rs-status-draft     { background: #fef3c7; color: #92400e; }
#roster-section .rs-status-published { background: #dcfce7; color: #166534; }

#roster-section .rs-open-list { display: flex; flex-direction: column; gap: 8px; }

#roster-section .rs-open-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: 10px;
}

#roster-section .rs-open-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fef3c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

#roster-section .rs-open-details { flex: 1; min-width: 0; }
#roster-section .rs-open-site    { font-size: 13px; font-weight: 700; color: #0f172a; }
#roster-section .rs-open-meta    { font-size: 11px; color: #64748b; margin-top: 2px; }

#roster-section .rs-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

#roster-section .rs-stat {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

#roster-section .rs-stat-value { font-size: 22px; font-weight: 800; color: #0f172a; }
#roster-section .rs-stat-label { font-size: 11px; color: #64748b; margin-top: 2px; font-weight: 500; }

#roster-section .rs-empty      { text-align: center; padding: 40px 20px; color: #94a3b8; font-size: 13px; }
#roster-section .rs-empty-icon { font-size: 32px; margin-bottom: 8px; }


/* ─────────────────────────────────────────────────────────────
   26. BULK UPLOAD
   ───────────────────────────────────────────────────────────── */
.upload-step {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e8eaed;
}

.upload-step:last-child { border-bottom: none; }

.step-number {
    width: 40px;
    height: 40px;
    background: #1a73e8;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.step-content         { flex: 1; min-width: 0; }
.step-content h3      { margin: 0 0 0.5rem 0; color: #202124; font-size: 1.125rem; }
.step-content p       { margin: 0 0 1rem 0; color: #5f6368; }

.file-upload-area {
    border: 2px dashed #dadce0;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.file-upload-area:hover { border-color: #1a73e8; background: #f8f9fa; }
.file-upload-area i     { font-size: 3rem; color: #1a73e8; margin-bottom: 1rem; }
.file-upload-area p     { margin: 0 0 1rem 0; color: #5f6368; }

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #e8f0fe;
    border-radius: 8px;
    margin-top: 1rem;
}

.file-info i    { font-size: 1.5rem; color: #1a73e8; flex-shrink: 0; }
.file-info span { flex: 1; font-weight: 500; color: #202124; word-break: break-all; }

.btn-remove       { background: none; border: none; color: #d93025; cursor: pointer; padding: 0.5rem; transition: all 0.2s; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.btn-remove:hover { background: rgba(217,48,37,0.1); border-radius: 4px; }

.validation-summary { margin-bottom: 1.5rem; }

.validation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.validation-stats .stat { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; border-radius: 8px; font-weight: 500; }
.validation-stats .stat.valid   { background: #e6f4ea; color: #1e8e3e; }
.validation-stats .stat.invalid { background: #fce8e6; color: #d93025; }
.validation-stats .stat.total   { background: #e8f0fe; color: #1a73e8; }
.validation-stats .stat i       { font-size: 1.5rem; }

.validation-errors { background: #fef7e0; border-left: 4px solid #f9ab00; padding: 1rem; border-radius: 8px; }
.validation-errors h4  { margin: 0 0 0.5rem 0; color: #202124; font-size: 0.9375rem; }
.validation-errors ul  { margin: 0; padding-left: 1.5rem; color: #5f6368; font-size: 0.875rem; }
.validation-errors li  { margin-bottom: 0.25rem; }

.preview-table-container { max-height: 400px; overflow-y: auto; border: 1px solid #e8eaed; border-radius: 8px; -webkit-overflow-scrolling: touch; }
.preview-table-container .data-table { margin: 0; }
.valid-row   { background: #f6fff8; }
.invalid-row { background: #fff4f4; }

.upload-progress { text-align: center; padding: 2rem; }

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill { height: 100%; background: #1a73e8; transition: width 0.3s ease; }
#progressText  { color: #5f6368; font-weight: 500; }

.upload-results { padding: 1.5rem; }

.results-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-stat         { display: flex; align-items: center; gap: 1rem; padding: 1.5rem; border-radius: 12px; }
.result-stat.success { background: #e6f4ea; }
.result-stat.error   { background: #fce8e6; }
.result-stat i       { font-size: 2.5rem; flex-shrink: 0; }
.result-stat.success i { color: #1e8e3e; }
.result-stat.error i   { color: #d93025; }
.result-stat h4      { margin: 0; font-size: 2rem; font-weight: 700; color: #202124; }
.result-stat p       { margin: 0; color: #5f6368; font-size: 0.875rem; }

.error-details    { background: #fff; border: 1px solid #e8eaed; border-radius: 8px; padding: 1rem; }
.error-details h4 { margin: 0 0 0.75rem 0; color: #202124; }
.error-details ul { margin: 0; padding-left: 1.5rem; color: #5f6368; }
.error-details li { margin-bottom: 0.5rem; }

.success-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #1e8e3e;
    font-weight: 500;
    padding: 1rem;
    background: #e6f4ea;
    border-radius: 8px;
}

.success-message i { font-size: 1.5rem; }


/* ─────────────────────────────────────────────────────────────
   27. EMPTY STATE
   ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-state p { font-size: 0.95rem; }


/* ─────────────────────────────────────────────────────────────
   28. LOADING OVERLAY
   ───────────────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e8eaed;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay p { margin-top: 1rem; color: #5f6368; font-size: 0.9375rem; }


/* ─────────────────────────────────────────────────────────────
   29. TOAST NOTIFICATIONS
   ───────────────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.toast i          { font-size: 1.25rem; flex-shrink: 0; }
.toast span       { flex: 1; color: #202124; font-size: 0.9375rem; }
.toast.success    { border-left: 4px solid #1e8e3e; }
.toast.success i  { color: #1e8e3e; }
.toast.error      { border-left: 4px solid #d93025; }
.toast.error i    { color: #d93025; }
.toast.info       { border-left: 4px solid #1a73e8; }
.toast.info i     { color: #1a73e8; }
.toast.warning    { border-left: 4px solid #f9ab00; }
.toast.warning i  { color: #f9ab00; }


/* ─────────────────────────────────────────────────────────────
   30. MISC UTILITIES
   ───────────────────────────────────────────────────────────── */
.gps-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; cursor: help; }
.gps-badge.valid   { color: var(--success-color); }
.gps-badge.invalid { color: var(--danger-color); }

.action-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Accessibility focus rings */
.btn:focus-visible,
.form-control:focus-visible,
.modal-close:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* ── Horizontal scroll tab bars (leave, uniforms, payslips) ── */
/* These inline-style tab rows need scroll behavior on mobile */
[style*="border-bottom:2px solid #e2e8f0"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

[style*="border-bottom:2px solid #e2e8f0"]::-webkit-scrollbar {
    display: none;
}

/* ── Roster staff table horizontal scroll ───────────────────── */
.rs-staff-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rs-staff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 700px;
}

.rs-staff-table thead th {
    background: #f8fafc;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-align: left;
    border-bottom: 1.5px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rs-staff-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

/* ── Unsaved banner ──────────────────────────────────────────── */
.rs-unsaved-banner {
    display: none;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #92400e;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Rules grid ──────────────────────────────────────────────── */
.rs-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.rs-rules-hint {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
}

/* ── Deploy grid ─────────────────────────────────────────────── */
.rs-deploy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.rs-unassigned-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rs-unassigned-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ── Preview table ───────────────────────────────────────────── */
.rs-preview-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 11px;
}

.rs-preview-table thead th {
    background: #f8fafc;
    padding: 6px 4px;
    font-weight: 700;
    font-size: 10px;
    color: #475569;
    text-align: center;
    border-bottom: 1.5px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rs-preview-table thead th:first-child {
    text-align: left;
    padding-left: 8px;
    min-width: 120px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: #f1f5f9;
}

.rs-preview-table tbody td {
    padding: 3px 4px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    vertical-align: middle;
}

.rs-preview-table tbody td:first-child {
    text-align: left;
    padding-left: 8px;
    font-weight: 600;
    color: #334155;
    font-size: 11px;
    background: #fafbfd;
    position: sticky;
    left: 0;
    z-index: 1;
    border-right: 1.5px solid #e2e8f0;
    white-space: nowrap;
}


/* ─────────────────────────────────────────────────────────────
   31. RESPONSIVE — TABLET (≤ 1200px)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .quick-stats  { grid-template-columns: repeat(2, 1fr); }
    .pending-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ─────────────────────────────────────────────────────────────
   32. RESPONSIVE — MOBILE (≤ 768px)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    /* ── Header ─────────────────────────────────────────────── */
    .mobile-menu-toggle { display: flex; }

    .header-content { padding: 0 0.75rem; }

    .logo img { height: 48px; }

    .header-right { gap: 0.5rem; }

    .user-info { display: none; }

    .logout-text { display: none; }

    .btn-logout { padding: 0.5rem; min-width: 44px; justify-content: center; }

    /* ── Sidebar ────────────────────────────────────────────── */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        top: 0;
        height: 100vh;
        padding-top: var(--header-height);
    }

    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 899;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: var(--transition);
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .nav-item {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
    }

    /* ── Main content ───────────────────────────────────────── */
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    /* ── Section headers ────────────────────────────────────── */
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .section-header h1 { font-size: 1.35rem; }

    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .header-actions .btn,
    .header-actions .btn-link-staff {
        justify-content: center;
        font-size: 0.8125rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ── Stat cards ─────────────────────────────────────────── */
    .quick-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .stat-card:hover { transform: none; }

    .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
    .stat-info h3 { font-size: 1.35rem; }
    .stat-info p  { font-size: 0.75rem; }

    /* ── Pending grid ───────────────────────────────────────── */
    .pending-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .pending-card { padding: 1rem; gap: 0.75rem; }
    .pending-card:hover { transform: none; }
    .pending-icon { width: 36px; height: 36px; font-size: 1rem; }
    .pending-info h4 { font-size: 1.25rem; }

    /* ── Form rows ──────────────────────────────────────────── */
    .form-row { grid-template-columns: 1fr; gap: 0; }

    /* ── Filter bar ─────────────────────────────────────────── */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
    }

    .filter-bar .btn { width: 100%; justify-content: center; }

    .search-group { min-width: 0; }

    /* ── Tables ─────────────────────────────────────────────── */
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }

    /* ── Modals — near-fullscreen ───────────────────────────── */
    .modal-overlay { padding: 0 !important; }

    .modal {
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }

    .modal-large { max-width: 100% !important; }

    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: white;
        z-index: 1;
    }

    .modal-header h2 { font-size: 1.15rem; }

    .modal-body { padding: 1rem; }

    .modal-footer {
        padding: 1rem;
        flex-direction: column-reverse;
        position: sticky;
        bottom: 0;
        background: white;
        z-index: 1;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* ── Approval cards ─────────────────────────────────────── */
    .approval-card { padding: 1rem; }
    .approval-card-body { grid-template-columns: 1fr 1fr; }
    .approval-card-actions { flex-wrap: wrap; }
    .approval-card-actions .btn { flex: 1; min-width: 120px; justify-content: center; }

    /* ── Detail rows ────────────────────────────────────────── */
    .detail-row { grid-template-columns: 1fr; gap: 0.25rem; }

    /* ── Upload steps ───────────────────────────────────────── */
    .upload-step { flex-direction: column; gap: 1rem; }
    .validation-stats { grid-template-columns: 1fr; }
    .results-summary  { grid-template-columns: 1fr; }

    /* ── Form actions ───────────────────────────────────────── */
    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn { width: 100%; justify-content: center; }

    /* ── Policy panel ───────────────────────────────────────── */
    .policy-management-container { grid-template-columns: 1fr; }
    .policy-list-panel           { height: auto; max-height: 400px; }
    .policy-preview-panel        { height: auto; }

    .policy-preview-actions { width: 100%; }
    .policy-preview-actions .btn { flex: 1; }

    /* ── Summary cards ──────────────────────────────────────── */
    .attendance-summary,
    .timesheet-overview,
    .advance-overview {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .summary-card { padding: 0.875rem; }
    .summary-card p { font-size: 1.25rem; }

    /* ── Toasts ─────────────────────────────────────────────── */
    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        top: calc(var(--header-height) + 0.5rem);
    }

    .toast { min-width: auto; width: 100%; }

    /* ── Roster ─────────────────────────────────────────────── */
    #roster-section .rs-stats { grid-template-columns: repeat(2, 1fr); }
    #roster-section .rs-panel { padding: 10px; }
    #roster-section .rs-card  { padding: 12px; }

    .rs-rules-grid { grid-template-columns: 1fr; }
    .rs-deploy-grid { grid-template-columns: 1fr; }

    /* ── Activity grid ──────────────────────────────────────── */
    .activity-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .activity-card:hover { transform: none; }

    .activity-icon { width: 40px; height: 40px; font-size: 1.1rem; }
    .activity-info h4 { font-size: 1.35rem; }
    .activity-info p  { font-size: 0.8rem; }

    /* ── On duty list ───────────────────────────────────────── */
    .on-duty-list { grid-template-columns: 1fr; }
}


/* ─────────────────────────────────────────────────────────────
   33. RESPONSIVE — SMALL PHONE (≤ 480px)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .quick-stats  { grid-template-columns: 1fr; gap: 0.5rem; }
    .pending-grid { grid-template-columns: 1fr; gap: 0.5rem; }

    .stat-card {
        flex-direction: row;
        padding: 0.875rem;
    }

    .approval-card-body { grid-template-columns: 1fr; }

    .modal-header h2 { font-size: 1.1rem; }

    #addStaffModal h3,
    #bulkUploadModal h3 { font-size: 1rem; }

    .header-actions {
        grid-template-columns: 1fr;
    }

    .attendance-summary,
    .timesheet-overview,
    .advance-overview {
        grid-template-columns: 1fr;
    }

    #roster-section .rs-tabs { padding: 0 8px; }
    #roster-section .rs-tab  { padding: 10px 12px; font-size: 12px; }

    .report-cards { grid-template-columns: 1fr; }

    /* Compact file upload on small screens */
    .file-upload-area { padding: 1.25rem; }
    .file-upload-area i { font-size: 2rem; }
}


/* ─────────────────────────────────────────────────────────────
   34. SAFE AREA INSETS (notched phones)
   ───────────────────────────────────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .main-content {
            padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        }

        .modal-footer {
            padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        }

        .sidebar {
            padding-bottom: env(safe-area-inset-bottom);
        }

        #ps-confirmBar {
            padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
        }

        .toast-container {
            top: calc(var(--header-height) + 0.5rem + env(safe-area-inset-top));
        }
    }
}
/* ── Roster Export Toolbar ─────────────────────────────── */
.rs-export-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; background: #f8fafc;
  border: 1.5px solid #e2e8f0; border-radius: 8px; margin-bottom: 12px;
}
.rs-export-bar-label  { font-size: 12px; font-weight: 700; color: #475569; white-space: nowrap; }
.rs-export-bar-divider{ width: 1px; height: 20px; background: #e2e8f0; margin: 0 2px; flex-shrink: 0; }
.rs-period-toggle {
  display: inline-flex; border: 1.5px solid #e2e8f0; border-radius: 8px; overflow: hidden;
}
.rs-period-btn {
  padding: 5px 14px; border: none; font-size: 12px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: background .15s, color .15s;
  background: #f8fafc; color: #475569;
}
.rs-period-btn.active          { background: #2563eb; color: #fff; }
.rs-period-btn:not(.active):hover { background: #e2e8f0; }

/* ─────────────────────────────────────────────────────────────
   35. REDUCED MOTION (accessibility)
   ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}