:root {
  --navy-900: #0a1a2f;
  --navy-800: #0f2439;
  --green-600: #4b6f4a;
  --green-500: #5a8a59;
  --blue-600: #3a6ea5;
  --amber-500: #f2a900;
  --red-600: #a63232;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --bg: #0d1317;
  --surface: #161d26;
  --surface-2: #1e2730;
  --border: rgba(255, 255, 255, 0.08);
}

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

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: #111827;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] body {
  color: #e2e8f0;
}

/* Sidebar Styling */
.sidebar {
  background: var(--navy-900);
  color: white;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  z-index: 1040;
  transition: transform 0.3s ease;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
}

/* Menu Category Header (Collapsible) */
.sidebar .menu-category {
  margin: 8px 16px 4px 16px;
}

.sidebar .menu-category-header {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar .menu-category-header:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
}

/* Disabled State for Category Header */
.sidebar .menu-category-header.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.sidebar .menu-category-header.disabled:hover {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.5);
}

.sidebar .menu-category-header .fa-chevron-down {
  font-size: 10px;
  transition: transform 0.3s ease;
}

.sidebar .menu-category-header[aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
}

.sidebar .menu-category-header[aria-expanded="false"] .fa-chevron-down {
  transform: rotate(0deg);
}

/* Category Collapse Container */
.sidebar .category-collapse {
  margin-top: 4px;
}

/* Nav Item Wrapper */
.sidebar .nav-item {
  margin: 4px 16px;
}

/* Main Nav Links */
.sidebar .nav-item > .nav-link {
  color: rgba(255, 255, 255, 0.75);
  padding: 12px 16px;
  border-radius: 10px;
  margin: 0;
  transition: all 0.25s;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar .nav-item > .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(2px);
}

.sidebar .nav-item > .nav-link.active {
  background: rgba(75, 111, 74, 0.35);
  color: white;
  font-weight: 600;
  border-left: 4px solid var(--green-500);
}

/* Submenu Collapse Container */
.sidebar .collapse {
  margin-top: 4px;
  padding-left: 0;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  overflow: hidden;
}

/* Submenu Links */
.sidebar .collapse .nav-link {
  margin: 0;
  padding: 10px 16px 10px 44px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  border-radius: 0;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.sidebar .collapse .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-left-color: var(--green-500);
}

.sidebar .collapse .nav-link.active {
  background: rgba(75, 111, 74, 0.25);
  border-left: 3px solid var(--green-500);
  color: white;
  font-weight: 600;
}

/* Chevron Icon Animation */
.sidebar .nav-link[aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

.sidebar .nav-link[aria-expanded="false"] .fa-chevron-down {
  transform: rotate(0deg);
  transition: transform 0.3s ease;
}

/* Parent Menu with Submenu Styling */
.sidebar .nav-link[data-bs-toggle="collapse"] {
  cursor: pointer;
}

.sidebar .nav-link[data-bs-toggle="collapse"]:hover .fa-chevron-down {
  color: var(--green-500);
}

.sidebar.hide-mobile {
  transform: translateX(-100%);
}

.brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--green-600), var(--blue-600));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(75, 111, 74, 0.4);
}

.brand h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.brand p {
  font-size: 11px;
  opacity: 0.7;
  margin: 0;
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.75);
  padding: 12px 20px;
  border-radius: 12px;
  margin: 4px 16px;
  transition: all 0.25s;
  font-weight: 500;
}

.sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

.sidebar .nav-link.active {
  background: rgba(75, 111, 74, 0.35);
  color: white;
  font-weight: 600;
  border-left: 4px solid var(--green-500);
}

.sidebar-footer {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  opacity: 0.7;
}

/* Main Content */
.main-content {
  margin-left: 280px;
  min-height: 100vh;
  background: var(--bg);
  transition: margin-left 0.3s ease;
}

.main-content.full-width {
  margin-left: 0;
}

/* Header */
.top-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: blur(10px);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.notification-icon {
  position: relative;
  cursor: pointer;
  padding: 8px;
}

.notification-icon::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: var(--amber-500);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* Cards */
.stat-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--green-600), var(--blue-600));
}

.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  margin: 8px 0;
}

/* Pills/Badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.pill.pending {
  background: rgba(58, 110, 165, 0.15);
  color: var(--blue-600);
}

.pill.approved {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.pill.rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.pill.normal {
  background: rgba(75, 111, 74, 0.15);
  color: var(--green-600);
}

.pill.warn {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.pill.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.pill.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Type Badges */
.type-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.type-badge.in {
  background: rgba(34, 197, 94, 0.2);
  color: #16a34a;
}

.type-badge.out {
  background: rgba(239, 68, 68, 0.2);
  color: #dc2626;
}

/* Level Badge */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.level-badge.info {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.level-badge.warning {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.level-badge.critical {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Timeline (for Log Aktivitas) */
.timeline {
  position: relative;
  padding: 20px 0;
}

.timeline-item {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: -24px;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 600;
  z-index: 1;
}

.timeline-icon.info {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.timeline-icon.warning {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.timeline-icon.critical {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.timeline-content {
  flex: 1;
  padding: 16px 20px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-title {
  font-weight: 600;
  font-size: 15px;
}

.timeline-time {
  font-size: 13px;
  color: #6b7280;
}

.timeline-desc {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}

.timeline-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #6b7280;
}

/* Buttons */
.btn-primary {
  background: var(--green-600);
  border: none;
  color: white;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--green-500);
  color: white;
}

.btn-outline-primary {
  border: 1.5px solid var(--blue-600);
  color: var(--blue-600);
  font-weight: 600;
}

.btn-outline-primary:hover {
  background: var(--blue-600);
  color: white;
}

.btn-outline-secondary {
  border: 1.5px solid var(--border);
  color: #6b7280;
  font-weight: 600;
}

.btn-outline-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: #111827;
}

.btn-danger {
  background: var(--red-600);
  border: none;
  color: white;
  font-weight: 600;
}

.btn-danger:hover {
  background: #8a2828;
  color: white;
}

/* Table */
.table-custom {
  background: var(--surface);
}

.table-custom thead th {
  background: var(--surface-2);
  color: #6b7280;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border: none;
  padding: 16px 20px;
}

.table-custom tbody td {
  padding: 16px 20px;
  vertical-align: middle;
  border-top: 1px solid var(--border);
}

.table-custom tbody tr:hover {
  background: var(--surface-2);
}

/* Toast */
.toast-custom {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 14px 32px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 9999;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show-mobile {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1039;
  }

  .overlay.show {
    display: block;
  }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .table-custom {
  color: #e2e8f0;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: var(--surface);
  color: white;
  border-color: var(--border);
}

[data-theme="dark"] .timeline-content {
  background: var(--surface);
}

[data-theme="dark"] .btn-outline-secondary:hover {
  color: #e2e8f0;
}
