:root {
  --pv-primary: #2563eb;
  --pv-primary-dark: #1d4ed8;
  --pv-bg: #f4f6f9;
  --pv-sidebar-bg: #111827;
  --pv-sidebar-active: #2563eb;
  --pv-text-muted: #6c757d;
  --pv-danger: #dc3545;
  --pv-warning: #fd7e14;
  --pv-success: #198754;
}

body {
  background-color: var(--pv-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------- Login page ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--pv-primary) 0%, #172554 100%);
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card .brand-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--pv-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 12px;
}

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

.sidebar {
  width: 250px;
  background: var(--pv-sidebar-bg);
  color: #d8d4e3;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .25s ease;
}
.sidebar .brand {
  padding: 20px 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .nav-link {
  color: #c9c4d8;
  padding: 11px 18px;
  border-radius: 0;
  font-size: .93rem;
  display: flex; align-items: center; gap: 10px;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active {
  background: var(--pv-sidebar-active);
  color: #fff;
  font-weight: 600;
}
.sidebar .nav-section-title {
  padding: 16px 18px 6px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #8b84a3;
}

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

.topbar {
  background: #fff;
  border-bottom: 1px solid #e9e9ef;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 1020;
}

.content-area { padding: 20px; flex: 1; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; }
  .sidebar-backdrop.show { display: block; }
}

/* ---------- Cards / widgets ---------- */
.stat-card {
  border: none;
  border-radius: 14px;
  padding: 18px;
  color: #fff;
  height: 100%;
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card .stat-label { font-size: .82rem; opacity: .9; }

.bg-grad-purple { background: linear-gradient(135deg,#2563eb,#60a5fa); }
.bg-grad-green  { background: linear-gradient(135deg,#198754,#34c780); }
.bg-grad-orange { background: linear-gradient(135deg,#fd7e14,#ffab53); }
.bg-grad-red    { background: linear-gradient(135deg,#dc3545,#f0616f); }

.card { border: none; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-header { background: #fff; border-bottom: 1px solid #f0f0f4; border-radius: 14px 14px 0 0 !important; font-weight: 600; }

.table thead th { font-size: .78rem; text-transform: uppercase; color: var(--pv-text-muted); border-bottom-width: 1px; }
.badge-status-lunas { background: #d1f2e2; color: #0f7a45; }
.badge-status-belum { background: #fde3e3; color: #c22b2b; }
.badge-overdue { background: #fde3e3; color: #c22b2b; }
.badge-duesoon { background: #fff1d6; color: #a5680b; }

/* ---------- POS screen ---------- */
.pos-product-card {
  border: 1px solid #ececf3;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  background: #fff;
  transition: all .15s ease;
  height: 100%;
}
.pos-product-card:hover { border-color: var(--pv-primary); box-shadow: 0 4px 14px rgba(111,66,193,.15); }
.pos-product-card .name { font-weight: 600; font-size: .92rem; }
.pos-product-card .price { color: var(--pv-primary); font-weight: 700; font-size: .9rem; }

.cart-item { border-bottom: 1px solid #f0f0f4; padding: 10px 0; }
.qty-box { width: 60px; }

/* ---------- Receipt / struk ---------- */
.receipt {
  max-width: 340px;
  margin: 0 auto;
  background: #fff;
  padding: 20px;
  font-family: 'Courier New', monospace;
  font-size: .85rem;
}
.receipt hr { border-top: 1px dashed #999; }
@media print {
  .no-print { display: none !important; }
  .sidebar, .topbar { display: none !important; }
  .main-content { margin-left: 0 !important; width: 100% !important; }
  body { background: #fff; }
}

.low-stock-row { background: #fff8ec; }
