/* =====================================================================
   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"] {
  --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);
}

/* ---------------- 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: cover; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: 1px; color: var(--brand-dark); line-height: 1.1; }
.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; }

.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.3: tombol BAYAR tidak pernah keluar box — panel scroll bila ringkas */
}
.pos-cart-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pos-cart-head h5 { margin: 0; font-weight: 700; }
/* v2.3: area item boleh menyusut (min-height 0) supaya summary + tombol BAYAR
   selalu muat di dalam panel, tidak meluber keluar box di desktop */
.cart-items { overflow-y: auto; padding: 8px 14px; flex: 1 1 0; min-height: 0; }
.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 16px; }
.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 { border-color: var(--brand); background: var(--brand-soft); }

/* ---------------- 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: cover; margin: 0 auto 14px; display: block; }
.login-brand { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: 2px; color: var(--brand-dark); margin: 0; }
.login-slogan { text-align: center; font-size: 11px; letter-spacing: 4px; color: var(--muted); text-transform: uppercase; margin: 4px 0 26px; }

/* ---------------- Struk (receipt) ---------------- */
.receipt-wrap { display: flex; justify-content: 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: 300px; }
.receipt.r-80 { width: 380px; }
.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; }
.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; }
}
@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) ---------------- */
.conn-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .5px;
  border-radius: 20px; padding: 4px 11px; white-space: nowrap;
  background: #f3f4f6; color: #6b7280;
}
.conn-state-online  { background: #dcfce7 !important; color: #15803d !important; }
.conn-state-offline { background: #fee2e2 !important; color: #b91c1c !important; }
.conn-state-sync    { background: #fef3c7 !important; color: #b45309 !important; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.conn-dot.conn-on  { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.conn-dot.conn-off { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
.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; }

/* ---------------- 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; }
}
@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 + tombol BAYAR tetap muat tanpa scroll panjang */
@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: 6px 12px; margin-top: 6px; }
  .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.3: mode DENSE — diaktifkan JS saat konten tetap meluber walau sudah
   dirapatkan (viewport ekstrem pendek). Total/kembalian tetap jelas. */
.pos-cart.cart-dense .pos-cart-head { padding: 5px 12px; }
.pos-cart.cart-dense .pos-cart-head i { font-size: 15px; }
.pos-cart.cart-dense .pos-cart-head h5 { font-size: 15px; }
.pos-cart.cart-dense .pos-summary { padding: 6px 10px 8px; }
.pos-cart.cart-dense .sum-row { margin-bottom: 2px; }
.pos-cart.cart-dense .sum-row.total { font-size: 16px; padding: 5px 10px; margin: 5px 0; }
.pos-cart.cart-dense .sum-row.total .lbl { font-size: 10.5px; }
.pos-cart.cart-dense .sum-row.change-row { padding: 4px 10px; margin-top: 4px; }
.pos-cart.cart-dense .sum-row.change-row b { font-size: 15px; }
.pos-cart.cart-dense .form-label2 { font-size: 11px; margin-bottom: 2px; }
.pos-cart.cart-dense #paidInput, .pos-cart.cart-dense #discountInput,
.pos-cart.cart-dense #refInput { padding: 4px 8px; font-size: 13.5px; }
.pos-cart.cart-dense .pos-summary .mb-2 { margin-bottom: 5px !important; }
.pos-cart.cart-dense .quick-cash { display: none; }
.pos-cart.cart-dense #btnPay.btn-xl { padding: 7px 14px; font-size: 15px; margin-top: 6px; }
.pos-cart.cart-dense .member-box { padding: 4px 8px; margin: 4px 0; }
.pos-cart.cart-dense .member-search input { padding: 4px 8px; font-size: 12.5px; }
.pos-cart.cart-dense #btnRegMember { display: none; }
@media (max-width: 767.98px) {
  .pos-cart.cart-dense .sum-row.total { font-size: 22px; }
  .pos-cart.cart-dense .sum-row.change-row b { font-size: 20px; }
}
