/* ==========================================
   HR System - Core CSS Stylesheet (v2.0 Expanded)
   Theme: nedee.ai (Magenta/Pinkish-red)
   ========================================== */

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Kanit', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
}

:root {
  --primary-color: #d4af37;
  --primary-hover: #b5952f;
  --primary-light: #fdfaf2;
  --primary-glow: rgba(212, 175, 55, 0.15);
  
  --text-dark: #2d3748;
  --text-muted: #718096;
  --text-light: #a0aec0;
  
  --bg-light: #f7fafc;
  --bg-white: #ffffff;
  --border-color: #edf2f7;
  
  --success: #38a169;
  --success-light: #f0fff4;
  --success-text: #276749;
  
  --danger: #e53e3e;
  --danger-light: #fff5f5;
  --danger-text: #9b2c2c;
  
  --warning: #dd6b20;
  --warning-light: #fffaf0;
  --warning-text: #7b341e;
  
  --info: #3182ce;
  --info-light: #ebf8ff;
  --info-text: #2b6cb0;

  --purple: #805ad5;
  --purple-light: #faf5ff;
  --purple-text: #553c9a;
  
  --bg-pattern: none;
  
  --sidebar-width: 280px;
  --transition-speed: 0.25s;
  --border-radius: 12px;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Custom Themes */
[data-theme="food"] {
  --primary-color: #f97316;
  --primary-hover: #ea580c;
  --primary-light: #fff7ed;
  --primary-glow: rgba(249, 115, 22, 0.15);
  --bg-light: #fef8f1;
  --bg-pattern: radial-gradient(#f97316 1px, transparent 1px);
}

[data-theme="energy"] {
  --primary-color: #10b981;
  --primary-hover: #059669;
  --primary-light: #ecfdf5;
  --primary-glow: rgba(16, 185, 129, 0.15);
  --bg-light: #f4fdf8;
  --bg-pattern: linear-gradient(0deg, transparent 24%, rgba(16, 185, 129, 0.05) 25%, rgba(16, 185, 129, 0.05) 26%, transparent 27%, transparent 74%, rgba(16, 185, 129, 0.05) 75%, rgba(16, 185, 129, 0.05) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, rgba(16, 185, 129, 0.05) 25%, rgba(16, 185, 129, 0.05) 26%, transparent 27%, transparent 74%, rgba(16, 185, 129, 0.05) 75%, rgba(16, 185, 129, 0.05) 76%, transparent 77%, transparent);
}

[data-theme="service"] {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --primary-glow: rgba(59, 130, 246, 0.15);
  --bg-light: #f5f9ff;
  --bg-pattern: repeating-linear-gradient(45deg, rgba(59, 130, 246, 0.03) 0, rgba(59, 130, 246, 0.03) 1px, transparent 1px, transparent 10px);
}

[data-theme="trading"] {
  --primary-color: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-light: #f5f3ff;
  --primary-glow: rgba(139, 92, 246, 0.15);
  --bg-light: #faf5ff;
  --bg-pattern: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 25%, transparent 25%, transparent 50%, rgba(139, 92, 246, 0.03) 50%, rgba(139, 92, 246, 0.03) 75%, transparent 75%, transparent);
}

[data-theme="construction"] {
  --primary-color: #f59e0b;
  --primary-hover: #d97706;
  --primary-light: #fffbeb;
  --primary-glow: rgba(245, 158, 11, 0.15);
  --bg-light: #fffdf5;
  --bg-pattern: linear-gradient(rgba(245, 158, 11, 0.05) 2px, transparent 2px), linear-gradient(90deg, rgba(245, 158, 11, 0.05) 2px, transparent 2px);
}

body {
  background-color: var(--bg-light);
  background-image: var(--bg-pattern);
  background-size: 40px 40px;
  color: var(--text-dark);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* ==========================================
   Authentication & Lock Screen
   ========================================== */
.lock-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #ffffff 0%, #f7fafc 100%);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity var(--transition-speed), visibility var(--transition-speed);
  opacity: 0;
  visibility: hidden;
}

.lock-screen-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lock-card {
  width: 400px;
  padding: 40px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
  text-align: center;
}

.lock-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.logo-dot {
  width: 16px;
  height: 16px;
  background-color: var(--primary-color);
  border-radius: 50%;
}

.lock-logo span {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-dark);
}

