/* ============================================================
   UD MANDIRI — Design System v2.0
   Referensi: SmartHR Dashboard (light sidebar + orange accent)
   ============================================================ */

/* ── 1. Google Fonts (Inter) ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── 2. CSS Variables / Design Tokens ── */
:root {
  /* Sidebar — Light */
  --sidebar-width:        240px;
  --sidebar-collapsed:    68px;
  --sidebar-bg:           #FFFFFF;
  --sidebar-border:       #F0F0F0;
  --sidebar-hover:        #FFF5F2;
  --sidebar-active:       #FFF0EB;
  --sidebar-active-line:  #E8501E;
  --sidebar-text:         #6B7280;
  --sidebar-text-active:  #E8501E;
  --sidebar-icon:         #9CA3AF;
  --sidebar-icon-active:  #E8501E;

  /* Main */
  --bg-body:              #F5F5F7;
  --bg-card:              #FFFFFF;
  --bg-header:            #FFFFFF;

  /* Brand / Primary — Orange */
  --primary:              #E8501E;
  --primary-dark:         #C94318;
  --primary-light:        #FFF0EB;
  --primary-rgb:          232, 80, 30;

  /* Semantic */
  --success:              #22C55E;
  --success-bg:           #DCFCE7;
  --warning:              #F59E0B;
  --warning-bg:           #FEF3C7;
  --danger:               #EF4444;
  --danger-bg:            #FEE2E2;
  --info:                 #0EA5E9;
  --info-bg:              #E0F2FE;

  /* Text */
  --text-dark:            #111827;
  --text-medium:          #6B7280;
  --text-light:           #9CA3AF;
  --text-white:           #FFFFFF;

  /* Border & Shadow */
  --border:               #E5E7EB;
  --border-light:         #F3F4F6;
  --shadow-sm:            0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:            0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg:            0 10px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.07);

  /* Radius */
  --radius-sm:            6px;
  --radius-md:            10px;
  --radius-lg:            12px;
  --radius-xl:            16px;
  --radius-full:          9999px;

  /* Spacing */
  --header-h:             60px;

  /* Transition */
  --transition:           0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ── 4. App Shell Layout ── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ── 5. SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;           /* tinggi tetap = viewport, agar nav bisa scroll */
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}

/* Collapsed state */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar.collapsed .nav-item { justify-content: center; }
.sidebar.collapsed .nav-item .nav-arrow { display: none; }
.sidebar.collapsed .sidebar-user { padding: 12px 8px; }

/* ─ Sidebar Logo ─ */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: var(--header-h);
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  letter-spacing: -0.5px;
}
.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  transition: opacity var(--transition), width var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-logo-text strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}
.sidebar-logo-text span {
  font-size: 10px;
  color: var(--text-light);
  font-weight: 400;
}

/* ─ Sidebar Nav ─ */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-section { margin-bottom: 1px; }
.nav-section-title {
  padding: 12px 18px 3px;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sidebar-icon);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
}
.nav-item:hover .nav-icon { color: var(--primary); }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--sidebar-icon-active); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--sidebar-active-line);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-icon);
  flex-shrink: 0;
  font-size: 18px;
  transition: color var(--transition);
}
.nav-icon svg { width: 17px; height: 17px; }

.nav-label {
  flex: 1;
  font-size: 13px;
  transition: opacity var(--transition);
}

.nav-arrow {
  margin-left: auto;
  font-size: 11px;
  color: var(--sidebar-icon);
  transition: transform var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.nav-arrow svg { width: 14px; height: 14px; }
.nav-item.submenu-open .nav-arrow { transform: rotate(180deg); }

/* Sub-nav */
.nav-submenu {
  display: none;
  flex-direction: column;
  padding: 0 8px 4px 8px;
}
.nav-submenu.open { display: flex; }

.nav-subitem {
  position: relative;
  display: flex;
  align-items: center;
  /* padding-left: 52px memberi ruang untuk dot (di left:36px, lebar 4px → berakhir di 40px)
     ada 12px jarak sebelum teks mulai — tidak ada overlap */
  padding: 7px 12px 7px 52px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 12.5px;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
/* Bullet dot — pakai absolute agar tidak ikut flex layout */
.nav-subitem::before {
  content: '';
  position: absolute;
  left: 36px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sidebar-icon);
  transition: background var(--transition);
  flex-shrink: 0;
}
.nav-subitem:hover              { background: var(--sidebar-hover); color: var(--primary); }
.nav-subitem:hover::before      { background: var(--primary); }
.nav-subitem.active             { color: var(--primary); font-weight: 600; }
.nav-subitem.active::before     { background: var(--primary); }

/* Badge on nav */
.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  margin-left: auto;
  flex-shrink: 0;
}

/* ─ Sidebar Border (right shadow untuk light sidebar) ─ */
.sidebar {
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 2px 0 8px rgba(0,0,0,.04);
}

