:root {
  --bg-dark: #0f172a;
  --primary-color: #17A897;
  --primary-light: rgba(23, 168, 151, 0.2);
  --glass-bg: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Layout disembunyikan sampai sesi login tervalidasi (dilepas oleh app.js) */
body.auth-pending .app-layout {
  visibility: hidden;
}

img, canvas, svg {
  max-width: 100%;
}

.glass-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
}

.blob-1 {
  width: 300px;
  height: 300px;
  background: rgba(23, 168, 151, 0.25);
  top: -50px;
  left: -50px;
}

.blob-2 {
  width: 250px;
  height: 250px;
  background: rgba(59, 130, 246, 0.2);
  bottom: -50px;
  right: -50px;
}

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

/* ---------- Sidebar (menu pendukung) ---------- */
.sidebar {
  width: 260px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-icon {
  font-size: 24px;
  color: var(--primary-color);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  display: block;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  font-size: 13px;
}

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

.sidebar-top {
  display: flex;
  flex-direction: column;
}

.sidebar-bottom {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--glass-border);
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-logout-full {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout-full:hover {
  background: #f87171;
  color: #fff;
}

/* ---------- Konten utama ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 16px;
  padding-bottom: 90px;
  width: 100%;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.hamburger-btn {
  background: var(--primary-light);
  border: 1px solid var(--glass-border);
  color: var(--primary-color);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.hamburger-btn:hover {
  background: var(--primary-color);
  color: #fff;
}

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

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

/* ---------- Grid dashboard (responsif HP & PC) ---------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  width: 100%;
}

.metric-card {
  width: 100%;
  min-width: 0;
  padding: 16px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.metric-sub {
  font-size: 9px;
}

.text-positive { color: #34d399; }
.text-muted { color: var(--text-muted); }

.icon-teal { color: #17A897; }
.icon-blue { color: #38bdf8; }
.icon-green { color: #34d399; }
.icon-orange { color: #fb923c; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 10px;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.chart-container,
.recent-tx-container {
  padding: 16px;
  width: 100%;
  min-width: 0;
}

.canvas-wrapper {
  position: relative;
  height: 220px;
  margin-top: 12px;
}

.card-title h4 {
  font-size: 14px;
  font-weight: 600;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- Tombol & input ---------- */
.btn-primary {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.export-btn-container {
  display: flex;
  gap: 10px;
  width: 100%;
}

.export-btn-container button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.glass-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 13px;
  outline: none;
}

.glass-input:focus {
  border-color: var(--primary-color);
}

.glass-input option {
  background: #1e293b;
  color: #fff;
}

.form-group label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0;
}

/* ---------- Baris daftar (hutang, stok, pengeluaran, pelanggan) ---------- */
.row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.row-item > div:first-child {
  min-width: 0;
}

.btn-mini {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  border: 1px solid;
}

.btn-mini-blue { background: rgba(56, 189, 248, 0.2); border-color: #38bdf8; color: #38bdf8; }
.btn-mini-red { background: rgba(248, 113, 113, 0.2); border-color: #f87171; color: #f87171; }
.btn-mini-green { background: rgba(52, 211, 153, 0.2); border-color: #34d399; color: #34d399; }

.debt-total {
  padding: 8px 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.debt-total strong {
  color: #f87171;
}

.badge-debt {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  border-radius: 0;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 99;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
}

.bottom-nav-item.active {
  color: var(--primary-color);
  font-weight: 600;
}

/* ---------- Tabel riwayat (geser horizontal) ---------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tx-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 12px;
  text-align: left;
}

.tx-table th {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 10px;
  border-bottom: 1px solid var(--glass-border);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.tx-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
}

.tx-table tr:hover td {
  background: rgba(23, 168, 151, 0.05);
}

.tx-action-btns {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.tx-action-btns button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
}

.tx-action-btns button.btn-receipt {
  color: var(--primary-color);
  background: var(--primary-light);
}

.tx-action-btns button.btn-delete {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

/* ---------- Toast ---------- */
#custom-toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(52, 211, 153, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* toast tidak pernah boleh menghalangi klik */
  transition: all 0.3s ease;
  width: 360px;
  max-width: 90%;
}

#custom-toast-container.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

#custom-toast-container .toast-text {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #f8fafc;
}

/* ---------- Modal (konfirmasi & form) ---------- */
.app-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.app-modal-box {
  background: #1e293b;
  border: 1px solid;
  padding: 22px;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  max-height: 90vh;
  overflow-y: auto;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.app-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.app-modal-head i {
  font-size: 20px;
}

.app-modal-head h3 {
  font-size: 16px;
  font-weight: 600;
}

.app-modal-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.app-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.app-btn-ghost,
.app-btn-solid {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
}

.app-btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-btn-solid {
  border: none;
}

.app-btn-solid:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fm-error {
  min-height: 16px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #f87171;
}

/* ---------- Catatan hutang per pelanggan ---------- */
.debt-group {
  padding: 4px 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.debt-group-head {
  border-bottom: none;
  padding-bottom: 6px;
}

.debt-sisa {
  font-size: 14px;
  font-weight: 700;
  color: #f87171;
}

.debt-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 6px 12px;
  margin-left: 4px;
  border-left: 2px solid rgba(248, 113, 113, 0.35);
  font-size: 12px;
}

.debt-line small {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
}

.debt-history-title {
  margin: 22px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fm-info {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #bae6fd;
  font-size: 12px;
  line-height: 1.5;
}

/* ==========================================================
   FITUR BARU v2.2: Pindah Saldo, Komisi & Fee, Kalkulator Uang
   ========================================================== */
.row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.feature-warning {
  margin-bottom: 14px;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
}

.report-rows .row-item span {
  font-size: 12px;
  color: var(--text-muted);
}

.report-rows .row-item strong {
  font-size: 13px;
}

.report-note {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.badge-ok,
.badge-plain {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.badge-ok {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.badge-plain {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
}

/* ---------- Kalkulator uang: kartu dua kolom, tema mengikuti aplikasi ---------- */
.cash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

@media (min-width: 768px) {
  .cash-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.cash-card {
  min-width: 0;
  min-height: 140px;
  padding: 18px 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.cash-card:focus-within,
.cash-card.cash-filled {
  border-color: rgba(23, 168, 151, 0.7);
  background: rgba(23, 168, 151, 0.1);
}

.cash-card-head {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  color: var(--primary-color);
}

.cash-card .cash-qty {
  width: 80%;
  padding: 11px 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  outline: none;
}

.cash-card .cash-qty::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.cash-card .cash-qty:focus {
  border-color: var(--primary-color);
}

.cash-sub {
  align-self: flex-start;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-main);
  word-break: break-word;
}

.cash-sub:empty {
  display: none;
}

.cash-summary {
  padding: 18px;
}

.cash-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.cash-summary-label {
  font-size: 11px;
  color: var(--text-muted);
}

.cash-total {
  font-size: 22px;
  font-weight: 800;
  color: #34d399;
}

.cash-pieces {
  font-size: 16px;
  font-weight: 700;
}

.cash-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.cash-actions .btn-primary {
  justify-content: center;
}

/* ---------- Logo Nexora ---------- */
.brand-logo {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(23, 168, 151, 0.35));
}

.brand-logo[hidden],
.brand-icon[hidden],
.top-bar-logo[hidden] {
  display: none !important;
}

.top-bar-logo {
  height: 30px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(23, 168, 151, 0.35));
}

/* HP kecil: hanya ikon logo, sedikit lebih ringkas supaya judul tidak terpotong */
@media (max-width: 400px) {
  .top-bar {
    gap: 10px;
  }

  .top-bar-logo {
    height: 26px;
  }
}

/* ---------- PWA: tombol pasang & banner offline ---------- */
.btn-install-app {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 168, 151, 0.45);
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-install-app:hover {
  background: var(--primary-color);
  color: #fff;
}

.btn-install-app[hidden] {
  display: none !important;
}

#offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: #b45309;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  transform: translateY(-110%);
  transition: transform 0.3s ease;
  pointer-events: none;
}

#offline-bar.show {
  transform: translateY(0);
}

#offline-bar.online {
  background: #0f766e;
}



/* ==========================================
   FILTER TANGGAL RIWAYAT TRANSAKSI
   ========================================== */
.tx-filter-card { padding: 14px 16px; margin-bottom: 14px; }
.tx-filter-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.tx-filter-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tx-filter-chips::-webkit-scrollbar { display: none; }
.tx-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tx-chip:hover { color: var(--text-main); border-color: rgba(255, 255, 255, 0.25); }
.tx-chip.active { background: var(--primary-light); border-color: var(--primary-color); color: var(--primary-color); }
@media (min-width: 768px) { .tx-filter-chips { flex-wrap: wrap; overflow-x: visible; } }

.tx-filter-custom { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--glass-border); }
.tx-filter-custom[hidden], .tx-filter-active[hidden] { display: none; }
.tx-filter-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tx-filter-dates label { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.tx-filter-dates .glass-input { width: 100%; color-scheme: dark; }
.tx-filter-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tx-filter-actions .btn-primary { font-size: 12px; padding: 8px 14px; }
.tx-btn-ghost { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-main); }
.tx-filter-hint { margin-top: 8px; font-size: 11px; color: var(--text-muted); }
@media (max-width: 480px) {
  .tx-filter-dates { grid-template-columns: 1fr; }
  .tx-filter-actions .btn-primary { flex: 1 1 0; justify-content: center; }
}

.tx-filter-active {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  border: 1px solid rgba(23, 168, 151, 0.4);
}
.tx-filter-active-text { font-size: 12px; font-weight: 600; color: var(--primary-color); min-width: 0; overflow-wrap: anywhere; }
.tx-filter-clear {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.tx-filter-clear:hover { background: rgba(255, 255, 255, 0.15); }


/* ==========================================
   PEMILIH KUSTOM (pengganti tampilan <select>)
   ========================================== */
.pk-wrap { position: relative; width: 100%; }
/* <select> asli tetap ada (sumber nilai & validasi "required"), hanya disembunyikan secara visual */
.pk-wrap > .pk-native {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.pk-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.pk-trigger .pk-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-trigger .pk-caret { flex-shrink: 0; font-size: 11px; color: var(--text-muted); transition: transform 0.2s ease; }
.pk-trigger[aria-expanded="true"] { border-color: var(--primary-color); }
.pk-trigger[aria-expanded="true"] .pk-caret { transform: rotate(180deg); }
.pk-trigger:focus-visible { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-light); }
.pk-trigger.pk-placeholder .pk-label { color: var(--text-muted); }
.pk-trigger.pk-invalid { border-color: #f87171; }
.pk-trigger:disabled { opacity: 0.5; cursor: not-allowed; }

body.pk-lock { overflow: hidden; }
.pk-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.pk-overlay[hidden] { display: none; }
.pk-overlay.pk-open { opacity: 1; }

.pk-sheet {
  width: min(100%, 420px);
  max-height: min(80vh, 640px);
  max-height: min(80dvh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.18s ease;
}
.pk-open .pk-sheet { transform: none; }

.pk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--glass-border); }
.pk-head h5 { font-size: 13px; font-weight: 600; color: var(--text-muted); min-width: 0; overflow-wrap: anywhere; }
.pk-close { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.06); color: var(--text-main); cursor: pointer; }
.pk-close:hover { background: rgba(255, 255, 255, 0.14); }

.pk-search { position: relative; padding: 10px 16px; border-bottom: 1px solid var(--glass-border); }
.pk-search[hidden] { display: none; }
.pk-search i { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-muted); }
.pk-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 13px;
  outline: none;
}
.pk-search input:focus { border-color: var(--primary-color); }

.pk-list { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pk-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-main);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pk-item:last-child { border-bottom: 0; }
.pk-item:hover, .pk-item:focus-visible { background: rgba(255, 255, 255, 0.07); outline: none; }
.pk-item[aria-selected="true"] { background: var(--primary-light); }
.pk-item:disabled { opacity: 0.4; cursor: not-allowed; }
.pk-item-text { min-width: 0; overflow-wrap: anywhere; }
.pk-item-empty .pk-item-text { color: var(--text-muted); }
.pk-radio { flex-shrink: 0; position: relative; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-muted); }
.pk-item[aria-selected="true"] .pk-radio { border-color: var(--primary-color); }
.pk-item[aria-selected="true"] .pk-radio::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary-color); }
.pk-empty { padding: 22px 20px; text-align: center; font-size: 13px; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .pk-overlay, .pk-sheet, .pk-trigger, .pk-caret { transition: none; }
}

