/* =====================================================================
   TEOVA POS - Stylesheet Utama
   Tema via CSS variables -> mudah diganti (teal/purple/cocoa/green)
   Warna TIDAK di-hardcode di file lain; cukup ubah [data-theme].
   ===================================================================== */

:root,
[data-theme="teal"] {
  /* v2.5.20: VERSI CSS — dibaca app.js via getComputedStyle. Bila browser/SW
     menyajikan CSS basi (akar "dibayar/kembalian melebar tanpa padding",
     quick-cash hilang, tombol terasa mati), nilainya beda -> self-heal
     otomatis (reload + bersihkan service worker & cache). */
  --teova-css-ver: '2.6.5';
  --brand:        #0d9488;
  --brand-dark:   #0f766e;
  --brand-darker: #115e59;
  --brand-light:  #ccfbf1;
  --brand-soft:   #f0fdfa;
  --bg:           #f4f6f8;
  --surface:      #ffffff;
  --text:         #1f2937;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --danger:       #dc2626;
  --warning:      #d97706;
  --success:      #16a34a;
  --info:         #0284c7;
  --radius:       14px;
  --radius-sm:    10px;
  --shadow:       0 2px 10px rgba(15, 118, 110, .08);
  --shadow-lg:    0 10px 30px rgba(15, 118, 110, .14);
}
[data-theme="purple"] {
  --brand: #7c3aed; --brand-dark: #6d28d9; --brand-darker: #5b21b6;
  --brand-light: #ede9fe; --brand-soft: #f5f3ff;
  --shadow: 0 2px 10px rgba(124, 58, 237, .08);
  --shadow-lg: 0 10px 30px rgba(124, 58, 237, .14);
}
[data-theme="cocoa"] {
  --brand: #795548; --brand-dark: #5d4037; --brand-darker: #4e342e;
  --brand-light: #efebe9; --brand-soft: #faf6f4;
  --shadow: 0 2px 10px rgba(121, 85, 72, .08);
  --shadow-lg: 0 10px 30px rgba(121, 85, 72, .14);
}
[data-theme="green"] {
  --brand: #16a34a; --brand-dark: #15803d; --brand-darker: #166534;
  --brand-light: #dcfce7; --brand-soft: #f0fdf4;
  --shadow: 0 2px 10px rgba(22, 163, 74, .08);
  --shadow-lg: 0 10px 30px rgba(22, 163, 74, .14);
}
/* v2.5.4: 5 tema baru — soft & colorful */
[data-theme="pink"] {
  --brand: #ec4899; --brand-dark: #db2777; --brand-darker: #be185d;
  --brand-light: #fce7f3; --brand-soft: #fdf2f8;
  --shadow: 0 2px 10px rgba(236, 72, 153, .08);
  --shadow-lg: 0 10px 30px rgba(236, 72, 153, .14);
}
[data-theme="sky"] {
  --brand: #0ea5e9; --brand-dark: #0284c7; --brand-darker: #0369a1;
  --brand-light: #e0f2fe; --brand-soft: #f0f9ff;
  --shadow: 0 2px 10px rgba(14, 165, 233, .08);
  --shadow-lg: 0 10px 30px rgba(14, 165, 233, .14);
}
[data-theme="indigo"] {
  --brand: #6366f1; --brand-dark: #4f46e5; --brand-darker: #4338ca;
  --brand-light: #e0e7ff; --brand-soft: #eef2ff;
  --shadow: 0 2px 10px rgba(99, 102, 241, .08);
  --shadow-lg: 0 10px 30px rgba(99, 102, 241, .14);
}
[data-theme="orange"] {
  --brand: #f97316; --brand-dark: #ea580c; --brand-darker: #c2410c;
  --brand-light: #ffedd5; --brand-soft: #fff7ed;
  --shadow: 0 2px 10px rgba(249, 115, 22, .08);
  --shadow-lg: 0 10px 30px rgba(249, 115, 22, .14);
}
[data-theme="berry"] {
  --brand: #d946ef; --brand-dark: #c026d3; --brand-darker: #a21caf;
  --brand-light: #fae8ff; --brand-soft: #fdf4ff;
  --shadow: 0 2px 10px rgba(217, 70, 239, .08);
  --shadow-lg: 0 10px 30px rgba(217, 70, 239, .14);
}

/* ---------------- Base ---------------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
}
a { text-decoration: none; color: var(--brand-dark); }
a:hover { color: var(--brand-darker); }
.cursor-pointer { cursor: pointer; }
.text-muted2 { color: var(--muted); }
.fw-bold2 { font-weight: 700; }

/* ---------------- Layout ---------------- */
.app-wrapper { min-height: 100vh; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: 258px; z-index: 1040;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; }
.sidebar-brand > div { flex: 1; min-width: 0; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: 1px; color: var(--brand-dark); line-height: 1.15; word-break: break-word; }
.brand-slogan { font-size: 10.5px; letter-spacing: 2.5px; color: var(--muted); text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 2px;
  border-radius: var(--radius-sm); color: #4b5563; font-weight: 500; font-size: 14px;
}
.sidebar-nav .nav-item i { font-size: 17px; width: 22px; text-align: center; }
.sidebar-nav .nav-item:hover { background: var(--brand-soft); color: var(--brand-dark); }
.sidebar-nav .nav-item.active { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--brand-light);
  color: var(--brand-dark); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11.5px; color: var(--muted); }
.btn-logout { margin-left: auto; color: var(--muted); font-size: 18px; }
.btn-logout:hover { color: var(--danger); }

.app-main { margin-left: 258px; min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky; top: 0; z-index: 1020; background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 12px 22px;
  display: flex; align-items: center; gap: 14px;
}
.topbar-title { font-size: 18px; font-weight: 700; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.role-badge { background: var(--brand-light); color: var(--brand-dark); padding: 6px 12px; border-radius: 20px; font-weight: 600; }
.btn-burger { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 4px 10px; font-size: 20px; line-height: 1; }
.app-content { padding: 22px; flex: 1; }
.app-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted);
  background: var(--surface);
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }

