/* ============================================
   Employee & Salary Management System
   Design System & Global Styles
   ============================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --secondary: #7c3aed;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0891b2;
  --info-light: #cffafe;

  --sidebar-bg: #1e1b4b;
  --sidebar-hover: #312e81;
  --sidebar-active: #4f46e5;
  --sidebar-text: #c7d2fe;
  --sidebar-text-active: #ffffff;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #4f46e5;

  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  --transition: 0.2s ease;
  --sidebar-width: 260px;
  --header-height: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================
   LAYOUT
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand h1 {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.sidebar-brand span {
  color: var(--primary-light);
  font-size: 12px;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  color: rgba(199,210,254,0.4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
}

.nav-link .nav-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link .badge {
  margin-left: auto;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer p {
  color: rgba(199,210,254,0.4);
  font-size: 11px;
  text-align: center;
}

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

/* TOPBAR */
.topbar {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.topbar-subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

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

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

/* PAGE CONTENT */
.page-content {
  flex: 1;
  padding: 24px;
}

/* ============================================
   VIEWS (SPA)
   ============================================ */
.view { display: none; }
.view.active { display: block; }

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 24px; }

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: var(--secondary); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-top: 2px;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================
   FORMS
   ============================================ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

label .required {
  color: var(--danger);
  margin-left: 2px;
}

input, select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--text-light);
}

textarea { resize: vertical; min-height: 80px; }

.input-with-prefix {
  display: flex;
  align-items: center;
}

.input-prefix {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-right: none;
  padding: 10px 12px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.input-with-prefix input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  display: none;
}

.form-error.show { display: block; }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #047857;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover:not(:disabled) {
  background: #b45309;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 15px;
}

.btn-icon {
  padding: 8px;
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

/* ============================================
   TABLES
   ============================================ */

.table-responsive { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

tbody td {
  padding: 14px 16px;
  color: var(--text);
  vertical-align: middle;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-primary { background: #eff6ff; color: #2563eb; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-purple { background: #f3e8ff; color: var(--secondary); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 420px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition);
}

.modal-close:hover { background: var(--border); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  gap: 0;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================
   SEARCH BAR
   ============================================ */

.search-bar {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-bar input {
  padding-left: 40px;
}

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

/* ============================================
   FILE UPLOAD
   ============================================ */

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-2);
}

.file-upload-area:hover, .file-upload-area.dragover {
  border-color: var(--primary);
  background: rgba(79,70,229,0.04);
}

.file-upload-area .upload-icon { font-size: 36px; color: var(--text-light); margin-bottom: 8px; }
.file-upload-area p { font-size: 14px; color: var(--text-muted); }
.file-upload-area strong { color: var(--primary); }
.file-upload-area input[type="file"] { display: none; }

.file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.file-preview .file-icon { font-size: 24px; }
.file-preview .file-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview .file-size { font-size: 12px; color: var(--text-muted); }

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto 20px; }

/* ============================================
   CHARTS
   ============================================ */

.chart-container {
  position: relative;
  height: 240px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  height: 180px;
  gap: 8px;
  padding-bottom: 32px;
  position: relative;
}

.chart-bars::before {
  content: '';
  position: absolute;
  bottom: 32px;
  left: 0; right: 0;
  border-top: 1px dashed var(--border);
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
}

.chart-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 0.6s ease;
  min-height: 4px;
  cursor: pointer;
  position: relative;
}

.chart-bar:hover::after {
  content: attr(data-value);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
}

.chart-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  position: absolute;
  bottom: 0;
}

/* ============================================
   SALARY BREAKDOWN
   ============================================ */

.salary-breakdown {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 16px;
}

.salary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.salary-row:last-child { border-bottom: none; }
.salary-row.total {
  font-size: 16px;
  font-weight: 800;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.salary-row .amount-positive { color: var(--success); font-weight: 600; }
.salary-row .amount-negative { color: var(--danger); font-weight: 600; }
.salary-row .amount-total { color: var(--primary); font-weight: 800; font-size: 18px; }

/* ============================================
   HISTORY ITEMS
   ============================================ */

.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.history-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.history-info { flex: 1; min-width: 0; }
.history-title { font-size: 14px; font-weight: 600; color: var(--text); }
.history-reason { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.history-date { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.history-amount { font-size: 15px; font-weight: 700; flex-shrink: 0; }

/* ============================================
   AVATAR
   ============================================ */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 24px;
}

/* ============================================
   ALERTS / TOASTS
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  pointer-events: all;
  animation: slideInUp 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

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

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(10px); }
}

/* ============================================
   PROFILE PAGE SPECIFIC
   ============================================ */

.profile-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: #fff;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  border: 3px solid rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.profile-hero-info h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 4px;
}

.profile-hero-info p {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 12px;
}

.profile-hero-badges { display: flex; gap: 8px; flex-wrap: wrap; }

.profile-hero-badge {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
}

.net-salary-card {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
}

.net-salary-label { font-size: 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.net-salary-value { font-size: 30px; font-weight: 900; line-height: 1.1; margin-top: 4px; }

/* ============================================
   DOCUMENT GRID
   ============================================ */

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow var(--transition);
  cursor: pointer;
}

.doc-card:hover { box-shadow: var(--shadow-md); }

.doc-card-thumb {
  height: 100px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  overflow: hidden;
}

.doc-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doc-card-info {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}

.doc-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-card-date { font-size: 11px; color: var(--text-muted); }

/* ============================================
   FILTERS ROW
   ============================================ */

.filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-select {
  width: auto;
  min-width: 160px;
  padding: 9px 32px 9px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
  -webkit-appearance: none;
  appearance: none;
}

/* ============================================
   DIVIDER
   ============================================ */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ============================================
   INLINE FORM (loan/bonus/deduction row)
   ============================================ */

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--surface-2);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.inline-form .form-group { flex: 1; min-width: 140px; }
.inline-form .form-group:last-of-type { flex: 2; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn { display: flex; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-content { padding: 12px; }

  .topbar {
    padding: 0 12px;
    gap: 8px;
    flex-wrap: wrap;
    min-height: var(--header-height);
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .topbar-title { font-size: 16px; }
  .topbar-subtitle { font-size: 11px; }

  .topbar-actions { margin-left: auto; }
  .topbar-actions .btn { font-size: 13px; padding: 7px 12px; }

  /* Tables: horizontal scroll on mobile */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table { min-width: 600px; }

  /* Employee table action buttons */
  .btn-sm { padding: 5px 8px; font-size: 12px; }

  .profile-hero {
    flex-direction: column;
    text-align: center;
  }

  .net-salary-card { margin-left: 0; width: 100%; }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; }

  .modal-lg { max-height: 90vh; overflow-y: auto; }

  /* Card padding reduction on mobile */
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }

  /* Charts */
  .charts-grid { grid-template-columns: 1fr !important; }

  /* Doc grid */
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .filter-select { min-width: unset; }
  .doc-grid { grid-template-columns: 1fr; }

  /* Login page */
  .login-card { padding: 32px 20px; margin: 16px; }

  /* Employee profile hero */
  .avatar { width: 64px !important; height: 64px !important; font-size: 22px !important; }
  .profile-name { font-size: 22px !important; }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.sidebar-overlay.show { display: block; }

/* ============================================
   MISC UTILITIES
   ============================================ */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Confirm dialog */
.confirm-dialog .modal-body {
  text-align: center;
  padding: 32px 24px;
}

.confirm-dialog .confirm-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.confirm-dialog h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-dialog p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   PRINT STYLES (for profile page)
   ============================================ */

@media print {
  .sidebar, .topbar, .btn, .nav-link { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
  .profile-hero { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
