/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold: #ce9418;
  --gold-light: #e8b84b;
  --gold-dark: #a5760f;
  --dark: #1d1d22;
  --dark-2: #2a2a32;
  --dark-3: #35353f;
  --light: #f7f7f8;
  --light-2: #eeeeef;
  --text: #1d1d22;
  --text-muted: #6b6b7a;
  --white: #ffffff;
  --success: #2d8a4e;
  --success-bg: #e8f5ee;
  --danger: #c0392b;
  --danger-bg: #fdeaea;
  --warning: #d68910;
  --warning-bg: #fef9e7;
  --info: #2471a3;
  --info-bg: #eaf4fd;
  --sidebar-w: 260px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--light);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  color: #ccc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--dark-3);
}

.brand-logo {
  width: 40px; height: 40px;
  flex-shrink: 0;
}
.brand-logo img { width: 40px; height: 40px; display: block; }

.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 600; color: var(--white); line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--gold); letter-spacing: 1px; text-transform: uppercase; }

.nav-section { padding: 16px 0 4px; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: #555566; padding: 0 20px; display: block; margin-bottom: 4px; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: #aaaabc;
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-link:hover { color: var(--white); background: var(--dark-2); }
.nav-link.active { color: var(--gold); border-left-color: var(--gold); background: rgba(206,148,24,0.08); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--dark-3);
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); color: var(--dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-fullname { font-size: 13px; color: var(--white); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px; margin-top: 2px; width: fit-content; }
.user-role-badge.admin { background: rgba(206,148,24,0.2); color: var(--gold); }
.user-role-badge.hr_manager { background: rgba(36,113,163,0.2); color: #4fa3d6; }
.user-role-badge.jr_hr { background: rgba(45,138,78,0.2); color: #5db87a; }

.sidebar-actions { display: flex; gap: 12px; }
.sidebar-action-link { font-size: 12px; color: #777788; text-decoration: none; transition: color 0.15s; }
.sidebar-action-link:hover { color: var(--white); }
.sidebar-action-link.logout:hover { color: #e74c3c; }

/* ===== Main content ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--light-2);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.menu-toggle svg { width: 20px; height: 20px; stroke: var(--text); fill: none; stroke-width: 2; stroke-linecap: round; }

.topbar-title { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; color: var(--dark); flex: 1; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content-area { padding: 24px; flex: 1; }

/* ===== Alerts ===== */
.alerts { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
}
.alert button { background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; opacity: 0.6; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--light-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== Stat cards ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--gold);
}
.stat-card.blue { border-left-color: var(--info); }
.stat-card.green { border-left-color: var(--success); }
.stat-card.red { border-left-color: var(--danger); }
.stat-card.orange { border-left-color: #e67e22; }

.stat-value { font-family: 'Cormorant Garamond', serif; font-size: 32px; font-weight: 700; color: var(--dark); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--gold); color: var(--dark); }
.btn-primary:hover { background: var(--gold-light); }
.btn-secondary { background: var(--light-2); color: var(--text); }
.btn-secondary:hover { background: #e0e0e2; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f9c9c5; }
.btn-outline { background: transparent; border: 1px solid var(--light-2); color: var(--text); }
.btn-outline:hover { background: var(--light-2); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-gold-outline { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.btn-gold-outline:hover { background: var(--gold); color: var(--dark); }
.btn-success { background: var(--success-bg); color: var(--success); }
.btn-success:hover { background: #c8ecd6; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--light); font-size: 11.5px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--light-2); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--light-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--light); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Forms ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-control {
  padding: 9px 12px;
  border: 1px solid var(--light-2);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  width: 100%;
}
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(206,148,24,0.12); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.form-check label { font-size: 13.5px; font-weight: 400; text-transform: none; letter-spacing: 0; cursor: pointer; }
.form-section { margin-bottom: 28px; }
.form-section-title { font-family: 'Cormorant Garamond', serif; font-size: 17px; font-weight: 600; color: var(--dark); padding-bottom: 10px; border-bottom: 1px solid var(--light-2); margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; padding-top: 20px; border-top: 1px solid var(--light-2); margin-top: 20px; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-former { background: var(--light-2); color: var(--text-muted); }
.badge-open { background: var(--danger-bg); color: var(--danger); }
.badge-resolved { background: var(--success-bg); color: var(--success); }
.badge-escalated { background: var(--warning-bg); color: var(--warning); }
.badge-low { background: var(--info-bg); color: var(--info); }
.badge-medium { background: var(--warning-bg); color: var(--warning); }
.badge-high { background: var(--danger-bg); color: var(--danger); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-partial { background: var(--info-bg); color: var(--info); }
.badge-repaid { background: var(--success-bg); color: var(--success); }
.badge-gold { background: rgba(206,148,24,0.15); color: var(--gold-dark); }

/* ===== Login page ===== */
.login-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  background-image: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 100%);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo {
  width: 140px; height: 140px;
  display: block;
  margin: 0 auto 16px;
}
.login-brand h1 { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 700; color: var(--dark); }
.login-brand p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-group label { margin-bottom: 6px; }
.login-submit { width: 100%; padding: 11px; background: var(--gold); color: var(--dark); border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px; transition: background 0.15s; font-family: inherit; }
.login-submit:hover { background: var(--gold-light); }

/* ===== Employee profile header ===== */
.emp-header {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.emp-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--light-2);
}
.emp-avatar-placeholder {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--dark);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 30px;
  font-weight: 700;
  flex-shrink: 0;
}
.emp-info { flex: 1; min-width: 200px; }
.emp-name { font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 700; color: var(--dark); }
.emp-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.emp-meta-item { font-size: 13px; color: var(--text-muted); }
.emp-meta-item strong { color: var(--text); }
.emp-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--light-2); margin-bottom: 20px; overflow-x: auto; }
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Detail grid ===== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.detail-item label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.detail-item span { font-size: 14px; color: var(--text); }

/* ===== Salary calculator ===== */
.calc-result {
  background: linear-gradient(135deg, var(--dark), var(--dark-2));
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
}
.calc-result-title { font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 600; color: var(--gold); margin-bottom: 16px; }
.calc-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.07); font-size: 13.5px; }
.calc-row:last-child { border-bottom: none; }
.calc-row.total { font-weight: 700; font-size: 15px; margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.2); border-bottom: none; }
.calc-row.deduction { color: #ff8a8a; }
.calc-row.employer { color: #aaaabc; font-style: italic; }
.calc-row.net { color: var(--gold); font-size: 18px; font-weight: 700; margin-top: 4px; }
.calc-net-amount { font-family: 'Cormorant Garamond', serif; font-size: 28px; }

/* ===== Payslip ===== */
.payslip-print {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  max-width: 800px;
}
.payslip-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--gold); padding-bottom: 16px; margin-bottom: 20px; }
.payslip-company h2 { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 700; }
.payslip-company p { font-size: 12px; color: var(--text-muted); }
.payslip-title { text-align: right; }
.payslip-title h3 { font-size: 16px; font-weight: 600; }
.payslip-title p { font-size: 12px; color: var(--text-muted); }
.payslip-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.payslip-table th, .payslip-table td { padding: 8px 12px; border: 1px solid var(--light-2); font-size: 13px; }
.payslip-table th { background: var(--light); font-weight: 600; }
.payslip-net { background: var(--dark); color: var(--white); text-align: center; padding: 16px; border-radius: var(--radius); margin-top: 16px; }
.payslip-net .amount { font-family: 'Cormorant Garamond', serif; font-size: 28px; color: var(--gold); }

/* ===== Upload zone ===== */
.upload-zone {
  border: 2px dashed var(--light-2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.upload-zone:hover { border-color: var(--gold); }
.upload-zone input { display: none; }

/* ===== Search bar ===== */
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-input { flex: 1; min-width: 200px; }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state svg { width: 40px; height: 40px; stroke: var(--light-2); fill: none; stroke-width: 1.5; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== Breadcrumb ===== */
.breadcrumb { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb a { color: var(--gold); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--light-2); }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--light-2); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--light-2); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Inline form (modal-like) ===== */
.inline-form { background: var(--light); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; border: 1px solid var(--light-2); }
.inline-form-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--dark); }

/* ===== Two-column layout ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .form-grid, .form-grid-3, .two-col, .three-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
  .emp-header { flex-direction: column; align-items: center; text-align: center; }
}

/* ===== Print ===== */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .content-area { padding: 0; }
  .payslip-print { box-shadow: none; }
}