/* ---------------- Cards & stats ---------------- */
.card-teova {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); border: 0;
}
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; height: 100%;
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center;
  justify-content: center; font-size: 24px; flex-shrink: 0;
  background: var(--brand-light); color: var(--brand-dark);
}
.stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-icon.red { background: #fee2e2; color: #b91c1c; }
.stat-icon.amber { background: #fef3c7; color: #b45309; }
.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-label { font-size: 12.5px; color: var(--muted); margin: 0; }
.stat-value { font-size: 21px; font-weight: 800; margin: 2px 0 0; }
.stat-sub { font-size: 12px; color: var(--muted); margin: 0; }

.section-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; }

/* ---------------- Tables ---------------- */
.table-teova { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-teova thead th {
  background: var(--brand-soft); color: var(--brand-darker); font-size: 12px;
  text-transform: uppercase; letter-spacing: .6px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-teova tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-teova tbody tr:last-child td { border-bottom: 0; }
.table-teova tbody tr:hover td { background: var(--brand-soft); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

/* ---------------- Badges ---------------- */
.badge-st { padding: 5px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700; display: inline-block; }
.st-active, .st-aman, .st-completed, .st-open   { background: #dcfce7; color: #15803d; }
.st-inactive, .st-inactive2, .st-closed          { background: #e5e7eb; color: #4b5563; }
.st-menipis, .st-pending                         { background: #fef3c7; color: #b45309; }
.st-habis, .st-cancelled, .st-low                { background: #fee2e2; color: #b91c1c; }
.st-role { background: var(--brand-light); color: var(--brand-dark); }

/* ---------------- Buttons besar kasir ---------------- */
.btn-brand {
  background: var(--brand); border: 0; color: #fff; font-weight: 700;
  border-radius: var(--radius-sm); padding: 11px 20px;
}
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); color: #fff; }
.btn-brand:disabled { background: #9ca3af; }
.btn-brand-outline {
  border: 1.5px solid var(--brand); color: var(--brand-dark); background: transparent;
  font-weight: 600; border-radius: var(--radius-sm); padding: 9px 18px;
}
.btn-brand-outline:hover { background: var(--brand-soft); color: var(--brand-darker); }
.btn-xl { font-size: 17px; padding: 14px 24px; }

/* ---------------- POS / Kasir ---------------- */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .pos-grid { grid-template-columns: 1fr; } }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 13px; }
.product-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
.product-card:active { transform: scale(.97); }
.product-thumb { width: 100%; aspect-ratio: 1/0.78; object-fit: cover; background: var(--brand-soft); }
.product-body { padding: 10px 12px 12px; }
.product-name { font-size: 13.5px; font-weight: 700; line-height: 1.25; min-height: 34px; }
.product-price { color: var(--brand-dark); font-weight: 800; font-size: 15px; }
.product-meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.chip { background: var(--brand-light); color: var(--brand-dark); border-radius: 20px; padding: 2px 9px; font-weight: 600; }

/* v2.5.22: PENANDA PRODUK DI KERANJANG — badge qty permanen di sudut kartu
   + border kartu berwarna brand selama produknya ada di keranjang.
   Badge dekoratif (aria-hidden, pointer-events:none) — tidak makan area
   sentuh; klik kartu tetap menambah. Pop/flash hanya transform+box-shadow
   singkat; hormat prefers-reduced-motion. */
.product-card { position: relative; }
.product-card.in-cart { border-color: var(--brand); }
.pd-badge {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 22px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
  display: none; pointer-events: none;
}
.product-card.in-cart .pd-badge { display: block; }
.pd-badge.bump { animation: teova-badge-bump .38s ease; }
.product-card.flash { animation: teova-card-flash .55s ease; }
@keyframes teova-badge-bump { 0% { transform: scale(.55); } 55% { transform: scale(1.32); } 100% { transform: scale(1); } }
@keyframes teova-card-flash { 0% { box-shadow: 0 0 0 4px var(--brand); } 100% { box-shadow: var(--shadow-lg); } }
/* denyut kecil di chip "n item" keranjang saat dot tiba */
.cart-pulse { animation: teova-badge-bump .38s ease; }
/* DOT TERBANG kartu -> keranjang (desktop saja; di mobile keranjang berada
   di bawah layar sehingga animasi ke target tak terlihat justru membingungkan) */
.teova-fly-dot {
  position: fixed; left: 0; top: 0; z-index: 1600; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); pointer-events: none;
  box-shadow: 0 2px 8px rgba(2, 6, 23, .35);
  transition: transform .5s cubic-bezier(.2, .7, .3, 1), opacity .5s ease;
  will-change: transform;
}
/* mobile: badge sedikit lebih kecil agar proporsional di kartu padat (grid3/4) */
@media (max-width: 1100px) {
  .pd-badge { top: 5px; right: 5px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 10.5px; line-height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .pd-badge.bump, .product-card.flash, .cart-pulse { animation: none; }
  .teova-fly-dot { display: none; }
}

.cat-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-pill {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 22px;
  padding: 7px 16px; font-size: 13px; font-weight: 600; color: #4b5563; cursor: pointer;
}
.cat-pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.pos-cart {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  position: sticky; top: 76px; display: flex; flex-direction: column; max-height: calc(100vh - 96px);
  overflow-y: auto; /* v2.5.17: panel SELALU bisa menggulir — tidak ada lagi mode yang menyembunyikan bagian panel */
}
/* v2.5.22: header panel ikut STICKY di dalam panel — saat panel menggulir
   (layar pendek), judul + tombol +member/hapus tidak ikut tenggelam */
.pos-cart-head { position: sticky; top: 0; z-index: 6; background: var(--surface); padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pos-cart-head .badge { flex-shrink: 0; }
/* v2.5.17: tombol header (+member & hapus) tidak boleh terpencet keluar */
.pos-cart-head .btn { flex-shrink: 0; }
.pos-cart-head h5 { margin: 0; font-weight: 700; }
/* v2.5.22 FIX BUG "5 item hanya 1 terlihat": sebelumnya flex: 0 1 auto +
   min-height 60px membuat daftar item dipatok 60px (pas 1 item) karena
   section lain (member/summary/pay) semuanya flex-shrink:0. Sekarang:
   - flex: 1 1 auto  -> daftar item MENGISI SISA RUANG panel, bukan dikecilkan;
   - min-height 172px -> lantai ±3 item selalu tampak sekaligus;
   - item lebih dari itu menggulir DI DALAM area item (bukan menutup section);
   - panel tetap punya overflow-y:auto sebagai rem darurat layar pendek;
   - pay-cluster & header tetap sticky sehingga BAYAR tak pernah hilang.
   Mobile TIDAK berubah: rule di bawah (max-width 1100px) tetap menimpa ini. */
.cart-items { overflow-y: auto; padding: 8px 14px; flex: 1 1 auto; min-height: 172px; }
.pos-cart > .px-3, .pos-cart .member-wrap { flex-shrink: 0; }
.cart-empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.cart-empty i { font-size: 40px; display: block; margin-bottom: 10px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--border); }
.cart-item:last-child { border-bottom: 0; }
.cart-item .ci-name { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.cart-item .ci-price { font-size: 12px; color: var(--muted); }
.qty-box { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.qty-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--brand);
  background: var(--surface); color: var(--brand-dark); font-weight: 800; line-height: 1;
}
.qty-btn:hover { background: var(--brand-soft); }
.qty-val { min-width: 26px; text-align: center; font-weight: 700; }
.ci-remove { border: 0; background: transparent; color: var(--danger); font-size: 16px; }

.pos-summary { border-top: 1px solid var(--border); padding: 14px 18px 12px; flex-shrink: 0; }
/* v2.5.17: KLASTER PEMBAYARAN — selalu menempel di dasar panel (sticky).
   Berisi quick-cash + Uang Dibayar + Kembalian + BAYAR. position:sticky
   murni CSS: TIDAK butuh JS, TIDAK menyembunyikan apa pun, dan bekerja
   di semua ukuran layar. Mobile (panel statis) otomatis mengikuti alur. */
.pay-cluster {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--surface);
  border-top: 1px solid var(--border);
  /* v2.5.20: padding horizontal PASTI ada (16px) — klaim user "dibayar &
     kembalian melebar tanpa padding" berasal dari CSS basi produksi yg tidak
     mengenal .pay-cluster; dgn handshake versi CSS (lihat --teova-css-ver)
     CSS basi tidak mungkin lagi dipakai, dan padding ini dikunci eksplisit. */
  padding: 12px 16px 14px;
  flex-shrink: 0;
  box-shadow: 0 -10px 16px -12px rgba(2, 6, 23, .35);
}
/* v2.5.20: semua anak klaster tidak boleh menembus padding */
.pay-cluster > * { min-width: 0; }
.pay-cluster .quick-cash { margin-top: 0; margin-bottom: 2px; }
/* v2.5.20: chip catatan order — catatan selalu TERLIHAT menempel di transaksi */
.note-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--brand-dark);
  background: var(--brand-soft); border: 1px dashed var(--brand);
  border-radius: 8px; padding: 5px 10px; margin: 2px 0 8px;
  overflow: hidden;
}
.note-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-chip i { flex-shrink: 0; }
/* v2.5.16: catatan order per transaksi */
#orderNote { font-size: 13px; min-height: 52px; resize: none; }
/* v2.5.16: tombol + member kecil di header panel keranjang */
.btn-add-member { padding: 2px 8px; font-size: 13px; line-height: 1.4; border-width: 1.5px; }
.btn-add-member i { font-size: 14px; }
.sum-row { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 14px; }
.sum-row .lbl { color: var(--muted); }

/* v2.2: GRAND TOTAL diperbesar & dibuat mencolok
   v2.3: ukuran desktop disesuaikan (tetap besar & jelas, tapi muat di panel
   400px sehingga tombol BAYAR tidak keluar box) */
.sum-row.total {
  font-size: 21px; font-weight: 900; letter-spacing: -.3px;
  background: var(--brand-soft); border: 1.5px solid var(--brand-light);
  border-radius: var(--radius-sm); padding: 10px 13px;
  margin: 12px 0; align-items: center; flex-wrap: wrap; gap: 0 10px;
}
.sum-row.total .lbl { color: var(--brand-dark); font-size: 12.5px; font-weight: 800; letter-spacing: .8px; }
.sum-row.total span:last-child { min-width: 0; font-variant-numeric: tabular-nums; }

/* v2.2: KEMBALIAN besar & jelas (hanya mode cash) */
.sum-row.change-row {
  background: #f0fdf4; border: 1.5px dashed #86efac; border-radius: var(--radius-sm);
  padding: 8px 13px; align-items: center; margin-top: 10px; flex-wrap: wrap; gap: 0 10px;
}
.sum-row.change-row .lbl { color: #15803d; font-weight: 800; font-size: 12px; letter-spacing: .8px; }
.sum-row.change-row b { font-size: 19px; font-weight: 900; color: #15803d; line-height: 1.15; min-width: 0; font-variant-numeric: tabular-nums; }
.form-label2 { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(13,148,136,.15); }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick-cash button {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--brand-dark);
}
.quick-cash button:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
/* v2.5.6: pilihan cepat cash — Uang Pas disorot, denomasi < total nonaktif */
.quick-cash button.qc-exact { border-color: var(--brand); background: var(--brand-soft); }
.quick-cash button:disabled { opacity: .4; cursor: not-allowed; border-style: dashed; color: var(--muted); background: transparent; }

/* v2.5.14: Role Editor — sorot item hak akses yang dicentang */
.perm-item.perm-on { border-color: var(--brand) !important; background: var(--brand-soft); }
.perm-item .form-check-input { flex: 0 0 auto; }
/* v2.5.15 FIX: di dalam modal, JANGAN batasi wrapper checkbox (dulu max-height
   340px = double scroll yang membingungkan). Biarkan modal-body dari
   modal-dialog-scrollable yang scroll tunggal sampai tombol Simpan terlihat. */
#perm_create { max-height: 340px; overflow-y: auto; padding-right: 4px; }
.modal [id^="perm_edit"] { max-height: none; overflow: visible; padding-right: 0; }
/* v2.5.15: jaga flex chain Bootstrap bila ada modal yang membungkus body
   dengan <form> di antara .modal-content dan .modal-body — supaya
   modal-dialog-scrollable tetap berfungsi di semua popup */
.modal-dialog-scrollable .modal-content > form { display: flex; flex-direction: column; min-height: 0; }
.modal-dialog-scrollable .modal-content > form > .modal-body { overflow-y: auto; min-height: 0; }

/* ---------------- v2.2: Metode pembayaran (tombol ikon) ---------------- */
.pay-methods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pay-btn {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 9px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: #4b5563; cursor: pointer; line-height: 1.1;
  transition: all .12s ease;
}
.pay-btn i { font-size: 18px; color: var(--brand-dark); transition: inherit; }
.pay-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.pay-btn.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 3px 12px rgba(13, 148, 136, .35);
}
.pay-btn.active i { color: #fff; }
@media (max-width: 575.98px) {
  .pay-methods { grid-template-columns: repeat(3, 1fr); }
}

/* ---------------- v2.2: Mode tampilan produk (mobile) ---------------- */
.view-switch { display: none; gap: 5px; }
.view-switch button {
  width: 40px; height: 36px; border: 1.5px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--muted); font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.view-switch button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

@media (max-width: 767.98px) {
  .view-switch { display: inline-flex; }

  /* toolbar: pencarian sendiri di baris pertama, switch + kosongkan di baris kedua */
  .pos-toolbar { flex-wrap: wrap; }
  .pos-toolbar .search-input { flex: 1 1 100%; }

  /* MODE LIST: kartu memanjang ke bawah (gambar kiri, teks kanan) */
  .product-grid.view-list { display: flex; flex-direction: column; gap: 9px; }
  .product-grid.view-list .product-card { flex-direction: row; align-items: center; }
  .product-grid.view-list .product-thumb { width: 92px; height: 74px; aspect-ratio: auto; flex: 0 0 92px; }
  .product-grid.view-list .product-body { padding: 8px 12px; flex: 1; min-width: 0; }
  .product-grid.view-list .product-name { font-size: 14.5px; min-height: 0; }
  .product-grid.view-list .product-price { font-size: 15.5px; }

  /* MODE 3 KOLOM (default): kartu kecil rapi */
  .product-grid.view-grid3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .product-grid.view-grid3 .product-thumb { aspect-ratio: 1/0.85; }
  .product-grid.view-grid3 .product-body { padding: 6px 8px 9px; }
  .product-grid.view-grid3 .product-name { font-size: 12px; min-height: 30px; }
  .product-grid.view-grid3 .product-price { font-size: 13px; }
  .product-grid.view-grid3 .product-meta { font-size: 10px; gap: 4px; }
  .product-grid.view-grid3 .chip { padding: 1px 7px; }

  /* MODE 4 KOLOM: lebih kecil lagi, meta disembunyikan agar lega */
  .product-grid.view-grid4 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .product-grid.view-grid4 .product-thumb { aspect-ratio: 1/0.8; }
  .product-grid.view-grid4 .product-body { padding: 5px 6px 7px; }
  .product-grid.view-grid4 .product-name { font-size: 10.5px; min-height: 26px; }
  .product-grid.view-grid4 .product-price { font-size: 11.5px; }
  .product-grid.view-grid4 .product-meta { display: none; }
}

/* ---------------- Login ---------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand-dark) 45%, var(--brand) 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: 22px; padding: 40px 36px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 70px rgba(0,0,0,.3);
}
.login-logo { width: 84px; height: 84px; border-radius: 22px; object-fit: contain; margin: 0 auto 14px; display: block; }
.login-brand { text-align: center; font-size: 24px; font-weight: 800; letter-spacing: 1.5px; color: var(--brand-dark); margin: 0; word-break: break-word; }
.login-slogan { text-align: center; font-size: 11px; letter-spacing: 4px; color: var(--muted); text-transform: uppercase; margin: 4px 0 26px; }

/* ---------------- Struk (receipt) ---------------- */
/* v2.5.24: kolom + tengah — di modal detail transaksi struk dan panel aksi
 * (Unduh Struk / Kirim WhatsApp) kini TERSUSUN KE BAWAH, tidak lagi
 * berdampingan (dulu display:flex baris -> struk & tombol sejajar). */
.receipt-wrap { display: flex; flex-direction: column; align-items: center; }
.receipt {
  font-family: "Courier New", Consolas, monospace; font-size: 12.5px; line-height: 1.45;
  color: #111; background: #fff; padding: 10px 12px; border: 1px dashed #cbd5e1; border-radius: 8px;
}
.receipt.r-58 { width: 58mm; max-width: 100%; }
.receipt.r-80 { width: 80mm; max-width: 100%; }
.receipt .r-center { text-align: center; }
.receipt .r-brand { font-size: 19px; font-weight: 800; letter-spacing: 2px; }
.receipt .r-slogan { letter-spacing: 3px; font-size: 10.5px; }
/* v2.5.6: logo kecil di atas struk (dari Pengaturan, bila logo diunggah) */
.receipt .r-logo { display: block; margin: 0 auto 5px; max-width: 86px; max-height: 58px; object-fit: contain; }
.receipt.r-80 .r-logo { max-width: 104px; max-height: 68px; }
.receipt .r-dashed { border-top: 1px dashed #111; margin: 7px 0; }
.receipt .r-row { display: flex; justify-content: space-between; gap: 8px; }
.receipt .r-total { font-size: 14.5px; font-weight: 800; }
.receipt .r-item-line { display: flex; justify-content: space-between; gap: 8px; }

/* ---------------- Print (thermal 58mm / 80mm) ---------------- */
@media print {
  @page { margin: 2mm; size: auto; }
  body { background: #fff !important; }
  body.printing * { visibility: hidden !important; }
  body.printing #print-area,
  body.printing #print-area * { visibility: visible !important; }
  body.printing #print-area {
    position: absolute !important; left: 0; top: 0; width: auto;
    max-width: 100% !important; border: 0 !important; padding: 0 1mm !important;
    box-shadow: none !important; font-size: 11.5px;
  }
  body.printing .modal-backdrop, body.printing .modal { display: none !important; }
  .receipt.r-58 { width: 54mm !important; }
  .receipt.r-80 { width: 76mm !important; }
}

/* ---------------- Misc ---------------- */
.page-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filter-bar > div { min-width: 150px; }
.search-input { position: relative; }
.search-input i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 36px; }
.product-photo-sm { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.kbd { background: #eef2f4; border: 1px solid #d5dbe0; border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 700; color: #374151; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
/* v2.3: kartu pilihan di halaman Reset Data */
.group-card { transition: border-color .12s ease, background .12s ease; }
.group-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.group-card:has(input:checked) { border-color: var(--danger) !important; background: #fef2f2; }
.chart-box { position: relative; height: 300px; }
.hpp-row td { background: var(--brand-soft); }
.margin-badge { font-weight: 700; }
.rank-num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-light); color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .app-main { margin-left: 0; }
  .app-content { padding: 14px; }
  .pos-cart { position: static; max-height: none; }
  /* v2.5.3 FIX: di HP daftar keranjang di-expand penuh (dulu menyusut jadi 0
     karena flex-basis 0 di panel setinggi konten), maksimal 55vh supaya
     summary + tombol BAYAR tetap terjangkau tanpa scroll panjang */
  .cart-items { flex: 0 0 auto; max-height: 55vh; min-height: 0; }
}
@media (max-width: 575.98px) {
  .stat-value { font-size: 18px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
}

/* =====================================================================
   TEOVA POS v2.1 - TAMPILAN KLASIK (layout v1) + dukungan fitur v2
   Shell mobile-first (topbar/sheet/floating cart/keypad/pay-card) dihapus.
   Fitur v2 yang dipertahankan: indikator koneksi, member, addon modal,
   sync page, toast offline, tombol WhatsApp.
   ===================================================================== */

/* ---------------- Indikator koneksi (topbar) ----------------
   v2.5.4: gaya TOMBOL kecil (bukan pill polos) — border, gradient halus
   dan bayangan bawah seperti tombol nyata, tetapi mungil di topbar. */
.conn-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px;
  border-radius: 8px; padding: 3px 10px; white-space: nowrap;
  background: linear-gradient(180deg, #ffffff, #f1f3f5);
  border: 1px solid #d3d7dc;
  color: #6b7280;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .07), inset 0 1px 0 rgba(255, 255, 255, .7);
  line-height: 1.5;
}
.conn-state-online  { background: linear-gradient(180deg, #f0fdf4, #dcfce7) !important; color: #15803d !important; border-color: #86efac !important; }
.conn-state-offline { background: linear-gradient(180deg, #fef2f2, #fee2e2) !important; color: #b91c1c !important; border-color: #fca5a5 !important; }
.conn-state-sync    { background: linear-gradient(180deg, #fffbeb, #fef3c7) !important; color: #b45309 !important; border-color: #fcd34d !important; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.conn-dot.conn-on  { background: #16a34a; box-shadow: 0 0 0 2.5px rgba(22,163,74,.18); }
.conn-dot.conn-off { background: #dc2626; box-shadow: 0 0 0 2.5px rgba(220,38,38,.16); }
.conn-dot.conn-sync{ background: #d97706; animation: connPulse 1s infinite alternate; }
@keyframes connPulse { from { opacity: .4 } to { opacity: 1 } }

/* ---------------- POS: state kosong / memuat / gagal ---------------- */
.pos-empty { text-align: center; color: var(--muted); padding: 56px 0; grid-column: 1 / -1; }
.pos-empty i { font-size: 42px; display: block; margin-bottom: 8px; }

/* addon line di dalam item keranjang */
.cart-item .ci-addons { font-size: 11px; color: var(--brand-dark); font-weight: 600; margin-top: 1px; }

/* ---------------- Member (panel keranjang) ---------------- */
.member-box {
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 10px 0;
}
.member-search { position: relative; }
.member-search input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px;
}
.member-results {
  position: absolute; inset: 100% 0 auto 0; z-index: 30; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  max-height: 240px; overflow-y: auto;
}
.member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; border: 0; background: none; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.member-row:last-child { border-bottom: 0; }
.member-row:active, .member-row:hover { background: var(--brand-soft); }
.member-row small { display: block; color: var(--muted); font-size: 11.5px; }
.member-poin { font-weight: 800; color: var(--brand-dark); white-space: nowrap; text-align: right; font-size: 12.5px; }
.member-none { padding: 12px; text-align: center; color: var(--muted); font-size: 13px; }
.member-card {
  display: flex; align-items: center; gap: 10px; background: var(--brand-soft);
  border: 1.5px solid var(--brand-light); border-radius: var(--radius-sm); padding: 10px 12px;
}
.member-card small { display: block; color: var(--muted); font-size: 11.5px; }
.member-card .member-poin { text-align: right; }
.member-actions { margin-left: auto; display: flex; flex-direction: column; gap: 4px; }

/* v2.5.22: MEMBER COLLAPSIBLE (fold) — form member bisa terlipat jadi satu
   baris. Desktop default TERLIPAT (pos.js saat init) supaya ruang vertikal
   jatuh ke daftar item; mobile default TERBUKA (perilaku lama yang sudah
   aman). Saat terlipat, nama member terpilih tetap tampak di header fold. */
.member-fold-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; padding: 0 0 6px; margin: 0;
  cursor: pointer; text-align: left; color: inherit;
}
.member-fold-head .mf-title { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.member-fold-head .mf-hint {
  font-size: 12px; font-weight: 700; color: var(--brand-dark);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.member-fold-head .mf-chev {
  margin-left: auto; flex-shrink: 0; font-size: 12px; color: var(--muted);
  transition: transform .15s ease;
}
.member-fold.open .mf-chev { transform: rotate(180deg); }
.member-fold:not(.open) .member-fold-body { display: none; }
.member-fold .member-fold-body { padding-top: 2px; }

/* ---------------- Addon (modal pilih tambahan) ---------------- */
.addon-hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.addon-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer;
}
.addon-item:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.addon-item input { width: 19px; height: 19px; accent-color: var(--brand); }
.addon-name { font-weight: 700; flex: 1; }
.addon-price { font-weight: 800; color: var(--brand-dark); }

/* ---------------- Tombol WhatsApp ---------------- */
.btn-wa { background: #25d366; border: 0; color: #fff; font-weight: 800; }
.btn-wa:hover, .btn-wa:focus { background: #1fb857; color: #fff; }

/* ---------------- Halaman sync offline ---------------- */
.stat-box { background: #f8fafc; border-radius: var(--radius-sm); padding: 12px 6px; }
.stat-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.sync-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 2px; border-bottom: 1px dashed var(--border); font-size: 13.5px;
}
.sync-item:last-child { border-bottom: 0; }
.sync-item b { display: block; }
.sync-item small { display: block; color: var(--muted); font-size: 11.5px; max-width: 420px; }

/* ---------------- Toast offline engine ---------------- */
.toast-offline {
  background: #111827; color: #fff; border-radius: 10px; padding: 10px 16px;
  font-size: 13.5px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toastIn .25s ease; border-left: 4px solid var(--brand);
}
.toast-offline-success { border-left-color: #16a34a; }
.toast-offline-danger  { border-left-color: #dc2626; }
.toast-offline-warning { border-left-color: #d97706; }
.toast-offline.hide { opacity: 0; transform: translateX(20px); transition: all .4s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ---------------- POS responsive (layout klasik) ---------------- */
@media (max-width: 991.98px) {
  /* keranjang turun di bawah grid produk (bukan sticky) */
  .pos-cart { position: static; max-height: none; }
  .cart-items { flex: 0 0 auto; max-height: 55vh; min-height: 0; }
}
@media (max-width: 767.98px) {
  .pos-grid { gap: 12px; }
  .product-thumb { aspect-ratio: 1/0.9; }
  /* v2.2: total & kembalian TETAP besar di HP (mencolok untuk kasir)
     v2.3: di HP panel tidak sticky (static) jadi aman untuk font besar */
  .sum-row.total { font-size: 24px; padding: 10px 12px; }
  .sum-row.total .lbl { font-size: 12px; }
  .sum-row.change-row b { font-size: 22px; }
  .pos-summary { padding: 12px 14px 14px; }
}
/* v2.3: layar desktop pendek (<860px tinggi) — panel dirapatkan agar
   seluruh isi tetap muat tanpa scroll panjang (murni kosmetik; TIDAK
   menyembunyikan elemen apa pun — v2.5.17). */
@media (min-width: 768px) and (max-height: 860px) {
  .pos-cart-head { padding: 9px 14px; }
  .pos-cart .member-box { padding: 7px 10px; margin: 6px 0; }
  .member-search input { padding: 7px 10px; font-size: 13px; }
  .member-results { max-height: 150px; }
  .pos-cart #btnRegMember { padding: 4px 10px; margin-top: 5px; }
  .pos-summary { padding: 9px 14px 11px; }
  .sum-row { margin-bottom: 4px; }
  .sum-row.total { font-size: 19px; padding: 7px 12px; margin: 8px 0; }
  .sum-row.total .lbl { font-size: 11.5px; }
  .sum-row.change-row b { font-size: 17px; }
  .sum-row.change-row { padding: 8px 12px; margin-top: 6px; }
  .pay-cluster { padding: 10px 14px 12px; }
  .pay-btn { padding: 6px 2px 5px; }
  .pay-btn i { font-size: 16px; }
  .pay-btn span { font-size: 10px; }
  .quick-cash { margin-top: 5px; }
  .quick-cash button { padding: 3px 9px; font-size: 11.5px; }
  #paidInput, #discountInput, #refInput { padding: 6px 10px; }
  #btnPay.btn-xl { padding: 10px 20px; font-size: 16px; }
  .cart-empty { padding: 20px 10px; }
}
/* =====================================================================
   v2.5.17: SISTEM "FIT PANEL" DIHAPUS SEPENUHNYA.
   Mode cart-dense / cart-tight / cart-tighter / cart-tighter2 yang dulu
   MENYEMBUNYIKAN bagian panel (header keranjang, kotak catatan, kotak
   member — penyebab quick-cash & tombol hapus/+member "hilang" di
   desktop) tidak ada lagi. Penggantinya murni CSS:
     - panel selalu scrollable (lihat .pos-cart),
     - daftar item menyusut & scroll internal (lihat .cart-items),
     - klaster pembayaran (quick-cash + Uang Dibayar + Kembalian + BAYAR)
       position:sticky bottom — SELALU tampak (lihat .pay-cluster).
   Tidak ada satu elemen fungsional pun yang disembunyikan oleh CSS/JS.
   ===================================================================== */

/* =====================================================================
   v2.5: DARK MODE (data-mode="dark" di <html>)
   Tema warna brand tetap dipertahankan; yang diganti adalah permukaan
   netral (bg/surface/text/border) + tint brand dibuat transparan.
   Persist per perangkat via localStorage "teova_dark".
   ===================================================================== */
html[data-mode="dark"] { color-scheme: dark; }
html[data-mode="dark"],
html[data-theme="teal"][data-mode="dark"] {
  --bg:      #0b1220;
  --surface: #121a2b;
  --text:    #e5eaf1;
  --muted:   #93a1b5;
  --border:  #223050;
  --shadow:    0 2px 10px rgba(0, 0, 0, .45);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .60);
  --brand-light: rgba(13, 148, 136, .25);
  --brand-soft:  rgba(13, 148, 136, .10);
  --brand-dark:   #2dd4bf;
  --brand-darker: #5eead4;
}
html[data-theme="purple"][data-mode="dark"] {
  --brand-light: rgba(124, 58, 237, .30);
  --brand-soft:  rgba(124, 58, 237, .12);
  --brand-dark:   #a78bfa;
  --brand-darker: #c4b5fd;
}
html[data-theme="cocoa"][data-mode="dark"] {
  --brand-light: rgba(161, 136, 127, .32);
  --brand-soft:  rgba(161, 136, 127, .14);
  --brand-dark:   #bcaaa4;
  --brand-darker: #d7ccc8;
}
html[data-theme="green"][data-mode="dark"] {
  --brand-light: rgba(74, 222, 128, .22);
  --brand-soft:  rgba(74, 222, 128, .10);
  --brand-dark:   #4ade80;
  --brand-darker: #86efac;
}
/* v2.5.4: varian gelap 5 tema baru — aksen dibuat lebih terang agar terbaca */
html[data-theme="pink"][data-mode="dark"] {
  --brand-light: rgba(244, 114, 182, .25);
  --brand-soft:  rgba(244, 114, 182, .10);
  --brand-dark:   #f472b6;
  --brand-darker: #f9a8d4;
}
html[data-theme="sky"][data-mode="dark"] {
  --brand-light: rgba(56, 189, 248, .25);
  --brand-soft:  rgba(56, 189, 248, .10);
  --brand-dark:   #38bdf8;
  --brand-darker: #7dd3fc;
}
html[data-theme="indigo"][data-mode="dark"] {
  --brand-light: rgba(129, 140, 248, .28);
  --brand-soft:  rgba(129, 140, 248, .11);
  --brand-dark:   #818cf8;
  --brand-darker: #a5b4fc;
}
html[data-theme="orange"][data-mode="dark"] {
  --brand-light: rgba(251, 146, 60, .25);
  --brand-soft:  rgba(251, 146, 60, .10);
  --brand-dark:   #fb923c;
  --brand-darker: #fdba74;
}
html[data-theme="berry"][data-mode="dark"] {
  --brand-light: rgba(232, 121, 249, .26);
  --brand-soft:  rgba(232, 121, 249, .11);
  --brand-dark:   #e879f9;
  --brand-darker: #f0abfc;
}

/* --- Komponen bootstrap yang default putih ---
   v2.5.3 FIX: wajib pakai background-COLOR (bukan shorthand "background:")
   — shorthand me-reset background-position/size/repeat sehingga panah
   .form-select ikut "tercetak" berulang-reput sepanjang input (bug panah
   aneh berjejer di dark mode). */
html[data-mode="dark"] .form-control,
html[data-mode="dark"] .form-select,
html[data-mode="dark"] .input-group-text {
  background-color: #0d1524; border-color: var(--border); color: var(--text);
}
html[data-mode="dark"] .form-control::placeholder { color: #5c6b82; }
html[data-mode="dark"] .form-control:focus,
html[data-mode="dark"] .form-select:focus {
  background-color: #0d1524; color: var(--text); border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(13, 148, 136, .22);
}
html[data-mode="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2393a1b5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 16px 12px;
}
html[data-mode="dark"] .form-check-input { background-color: #0d1524; border-color: var(--border); }
html[data-mode="dark"] .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
html[data-mode="dark"] .modal-content {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
html[data-mode="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
html[data-mode="dark"] .btn-outline-secondary { color: var(--text); border-color: var(--border); }
html[data-mode="dark"] .btn-outline-secondary:hover { background: #1a2438; color: var(--text); }
html[data-mode="dark"] .btn-outline-danger { color: #f87171; border-color: #7f1d1d; }
html[data-mode="dark"] .btn-outline-danger:hover { background: #2c0f0f; color: #fca5a5; }
html[data-mode="dark"] .btn-brand:disabled { background: #475569; }
html[data-mode="dark"] .border { border-color: var(--border) !important; }
html[data-mode="dark"] hr { border-color: var(--border); opacity: 1; }
html[data-mode="dark"] .alert-light { background: #1a2438; color: var(--text); border-color: var(--border); }
html[data-mode="dark"] .alert-info    { background: #0c1f33; color: #9ecfef; border-color: #164e6b; }
html[data-mode="dark"] .alert-warning { background: #2a2109; color: #fcd34d; border-color: #713f12; }
html[data-mode="dark"] .alert-danger  { background: #2c0f0f; color: #fca5a5; border-color: #7f1d1d; }
html[data-mode="dark"] .alert-success { background: #0c2317; color: #86efac; border-color: #14532d; }

/* --- Komponen aplikasi --- */
html[data-mode="dark"] .sidebar-nav .nav-item { color: #aeb8c8; }
html[data-mode="dark"] .btn-burger { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-mode="dark"] .stat-icon.green { background: rgba(34, 197, 94, .15); color: #4ade80; }
html[data-mode="dark"] .stat-icon.red   { background: rgba(239, 68, 68, .15); color: #f87171; }
html[data-mode="dark"] .stat-icon.amber { background: rgba(245, 158, 11, .15); color: #fbbf24; }
html[data-mode="dark"] .stat-icon.blue  { background: rgba(59, 130, 246, .15); color: #60a5fa; }
html[data-mode="dark"] .st-active, html[data-mode="dark"] .st-aman,
html[data-mode="dark"] .st-completed, html[data-mode="dark"] .st-open {
  background: rgba(34, 197, 94, .15); color: #4ade80;
}
html[data-mode="dark"] .st-inactive, html[data-mode="dark"] .st-inactive2,
html[data-mode="dark"] .st-closed { background: #1a2438; color: #aeb8c8; }
html[data-mode="dark"] .st-menipis, html[data-mode="dark"] .st-pending {
  background: rgba(245, 158, 11, .15); color: #fbbf24;
}
html[data-mode="dark"] .st-habis, html[data-mode="dark"] .st-cancelled,
html[data-mode="dark"] .st-low { background: rgba(239, 68, 68, .15); color: #f87171; }
html[data-mode="dark"] .kbd { background: #1a2438; border-color: #2a3a5c; color: #cbd5e1; }
/* v2.5.4: tombol koneksi versi gelap — tetap bentuk tombol kecil */
html[data-mode="dark"] .conn-badge {
  background: linear-gradient(180deg, #1e2a44, #17223a);
  border-color: #2a3a5c; color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .05);
}
html[data-mode="dark"] .conn-state-online  { background: linear-gradient(180deg, rgba(34,197,94,.24), rgba(34,197,94,.10)) !important; color: #4ade80 !important; border-color: rgba(74,222,128,.45) !important; }
html[data-mode="dark"] .conn-state-offline { background: linear-gradient(180deg, rgba(239,68,68,.24), rgba(239,68,68,.10)) !important; color: #f87171 !important; border-color: rgba(248,113,113,.45) !important; }
html[data-mode="dark"] .conn-state-sync    { background: linear-gradient(180deg, rgba(245,158,11,.24), rgba(245,158,11,.10)) !important; color: #fbbf24 !important; border-color: rgba(251,191,36,.45) !important; }
html[data-mode="dark"] .pay-btn { color: #cbd5e1; }
html[data-mode="dark"] .pay-btn.active { color: #fff; box-shadow: 0 3px 12px rgba(0, 0, 0, .5); }
html[data-mode="dark"] .pay-btn.active i { color: #fff; }
html[data-mode="dark"] .btn-brand-outline { color: var(--brand-dark); }
html[data-mode="dark"] .text-success { color: #4ade80 !important; }
html[data-mode="dark"] .text-danger  { color: #f87171 !important; }
html[data-mode="dark"] .margin-badge { border: 1px solid transparent; }

/* --- v2.5.3: TABEL Bootstrap yang masih berlatar PUTIH ---
   Bootstrap 5.3 mengunci latar sel lewat var --bs-table-bg (default putih).
   Tanpa override ini semua <table class="table ..."> tetap putih di dark mode. */
html[data-mode="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: rgba(255, 255, 255, .03);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: rgba(255, 255, 255, .05);
  --bs-table-hover-color: var(--text);
  --bs-table-active-bg: rgba(255, 255, 255, .07);
  --bs-table-active-color: var(--text);
}
/* Ikon panah kecil bawaan browser yang hitam pekat & tampak "aneh" di input
   gelap: spinner input number, ikon kalender date, silang pencarian. */
html[data-mode="dark"] input[type="number"]::-webkit-outer-spin-button,
html[data-mode="dark"] input[type="number"]::-webkit-inner-spin-button { filter: invert(.75); opacity: .65; }
html[data-mode="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-mode="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
html[data-mode="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(.8); opacity: .7; cursor: pointer;
}
html[data-mode="dark"] input[type="search"]::-webkit-search-cancel-button { filter: invert(.8); }
/* Komponen Bootstrap lain yang default terang (kalau dipakai di masa depan) */
html[data-mode="dark"] .dropdown-menu { background: var(--surface); border-color: var(--border); color: var(--text); }
html[data-mode="dark"] .dropdown-item { color: var(--text); }
html[data-mode="dark"] .dropdown-item:hover, html[data-mode="dark"] .dropdown-item:focus { background: var(--brand-soft); color: var(--text); }
html[data-mode="dark"] .dropdown-divider { border-color: var(--border); opacity: 1; }
html[data-mode="dark"] .list-group-item { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-mode="dark"] .card { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-mode="dark"] .card-header, html[data-mode="dark"] .card-footer { background: var(--brand-soft); color: var(--text); border-color: var(--border); }
html[data-mode="dark"] .pagination { --bs-pagination-bg: var(--surface); --bs-pagination-color: var(--text); --bs-pagination-border-color: var(--border); --bs-pagination-hover-bg: var(--brand-soft); --bs-pagination-hover-color: var(--text); --bs-pagination-hover-border-color: var(--border); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); }
html[data-mode="dark"] .table-wrap { color: var(--text); }

/* Tombol toggle dark mode di topbar */
.btn-darkmode {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 8px; padding: 4px 10px; font-size: 16px; line-height: 1.4; cursor: pointer;
}
.btn-darkmode:hover { color: var(--brand-dark); border-color: var(--brand); }

/* ======================================================================
   v2.5.2 - MODAL KONFIRMASI PESANAN KASIR (popup kustom aplikasi,
   bukan popup bawaan browser) + dialog dinamis pengganti alert/confirm
   ====================================================================== */
.co-member {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand-soft);
  border: 1px dashed var(--brand);
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.co-member i { font-size: 22px; color: var(--brand-dark); }
.co-member > div { line-height: 1.35; min-width: 0; }
.co-member > div > div { font-size: 12px; color: var(--muted); }
.co-member-none { background: var(--bg); border-color: var(--border); }
.co-member-none i { color: var(--muted); }
#confirmItems { max-height: 38vh; overflow-y: auto; }
.co-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--border);
}
.co-item:last-child { border-bottom: none; }
.co-info { min-width: 0; }
.co-name { font-weight: 600; font-size: 14px; }
.co-qty {
  display: inline-block; min-width: 38px; text-align: center;
  background: var(--brand-light); color: var(--brand-darker);
  border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 700;
}
.co-addons { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.co-price { white-space: nowrap; font-size: 14px; }
#dynDialog .modal-body { font-size: 14.5px; }

/* =====================================================================
   v2.5.9: STOK LEVEL PRODUK
   - .stok-tag     : chip kecil stok di kartu produk kasir
   - .product-card : state habis (redup + garis putus + tidak bisa diklik)
   ===================================================================== */
.stok-tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px; line-height: 1.6;
}
.stok-tag.stok-aman    { background: #dcfce7; color: #15803d; }
.stok-tag.stok-menipis { background: #fef3c7; color: #b45309; }
.stok-tag.stok-habis   { background: #fee2e2; color: #b91c1c; }
.product-card.habis { opacity: .55; cursor: not-allowed; border-style: dashed; }
.product-card.habis:hover { transform: none; box-shadow: none; border-color: var(--border, #e2e8f0); }
.product-card.habis .product-thumb { filter: grayscale(.8); }
html[data-mode="dark"] .stok-tag.stok-aman    { background: rgba(34,197,94,.18); color: #4ade80; }
html[data-mode="dark"] .stok-tag.stok-menipis { background: rgba(245,158,11,.18); color: #fbbf24; }
html[data-mode="dark"] .stok-tag.stok-habis   { background: rgba(239,68,68,.2);  color: #f87171; }
html[data-mode="dark"] .product-card.habis { opacity: .45; }

/* =====================================================================
   v2.5.27: MOBILE LAYOUT PERMINTAAN USER
   - Shift bar lebih kecil + tombol di kanan
   - Tombol Kosongkan & Kiosk sejajar di mobile
   - Tombol kiosk modal (Bersihkan/Tutup/Muat Ulang) sejajar di mobile
   - Bottom navbar khusus mobile (4 ikon)
   - Floating cart pill dgn total belanja
   - Discount fold (default terlipat, klik untuk buka)
   - Metode pembayaran 5-kolom sebaris di mobile
   - Quick cash 1 baris di mobile (200rb dihapus)
   ===================================================================== */

/* ---------- #1 SHIFT BAR (lebih kecil, tombol kanan) ---------- */
.shift-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; margin-bottom: 12px;
  border-radius: var(--radius-sm); font-size: 12.5px;
  border: 1px solid var(--border);
}
.shift-bar.shift-active {
  background: var(--brand-soft); border-color: var(--brand-light); color: var(--text);
}
.shift-bar.shift-inactive {
  background: #fffbeb; border-color: #fde68a; color: #92400e;
}
.shift-bar-icon { font-size: 16px; flex-shrink: 0; }
.shift-bar.shift-active .shift-bar-icon { color: var(--brand-dark); }
.shift-bar.shift-inactive .shift-bar-icon { color: #d97706; }
.shift-bar-text {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.25;
}
.shift-bar-label { font-weight: 700; font-size: 12.5px; }
.shift-bar.shift-active .shift-bar-label { color: var(--brand-dark); }
.shift-bar-detail {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.shift-bar.shift-inactive .shift-bar-detail { color: #b45309; }
.shift-bar-btn { flex-shrink: 0; padding: 4px 12px; font-size: 12px; }
/* Desktop: teks detail ikut ditampilkan sbg baris kedua */
@media (min-width: 768px) {
  .shift-bar { padding: 8px 14px; font-size: 13px; }
  .shift-bar-label { font-size: 13px; }
  .shift-bar-detail { font-size: 12px; }
  .shift-bar-btn { padding: 5px 14px; font-size: 12.5px; }
}
html[data-mode="dark"] .shift-bar.shift-active {
  background: var(--brand-soft); border-color: var(--brand-light); color: var(--text);
}
html[data-mode="dark"] .shift-bar.shift-inactive {
  background: rgba(245,158,11,.14); border-color: rgba(251,191,36,.4); color: #fbbf24;
}
html[data-mode="dark"] .shift-bar.shift-inactive .shift-bar-detail { color: #fcd34d; }

/* ---------- #2 POS TOOLBAR — layout dua baris di mobile ---------- */
.pos-toolbar { margin-bottom: 12px; }
.pos-toolbar-row1, .pos-toolbar-row2 {
  display: flex; gap: 8px; align-items: center;
}
.pos-toolbar-row2 { margin-top: 8px; display: none; }
.pos-toolbar-row2 .btn { white-space: nowrap; }
/* Mobile: pecah jadi 2 baris */
@media (max-width: 767.98px) {
  .pos-toolbar-row1 { flex-wrap: nowrap; }
  .pos-toolbar-row1 .search-input { flex: 1 1 auto; min-width: 0; }
  .pos-toolbar-row2 { display: flex; }
}
/* Desktop: satukan jadi 1 baris (search + view + clear + kiosk) */
@media (min-width: 768px) {
  .pos-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .pos-toolbar-row1 { flex: 1 1 auto; min-width: 0; }
  .pos-toolbar-row2 { display: flex; margin-top: 0; flex: 0 0 auto; }
  /* tombol di desktop ukuran normal (tidak full-fill) */
  .pos-toolbar-row2 .btn.flex-fill { flex: 0 0 auto !important; }
}

/* ---------- #3 KIOSK MODAL FOOTER (3 tombol sejajar di mobile) ---------- */
.kiosk-modal-footer {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.kiosk-modal-footer .btn {
  flex: 1 1 auto; min-width: 0; font-size: 13px; padding: 7px 10px;
  text-align: center; justify-content: center;
}
.kiosk-modal-footer .btn i { margin-right: 4px; }
/* Mobile: pastikan 3 tombol tepat sejajar */
@media (max-width: 575.98px) {
  .kiosk-modal-footer { gap: 6px; padding: 8px !important; }
  .kiosk-modal-footer .btn { font-size: 12.5px; padding: 8px 6px; }
  .kiosk-modal-footer .btn i { font-size: 13px; margin-right: 3px; }
}

/* ---------- #4 BOTTOM NAVBAR (mobile only) ---------- */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1050;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(2, 6, 23, .08);
  padding: 6px env(safe-area-inset-bottom, 6px) env(safe-area-inset-bottom, 6px);
  justify-content: space-around;
}
.mbn-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; color: var(--muted); font-size: 10.5px; font-weight: 600;
  border-radius: 10px; flex: 1 1 0; min-width: 0; text-align: center;
  transition: color .15s ease, background .15s ease;
}
.mbn-item i { font-size: 19px; line-height: 1; }
.mbn-item.active { color: var(--brand-dark); }
.mbn-item.active i { color: var(--brand); }
html[data-mode="dark"] .mobile-bottom-nav {
  background: var(--surface); border-color: var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.4);
}
html[data-mode="dark"] .mbn-item { color: #aeb8c8; }
html[data-mode="dark"] .mbn-item.active { color: var(--brand-dark); }
html[data-mode="dark"] .mbn-item.active i { color: var(--brand-dark); }

/* ---------- #4b FLOATING CART (mobile only) ---------- */
.floating-cart-btn {
  display: none;
  position: fixed; bottom: 70px; right: 14px; z-index: 1055;
  background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 18px; gap: 8px; align-items: center;
  font-weight: 800; font-size: 14.5px; line-height: 1;
  box-shadow: 0 8px 24px rgba(13, 148, 136, .35), 0 2px 6px rgba(2, 6, 23, .15);
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.floating-cart-btn:active { transform: scale(.95); }
.floating-cart-btn i { font-size: 18px; }
.floating-cart-btn .fc-total { font-variant-numeric: tabular-nums; }
.floating-cart-btn .fc-count {
  background: #fff; color: var(--brand-dark);
  border-radius: 999px; padding: 2px 8px; font-size: 11px;
  font-weight: 800; line-height: 1.3; min-width: 20px; text-align: center;
}
.floating-cart-btn.fc-hidden { display: none !important; }
html[data-mode="dark"] .floating-cart-btn {
  background: var(--brand); color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.35);
}

/* Mobile: aktifkan bottom nav + floating cart + beri padding bawah konten */
@media (max-width: 767.98px) {
  .mobile-bottom-nav { display: flex; }
  .floating-cart-btn { display: inline-flex; }
  /* Beri ruang bawah agar konten tidak ketutup bottom nav */
  .app-content { padding-bottom: 78px !important; }
  /* Footer geser ke atas agar tidak tertutup bottom nav */
  .app-footer { margin-bottom: 60px; }
}
/* Mobile + modal aktif: sembunyikan floating cart & bottom nav (modal full screen) */
body.modal-open .floating-cart-btn,
body.modal-open .mobile-bottom-nav { display: none !important; }

/* ---------- #5 DISCOUNT FOLD (default terlipat) ---------- */
.discount-fold {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
}
.discount-fold-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%; border: 0; background: transparent;
  padding: 9px 12px; cursor: pointer; text-align: left; color: inherit;
  font-size: 13px; font-weight: 600;
}
.discount-fold-head .df-title {
  color: var(--muted); font-weight: 600; font-size: 12.5px;
}
.discount-fold-head .df-title i { color: var(--brand-dark); }
.discount-fold-head .df-hint {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 2px 9px; border-radius: 999px; background: var(--bg);
}
.discount-fold-head .df-hint.df-hint-active {
  color: var(--brand-dark); background: var(--brand-soft);
}
.discount-fold-head .df-chev {
  flex-shrink: 0; font-size: 12px; color: var(--muted);
  transition: transform .15s ease;
}
.discount-fold.open .df-chev { transform: rotate(180deg); }
.discount-fold-body { padding: 0 12px 10px; display: none; }
.discount-fold.open .discount-fold-body { display: block; }
html[data-mode="dark"] .discount-fold { border-color: var(--border); background: transparent; }
html[data-mode="dark"] .discount-fold-head .df-hint { background: #1a2438; color: #aeb8c8; }
html[data-mode="dark"] .discount-fold-head .df-hint.df-hint-active { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- #6 METODE PEMBAYARAN 5-kolom sebaris di mobile ---------- */
/* Default: 5-kolom (desktop). v2.5.27: mobile juga 5-kolom (sebelumnya 3). */
.pay-methods { grid-template-columns: repeat(5, 1fr) !important; }
@media (max-width: 575.98px) {
  .pay-methods { grid-template-columns: repeat(5, 1fr) !important; gap: 4px !important; }
  .pay-btn { padding: 6px 1px 5px !important; gap: 2px !important; }
  .pay-btn i { font-size: 15px !important; }
  .pay-btn span { font-size: 9px !important; line-height: 1.1 !important; }
}

/* ---------- #7 QUICK CASH — 1 baris di mobile, 200rb dihapus ---------- */
@media (max-width: 575.98px) {
  .quick-cash {
    display: flex; flex-wrap: nowrap !important; overflow-x: auto;
    gap: 5px !important; margin-top: 5px !important;
    padding-bottom: 2px; -webkit-overflow-scrolling: touch;
  }
  .quick-cash button {
    flex: 1 0 auto; min-width: 60px; padding: 6px 10px !important;
    font-size: 11.5px !important; white-space: nowrap;
  }
  /* Sembunyikan scrollbar jelek di mobile ( masih scrollable ) */
  .quick-cash::-webkit-scrollbar { height: 3px; }
  .quick-cash::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
}

/* =====================================================================
   v2.5.28: PERBAIKAN LANJUTAN MOBILE
   - #1 Modal konfirmasi pesanan: 2 tombol 1 baris
   - #2 Modal sukses: tombol lebih kecil, Unduh+WA 1 baris, preview struk match paper size
   - #3 Tombol Kosongkan + Kiosk benar-benar seukuran di mobile
   ===================================================================== */

/* ---------- #1 MODAL KONFIRMASI PESANAN: 2 tombol 1 baris ---------- */
#confirmOrderModal .modal-footer {
  display: flex !important; gap: 8px; justify-content: stretch !important;
  padding: 8px 12px;
}
#confirmOrderModal .modal-footer .btn {
  flex: 1 1 0 !important; min-width: 0; margin: 0 !important;
  padding: 10px 8px; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap;
}
#confirmOrderModal .modal-footer .btn i { font-size: 14px; margin: 0 !important; }
@media (max-width: 575.98px) {
  #confirmOrderModal .modal-footer .btn {
    padding: 11px 6px; font-size: 12.5px;
  }
  #confirmOrderModal .modal-footer .btn i { font-size: 13px; margin: 0 !important; }
}

/* ---------- #2 MODAL SUKSES — tombol lebih kecil + grid layout ---------- */
/* Default (BT hidden): Row 1 = Cetak Struk (full), Row 2 = Unduh | WA (50-50),
   Row 3 = Transaksi Baru (full). BT shown: Row 1 = Cetak | BT (50-50). */
#successModal .modal-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "cetak cetak"
    "unduh wa"
    "new new";
  gap: 6px; padding: 10px;
}
/* Bila tombol Bluetooth tampak (navigator.bluetooth), ubah baris pertama jadi Cetak|BT */
#successModal .modal-footer:has(#btnBtPrint:not(.d-none)) {
  grid-template-areas:
    "cetak bt"
    "unduh wa"
    "new new";
}
#successModal .modal-footer .btn {
  margin: 0 !important;
  padding: 8px 8px;
  font-size: 12.5px; font-weight: 700; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap;
}
#successModal .modal-footer .btn i { font-size: 14px; margin: 0 !important; }
#successModal .modal-footer #btnPrint    { grid-area: cetak; }
#successModal .modal-footer #btnBtPrint   { grid-area: bt; }
#successModal .modal-footer #btnDl        { grid-area: unduh; }
#successModal .modal-footer #btnWA         { grid-area: wa; }
#successModal .modal-footer #btnNewTrx    { grid-area: new; }
/* WhatsApp button tetap warna hijau tapi ukuran seragam */
#successModal .modal-footer #btnWA.btn-wa {
  padding: 8px 8px !important; font-size: 12.5px !important;
}
/* Mobile: tighten padding lagi */
@media (max-width: 575.98px) {
  #successModal .modal-footer { gap: 5px; padding: 8px; }
  #successModal .modal-footer .btn {
    padding: 8px 4px; font-size: 11.5px;
  }
  #successModal .modal-footer .btn i { font-size: 13px; }
}
/* Dark mode: tidak perlu override (warna tombol sudah pakai var) */

/* ---------- #2b PREVIEW STRUK match paper size ---------- */
/* r-58: 58mm width (sebelumnya 300px) — sesuai kertas thermal 58mm */
/* r-80: 80mm width (sebelumnya 380px) — sesuai kertas thermal 80mm */
/* max-width: 100% supaya muat di layar mobile yg lebih sempit dari kertas */
.receipt-wrap { width: 100%; }
.receipt.r-58, .receipt.r-80 { margin: 0 auto; box-sizing: border-box; }
/* Bila viewport terlalu sempit (< 240px untuk r-58 / < 320px untuk r-80),
   struk menyusut ke lebar viewport — tetap printable */
@media (max-width: 359.98px) {
  .receipt.r-58 { width: 100%; max-width: 100%; }
}
@media (max-width: 419.98px) {
  .receipt.r-80 { width: 100%; max-width: 100%; }
}

/* ---------- #3 TOMBOL KOSONGKAN + KIOSK benar-benar seukuran ---------- */
/* Bootstrap flex-fill = flex:1 1 auto (basis auto = ukuran konten) — bila
   satu tombol punya teks lebih panjang, hasilnya tidak sama. Override ke
   flex:1 1 0 (basis 0) supaya distribusi ruang benar-benar 50-50. */
@media (max-width: 767.98px) {
  .pos-toolbar-row2 .btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 8px 8px;
    font-size: 12.5px;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    white-space: nowrap;
  }
  .pos-toolbar-row2 .btn i { font-size: 14px; margin: 0 !important; }
}

/* =====================================================================
   v2.6.0: MULTI-CABANG — chip topbar & tombol pilih cabang
   ===================================================================== */
.branch-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand-soft); color: var(--brand-darker);
  border: 1px solid var(--brand-light);
  border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; font-weight: 700; text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.branch-chip:hover { background: var(--brand-light); color: var(--brand-darker); text-decoration: none; }
.branch-chip i.bi-shop { font-size: 14px; }
html[data-mode="dark"] .branch-chip {
  background: var(--brand-soft); color: var(--brand-darker);
  border-color: var(--brand-light);
}
/* Mobile: chip tetap tampil tapi compact */
@media (max-width: 575.98px) {
  .branch-chip { padding: 4px 10px; font-size: 11.5px; }
  /* v2.6.4: max-width hanya untuk .bc-name (di mobile disembunyikan juga via rule bawah) */
  .branch-chip .bc-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Tombol pilih cabang di halaman cashier/switch_branch.php */
.btn-branch-select {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  text-align: left; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.btn-branch-select:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn-branch-select.active {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-light);
}
html[data-mode="dark"] .btn-branch-select { background: transparent; border-color: var(--border); }
html[data-mode="dark"] .btn-branch-select:hover { border-color: var(--brand); background: var(--brand-soft); }

/* =====================================================================
   v2.6.4: FIX TOPBAR MOBILE OVERFLOW
   Penyebab: topbar (header atas) berisi 6 elemen flex tanpa flex-wrap.
   Total min-width ± 480px > viewport mobile (360-400px). Page dipaksa
   melebar > viewport → user harus pinch-zoom-out untuk lihat semua.
   Solusi: (1) flex-wrap supaya wrap ke baris kedua bila tidak muat;
   (2) hide role-badge <576px (admin sudah tahu via chip user di sidebar);
   (3) reduce padding & gap di mobile; (4) branch-chip ringkas (icon + code,
   bukan full name); (5) title font lebih kecil; (6) overflow-x: hidden
   di body sebagai safety net anti horizontal scroll ghost.
   ===================================================================== */

/* Safety net: jangan pernah ada horizontal scroll ghost di mobile.
   Ini TIDAK menyembunyikan konten vertikal — hanya clamp horizontal. */
html, body { max-width: 100%; overflow-x: hidden; }

/* Topbar: aktifkan flex-wrap di mobile supaya elemen yang tidak muat pindah ke baris baru */
@media (max-width: 767.98px) {
  .app-topbar {
    flex-wrap: wrap;        /* v2.6.4: bungkus elemen ke baris berikutnya bila tidak muat */
    padding: 8px 14px;      /* lebih sempit dari default 12px 22px */
    gap: 8px;               /* gap antar elemen diperkecil dari 14px */
  }
  .app-topbar .topbar-title {
    font-size: 16px;        /* lebih kecil dari 18px default */
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Burger & dark-mode btn tetap fixed size — tidak shrink */
  .app-topbar .btn-burger,
  .app-topbar .btn-darkmode {
    flex: 0 0 auto;
  }
  .app-topbar .topbar-right {
    gap: 6px;               /* gap antar badge di topbar-right */
    flex-wrap: wrap;       /* bungkus juga bila perlu */
    justify-content: flex-end;
  }
  /* Sembunyikan role-badge di mobile — admin/owner/kasir sudah tahu
     posisinya via chip user di sidebar (yg aktif dgn sidebar mobile). */
  .app-topbar .role-badge { display: none !important; }
  /* Conn-badge: lebih compact di mobile */
  .app-topbar .conn-badge { padding: 2px 7px; font-size: 9.5px; }
  .app-topbar .conn-badge .conn-dot { width: 6px; height: 6px; }
}

/* Branch-chip: ringkas di mobile — hanya ikon + kode cabang (bukan nama full) */
@media (max-width: 767.98px) {
  .branch-chip {
    padding: 3px 9px !important;
    font-size: 11px !important;
    gap: 3px !important;
  }
  /* Mobile: sembunyikan nama full, tampilkan kode singkat (mis. PUSAT / BOOTH-A) */
  .branch-chip .bc-name { display: none !important; }
  .branch-chip .bc-code { display: inline !important; font-weight: 800; }
}
/* Desktop: tampilkan nama full, sembunyikan kode singkat */
@media (min-width: 768px) {
  .branch-chip .bc-name { display: inline; }
  .branch-chip .bc-code { display: none; }
}
/* Mobile sangat sempit (<400px iPhone SE) — sembunyikan conn-badge text,
   hanya titik warna saja */
@media (max-width: 399.98px) {
  .app-topbar .conn-badge {
    padding: 2px 5px;
    font-size: 0;
  }
  .app-topbar .conn-badge .conn-dot { width: 8px; height: 8px; }
}

/* Pastikan app-content juga tidak menyebabkan overflow horizontal.
   Padding pakai box-sizing: border-box (sudah default di Bootstrap). */
.app-content { box-sizing: border-box; max-width: 100%; }

/* Pastikan semua child .app-content juga clamp — terutama .page-card,
   .filter-bar, .pos-grid yg punya gap antar-elemen */
.app-content > * { max-width: 100%; box-sizing: border-box; }

/* Pos-grid: pastikan tidak ada horizontal overflow di mobile
   (sebelumnya gap 18px + 400px sidebar kanan, di mobile collapse ke 1fr,
   tapi pastikan gap tidak menyebabkan overflow) */
@media (max-width: 1100px) {
  .pos-grid { gap: 12px; box-sizing: border-box; max-width: 100%; }
}

/* Cart panel (sticky right) di mobile: pastikan width 100% tidak melebar */
@media (max-width: 1100px) {
  .pos-cart { width: 100%; max-width: 100%; box-sizing: border-box; }
}

/* Quick-cash horizontal scroll: pastikan tidak overflow parent */
.quick-cash { max-width: 100%; box-sizing: border-box; }
