/* ============================================
   VMS — Trijaya Solution
   Admin / Dashboard styles
   ============================================ */
:root {
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #7c3aed;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0891b2;
  --info-soft: #cffafe;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;

  --sidebar-w: 264px;
  --sidebar-w-mini: 78px;
  --topbar-h: 64px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 20px 50px -20px rgba(15, 23, 42, .25);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); background: var(--bg);
  color: var(--text); font-size: 14.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: flex; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, #0f1e3d 0%, #0b1730 100%);
  color: #cbd5e1; position: fixed; inset: 0 auto 0 0; z-index: 50;
  display: flex; flex-direction: column; transition: width .28s cubic-bezier(.4, 0, .2, 1), transform .28s cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
}
.sidebar-brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); flex-shrink: 0;
}
.sidebar-brand img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; flex-shrink: 0; }
.brand-name { font-weight: 700; color: #fff; font-size: 15px; white-space: nowrap; overflow: hidden; }
.brand-sub { font-size: 10.5px; color: #7d93b8; white-space: nowrap; overflow: hidden; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 12px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 4px; }
.nav-section {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #5c729b;
  padding: 16px 12px 6px; white-space: nowrap; overflow: hidden;
}
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0;
  border-radius: 10px; color: #b6c4dc; font-weight: 500; white-space: nowrap;
  transition: background .18s, color .18s, transform .18s; position: relative;
}
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); }
.nav-link.active { background: linear-gradient(90deg, var(--primary), #3b82f6); color: #fff; box-shadow: 0 6px 18px -6px rgba(37, 99, 235, .55); }
.nav-link .label { overflow: hidden; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; flex-shrink: 0;
}
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); flex-shrink: 0; white-space: nowrap; overflow: hidden; }

/* Collapsed (mini) sidebar */
.app.sidebar-collapsed .sidebar { width: var(--sidebar-w-mini); }
.app.sidebar-collapsed .sidebar .brand-name,
.app.sidebar-collapsed .sidebar .brand-sub,
.app.sidebar-collapsed .sidebar .nav-link .label,
.app.sidebar-collapsed .sidebar .nav-section,
.app.sidebar-collapsed .sidebar .nav-badge { display: none; }
.app.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
.app.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 12px; }
.app.sidebar-collapsed .main { margin-left: var(--sidebar-w-mini); }

/* Mobile */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .app.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0 !important; }
}
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 49;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.app.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

/* Main */
.main {
  flex: 1; margin-left: var(--sidebar-w); min-width: 0;
  display: flex; flex-direction: column; min-height: 100vh;
  transition: margin-left .28s cubic-bezier(.4, 0, .2, 1);
}

/* Topbar */
.topbar {
  height: var(--topbar-h); background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 0 20px;
}
.btn-icon {
  width: 40px; height: 40px; border-radius: 11px; border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--muted); transition: background .18s, color .18s, transform .18s; position: relative;
}
.btn-icon:hover { background: var(--primary-soft); color: var(--primary); transform: translateY(-1px); }
.btn-icon svg { width: 21px; height: 21px; }
.topbar-title { font-size: 15px; font-weight: 700; }
.topbar-spacer { flex: 1; }