/* ==========================================
   KASIR: pencarian produk, keranjang, pembayaran
   Memakai variabel tema yang sama (teal #17A897, kartu kaca, Plus Jakarta Sans)
   ========================================== */
#page-voucher [hidden] { display: none !important; }

.kasir-wrap { max-width: 720px; margin: 0 auto; }
.kasir-head { margin-bottom: 14px; gap: 10px; }
.kasir-add-btn { font-size: 12px; padding: 8px 12px; white-space: nowrap; flex-shrink: 0; }
.kasir-back { padding: 8px 12px; font-size: 12px; flex-shrink: 0; }

.kasir-card { padding: 16px; margin-bottom: 14px; }
.kasir-card .form-group + .form-group,
.kasir-card .kasir-hint + .form-group { margin-top: 12px; }
.kasir-card input[type="datetime-local"] { color-scheme: dark; min-height: 42px; }
.kasir-hint { display: block; margin-top: 8px; font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }

/* ---- Pencarian + hasil live ---- */
.kasir-search { position: relative; z-index: 20; margin-bottom: 14px; }
.kasir-search-box { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 48px; transition: border-color 0.2s, box-shadow 0.2s; }
.kasir-search-box:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-light); }
.kasir-search-box i { color: var(--text-muted); font-size: 14px; }
.kasir-search-box input { flex: 1; min-width: 0; height: 100%; background: transparent; border: none; outline: none; color: #fff; font-size: 14px; }
.kasir-search-box input::placeholder { color: var(--text-muted); }

.kasir-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  max-height: min(55vh, 420px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #1e293b; border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}
.kasir-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.kasir-result:last-child { border-bottom: none; }
.kasir-result-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-muted); }
.kasir-result-info strong { color: #fff; font-size: 14px; overflow-wrap: anywhere; }
.kasir-result-info b { color: #34d399; font-weight: 700; }
.kasir-stock-out { color: #f87171; }
.kasir-add {
  flex-shrink: 0; padding: 10px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  font-size: 12px; font-weight: 700; color: var(--primary-color);
  background: var(--primary-light); border: 1px solid rgba(23, 168, 151, 0.55);
}
.kasir-add:active { transform: scale(0.97); }
.kasir-add:disabled { opacity: 0.45; cursor: not-allowed; }
.kasir-noresult { padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---- Keranjang ---- */
.kasir-cart-card { padding: 0; overflow: hidden; margin-bottom: 14px; }
.kasir-cart-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid var(--glass-border); }
.kasir-empty { text-align: center; padding: 30px 16px; color: var(--text-muted); font-size: 12px; }
.kasir-empty i { display: block; margin-bottom: 10px; font-size: 34px; color: var(--primary-color); }
.kasir-empty strong { display: block; margin-bottom: 4px; font-size: 14px; color: #fff; }

.kasir-item { padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.kasir-item:last-child { border-bottom: none; }
.kasir-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.kasir-item-name { font-size: 14px; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.kasir-item-del { flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: #f87171; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.4); }
.kasir-item-bottom { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.kasir-pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-main); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-border); }
.kasir-qty { display: inline-flex; align-items: center; gap: 6px; }
.kasir-qty button { width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 16px; font-weight: 700; color: #fff; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--glass-border); }
.kasir-qty button:active { background: var(--primary-light); }
.kasir-qty input { width: 48px; height: 34px; text-align: center; font-size: 14px; font-weight: 600; color: #fff; outline: none; border-radius: 10px; background: rgba(15, 23, 42, 0.6); border: 1px solid var(--glass-border); }
.kasir-qty input:focus { border-color: var(--primary-color); }
.kasir-item-sub { margin-left: auto; font-size: 14px; color: #34d399; font-variant-numeric: tabular-nums; }
.kasir-item-meta { display: block; margin-top: 8px; font-size: 11px; color: var(--text-muted); }
.kasir-item-meta.warn { color: #fbbf24; font-weight: 600; }

.kasir-total-bar { padding: 14px 16px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 12px; }
.kasir-total-row { display: flex; justify-content: space-between; align-items: baseline; }
.kasir-total-row span { font-size: 12px; color: var(--text-muted); }
.kasir-total-row strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.kasir-btn-next { width: 100%; justify-content: center; padding: 14px; font-size: 14px; background: linear-gradient(135deg, #22c55e, #16a34a); }

/* ---- Pembayaran ---- */
.kasir-pay-total { padding: 16px; margin-bottom: 14px; text-align: center; border-color: rgba(23, 168, 151, 0.45); }
.kasir-pay-total span { display: block; font-size: 12px; color: var(--text-muted); }
.kasir-pay-total strong { display: block; margin: 2px 0; font-size: 28px; color: var(--primary-color); font-variant-numeric: tabular-nums; }
.kasir-pay-total small { font-size: 11.5px; color: var(--text-muted); }
.kasir-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kasir-card .kasir-two .form-group { margin: 0; min-width: 0; }
.kasir-paid-input { font-size: 18px; font-weight: 700; padding: 12px 14px; font-variant-numeric: tabular-nums; }

.kasir-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.kq { padding: 13px 8px; border-radius: var(--radius-md); font-size: 14px; font-weight: 700; cursor: pointer; border: 1px solid; transition: transform 0.1s; }
.kq:active { transform: scale(0.97); }
.kq-wide { grid-column: 1 / -1; }
.kq-blue   { color: #60a5fa; background: rgba(59, 130, 246, 0.16); border-color: rgba(96, 165, 250, 0.55); }
.kq-green  { color: #34d399; background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.55); }
.kq-amber  { color: #fbbf24; background: rgba(251, 191, 36, 0.16); border-color: rgba(251, 191, 36, 0.55); }
.kq-red    { color: #f87171; background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.55); }
.kq-violet { color: #c4b5fd; background: rgba(139, 92, 246, 0.2); border-color: rgba(167, 139, 250, 0.55); }

.kasir-status { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 14px; margin-bottom: 10px; border-radius: var(--radius-md); font-size: 14px; font-weight: 700; text-align: center; border: 1px solid; font-variant-numeric: tabular-nums; }
.kasir-status.ok   { color: #34d399; background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.4); }
.kasir-status.warn { color: #fbbf24; background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.4); }
.kasir-status.info { color: #38bdf8; background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.4); }

/* Tombol aksi menempel di atas menu bawah (tinggi menu bawah = 65px) */
.kasir-actions {
  position: sticky; bottom: calc(73px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin-top: 8px; padding: 10px;
  background: rgba(15, 23, 42, 0.92); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.kasir-actions .btn-primary { justify-content: center; padding: 12px 6px; font-size: 13px; }
.kasir-act-print { background: #16a34a; }
.kasir-act-cancel { background: #475569; }

@media (max-width: 360px) {
  .kasir-actions .btn-primary i { display: none; }
  .kasir-item-sub { margin-left: 0; flex-basis: 100%; text-align: right; }
}

/* ---------- Mutasi Rekening (buku mutasi) ---------- */
.ledger-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ledger-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.ledger-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  min-width: 0;
}

.ledger-card small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ledger-card strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ledger-card .ledger-sub {
  margin: 4px 0 0;
  font-size: 10px;
  color: var(--text-muted);
}

.ledger-ok { color: #34d399; }
.ledger-warn { color: #fbbf24; }
.ledger-in-text { color: #34d399; }
.ledger-out-text { color: #f87171; }

.ledger-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ledger-row:last-child {
  border-bottom: none;
}

.ledger-ic {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.ledger-ic.in { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.ledger-ic.out { background: rgba(248, 113, 113, 0.15); color: #f87171; }

.ledger-main {
  flex: 1;
  min-width: 0;
}

.ledger-main strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.ledger-main .ledger-note {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-main small {
  font-size: 10px;
  color: var(--text-muted);
}

.ledger-amt {
  text-align: right;
  flex-shrink: 0;
}

.ledger-amt b {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.ledger-amt small {
  font-size: 10px;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .ledger-summary {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Atribut hidden harus menang atas display bawaan tombol */
.btn-primary[hidden] {
  display: none !important;
}

