:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --danger: #e11d48;
  --success: #10b981;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* Navbar Glassmorphism */
.navbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 66px;
  gap: 12px;
}

.brand {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
}

.brand span {
  color: var(--primary);
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-item {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.18s ease;
}

.nav-item:hover {
  color: var(--primary);
}

/* Buttons & Form Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: 42px;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, filter 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #ffffff;
  box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -4px rgba(37, 99, 235, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
  color: #ffffff;
  box-shadow: 0 6px 14px -4px rgba(225, 29, 72, 0.35);
}

.btn-danger:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--surface);
  border: 1px solid #cbd5e1;
  color: var(--text);
}

.btn-outline:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-sm {
  padding: 7px 14px;
  min-height: 36px;
  font-size: 0.82rem;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1e293b;
}

.input-control {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-berangkat,
.badge-aktif {
  background: #dcfce7;
  color: #166534;
}

.badge-izin {
  background: #fef3c7;
  color: #92400e;
}

.badge-kosong,
.badge-hangus {
  background: #ffe4e6;
  color: #9f1239;
}

/* Dashboard & Tabs */
.dashboard-main {
  padding: 28px 20px 56px;
}

.tab-menu {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-menu::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  white-space: nowrap;
  padding: 10px 18px;
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--muted);
  transition: all 0.2s ease;
}

.tab-btn:hover {
  border-color: var(--primary-border);
  color: var(--primary);
  background: var(--primary-soft);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.38);
}

.tab-panel {
  display: none;
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: var(--shadow);
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 600px;
}

.table th,
.table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--primary-soft);
}

/* ===== MODERN TOAST NOTIFICATION ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  width: calc(100vw - 32px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--primary-border);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 14px 30px -8px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-item.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-item.hide {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  background: var(--primary-soft);
  color: var(--primary);
}

.toast-message {
  flex: 1;
  padding-top: 2px;
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s ease;
}

.toast-close:hover {
  color: #334155;
}

.toast-success {
  border-color: #a7f3d0;
  border-left-color: var(--success);
}

.toast-success .toast-icon {
  background: #dcfce7;
  color: #15803d;
}

.toast-error {
  border-color: #fecdd3;
  border-left-color: var(--danger);
}

.toast-error .toast-icon {
  background: #ffe4e6;
  color: #be123c;
}

.toast-warning {
  border-color: #fde68a;
  border-left-color: var(--warning);
}

.toast-warning .toast-icon {
  background: #fef3c7;
  color: #b45309;
}

/* ===== MODERN CONFIRM MODAL ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.confirm-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.confirm-dialog {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: 1px solid rgba(191, 219, 254, 0.7);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 28px 56px -12px rgba(15, 23, 42, 0.28);
  text-align: center;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-overlay.open .confirm-dialog {
  transform: translateY(0) scale(1);
}

.confirm-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.confirm-icon.is-danger {
  background: #ffe4e6;
  color: var(--danger);
  border-color: #fecdd3;
}

.confirm-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.3;
}

.confirm-message {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 22px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

.confirm-actions .btn {
  flex: 1;
  min-height: 44px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== MOBILE / HP (<= 640px) ===== */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .nav-content {
    min-height: 60px;
  }

  .brand {
    font-size: 1rem;
  }

  .nav-links {
    gap: 10px;
  }

  .dashboard-main {
    padding: 20px 16px 40px;
  }

  .tab-btn {
    padding: 9px 14px;
    font-size: 0.84rem;
  }

  .tab-panel {
    padding: 16px;
    border-radius: 14px;
  }

  .panel-header h3 {
    font-size: 1.05rem;
  }

  /* Mencegah auto-zoom di iPhone/Safari saat mengetik */
  .input-control {
    font-size: 16px;
  }

  .toast-container {
    top: 14px;
    left: 16px;
    right: 16px;
    max-width: none;
    width: auto;
  }

  .toast-item {
    padding: 12px 14px;
    font-size: 0.85rem;
    border-radius: 12px;
  }

  .confirm-dialog {
    padding: 20px 18px;
    border-radius: 18px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
}

/* ===== HP LAYAR KECIL (<= 360px) ===== */
@media (max-width: 360px) {
  .container {
    padding: 0 14px;
  }

  .brand span {
    display: none;
  }
}