/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font-family); background: #F3F4F6; color: #1F2937; line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ============ LAYOUT ============ */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--sidebar-bg); color: var(--sidebar-text); position: fixed; top: 0; left: 0; height: 100vh; display: flex; flex-direction: column; z-index: 100; transition: transform 0.3s; overflow-y: auto; }
.main-content { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; }
.content-area { padding: 24px; flex: 1; }

/* ============ SIDEBAR ============ */
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: space-between; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.sidebar-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,0.1); padding: 2px; }
.sidebar-logo-placeholder { width: 36px; height: 36px; border-radius: 8px; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.sidebar-company-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.sidebar-close { display: none; background: none; border: none; color: var(--sidebar-text); font-size: 18px; cursor: pointer; padding: 4px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 16px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,0.35); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--sidebar-text); transition: all 0.15s; font-size: 13px; font-weight: 500; text-decoration: none; border-left: 3px solid transparent; }
.nav-item:hover { background: var(--sidebar-hover); text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); border-left-color: var(--accent); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; opacity: 0.7; }
.nav-item.active i { opacity: 1; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.sidebar-user-avatar-placeholder { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.sidebar-user-info { display: flex; flex-direction: column; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 11px; opacity: 0.6; }

/* ============ TOPBAR ============ */
.topbar { height: 60px; background: #fff; border-bottom: 1px solid #E5E7EB; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.hamburger { display: none; background: none; border: none; font-size: 18px; color: #6B7280; cursor: pointer; padding: 6px; }
.page-title { font-size: 18px; font-weight: 700; color: #111827; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-notifications { position: relative; }
.notif-btn { background: none; border: none; font-size: 17px; color: #6B7280; cursor: pointer; position: relative; padding: 6px; }
.notif-badge { position: absolute; top: 0; right: 0; background: #EF4444; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 10px; }
.notif-panel { position: absolute; top: 100%; right: 0; width: 340px; background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); display: none; overflow: hidden; }
.notif-panel.show { display: block; }
.notif-header { padding: 14px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid #E5E7EB; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #F3F4F6; transition: background 0.15s; text-decoration: none; color: inherit; }
.notif-item:hover { background: #F9FAFB; text-decoration: none; }
.notif-item.unread { background: #EFF6FF; }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.notif-title { font-weight: 600; font-size: 12px; }
.notif-text { font-size: 11px; color: #6B7280; margin-top: 2px; }
.notif-time { font-size: 10px; color: #9CA3AF; margin-top: 4px; }
.notif-empty { padding: 30px; text-align: center; color: #9CA3AF; font-size: 13px; }
.notif-footer { display: block; text-align: center; padding: 10px; font-size: 12px; font-weight: 600; border-top: 1px solid #E5E7EB; }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.topbar-avatar-placeholder { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.topbar-logout { color: #9CA3AF; font-size: 16px; }
.topbar-logout:hover { color: #EF4444; }
.topbar-profile { text-decoration: none; }

/* ============ CARDS ============ */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid #F3F4F6; display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid #F3F4F6; background: #FAFAFA; }

/* ============ STAT CARDS ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); display: flex; align-items: flex-start; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.blue { background: #DBEAFE; color: #2563EB; }
.stat-icon.green { background: #D1FAE5; color: #059669; }
.stat-icon.purple { background: #EDE9FE; color: #7C3AED; }
.stat-icon.orange { background: #FED7AA; color: #EA580C; }
.stat-icon.red { background: #FEE2E2; color: #DC2626; }
.stat-icon.teal { background: #CCFBF1; color: #0D9488; }
.stat-info { flex: 1; }
.stat-value { font-size: 24px; font-weight: 800; color: #111827; line-height: 1.2; }
.stat-label { font-size: 12px; color: #6B7280; margin-top: 2px; font-weight: 500; }

/* ============ TABLE ============ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #6B7280; background: #F9FAFB; border-bottom: 1px solid #E5E7EB; white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid #F3F4F6; font-size: 13px; }
tbody tr:hover { background: #F9FAFB; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.avatar-sm-placeholder { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* ============ BADGES ============ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-primary { background: #EDE9FE; color: #5B21B6; }
.badge-muted { background: #F3F4F6; color: #6B7280; }

/* ============ BUTTONS ============ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap; line-height: 1.4; }
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-success { background: #059669; color: #fff; }
.btn-danger { background: #DC2626; color: #fff; }
.btn-warning { background: #D97706; color: #fff; }
.btn-outline { background: #fff; color: #374151; border: 1.5px solid #D1D5DB; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-control { width: 100%; padding: 9px 13px; border: 1.5px solid #D1D5DB; border-radius: 8px; font-size: 13px; transition: border-color 0.2s; background: #fff; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.form-control { appearance: none; 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='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-hint { font-size: 11px; color: #9CA3AF; margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ============ ALERTS ============ */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; animation: slideDown 0.3s ease; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ============ MODAL ============ */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,0.2); animation: modalIn 0.2s ease; }
.modal-lg { max-width: 900px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #E5E7EB; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; color: #9CA3AF; cursor: pointer; padding: 4px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #E5E7EB; display: flex; justify-content: flex-end; gap: 8px; }

/* ============ TABS ============ */
.tabs { display: flex; border-bottom: 2px solid #E5E7EB; margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 20px; font-size: 13px; font-weight: 600; color: #6B7280; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: all 0.15s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============ PAGINATION ============ */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination a, .pagination span { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #6B7280; text-decoration: none; transition: all 0.15s; }
.pagination a:hover { background: #F3F4F6; color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; }

/* ============ CHECKIN WIDGET ============ */
.checkin-widget { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; border-radius: 16px; padding: 28px; margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.checkin-info h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.checkin-info p { opacity: 0.85; font-size: 14px; }
.checkin-time { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.checkin-actions { display: flex; gap: 10px; }
.btn-checkin { background: rgba(255,255,255,0.2); color: #fff; border: 2px solid rgba(255,255,255,0.3); padding: 12px 28px; font-size: 15px; font-weight: 700; border-radius: 12px; backdrop-filter: blur(4px); }
.btn-checkin:hover { background: rgba(255,255,255,0.3); }
.btn-checkin.checked { background: rgba(255,255,255,0.3); border-color: rgba(255,255,255,0.5); }

/* ============ CHARTS ============ */
.chart-container { position: relative; height: 280px; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; margin-bottom: 24px; }

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ============ RATING STARS ============ */
.rating-input { display: flex; gap: 4px; }
.rating-star { font-size: 22px; cursor: pointer; color: #D1D5DB; transition: color 0.15s; }
.rating-star.active, .rating-star:hover { color: #F59E0B; }
.rating-display { color: #F59E0B; font-size: 14px; }

/* ============ PROGRESS BAR ============ */
.progress-bar { height: 8px; background: #E5E7EB; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.progress-fill.green { background: #059669; }
.progress-fill.blue { background: #2563EB; }
.progress-fill.orange { background: #EA580C; }
.progress-fill.red { background: #DC2626; }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 48px 20px; color: #9CA3AF; }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: #6B7280; margin-bottom: 8px; }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: #E5E7EB; }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.timeline-date { font-size: 11px; color: #9CA3AF; }
.timeline-text { font-size: 13px; margin-top: 2px; }

/* ============ LOGIN PAGE ============ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary, #4F46E5) 0%, var(--secondary, #7C3AED) 100%); padding: 20px; }
.login-card { background: #fff; border-radius: 20px; box-shadow: 0 25px 60px rgba(0,0,0,0.2); width: 100%; max-width: 420px; overflow: hidden; }
.login-header { padding: 36px 36px 20px; text-align: center; }
.login-header img { height: 48px; margin-bottom: 16px; }
.login-header h1 { font-size: 22px; font-weight: 800; color: #111827; }
.login-header p { font-size: 13px; color: #6B7280; margin-top: 4px; }
.login-body { padding: 12px 36px 36px; }
.login-body .form-group { margin-bottom: 18px; }
.login-body .btn { width: 100%; padding: 12px; font-size: 15px; }

/* ============ PRINT STYLES ============ */
@media print {
    .sidebar, .topbar, .hamburger, .btn, .sidebar-close { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-area { padding: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .checkin-widget { flex-direction: column; text-align: center; }
    .modal { margin: 10px; }
    .topbar { padding: 0 16px; }
    .content-area { padding: 16px; }
    .notif-panel { width: 300px; right: -40px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 15px; }
}

/* ============ MISC ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #9CA3AF; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none; }
.overlay-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); z-index: 99; display: none; }
.overlay-bg.show { display: block; }

/* ============ PAYSLIP PRINT ============ */
.payslip { max-width: 800px; margin: 0 auto; padding: 30px; }
.payslip-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--primary); padding-bottom: 16px; margin-bottom: 20px; }
.payslip-table { width: 100%; }
.payslip-table td { padding: 6px 12px; font-size: 13px; }
.payslip-table .label { font-weight: 600; color: #6B7280; width: 40%; }
.payslip-total { font-size: 16px; font-weight: 800; }

/* ============ FILTER BAR ============ */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar .form-control { width: auto; min-width: 160px; }

/* ============ REVIEW FORM ============ */
.review-section { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid #E5E7EB; }
.review-section:last-child { border-bottom: none; }
.review-section h4 { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.review-section .section-desc { font-size: 12px; color: #6B7280; margin-bottom: 16px; }
.review-question { padding: 16px; background: #F9FAFB; border-radius: 10px; margin-bottom: 12px; }
.review-question .question-text { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.review-question .question-desc { font-size: 11px; color: #9CA3AF; margin-bottom: 10px; }

/* ============ SKELETON LOADER ============ */
.skeleton { background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%); background-size: 400% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