/* ─ Sidebar User ─ */
.sidebar-user {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: padding var(--transition);
}
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info {
  flex: 1;
  overflow: hidden;
  transition: opacity var(--transition);
}
.sidebar-user-info strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info span {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}
.sidebar-logout-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-icon);
  border-radius: 6px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-logout-btn:hover { background: var(--sidebar-hover); color: var(--danger); }

/* Sidebar Toggle Button — di dalam topbar, bukan floating */
.sidebar-toggle {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-body);
  cursor: pointer;
  color: var(--text-medium);
  flex-shrink: 0;
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.sidebar-toggle svg { width: 16px; height: 16px; }
.app-wrapper.sidebar-collapsed .sidebar-toggle .icon-chevron { transform: rotate(180deg); }

/* Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

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

/* ── 7. HEADER / TOPBAR ── */
.topbar {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 0 var(--border-light);
}

/* Mobile hamburger */
.topbar-hamburger {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-medium);
  transition: all var(--transition);
  flex-shrink: 0;
}
.topbar-hamburger:hover { background: var(--bg-body); color: var(--text-dark); }
.topbar-hamburger svg { width: 20px; height: 20px; }

/* Breadcrumb / Page title */
.topbar-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.topbar-title h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1;
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-light);
}
.topbar-breadcrumb a { color: var(--text-light); transition: color var(--transition); }
.topbar-breadcrumb a:hover { color: var(--primary); }
.topbar-breadcrumb .sep { font-size: 10px; }

/* Search */
.topbar-search {
  position: relative;
  flex-shrink: 0;
}
.topbar-search input {
  height: 36px;
  width: 220px;
  padding: 0 12px 0 36px;
  background: var(--bg-body);
  border: 1.5px solid transparent;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-dark);
  transition: all var(--transition);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  width: 260px;
}
.topbar-search input::placeholder { color: var(--text-light); }
.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.topbar-search .search-icon svg { width: 15px; height: 15px; }

/* Topbar actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-medium);
  transition: all var(--transition);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--bg-body); color: var(--text-dark); }
.topbar-icon-btn svg { width: 18px; height: 18px; }
.topbar-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* User Dropdown */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.topbar-user:hover { background: var(--bg-body); }
.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.topbar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-user-info { display: flex; flex-direction: column; gap: 1px; }
.topbar-user-info strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
}
.topbar-user-info span {
  font-size: 10.5px;
  color: var(--text-light);
  white-space: nowrap;
}
.topbar-user-chevron {
  color: var(--text-light);
  display: flex;
  align-items: center;
}
.topbar-user-chevron svg { width: 14px; height: 14px; }

/* User dropdown menu */
.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 6px;
  display: none;
  z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}
.user-dropdown-header strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}
.user-dropdown-header span {
  font-size: 11px;
  color: var(--text-light);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-medium);
  transition: all var(--transition);
  cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-body); color: var(--text-dark); }
.dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); }
.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ── 8. PAGE CONTENT ── */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
  /* Transisi halus saat konten diganti AJAX */
  transition: opacity 0.15s ease;
}
/* Saat AJAX sedang load */
.page-content.ajax-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ── 9. CARDS ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  border: 1px solid var(--border-light);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-dark);
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat cards */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg); color: var(--danger); }
.stat-body { flex: 1; min-width: 0; }
.stat-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
  margin: 3px 0;
}
.stat-value.sm { font-size: 16px; }
.stat-change {
  font-size: 11.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-change svg  { width: 12px; height: 12px; }

/* ── 10. GRID LAYOUT HELPERS ── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ── 11. BUTTONS ── */

/*
 * Konvensi warna button:
 *   btn-create  → Hijau   — Tambah / Add baru
 *   btn-primary → Biru    — Simpan / Submit / Konfirmasi
 *   btn-search  → Abu-biru — Cari / Filter
 *   btn-warning → Amber   — Edit / Ubah
 *   btn-danger  → Merah   — Hapus / Batalkan
 *   btn-info    → Teal    — Detail / Lihat
 *   btn-outline → Outline — Reset / Batal / Sekunder
 *   btn-ghost   → Transparan — Ikon aksi tabel
 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  height: 40px;                     /* selalu sama tinggi dengan form-control */
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: 1.5px solid transparent;
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
  align-self: center;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Biru — Simpan / Konfirmasi */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.30);
}

/* Hijau — Tambah / Create */
.btn-create {
  background: #22C55E;
  color: #fff;
  border-color: #22C55E;
}
.btn-create:hover:not(:disabled) {
  background: #16A34A;
  border-color: #16A34A;
  box-shadow: 0 4px 14px rgba(34,197,94,0.28);
}

