:root {
  --primary: #123c69;
  --primary-2: #0f2f52;
  --accent: #1f9d55;
  --bg: #f5f7fb;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  color: #1f2937;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 1030;
}

.main-content {
  margin-left: 260px;
  padding: 24px;
  width: calc(100% - 260px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--primary);
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 22px;
  flex: 0 0 auto;
}

.nav-link {
  color: #374151;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  background: #eaf1f8;
  color: var(--primary);
  font-weight: 600;
}

.nav-heading {
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  font-weight: bold;
  padding-left: 12px;
}

.topbar {
  background: #fff;
  padding: 16px 18px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
  flex: 0 0 auto;
}

.user-pill {
  font-size: 13px;
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 14px;
  line-height: 1.1;
}

.card-soft {
  border: 0;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
}

.stat-card {
  border: 0;
  border-radius: 18px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
}

.stat-card .label {
  font-size: 13px;
  color: #6b7280;
}

.stat-card .value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-2);
  border-color: var(--primary-2);
}

.table {
  vertical-align: middle;
}

.badge-soft {
  background: #eaf1f8;
  color: var(--primary);
}

.pos-product {
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.pos-product:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.08);
}

.mobile-menu-btn,
.sidebar-close-btn {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* FOOTER BAWAH HALAMAN */
.app-footer {
  margin-top: auto;
  padding: 28px 10px 4px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.5;
  flex: 0 0 auto;
}

.app-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--primary-2);
  text-decoration: underline;
}

/* MOBILE RESPONSIVE SIDEBAR */
@media (max-width: 900px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    width: 280px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 1050 !important;
    transform: translateX(-105%) !important;
    transition: transform 0.22s ease !important;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    border-right: 1px solid #e5e7eb;
    background: #fff;
    overflow-y: auto;
  }

  body.sidebar-open .sidebar,
  .sidebar.sidebar-open {
    transform: translateX(0) !important;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.22s ease,
      visibility 0.22s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    min-height: 100vh;
    padding: 14px !important;
    display: flex;
    flex-direction: column;
  }

  .topbar {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px !important;
    align-items: flex-start !important;
  }

  .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar-left h4 {
    font-size: 18px;
    line-height: 1.25;
  }

  .topbar-left small {
    font-size: 12px;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .warung-switch-form {
    flex: 1 1 auto;
    min-width: 170px;
  }

  .warung-switch-form select {
    width: 100%;
  }

  .mobile-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 6px 16px rgba(18, 60, 105, 0.22);
  }

  .mobile-menu-btn:active {
    transform: scale(0.97);
  }

  .sidebar-close-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #f3f4f6;
    color: #374151;
    font-size: 24px;
    line-height: 1;
  }

  .sidebar .nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  .sidebar .nav-link {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
  }

  .nav-heading {
    margin-top: 12px;
  }

  .user-pill {
    font-size: 12px;
    padding: 7px 10px;
  }

  .table-responsive {
    border-radius: 12px;
  }

  .stat-card .value {
    font-size: 21px;
  }

  .app-footer {
    margin-top: auto;
    padding: 24px 10px 10px;
    font-size: 11px;
  }
}

/* DESKTOP LOCK */
@media (min-width: 901px) {
  .mobile-menu-btn,
  .sidebar-close-btn,
  .sidebar-backdrop {
    display: none !important;
  }

  body.sidebar-open {
    overflow: auto;
  }

  .sidebar {
    transform: none !important;
  }
}