.lock-logo span span {
  color: var(--primary-color);
}

.lock-card h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.lock-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.lock-input {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  outline: none;
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 4px;
  font-weight: 700;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.lock-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.lock-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background-color: var(--primary-color);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(255, 42, 95, 0.2);
  transition: all 0.2s;
}

.lock-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

/* ==========================================
   Sidebar Navigation
   ========================================== */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform var(--transition-speed);
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-dark);
}

.brand-text span {
  color: var(--primary-color);
}

.sidebar-menu-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.menu-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 14px 12px 6px 12px;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.menu-item:hover {
  background-color: #f7fafc;
  color: var(--text-dark);
}

.menu-item.active {
  background-color: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(255, 42, 95, 0.15);
}

.menu-item i, .menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fafbfd;
}

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

.topbar {
  background-color: var(--bg-white);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  cursor: pointer;
  color: var(--text-dark);
  padding: 6px;
  border-radius: 6px;
  background-color: #f7fafc;
}

.company-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.role-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.role-badge.admin {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border: 1px solid rgba(255, 42, 95, 0.15);
}

.role-badge.employee {
  background-color: var(--info-light);
  color: var(--info-text);
  border: 1px solid rgba(49, 130, 206, 0.15);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  padding: 4px 8px;
  border-radius: 12px;
}

.user-profile:hover {
  background-color: #f7fafc;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #edf2f7;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.user-name {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 0.85rem;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 180px;
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.08);
  margin-top: 6px;
  overflow: hidden;
  z-index: 110;
}

.user-dropdown.active {
  display: block;
}

.user-dropdown-header {
  padding: 10px 14px;
  background-color: #f7fafc;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 0.85rem;
}

.user-dropdown a:hover {
  background-color: #f7fafc;
  color: var(--primary-color);
}

/* View Layout */
.view-wrapper {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

.app-view {
  display: none;
  animation: viewFadeIn 0.25s ease-out;
}

.app-view.active {
  display: block;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.view-title-container h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-dark);
}

.view-title-container p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 1px;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================
   Form Controls
   ========================================== */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  outline: none;
  font-size: 0.88rem;
  background-color: var(--bg-white);
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23718096' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 32px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s;
}