/* Abu-biru — Cari / Filter */
.btn-search {
  background: #64748B;
  color: #fff;
  border-color: #64748B;
}
.btn-search:hover:not(:disabled) {
  background: #475569;
  border-color: #475569;
  box-shadow: 0 4px 14px rgba(100,116,139,0.22);
}

/* Amber — Edit */
.btn-warning {
  background: #F59E0B;
  color: #fff;
  border-color: #F59E0B;
}
.btn-warning:hover:not(:disabled) {
  background: #D97706;
  border-color: #D97706;
  box-shadow: 0 4px 14px rgba(245,158,11,0.28);
}

/* Merah — Hapus */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  border-color: #DC2626;
  box-shadow: 0 4px 14px rgba(239,68,68,0.28);
}

/* Teal — Detail / Info */
.btn-info {
  background: #0EA5E9;
  color: #fff;
  border-color: #0EA5E9;
}
.btn-info:hover:not(:disabled) {
  background: #0284C7;
  border-color: #0284C7;
  box-shadow: 0 4px 14px rgba(14,165,233,0.28);
}

/* Hijau — Sukses / Konfirmasi alternatif */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
  background: #16A34A;
  border-color: #16A34A;
  box-shadow: 0 4px 14px rgba(34,197,94,0.28);
}

/* Outline — Reset / Batal */
.btn-outline {
  background: transparent;
  color: var(--text-medium);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--text-medium);
  color: var(--text-dark);
  background: var(--bg-body);
}

/* Ghost — Ikon aksi di tabel */
.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border-color: transparent;
  height: 32px;
  padding: 0 8px;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-body);
  color: var(--text-dark);
  border-color: var(--border);
}

/* Ukuran */
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; }
.btn-lg svg { width: 17px; height: 17px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon.sm { width: 34px; height: 34px; }
.btn-block { width: 100%; }

/* ── Filter Form Layout ──
   Grid: [input panjang] [dropdown] [tombol]
   Semua row sama tinggi, tombol align-bottom otomatis */
.filter-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: flex-end;
}
.filter-form .filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.filter-form .filter-field-sm { min-width: 150px; }
@media (max-width: 640px) {
  .filter-form { grid-template-columns: 1fr; }
  .filter-form .filter-field-sm { min-width: unset; }
}

/* ── 12. FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--bg-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-dark);
  transition: all var(--transition);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}
.form-control::placeholder { color: var(--text-light); }
.form-control.is-invalid { border-color: var(--danger); background: #fff; }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; min-height: 90px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239CA3AF'%3E%3Cpath d='M7 7l3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }

.form-hint  { font-size: 11.5px; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.form-error svg { width: 12px; height: 12px; }

/* Input with icon */
.input-group { position: relative; }
.input-group .form-control { padding-left: 38px; }
.input-group .input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  display: flex;
}
.input-group .input-icon svg { width: 16px; height: 16px; }
.input-group .input-icon-right {
  left: auto;
  right: 11px;
  pointer-events: all;
  cursor: pointer;
  transition: color var(--transition);
}
.input-group .input-icon-right:hover { color: var(--text-dark); }
.input-group.has-right .form-control { padding-right: 38px; }

/* Form row */
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── 13. TABLES ── */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dark);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--bg-body); }
.table tbody tr { transition: background var(--transition); }
.table.table-sm th,
.table.table-sm td { padding: 9px 14px; }

/* ── 14. BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-success { background: var(--success-bg); color: #15803D; }
.badge-success::before { background: var(--success); }
.badge-warning { background: var(--warning-bg); color: #B45309; }
.badge-warning::before { background: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: #B91C1C; }
.badge-danger::before  { background: var(--danger); }
.badge-info    { background: var(--info-bg);    color: #1D4ED8; }
.badge-info::before    { background: var(--info); }
.badge-neutral { background: var(--bg-body); color: var(--text-medium); border: 1px solid var(--border); }
.badge-neutral::before { background: var(--text-light); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-primary::before { background: var(--primary); }
.badge.no-dot::before { display: none; }

/* ── 15. ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  margin-bottom: 16px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); border-color: #BBF7D0; color: #14532D; }
.alert-warning { background: var(--warning-bg); border-color: #FDE68A; color: #78350F; }
.alert-danger  { background: var(--danger-bg);  border-color: #FECACA; color: #7F1D1D; }
.alert-info    { background: var(--info-bg);    border-color: #BFDBFE; color: #1E3A5F; }
.alert-close {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition);
  flex-shrink: 0;
}
.alert-close:hover { opacity: 1; }

/* ── 16. PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.page-item {
  display: flex;
}
.page-link {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-medium);
  transition: all var(--transition);
  border: 1px solid transparent;
}
.page-link:hover { background: var(--bg-body); color: var(--text-dark); }
.page-item.active .page-link { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-item.disabled .page-link { opacity: 0.4; cursor: not-allowed; }

/* ── 17. MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}
.modal.modal-lg { max-width: 720px; }
.modal.modal-xl { max-width: 960px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-dark); flex: 1; }
.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-light);
  transition: all var(--transition);
  cursor: pointer;
}
.modal-close:hover { background: var(--bg-body); color: var(--text-dark); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 18. TABS ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 20px;
}
.tab-item {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-item:hover { color: var(--text-dark); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── 19. LOADING ── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }
.spinner.white { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #e9ebef 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── 20. EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.empty-state svg, .empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  color: var(--border);
  opacity: 0.8;
}
.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-medium);
  margin-bottom: 6px;
}
.empty-state p { font-size: 13px; color: var(--text-light); max-width: 260px; margin: 0 auto 16px; }

/* ── 21. TYPOGRAPHY UTILITIES ── */
.text-dark   { color: var(--text-dark); }
.text-medium { color: var(--text-medium); }
.text-light  { color: var(--text-light); }
.text-primary{ color: var(--primary); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }
.text-danger { color: var(--danger); }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.text-base{ font-size: 13.5px; }
.text-lg  { font-size: 16px; }
.text-xl  { font-size: 20px; }
.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uppercase { text-transform: uppercase; letter-spacing: 0.5px; }

