/* ══════════════════════════════════════
   HR ENTERPRISE SUITE — DESIGN SYSTEM
   ══════════════════════════════════════ */

:root {
  --bg:          #f4f5f7;
  --surface:     #ffffff;
  --surface-2:   #f8f9fb;
  --border:      #e5e8ed;
  --border-light:#edf0f4;

  --sidebar-bg:  #141c2e;
  --sidebar-2:   #1e2a40;
  --sidebar-3:   #263248;
  --sidebar-text:#8fa4c8;
  --sidebar-active:#ffffff;

  --primary:     #2563eb;
  --primary-dark:#1d4fd8;
  --primary-light:#eff5ff;

  --accent:      #0ea5e9;
  --success:     #16a34a;
  --success-bg:  #f0fdf4;
  --warning:     #d97706;
  --warning-bg:  #fffbeb;
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --info:        #0284c7;
  --info-bg:     #f0f9ff;

  --text:        #111827;
  --text-2:      #374151;
  --text-3:      #6b7280;
  --text-4:      #9ca3af;

  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   16px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg:   0 10px 25px -5px rgba(0,0,0,.1), 0 5px 10px -5px rgba(0,0,0,.06);

  --sidebar-w:   240px;
  --topbar-h:    60px;
  --font:        'DM Sans', system-ui, sans-serif;
  --font-display:'Syne', system-ui, sans-serif;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ──────────────────────────────────
   LAYOUT
────────────────────────────────── */

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

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo-mark {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800; font-size: 13px; color: #fff;
  letter-spacing: .5px;
  flex-shrink: 0;
}
.logo-title { display: block; font-family: var(--font-display); font-weight: 700;
  font-size: 13px; color: #fff; line-height: 1.2; }
.logo-sub   { display: block; font-size: 11px; color: var(--sidebar-text); }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section { margin-bottom: 4px; }
.nav-label {
  display: block; padding: 10px 20px 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: rgba(143,164,200,.5);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  border-radius: 0;
  transition: all .15s;
  margin: 1px 8px; border-radius: 8px;
}
.nav-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-3); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--sidebar-3); color: var(--sidebar-active);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; font-family: var(--font-display);
  flex-shrink: 0;
}
.user-name { display: block; font-size: 12.5px; font-weight: 600; color: #fff; }
.user-role { display: block; font-size: 11px; color: var(--sidebar-text); }
.user-details { flex: 1; min-width: 0; }
.logout-btn { color: var(--sidebar-text); flex-shrink: 0; }
.logout-btn:hover { color: var(--danger); }
.logout-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

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

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.menu-toggle svg { width: 20px; height: 20px; stroke: var(--text-3); fill: none;
  stroke-width: 2; stroke-linecap: round; }
.topbar-left { flex: 1; }
.page-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 17px; color: var(--text); line-height: 1;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.notif-btn, .topbar-icon {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-3);
  text-decoration: none; transition: all .15s;
}
.notif-btn:hover, .topbar-icon:hover { background: var(--bg); color: var(--text); }
.notif-btn svg, .topbar-icon svg { width: 18px; height: 18px; stroke: currentColor;
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

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

/* ──────────────────────────────────
   COMPONENTS
────────────────────────────────── */

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.card-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 15px; color: var(--text);
}
.card-subtitle { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* KPI Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: box-shadow .15s;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--primary);
}
.stat-card.green::before  { background: var(--success); }
.stat-card.amber::before  { background: var(--warning); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.teal::before   { background: var(--accent); }

.stat-value {
  font-family: var(--font-display); font-weight: 800;
  font-size: 28px; color: var(--text); line-height: 1;
}
.stat-label { font-size: 12.5px; color: var(--text-3); margin-top: 4px; font-weight: 500; }
.stat-icon {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  opacity: .07;
}
.stat-icon svg { width: 48px; height: 48px; stroke: var(--text); fill: none;
  stroke-width: 1.5; stroke-linecap: round; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-main-side { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; font-family: var(--font);
  border: none; cursor: pointer; text-decoration: none;
  transition: all .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(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: transparent; color: var(--text-2);
  border: 1.5px solid var(--border); 
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--text-3); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); color: var(--text);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11.5px; color: var(--text-4); margin-top: 3px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  padding: 10px 14px; text-align: left;
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border-light); transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child { border-bottom: none; }
td { padding: 11px 14px; color: var(--text-2); vertical-align: middle; }
td.strong { font-weight: 600; color: var(--text); }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-neutral { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* Tabs */
.tab-nav {
  display: flex; gap: 2px; margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  padding: 9px 18px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-family: var(--font); transition: all .15s;
  text-decoration: none; display: inline-block;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Flash */
.flash-container { padding: 0 24px; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  animation: slideIn .2s ease;
}
.flash button { background: none; border: none; cursor: pointer; font-size: 18px;
  opacity: .6; line-height: 1; color: inherit; }
.flash-success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.flash-danger  { background: var(--danger-bg);  color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: var(--info-bg);    color: #0c4a6e; border: 1px solid #bae6fd; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Employee avatar */
.emp-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--primary);
  font-family: var(--font-display); flex-shrink: 0;
}
.emp-avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.emp-row { display: flex; align-items: center; gap: 10px; }
.emp-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.emp-sub  { font-size: 12px; color: var(--text-3); }

/* Shift chips */
.shift-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: #fff;
  white-space: nowrap;
}

/* Schedule grid */
.schedule-table td { padding: 6px 8px; min-width: 120px; }
.schedule-table td.day-head {
  font-size: 11.5px; font-weight: 700; text-align: center;
  background: var(--surface-2); color: var(--text-2);
  text-transform: uppercase; letter-spacing: .5px;
}
.schedule-table td.today-col { background: #eff6ff; }
.schedule-cell { min-height: 48px; position: relative; }
.add-shift-btn {
  width: 100%; border: 1.5px dashed var(--border);
  background: none; border-radius: 6px; cursor: pointer;
  padding: 6px; color: var(--text-4); transition: all .15s;
  font-size: 18px; line-height: 1;
}
.add-shift-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Time chart */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 100px; padding: 8px 0 0; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: var(--primary); transition: height .4s ease;
  min-height: 2px;
}
.bar-label { font-size: 10px; color: var(--text-4); }

/* Page header */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Search / filter bar */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar .form-control { max-width: 280px; }

/* Profile tabs content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Section title */
.section-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 14px; color: var(--text); margin-bottom: 12px;
}

/* Empty state */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text-4);
}
.empty-state svg { width: 40px; height: 40px; stroke: currentColor; fill: none;
  stroke-width: 1.5; opacity: .4; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  transform: scale(.95); transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 22px;
  color: var(--text-3); line-height: 1; }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; }

/* Payroll checklist */
.payroll-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.payroll-row:last-child { border-bottom: none; }
.payroll-check { width: 24px; height: 24px; }
.payroll-amount { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); }

/* Login page */
.auth-page {
  min-height: 100vh; display: flex;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1a2a4a 100%);
}
.auth-panel {
  width: 100%; max-width: 420px; margin: auto;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 40px; box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-mark { width: 52px; height: 52px; font-size: 18px; margin: 0 auto 12px; }
.auth-logo h1 { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.auth-logo p  { color: var(--text-3); font-size: 13.5px; margin-top: 4px; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-main-side { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Utils */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-3); font-size: 12.5px; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.w-full { width: 100%; }
.fw-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1100px) {
  .grid-main-side { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