.btn-primary { background-color: var(--primary-color); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-secondary { background-color: #edf2f7; color: var(--text-dark); }
.btn-secondary:hover { background-color: #cbd5e0; }

.btn-outline { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-dark); }
.btn-outline:hover { background-color: #f7fafc; }

.btn-danger { background-color: var(--danger); color: #ffffff; }
.btn-danger:hover { background-color: #c53030; }

.btn-success { background-color: var(--success); color: #ffffff; }
.btn-success:hover { background-color: #2f855a; }

.btn-block { width: 100%; }
.btn-sm { padding: 4px 8px; font-size: 0.78rem; border-radius: 4px; }

/* ==========================================
   Dashboard, KPI Cards & SVGs
   ========================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.dash-card {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--box-shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-card-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.dash-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-card-icon.magenta { background-color: var(--primary-light); color: var(--primary-color); }
.dash-card-icon.green { background-color: var(--success-light); color: var(--success); }
.dash-card-icon.blue { background-color: var(--info-light); color: var(--info); }
.dash-card-icon.orange { background-color: var(--warning-light); color: var(--warning); }

.reports-charts-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.reports-charts-container.equal {
  grid-template-columns: 1fr 1fr;
}

.chart-card {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.chart-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.chart-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* ==========================================
   Table Presentation & Badges
   ========================================== */
.table-container {
  background-color: var(--bg-white);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.table-header-controls {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.search-box-wrapper {
  position: relative;
  width: 250px;
}

.search-box-wrapper input {
  padding-left: 32px;
}

.search-box-wrapper i, .search-box-wrapper svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 14px;
  height: 14px;
}

.table-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  background-color: #f8fafc;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-dark);
  font-size: 0.85rem;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background-color: #fafbfc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge.success { background-color: var(--success-light); color: var(--success-text); }
.badge.danger { background-color: var(--danger-light); color: var(--danger-text); }
.badge.warning { background-color: var(--warning-light); color: var(--warning-text); }
.badge.info { background-color: var(--info-light); color: var(--info-text); }
.badge.purple { background-color: var(--purple-light); color: var(--purple-text); }

/* Profile View Details */
.profile-card-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, #ff6289 100%);
  height: 90px;
}

.profile-card-body {
  padding: 20px;
  position: relative;
  margin-top: 30px;
}

.profile-avatar-container {
  position: absolute;
  top: -70px;
  left: 20px;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: #edf2f7;
  border: 4px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
}

.profile-info-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-main-title h3 { font-size: 1.25rem; font-weight: 600; }
.profile-main-title p { color: var(--text-muted); font-size: 0.88rem; }

.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.profile-stat-box {
  background-color: #f8fafc;
  padding: 12px;
  border-radius: var(--border-radius);
  text-align: center;
  border: 1px solid var(--border-color);
}

.profile-stat-val { font-size: 1.25rem; font-weight: 700; }
.profile-stat-lbl { font-size: 0.75rem; color: var(--text-muted); }

/* Master-detail Layout */
.two-col-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}

.two-col-layout.equal {
  grid-template-columns: 1fr 1fr;
}

/* ==========================================
   HRD - Skills Matrix, Onboarding, IDP
   ========================================== */

/* IDP Checklists */
.idp-checklist-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.idp-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f8fafc;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.idp-task-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.idp-task-left input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.idp-task-title {
  font-weight: 500;
  font-size: 0.88rem;
}

.idp-task-title.completed {
  text-decoration: line-through;
  color: var(--text-light);
}

/* Skills Rating Stars */
.star-rating {
  display: flex;
  gap: 2px;
  color: #cbd5e0;
}

.star-rating.active {
  color: #ecc94b;
}

.skill-row-matrix {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

/* Onboarding checklist */
.onboarding-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onboarding-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: white;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.onboarding-item input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.onboarding-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.onboarding-text h5 {
  font-size: 0.88rem;
  font-weight: 600;
}

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

/* ==========================================
   HROD - 9-Box Grid, Salary Band, Career Path
   ========================================== */

/* 9-Box Grid Layout */
.nine-box-grid {
  display: grid;
  grid-template-columns: 50px repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr) 40px;
  gap: 10px;
  background-color: #fafbfc;
  padding: 15px;
  border-radius: var(--border-radius);
  border: 1.5px solid var(--border-color);
  width: 100%;
  min-height: 420px;
}

.nine-box-cell {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: all 0.2s;
}

.nine-box-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.nine-box-cell.high-high { background-color: #fff0f3; border-color: #feb2b2; } /* Stars */
.nine-box-cell.med-high, .nine-box-cell.high-med { background-color: #fffaf0; border-color: #fbd38d; } /* High Growth */
.nine-box-cell.low-low { background-color: #edf2f7; } /* Underperformers */

.nine-box-cell-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  border-bottom: 1.5px dashed var(--border-color);
  padding-bottom: 4px;
}

.nine-box-emp-tag {
  display: inline-flex;
  align-items: center;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  width: fit-content;
}

/* Y-Axis Label (Potential) */
.nine-box-y-label {
  grid-column: 1;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* X-Axis Label (Performance) */
.nine-box-x-label {
  grid-row: 4;
  grid-column: 2 / span 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.nine-box-row-hdr {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-light);
}

.nine-box-col-hdr {
  text-align: center;
  padding-top: 6px;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* Salary Structure mid-range comparisons */
.compa-ratio-badge {
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.compa-ratio-badge.low { background-color: #fee2e2; color: #b91c1c; } /* Below midpoint */
.compa-ratio-badge.normal { background-color: #dcfce7; color: #15803d; } /* Near midpoint */
.compa-ratio-badge.high { background-color: #fef3c7; color: #d97706; } /* Above midpoint */

/* Career Path flow chart */
.career-path-flow {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 15px;
  background-color: #f8fafc;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.career-node {
  background: white;
  border: 2px solid var(--border-color);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-weight: 600;
}

.career-node:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-1px);
}

.career-node.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.career-arrow {
  display: flex;
  justify-content: center;
  color: var(--text-light);
}

/* Onboarding, IDP, and general progression bars */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-text-pct {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary-color);
}

/* Org Chart Node Styles */
.org-node-rect {
  fill: #ffffff;
  stroke: #e2e8f0;
  stroke-width: 1.5;
  rx: 8;
  cursor: pointer;
  transition: all 0.25s;
}

.org-node-rect:hover {
  stroke: var(--primary-color);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
}

.org-node-rect.selected {
  stroke: var(--primary-color);
  stroke-width: 2.5;
}

.org-node-root {
  fill: var(--primary-light);
  stroke: var(--primary-color);
}

/* General Layouts */
.user-info-avatar {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: bold;
}

/* Modals & Dialog overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(26, 32, 44, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-speed), visibility var(--transition-speed);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: var(--bg-white);
  border-radius: 16px;
  width: 580px;
  max-width: 90%;
  max-height: 85vh;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.large {
  width: 800px;
}

@keyframes modalSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.08rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #fafbfc;
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2d3748;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.25);
  z-index: 9999;
}

.toast-notification.active {
  transform: translateY(0);
  opacity: 1;
}

/* Chat support widget */
.chat-widget-float {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(255, 42, 95, 0.25);
  cursor: pointer;
  z-index: 999;
  transition: all 0.2s;
}

.chat-widget-float:hover {
  background-color: var(--primary-hover);
  transform: scale(1.05);
}

.chat-popup {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  height: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border: 1px solid var(--border-color);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-popup.active {
  display: flex;
}

.chat-popup-header {
  background-color: var(--primary-color);
  color: white;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-popup-header h4 { font-weight: 600; font-size: 0.9rem; }
.chat-popup-close { background: transparent; border: none; color: white; font-size: 1.2rem; cursor: pointer; }

.chat-popup-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: #f8fafc;
}

.chat-bubble {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  max-width: 85%;
}

.chat-bubble.bot {
  background-color: white;
  align-self: flex-start;
  border: 1px solid var(--border-color);
}

.chat-bubble.user {
  background-color: var(--primary-color);
  color: white;
  align-self: flex-end;
}

.chat-popup-footer {
  padding: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 6px;
}

.chat-popup-footer input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  outline: none;
  font-size: 0.82rem;
}

.chat-popup-footer button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.82rem;
}

/* Print configuration for Payslip */
@media print {
  body * { visibility: hidden; }
  #payslipModal, #payslipModal * { visibility: visible; }
  #payslipModal {
    position: absolute;
    left: 0; top: 0;
    width: 100%; margin: 0; padding: 0;
    box-shadow: none; background: white;
  }
  .modal-overlay { background: transparent !important; position: relative !important; }
  .modal-card { box-shadow: none !important; border: none !important; width: 100% !important; }
  .modal-header, .modal-footer { display: none !important; }
}

/* Tablet & Mobile responsive fixes */
@media (max-width: 1024px) {
  :root { --sidebar-width: 230px; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .reports-charts-container { grid-template-columns: 1fr; }
  .two-col-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.active { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
  .main-content { margin-left: 0 !important; }
  .topbar { padding: 0 16px; }
  .view-wrapper { padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 0; }
  .profile-stats-row { grid-template-columns: 1fr; }
  .nine-box-grid { grid-template-columns: 35px repeat(3, 1fr); min-height: 320px; }
}

/* ==========================================
   Passcode Display & Keypad
   ========================================== */
.passcode-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 30px 0;
}

.passcode-display .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background-color: transparent;
  transition: all 0.2s ease;
}

.passcode-display .dot.filled {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(255, 42, 95, 0.4);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  max-width: 260px;
  margin: 0 auto;
}

.key-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  border: none;
  background-color: #f1f5f9;
  color: var(--text-dark);
  font-size: 24px;
  font-weight: 600;
  font-family: 'Kanit', sans-serif;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  margin: 0 auto;
}

.key-btn:hover:not(.empty-btn) {
  background-color: #e2e8f0;
  transform: scale(1.05);
}

.key-btn:active:not(.empty-btn) {
  background-color: #cbd5e1;
  transform: scale(0.95);
}

.key-btn.empty-btn {
  background-color: transparent;
  cursor: default;
}

.key-btn.action-btn {
  background-color: transparent;
  color: var(--text-muted);
}
.key-btn.action-btn:hover {
  color: var(--danger);
  background-color: #fee2e2;
}

.lock-footer {
  text-align: center;
  margin-top: 20px;
}