/* ── 22. SPACING UTILITIES ── */
.mt-0{margin-top:0}.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mt-6{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}.mb-6{margin-bottom:24px}
.ml-auto{margin-left:auto}
.p-0{padding:0}.p-2{padding:8px}.p-3{padding:12px}.p-4{padding:16px}.p-5{padding:20px}.p-6{padding:24px}
.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}
.flex{display:flex}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}
.w-full{width:100%}.h-full{height:100%}

/* ── 23. MONEY FORMAT ── */
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-positive { color: var(--success); }
.money-negative { color: var(--danger); }

/* ── 24. TOOLTIP ── */
[data-tooltip] { position: relative; cursor: default; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-dark);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 500;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── 25. RESPONSIVE ── */

/* ─ Detail page: main content + sidebar panel ─ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.detail-grid-stretch {
  align-items: stretch;
}
.detail-grid-lg {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}
/* Info block di dalam kartu detail */
.info-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.info-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

@media (max-width: 900px) {
  .detail-grid, .detail-grid-lg { grid-template-columns: 1fr; }
  .info-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .info-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .info-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .info-grid-4, .info-grid-3, .info-grid-2 { grid-template-columns: 1fr; }
}

/* ─ Table container (scroll horizontal di mobile) ─ */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}

/* ─ Responsive form grid utilities ─ */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ─ Filter form: rata-rata 4–5 kolom yang bisa collapse ─ */
.filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  align-items: flex-end;
}
.filter-form .filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 1280px) {
  .grid-4  { grid-template-columns: repeat(2, 1fr); }
  .grid-5  { grid-template-columns: repeat(3, 1fr); }
  .topbar-search input { width: 180px; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .topbar-hamburger { display: flex; }
  .sidebar-toggle { display: none; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1025px) {
  .topbar-hamburger { display: none; }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }
  .page-content { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: repeat(2, 1fr); }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .topbar-title h1 { font-size: 14px; }
  .topbar-user-info { display: none; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 17px; }
  .card { padding: 14px; }
  .modal { max-height: 96vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  /* Toast: full width di mobile */
  .toast-container { left: 12px; right: 12px; bottom: 16px; }
  .toast { min-width: unset; max-width: unset; width: 100%; }
}

@media (max-width: 640px) {
  /* Page header: stack title & action buttons */
  .flex.items-center.justify-between.mb-6 {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .flex.items-center.justify-between.mb-6 > .btn,
  .flex.items-center.justify-between.mb-6 > a.btn,
  .flex.items-center.justify-between.mb-6 > div > .btn,
  .flex.items-center.justify-between.mb-6 > div.flex { align-self: flex-start; }
  /* Filter form: single column */
  .filter-form { grid-template-columns: 1fr; }
  .filter-form .filter-actions { width: 100%; }
  .filter-form .filter-actions .btn { flex: 1; justify-content: center; }
  /* Form grids */
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .page-content { padding: 12px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .stat-value.sm { font-size: 14px; }
  .card { padding: 12px; border-radius: var(--radius-md); }
  /* Tabel: font lebih kecil, padding lebih ketat */
  .table th, .table td { padding: 10px 12px; font-size: 12px; }
  /* Button lebih touch-friendly */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; }
}

/* ── 26. PRINT ── */
@media print {
  .sidebar, .topbar, .sidebar-toggle, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: white; }
}

/* ── 27. SCROLLBAR GLOBAL ── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── 28. NOTIFICATION TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text-dark);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn 0.3s ease;
  border-left: 3px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); max-height: 0; margin: 0; padding: 0; }
}
