:root {
  --bg: #0d0f14;
  --surface: #13161e;
  --surface2: #1a1d27;
  --surface3: #21253300;
  --border: #2a2e3d;
  --border2: #353a4e;
  --accent: #e8c14e;
  --accent2: #f0d070;
  --accent-dim: rgba(232, 193, 78, 0.12);
  --text: #eaedf5;
  --text2: #8b90a8;
  --text3: #555a72;
  --green: #4ecb8a;
  --green-dim: rgba(78, 203, 138, 0.1);
  --red: #e85e5e;
  --red-dim: rgba(232, 94, 94, 0.1);
  --blue: #5e9fe8;
  --blue-dim: rgba(94, 159, 232, 0.1);
  --yellow: #e8c14e;
  --sidebar-w: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ─── Scrollbar ─────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }

/* ─── Sidebar ───────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.brand-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  color: #0d0f14;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  line-height: 1;
}
.brand-sub {
  font-size: 10px;
  color: var(--text3);
  margin-top: 3px;
  font-weight: 300;
  letter-spacing: 0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 400;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(232, 193, 78, 0.2);
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent-dim);
  border: 1px solid rgba(232, 193, 78, 0.3);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.user-role { font-size: 11px; color: var(--text3); }

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

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

.menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text2);
  border-radius: 2px;
  transition: var(--transition);
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  flex: 1;
}

.clock {
  font-size: 13px;
  color: var(--text3);
  font-family: 'DM Sans', monospace;
  font-weight: 300;
}

/* ─── Pages ─────────────────────── */
.page { display: none; padding: 28px; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

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

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: var(--text);
  line-height: 1.1;
}

.page-header p {
  color: var(--text3);
  font-size: 13px;
  margin-top: 4px;
  font-weight: 300;
}

/* ─── Stats Grid ────────────────── */
.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: 22px 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.green::before { background: var(--green); }
.stat-card.yellow::before { background: var(--accent); }
.stat-card.blue::before { background: var(--blue); }
.stat-card.red::before { background: var(--red); }

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

.stat-card.loading {
  min-height: 110px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
  font-weight: 300;
}

.stat-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 28px;
  opacity: 0.15;
}

/* ─── Dashboard Grid ───────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Card ──────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.card-header h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.card-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.card-link:hover { opacity: 0.7; }

/* ─── Dept Chart ───────────────── */
.dept-chart {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dept-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dept-label {
  font-size: 12px;
  color: var(--text2);
  width: 160px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dept-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.dept-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.dept-count {
  font-size: 12px;
  color: var(--text3);
  width: 20px;
  text-align: right;
}

/* ─── Recent List ──────────────── */
.recent-list { padding: 8px 0; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  transition: var(--transition);
  cursor: pointer;
}

.recent-item:hover { background: var(--surface2); }

.recent-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.recent-info { flex: 1; min-width: 0; }
.recent-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ─── Filters ────────────────── */
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-input, .filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 9px 14px;
  outline: none;
  transition: var(--transition);
}

.filter-input {
  flex: 1;
  min-width: 200px;
}

.filter-input::placeholder { color: var(--text3); }

.filter-input:focus, .filter-select:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.filter-select option { background: var(--surface2); }

.result-count {
  font-size: 12px;
  color: var(--text3);
  margin-left: auto;
  white-space: nowrap;
}

/* ─── Table ─────────────────────── */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  background: var(--surface2);
  padding: 12px 16px;
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover { background: var(--surface2); }

.data-table td {
  padding: 13px 16px;
  color: var(--text);
  vertical-align: middle;
}

.emp-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.emp-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.emp-name {
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}

.emp-email {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

.nip-badge {
  font-size: 11px;
  font-family: 'DM Sans', monospace;
  color: var(--text3);
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
}

.status-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-aktif { color: var(--green); background: var(--green-dim); border: 1px solid rgba(78, 203, 138, 0.2); }
.status-cuti { color: var(--yellow); background: var(--accent-dim); border: 1px solid rgba(232, 193, 78, 0.2); }
.status-non-aktif { color: var(--red); background: var(--red-dim); border: 1px solid rgba(232, 94, 94, 0.2); }

.salary-text {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}

.action-btns {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}

.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* ─── Form ───────────────────────── */
.form-card { padding: 28px; }

.form-section { margin-bottom: 28px; }

.form-section-title {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

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

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.required { color: var(--red); }

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: var(--transition);
}

.form-group input::placeholder { color: var(--text3); }

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group select option { background: var(--surface2); color: var(--text); }

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ─── Buttons ────────────────────── */
.btn-primary, .btn-secondary {
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #0d0f14;
}

.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232, 193, 78, 0.25);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border2);
}

/* ─── Modal ──────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  transition: var(--transition);
}

.modal-close:hover { color: var(--text); border-color: var(--border2); }

.modal-head {
  padding: 28px 28px 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 700;
  border: 2px solid;
}

.modal-name {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.modal-pos { font-size: 13px; color: var(--text3); margin-top: 2px; }

.modal-body { padding: 24px 28px; }

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.modal-field label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
}

.modal-field span {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-top: 3px;
  font-weight: 400;
}

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

/* ─── Toast ──────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 300;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-color: rgba(78, 203, 138, 0.4); }
.toast.error { border-color: rgba(232, 94, 94, 0.4); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast.success .toast-dot { background: var(--green); }
.toast.error .toast-dot { background: var(--red); }

/* ─── Empty State ─────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text3);
}

.empty-state .icon { font-size: 40px; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }

/* ─── Overlay ───────────────────── */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* ─── Colors ─────────────────────── */
.color-0 { background: #5e9fe820; color: #5e9fe8; }
.color-1 { background: #e85e9820; color: #e85e98; }
.color-2 { background: #9fe85e20; color: #9fe85e; }
.color-3 { background: #e8c14e20; color: #e8c14e; }
.color-4 { background: #9e5ee820; color: #9e5ee8; }
.color-5 { background: #5ee8c120; color: #5ee8c1; }
.color-6 { background: #e87a5e20; color: #e87a5e; }
.color-7 { background: #5ee87a20; color: #5ee87a; }

/* ─── Responsive ─────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }
  .overlay.visible { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page { padding: 20px; }
  .modal-grid { grid-template-columns: 1fr; }
}

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