/* Global tokens */
:root {
  --primary-green: #2ecc71;
  --dark-green: #27ae60;
  --bg-body: #f0f2f5;
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 80px;
  --float-gap: 22px;
}

html,
body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-body);
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--float-gap);
  left: var(--float-gap);
  bottom: var(--float-gap);
  width: var(--sidebar-width);
  background-color: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  z-index: 3000;
  padding-top: 30px;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  overflow: visible;
  max-width: calc(100vw - (2 * var(--float-gap)));
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  z-index: -1;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 24px;
  padding-right: 6px;
}

.sidebar-footer {
  padding: 16px;
  margin-top: auto;
  border-top: 1px solid #eef2f5;
  background: #f9fafb;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
}

.sidebar-footer .btn {
  width: 100%;
  border-radius: 12px;
  border-width: 1px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 10px;
  box-shadow: none;
}

.sidebar-footer .btn .btn-label {
  white-space: nowrap;
}

.sidebar-footer .btn-outline-danger {
  color: #c53a3f;
  border-color: #e5e7eb;
  background: #ffffff;
}

.sidebar-footer .btn-outline-danger:hover,
.sidebar-footer .btn-outline-danger:focus-visible {
  color: #b12f34;
  border-color: #f0c2c4;
  background: #fff4f4;
  box-shadow: 0 3px 10px rgba(177, 47, 52, 0.12);
}

.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-green);
  margin-bottom: 40px;
  white-space: nowrap;
  transition: all 0.3s;
}

.sidebar-brand i {
  font-size: 1.8rem;
  margin-right: 10px;
}

.sidebar.collapsed .sidebar-brand span {
  display: none;
}

.sidebar.collapsed .sidebar-brand i {
  margin-right: 0;
}

.sidebar.collapsed .sidebar-footer {
  padding: 12px;
}

.sidebar.collapsed .sidebar-footer .btn {
  width: 48px;
  padding: 10px;
  border-radius: 14px;
  gap: 0;
}

.sidebar.collapsed .sidebar-footer .btn .btn-label {
  display: none;
}