/* Notif badge */
.notif-badge {
  position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Notification dropdown */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: 360px; max-width: calc(100vw - 30px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
  opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60;
}
.notif-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; transition: background .15s; cursor: pointer; }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #e0ecff; }
.notif-ico {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.notif-ico svg { width: 17px; height: 17px; }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-body { font-size: 12.5px; color: var(--muted); }
.notif-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* Profile dropdown */
.profile-wrap { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid transparent; background: transparent; cursor: pointer; transition: background .18s, border-color .18s; }
.profile-btn:hover { background: var(--primary-soft); border-color: var(--border); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.profile-name { font-weight: 600; font-size: 13.5px; color: var(--text); line-height: 1.2; }
.profile-role { font-size: 11px; color: var(--muted); }
.profile-menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 210px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
  opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.profile-menu.open { opacity: 1; transform: none; pointer-events: auto; }
.profile-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s; }
.profile-menu a:hover { background: var(--primary-soft); color: var(--primary); }
.profile-menu a svg { width: 17px; height: 17px; color: var(--muted); }
.profile-menu a:hover svg { color: var(--primary); }
.profile-menu hr { border: none; border-top: 1px solid var(--border); margin: 5px 8px; }
.profile-menu a.danger { color: var(--danger); }
.profile-menu a.danger svg { color: var(--danger); }

/* Tombol Keluar di menu profil */
.profile-logout {
  width: 100%; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  color: var(--danger); font-weight: 500; font-size: 13.5px; font-family: inherit;
}
.profile-logout:hover { background: #fef2f2; }
.profile-logout svg { width: 17px; height: 17px; flex-shrink: 0; }

@media (max-width: 575.98px) { .profile-text { display: none; } }

/* Content */
.content { padding: 24px; flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* Footer */
.app-footer {
  padding: 16px 24px; text-align: center; color: var(--muted); font-size: 12.5px;
  border-top: 1px solid var(--border); background: var(--surface);
}
.app-footer a { color: var(--primary); font-weight: 600; }
.app-footer a:hover { text-decoration: underline; }

/* ---------- Components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 20px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 11px; font-weight: 600; font-size: 13.5px; padding: 9px 16px;
  border: 1px solid transparent; cursor: pointer; transition: all .2s; text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-600)); color: #fff; box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .5); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(37, 99, 235, .6); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-label .req { color: var(--danger); }
.form-control, .form-select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 11px;
  font-family: var(--font); font-size: 14px; color: var(--text); background: var(--surface);
  transition: border-color .18s, box-shadow .18s; outline: none;
}
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { color: var(--danger); font-size: 12.5px; margin-top: 5px; }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 5px; }

/* Password wrapper + eye toggle */
.pass-wrap { position: relative; }
.pass-wrap .form-control { padding-right: 46px; }
.pass-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: none; background: transparent; border-radius: 9px;
  cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: color .18s, background .18s;
  z-index: 3;            /* pastikan selalu di atas input */
  pointer-events: auto;  /* pastikan bisa diklik */
  -webkit-tap-highlight-color: transparent;
}
.pass-eye:hover, .pass-eye:focus-visible { color: var(--primary); background: var(--primary-soft); outline: none; }
.pass-eye.active { color: var(--primary); background: var(--primary-soft); }
.pass-eye svg { width: 18px; height: 18px; pointer-events: none; }

/* Grid */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1199.98px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767.98px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .content { padding: 16px; } }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.table th {
  text-align: left; padding: 11px 14px; background: #f8fafc; color: var(--muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending { background: var(--warning-soft); color: #92400e; }
.badge-approved { background: var(--success-soft); color: #166534; }
.badge-rejected { background: var(--danger-soft); color: #991b1b; }
.badge-checked_in { background: var(--info-soft); color: #155e75; }
.badge-checked_out { background: #e2e8f0; color: #334155; }
.badge-cancelled { background: #f1f5f9; color: #64748b; }
.badge-dot { background: var(--primary-soft); color: var(--primary-600); }

/* Stat cards */
.stat-card {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
  transition: transform .25s, box-shadow .25s; animation: rise-in .55s cubic-bezier(.2, .7, .3, 1) both;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; position: relative; z-index: 1;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; position: relative; z-index: 1; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 3px; position: relative; z-index: 1; }
.stat-bg { position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; opacity: .12; }
.stat-card.blue { --sc: var(--primary); } .stat-card.green { --sc: var(--success); }
.stat-card.amber { --sc: var(--warning); } .stat-card.violet { --sc: var(--accent); }
.stat-card .stat-icon { background: color-mix(in srgb, var(--sc) 14%, white); color: var(--sc); }
.stat-card .stat-bg { background: var(--sc); }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 150px; }

/* Pagination */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span {
  padding: 7px 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600; transition: all .15s;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled span { color: #cbd5e1; background: #f8fafc; }

/* Alerts / toast */
.alert { padding: 13px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 500; margin-bottom: 18px; display: flex; gap: 10px; align-items: flex-start; animation: rise-in .4s both; }
.alert-success { background: var(--success-soft); color: #14532d; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-soft); color: #7f1d1d; border: 1px solid #fecaca; }
.alert-info { background: var(--info-soft); color: #164e63; border: 1px solid #a5f3fc; }

/* QR */
.qr-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: inline-flex; }
.qr-box svg { width: 190px; height: 190px; }

/* Animations */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.anim-rise { animation: rise-in .5s cubic-bezier(.2, .7, .3, 1) both; }
.d1 { animation-delay: .06s; } .d2 { animation-delay: .12s; } .d3 { animation-delay: .18s; }
.d4 { animation-delay: .24s; } .d5 { animation-delay: .3s; } .d6 { animation-delay: .36s; }

/* Empty state */
.empty { text-align: center; padding: 46px 16px; color: var(--muted); }
.empty svg { width: 52px; height: 52px; opacity: .35; margin-bottom: 12px; }

/* Detail list */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 22px; }
.detail-item .d-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.detail-item .d-value { font-size: 14px; font-weight: 600; margin-top: 2px; }
@media (max-width: 575.98px) { .detail-grid { grid-template-columns: 1fr; } }

/* Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab-btn {
  padding: 10px 18px; border: none; background: transparent; font-weight: 600; font-size: 13.5px;
  color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
  transition: color .18s, border-color .18s; white-space: nowrap; border-radius: 9px 9px 0 0;
}
.tab-btn:hover { color: var(--primary); background: var(--primary-soft); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; animation: rise-in .35s both; }
.tab-pane.active { display: block; }

/* Charts */
.chart-box { position: relative; height: 300px; }
.venn-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.venn-svg { max-width: 320px; width: 100%; height: auto; }
.venn-legend { display: flex; flex-direction: column; gap: 12px; }
.venn-legend .lg-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.venn-legend .lg-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.venn-legend .lg-val { margin-left: auto; font-weight: 800; font-size: 15px; }
.venn-circle { animation: venn-in 1s cubic-bezier(.2, .8, .3, 1) both; transform-origin: center; }
@keyframes venn-in {
  from { opacity: 0; transform: scale(.4); }
  to { opacity: 1; transform: scale(1); }
}
.venn-pulse { animation: venn-pulse 3.2s ease-in-out infinite; transform-origin: center; }
@keyframes venn-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

/* ---------- SVG safety net (icon tidak membengkak) ---------- */
svg { vertical-align: middle; }
button svg, .btn svg, .pass-eye svg, .captcha-refresh svg, .btn-icon svg { flex-shrink: 0; }
.pass-eye svg, .captcha-refresh svg { display: block; margin: 0; }
/* icon apapun di dalam dropdown/menu selalu 17px */
.profile-menu svg, .notif-panel svg { width: 17px; height: 17px; flex-shrink: 0; }