/* Nav links */
.nav-link {
  color: #566573;
  font-weight: 600;
  padding: 13px 16px;
  margin: 2px 12px 6px 12px;
  border-radius: 12px;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.nav-link:hover {
  background-color: #f6fbf8;
  color: var(--dark-green);
  border-color: #e4f5eb;
}

.nav-link.active {
  background-color: #eafaf1;
  color: #1f8f4d;
  box-shadow: 0 4px 14px rgba(46, 204, 113, 0.18);
  border-color: #cdeede;
  font-weight: 700;
}

.nav-link i {
  font-size: 1.2rem;
  min-width: 30px;
  display: flex;
  justify-content: center;
}

.nav-link span {
  margin-left: 10px;
  transition: opacity 0.3s;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding-left: 12px;
  padding-right: 12px;
}

.sidebar.collapsed .nav-link span {
  opacity: 0;
  width: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-toggle span {
  opacity: 0;
  width: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-toggle {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}

.sidebar.collapsed .submenu {
  display: none !important;
}

.nav-section {
  margin: 10px 12px 4px 12px;
}

.nav-section-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: #3d4c59;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.3px;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

.nav-section-toggle .chevron {
  margin-left: auto;
}

.nav-section-toggle i.bi:not(.chevron) {
  color: var(--primary-green);
  flex-shrink: 0;
}

.nav-section-toggle:hover,
.nav-section-toggle:focus-visible {
  background: #f6fbf8;
  border-color: #e4f5eb;
  outline: none;
}

.nav-section-toggle .chevron {
  transition: transform 0.25s ease, color 0.25s ease;
  color: #8ca1b1;
}

.nav-section-toggle.open .chevron {
  transform: rotate(90deg);
  color: var(--dark-green);
}

.nav-section-toggle.open {
  background: #eafaf1;
  border-color: #cdeede;
  color: #1f8f4d;
  box-shadow: 0 4px 14px rgba(46, 204, 113, 0.12);
}

.submenu {
  display: none;
  padding: 4px 0 6px 0;
}

.submenu.show {
  display: block;
}

.submenu .nav-link {
  margin: 4px 10px;
  padding: 11px 14px;
  border-radius: 10px;
  border-left: 3px solid transparent;
}

.submenu .nav-link.active {
  border-left-color: var(--primary-green);
}

/* Toggle */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -12px;
  width: 34px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid #cdeede;
  background-color: #ffffff;
  box-shadow: 0 8px 18px rgba(46, 204, 113, 0.14);
  display: grid;
  place-items: center;
  color: var(--primary-green);
  transition: all 0.28s ease;
  transform: translate(0, -50%);
  overflow: visible;
}

.sidebar-toggle::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  background: radial-gradient(circle, rgba(46, 204, 113, 0.12) 0%, rgba(46, 204, 113, 0) 65%);
  opacity: 0.75;
  z-index: -1;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.sidebar-toggle:hover {
  background-color: var(--primary-green);
  color: #ffffff;
  transform: translate(0, -50%) scale(1.04);
}

.sidebar-toggle:hover::after {
  transform: scale(1.06);
  opacity: 0.95;
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

/* Main wrapper */
.main {
  margin-left: calc(var(--sidebar-width) + var(--float-gap) + 16px);
  margin-right: calc(var(--float-gap) + 10px);
  margin-top: var(--float-gap);
  margin-bottom: var(--float-gap);
  transition: margin-left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  min-height: 100vh;
}

.main.collapsed {
  margin-left: calc(var(--sidebar-width-collapsed) + var(--float-gap) + 16px);
}

/* Topbar */
.topbar {
  background-color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: var(--float-gap);
  z-index: 1000;
}

.topbar .search-box {
  position: relative;
  min-width: 260px;
}

.topbar .search-box input {
  padding-left: 38px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  box-shadow: none;
}

.topbar .search-box i {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: #9e9e9e;
}

/* Badges */
.status-badge {
  padding: 6px 12px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.85rem;
}

.status-green {
  background: #eafaf1;
  color: #27ae60;
}

.status-yellow {
  background: #fff9e6;
  color: #f39c12;
}

.status-red {
  background: #ffeaea;
  color: #e74c3c;
}

/* Table card */
.card-table {
  background-color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  padding: 14px 20px;
}

/* Tables */
.table-sim-wrapper {
  border: 1px solid #e6edf3;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.table-sim-wrapper.table-responsive {
  overflow-x: auto;
}

.table-sim {
  margin-bottom: 0;
  color: #2f343a;
  border-color: #e6edf3;
  font-size: 0.95rem;
}

.table-sim thead th {
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  border-bottom: 1px solid #0b1221;
  padding: 16px 18px;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.table-sim tbody td {
  padding: 14px 18px;
  vertical-align: middle;
  border-bottom: 1px solid #eef1f5;
}

.table-sim tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.table-sim tbody tr:hover {
  background: #f4f7fb;
}

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

.table-sim .badge {
  border-radius: 10px;
  font-weight: 700;
}

.table-sim.table-bordered th,
.table-sim.table-bordered td {
  border: 1px solid #e6edf3;
}

.table-sim.table-bordered tbody tr:last-child td {
  border-bottom: 1px solid #e6edf3;
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    border-radius: 0;
    box-shadow: none;
    transform: translateX(-100%);
    padding-top: 20px;
    overflow: hidden;
  }

  .sidebar.mobile-expanded {
    transform: translateX(0);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    overflow: visible;
  }

  .sidebar-toggle {
    display: none;
  }

  .main {
    margin: 0;
    padding: 16px;
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1.5px solid #cdeede;
    border-radius: 12px;
    background: #eafaf1;
    color: var(--dark-green);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
  }

  .mobile-menu-btn:hover,
  .mobile-menu-btn:active {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: #fff;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
  }

  .topbar {
    top: 0;
    border-radius: 0 0 14px 14px;
  }
}

/* Laporan keuangan helpers */
.card-hero {
  background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
  color: #fff;
}

.card-hero h1,
.card-hero h6,
.card-hero small {
  color: #fff;
}

.table-kpi td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.table-separator-top {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.box-gross-profit {
  background: #fff;
  border: 1px solid #f0ad4e;
  border-radius: 0.4rem;
  padding: 1rem;
}

.alert-asset {
  background-color: #e9f4ff;
  border: 1px solid #cde7ff;
}

/* Dashboard helpers */
.card-hero-red {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5253 100%);
  color: #fff;
}

.progress-thin {
  height: 8px;
}

.badge-pill-sm {
  font-size: 0.7rem;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
}

/* Utility */
.hint-sm {
  font-size: 0.75rem;
}

.text-2xs {
  font-size: 0.7rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(46, 204, 113, 0.35);
}
