/* ==========================================================================
   KASIR MINIMARKET DESA • DESIGN SYSTEM (ANTI-SLOP & DESIGN.MD COMPLIANT)
   Style: Clean Retail, High Contrast, Ergonomic Touch Targets, Tabular Figures
   ========================================================================== */

:root {
  /* Color Palette - Fresh Retail Green & Crisp Slate */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-surface-active: #e2e8f0;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;        /* Slate 900 - High Contrast */
  --text-body: #334155;        /* Slate 700 - Readable */
  --text-muted: #64748b;       /* Slate 500 - Contrast > 4.5:1 */
  --text-inverse: #ffffff;

  /* Brand Accents */
  --color-primary: #15803d;         /* Green 700 - Retail Green */
  --color-primary-hover: #166534;   /* Green 800 */
  --color-primary-light: #dcfce7;   /* Green 100 */
  --color-primary-focus: rgba(21, 128, 61, 0.2);

  /* Status Colors */
  --color-success: #16a34a;         /* Green 600 */
  --color-success-light: #f0fdf4;
  --color-warning: #d97706;         /* Amber 600 */
  --color-warning-light: #fffbeb;
  --color-danger: #dc2626;          /* Red 600 */
  --color-danger-light: #fef2f2;
  --color-info: #0284c7;            /* Sky 600 */

  /* Radii & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

/* ================= BASE RESETS ================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  background-color: var(--bg-app);
  color: var(--text-body);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
}

/* Tabular figures for all numeric, price, and timestamp elements */
.tabular-nums, .price, .total-amount, .metric-val, .clock, #cart-subtotal, #change-amount, .rec-row {
  font-variant-numeric: tabular-nums;
}

/* ================= TOPBAR ================= */
.topbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

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

.brand-logo-box {
  width: 50px;
  height: 50px;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border: 2px solid #0f172a; /* Garis hitam tegas sekeliling dan samping */
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Nav Tabs - Segmented Style */
.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface-subtle);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.nav-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.6);
}

.nav-btn.active {
  background-color: var(--bg-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions,
.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-success {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid #bbf7d0;
}

.clock {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* ================= MAIN CONTAINER ================= */
.main-container {
  flex: 1;
  padding: 16px 20px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ================= POS LAYOUT ================= */
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.pos-products-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

/* POS Search & Barcode Container */
.pos-search-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.search-name-group {
  width: 100%;
}

.search-name-group input {
  width: 100%;
  font-size: 14.5px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  padding: 10px 14px;
  background: var(--bg-surface);
}

.barcode-search-group {
  display: flex;
  width: 100%;
  gap: 8px;
  align-items: center;
}

.barcode-search-group input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
}

.barcode-btn-row {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.barcode-btn-row button {
  padding: 0 16px;
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Clean Input Styling */
input[type="text"], input[type="number"], input[type="date"], select {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

#search-product-input {
  flex: 1;
  min-width: 240px;
}

/* Category Filter Pills */
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.pill {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-body);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-1px);
}

.pill.active {
  background: #15803d !important;
  border-color: #15803d !important;
  color: #ffffff !important;
  box-shadow: 0 3px 8px rgba(21, 128, 61, 0.3);
}

/* ================= PRODUCT CARDS GRID ================= */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
  min-height: 140px;
  user-select: none;
  position: relative;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: 0 8px 18px -2px rgba(21, 128, 61, 0.12);
}

.product-card:active, .product-card.card-tapped {
  transform: scale(0.97);
  background: #f0fdf4 !important;
  border-color: var(--color-primary) !important;
}

/* Badge Qty Keranjang di Baris Harga Kartu */
.card-cart-badge {
  background: #15803d;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  animation: popBadge 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popBadge {
  0% { transform: scale(0.5); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Tombol Cepat Satuan Grosir di Kartu Produk */
.quick-unit-add-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 11.5px;
  font-weight: 800;
  padding: 6px 10px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  touch-action: manipulation;
}

.quick-unit-add-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.quick-unit-add-btn.medium {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.quick-unit-add-btn.medium:hover {
  background: #dbeafe;
}

.quick-unit-add-btn.wholesale {
  background: #fefce8;
  border-color: #fef08a;
  color: #854d0e;
}

.quick-unit-add-btn.wholesale:hover {
  background: #fef9c3;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  width: 100%;
  min-width: 0;
}

.product-card .cat-tag {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.product-card .name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 10px;
}

.product-card .footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 8px;
  margin-top: auto;
  gap: 8px;
}

.price-stock-wrap {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

.product-card .price {
  font-size: 15px;
  font-weight: 900;
  color: #15803d;
  letter-spacing: -0.3px;
  line-height: 1.2;
  white-space: nowrap;
}

.product-card .stock-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-surface-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.product-card .stock-tag.low {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid #fecaca;
}

.product-card.in-cart {
  border-color: var(--color-primary);
  background: #fbfdfb;
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.12);
}

.card-action-wrap {
  display: flex;
  align-items: center;
  width: 100%;
}

.btn-card-add {
  width: 100%;
  min-height: 44px;
  background: var(--color-primary-light);
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  font-size: 13.5px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  touch-action: manipulation;
  user-select: none;
}

.btn-card-add:hover {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-card-add:active {
  transform: scale(0.97);
}

.card-stepper {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  min-height: 46px;
  background: #f0fdf4;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 6px;
  box-sizing: border-box;
}

.btn-card-stepper {
  border: none;
  width: 100%;
  min-width: 48px;
  height: 40px;
  min-height: 40px;
  border-radius: 6px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.1s ease;
  touch-action: manipulation;
  user-select: none;
}

.btn-card-minus {
  background: #fee2e2;
  color: #dc2626;
  border: 1.5px solid #fca5a5;
}

.btn-card-plus {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(21, 128, 61, 0.25);
}

.btn-card-stepper:active {
  transform: scale(0.93);
}

.card-stepper-qty {
  background: #ffffff;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 900;
  min-width: 38px;
  height: 40px;
  text-align: center;
  padding: 0 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  user-select: none;
  touch-action: manipulation;
}

/* ================= CART PANE ================= */
.pos-cart-pane {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  padding: 18px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 76px;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--bg-surface-subtle);
  padding-bottom: 12px;
}

.cart-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.cart-items {
  max-height: 320px;
  overflow-y: auto;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.empty-cart-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 10px;
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
}

.cart-item {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all 0.15s ease;
}

.cart-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.cart-item-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  flex: 1;
}

.cart-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 6px;
}

.cart-item-meta .price-btn-edit {
  cursor: pointer;
  text-decoration: underline dotted;
  font-weight: 700;
  color: var(--color-primary);
}

.cart-item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
}

.cart-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cart-qty-input {
  width: 56px;
  height: 42px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  font-family: inherit;
}

.cart-qty-input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.btn-qty {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text-main);
  width: 44px;
  height: 42px;
  border-radius: var(--radius-sm);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  touch-action: manipulation;
  user-select: none;
}

.btn-qty.btn-minus {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.btn-qty.btn-plus {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.btn-qty:hover {
  opacity: 0.92;
}

.btn-qty:active {
  transform: scale(0.92);
}

.btn-del {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid #fecaca;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
  flex-shrink: 0;
}

.btn-del:hover {
  background: #fee2e2;
  border-color: var(--color-danger);
}

.cart-item-total {
  font-size: 15px;
  font-weight: 900;
  color: var(--color-primary);
}

/* Cart Summary */
.cart-summary {
  border-top: 2px solid var(--bg-surface-subtle);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-body);
}

.input-sm {
  width: 110px;
  padding: 6px 10px !important;
  text-align: right;
  font-weight: 700;
  min-height: 36px;
}

.summary-total-box {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  color: #ffffff;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.28);
}

.total-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #bbf7d0;
}

.total-amount {
  font-size: 28px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Payment Method Tabs */
.payment-methods {
  display: flex;
  gap: 6px;
}

.pay-option {
  flex: 1;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 10px 4px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pay-option input {
  display: none;
}

.pay-option.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(21, 128, 61, 0.3);
}

/* Quick Cash Buttons (Ergonomic 44px Thumb Target) */
.quick-cash-row {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}

.btn-quick-cash {
  flex: 1;
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  color: var(--text-main);
  padding: 8px 4px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.12s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-quick-cash:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.btn-quick-cash:active {
  transform: scale(0.96);
}

.cash-input-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cash-input-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.input-lg {
  font-size: 18px !important;
  font-weight: 800;
  text-align: right;
  flex: 1;
  color: var(--color-primary) !important;
  background: var(--bg-surface-subtle) !important;
}

.change-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-primary-light);
  border: 1px dashed var(--color-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}

.change-box.shortage {
  background: var(--color-danger-light);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* Big Checkout Button */
.btn-checkout {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-top: 10px;
  min-height: 54px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.35);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-checkout:hover:not(:disabled) {
  background: linear-gradient(135deg, #15803d 0%, #166534 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(21, 128, 61, 0.4);
}

.btn-checkout:active:not(:disabled) {
  transform: scale(0.98);
}

/* ================= COMMON BUTTONS ================= */
.btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  min-height: 40px;
}

.btn:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-sm);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-body);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--text-muted);
  color: var(--text-main);
}

.btn-danger {
  background: var(--color-danger);
}
.btn-danger:hover {
  background: #b91c1c;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}

.btn-text-danger {
  background: transparent;
  border: none;
  color: var(--color-danger);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.btn-text-danger:hover {
  background: var(--color-danger-light);
}

/* ================= TABLES & METRICS ================= */
.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.pane-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.td-actions {
  white-space: nowrap;
}

.pane-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card.warning {
  border-left: 5px solid var(--color-warning);
}

.metric-card.success {
  border-left: 5px solid var(--color-primary);
}

.metric-card.highlight {
  background: #14532d;       /* Dark Green 900 for clean store highlight */
  color: #ffffff;
  border: none;
}

.metric-card.highlight .metric-label {
  color: #86efac;
}

.metric-card.highlight .metric-val {
  color: #ffffff;
}

.metric-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-val {
  font-size: 24px;
  font-weight: 900;
  margin-top: 8px;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background: var(--bg-surface-subtle);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
}

.data-table tr:hover td {
  background: var(--bg-app);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.report-section {
  margin-top: 24px;
}

.report-section h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

/* ================= MODALS ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-main);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

/* ================= RECEIPT MODAL (REAL THERMAL LOOK) ================= */
.receipt-card {
  max-width: 380px;
  background: #ffffff;
  padding: 20px;
}

.receipt-actions-wrap .btn {
  min-height: 40px;
  font-size: 13px;
  padding: 8px 12px;
}

@media (max-width: 600px) {
  .receipt-actions-wrap {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    width: 100%;
  }

  .receipt-actions-wrap #btn-bluetooth-receipt {
    grid-column: 1 / -1;
    min-height: 46px;
    font-size: 14px;
    font-weight: 800;
    justify-content: center;
  }

  .receipt-actions-wrap #btn-close-receipt {
    grid-column: 1 / -1;
    min-height: 40px;
    justify-content: center;
  }

  .receipt-actions-wrap .btn {
    width: 100%;
    min-height: 40px;
    justify-content: center;
  }
}

.receipt-paper {
  background: #ffffff;
  color: #000000;
  padding: 16px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  line-height: 1.45;
}

.receipt-header {
  text-align: center;
  margin-bottom: 10px;
}

.receipt-logo-img {
  max-height: 40px;
  width: auto;
  object-fit: contain;
  margin-bottom: 6px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.receipt-header h3 {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.receipt-header p {
  font-size: 11px;
  color: #000000;
  margin: 0;
}

.receipt-divider {
  border-bottom: 1px dashed #000000;
  height: 1px;
  line-height: 0;
  font-size: 0;
  color: transparent;
  margin: 6px 0;
  overflow: hidden;
}

.receipt-meta {
  font-size: 11px;
  color: #000000;
  line-height: 1.4;
}

.rec-row {
  display: flex;
  justify-content: space-between;
  color: #000000;
}

.rec-row.bold {
  font-weight: 900;
  font-size: 13px;
  margin: 4px 0;
  color: #000000;
}

.receipt-footer {
  text-align: center;
  font-size: 10px;
  margin-top: 10px;
  color: #000000;
  line-height: 1.35;
}

/* Camera Scanner Container */
#camera-scanner-wrapper {
  background: #0f172a;
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 14px;
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.hidden { display: none !important; }

/* ================= RESPONSIVE LAYOUT (MOBILE FIRST & TRUE SATU-LAYAR <= 820px) ================= */
@media (max-width: 820px) {
  .pos-layout {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
  }

  /* Full Mobile Checkout Sheet - Slides up when tapping [Lihat Keranjang & Bayar] */
  .pos-cart-pane {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: var(--bg-surface) !important;
    z-index: 2000 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 14px 14px 36px 14px !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .pos-cart-pane.mobile-open {
    display: flex !important;
    flex-direction: column !important;
    animation: slideUpMobile 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes slideUpMobile {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .desktop-only {
    display: none !important;
  }

  .main-container {
    padding: 8px 10px 88px 10px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }
}

/* ================= SMARTPHONE & TABLET OPTIMIZATION (<= 768px) ================= */
@media (max-width: 768px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 8px 10px;
    gap: 6px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    position: relative;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .brand-logo-box {
    width: 32px !important;
    height: 32px !important;
    padding: 2px !important;
  }

  .brand-title {
    font-size: 14.5px !important;
    white-space: nowrap;
  }

  .brand-sub {
    display: none !important;
  }

  .topbar-status {
    display: contents;
  }

  .topbar-meta {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-self: end;
  }

  .topbar-meta .badge,
  .topbar-meta .clock {
    font-size: 10.5px;
    padding: 2px 6px;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .nav-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border-radius: var(--radius-md);
    box-sizing: border-box;
  }

  .nav-btn {
    width: 100%;
    min-height: 38px;
    padding: 6px 2px;
    font-size: 11.5px;
    font-weight: 700;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    border-radius: var(--radius-sm);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    box-sizing: border-box;
  }

  .topbar-actions .btn-sm {
    width: 100%;
    padding: 4px 2px;
    font-size: 11.5px;
    font-weight: 700;
    min-height: 36px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }

  .pos-search-container {
    gap: 6px;
    width: 100%;
    max-width: 100%;
  }

  .search-name-group input {
    font-size: 13.5px;
    padding: 8px 12px;
    min-height: 38px;
    width: 100%;
    border-radius: var(--radius-md) !important;
  }

  .barcode-search-group {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    width: 100%;
    max-width: 100%;
  }

  .barcode-search-group input {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    padding: 8px 10px;
    min-height: 38px;
    border-radius: var(--radius-md) !important;
  }

  .barcode-btn-row {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }

  .barcode-btn-row button {
    padding: 0 10px;
    min-height: 38px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-md) !important;
    white-space: nowrap;
  }

  .fast-tap-section {
    padding: 6px 8px;
    margin-bottom: 6px;
    width: 100%;
    max-width: 100%;
  }

  .fast-tap-header {
    margin-bottom: 4px;
  }

  .fast-tap-title {
    font-size: 10.5px;
  }

  .fast-tap-chips {
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .fast-tap-chips::-webkit-scrollbar {
    display: none;
  }

  .fast-tap-chip {
    padding: 4px 8px;
    font-size: 11.5px;
    min-height: 28px;
  }

  .fast-tap-chip .chip-name {
    max-width: 100px;
  }

  .category-pills {
    padding: 2px 0 6px 0;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    scrollbar-width: none;
  }

  .category-pills::-webkit-scrollbar {
    display: none;
  }

  .pill {
    padding: 5px 12px;
    font-size: 12px;
    min-height: 32px;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    width: 100%;
    max-width: 100%;
  }

  .product-card {
    padding: 8px 10px !important;
    min-height: 92px !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .product-card .name {
    font-size: 12.5px !important;
    line-height: 1.25;
  }

  .product-card .footer .price {
    font-size: 13.5px !important;
  }

  .cart-item {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .cart-item-info {
    width: 100%;
  }

  .cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .cart-item-total {
    font-size: 13.5px;
    font-weight: 800;
  }

  .btn-checkout {
    height: 50px !important;
    font-size: 15px !important;
    letter-spacing: 0.5px;
  }

  .modal-card {
    padding: 16px 12px;
    width: 96%;
    max-width: 96vw;
    box-sizing: border-box;
  }

  /* Responsive Inventory, Reports & Debts Tables (Zero Horizontal Scroll on Mobile) */
  .pane-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  .pane-header h2 {
    font-size: 16px;
  }

  .pane-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px !important;
    width: 100%;
  }

  .pane-actions .btn {
    width: 100%;
    padding: 8px 6px;
    font-size: 11.5px;
    min-height: 38px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  .metric-card {
    padding: 10px 12px !important;
  }

  .metric-label {
    font-size: 10px !important;
    line-height: 1.2;
  }

  .metric-val {
    font-size: 15.5px !important;
    margin-top: 4px !important;
  }

  .table-wrap {
    overflow-x: hidden !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  .data-table,
  .data-table tbody {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    width: 100%;
  }

  .data-table tbody td {
    padding: 0 !important;
    border: none !important;
    font-size: 12.5px;
    min-width: 0;
    word-break: break-word;
  }

  .data-table tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 1px;
  }

  .data-table tbody td.td-full {
    grid-column: 1 / -1;
    order: -1;
    padding-bottom: 6px !important;
    margin-bottom: 2px;
    border-bottom: 1px dashed var(--border-subtle) !important;
    font-size: 13.5px;
  }

  .data-table tbody td.td-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 6px !important;
    margin-top: 2px;
    border-top: 1px dashed var(--border-subtle) !important;
    white-space: normal;
  }

  .data-table tbody td.td-actions:empty {
    display: none;
  }

  .data-table tbody td.td-actions .btn-sm {
    flex: 1 1 auto;
    min-height: 36px;
    padding: 6px 6px;
    font-size: 11.5px;
    justify-content: center;
  }

  .data-table tbody td[colspan] {
    grid-column: 1 / -1;
    text-align: center;
    padding: 16px 8px !important;
  }
}

/* ================= NEW BIG UPDATE STYLES ================= */
/* Shortcut Tip Badges */
.shortcut-tip {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

kbd {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
  font-weight: 800;
  color: var(--text-main);
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* Held Carts Bar */
.held-carts-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-subtle);
  margin-bottom: 8px;
}

.held-tag {
  background: var(--color-warning-light);
  border: 1px solid var(--color-warning);
  color: #92400e;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.held-tag:hover {
  background: #fde68a;
}

.held-tag .btn-dismiss-held {
  background: transparent;
  border: none;
  color: #b45309;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* Wholesale Section in Products & Cart */
.wholesale-form-box {
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--color-primary);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 14px;
}

.wholesale-box-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 8px;
  display: block;
}

.wholesale-badge {
  background: #fef08a;
  color: #854d0e;
  border: 1px solid #facc15;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.unit-switch-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  padding: 6px 12px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.unit-switch-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.unit-switch-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(21, 128, 61, 0.25);
}

.price-btn-edit:hover {
  color: var(--color-primary);
}

/* Shift Modal Styles */
.shift-live-summary {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.shift-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-body);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.expected-cash-box {
  background: #0f172a;
  color: #fff;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
}

.expected-cash-box strong {
  color: #4ade80;
  font-size: 20px;
}

.shift-action-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.shift-action-tabs button {
  flex: 1;
}

.shift-action-tabs button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ================= MULTI-TIER UOM STYLES ================= */
.uom-selection-section {
  margin: 16px 0 12px;
}

.uom-section-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.uom-preset-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.uom-pill-btn {
  flex: 1 1 160px;
  min-width: 0;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.uom-pill-btn:hover {
  border-color: var(--color-primary);
  background: #f8fafc;
}

.uom-pill-btn.active {
  border-color: var(--color-primary);
  background: #eff6ff;
  box-shadow: 0 0 0 1px var(--color-primary);
}

.uom-pill-btn .pill-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--border-subtle);
  color: var(--text-muted);
}

.uom-pill-btn.active .pill-badge {
  background: var(--color-primary);
  color: #fff;
}

.uom-pill-btn .pill-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.uom-pill-btn .pill-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.uom-tier-box {
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.tier-base {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
}

.tier-medium {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
}

.tier-wholesale {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
}

.uom-tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.tier-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
}

.tier-tag-base {
  background: #e2e8f0;
  color: #334155;
}

.tier-tag-medium {
  background: #dbeafe;
  color: #1e40af;
}

.tier-tag-wholesale {
  background: #dcfce7;
  color: #166534;
}

.tier-desc {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.uom-hint-text {
  margin-top: 6px;
  font-size: 11px;
  color: #1e40af;
  background: #ffffff;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px dashed #bfdbfe;
}

.uom-calc-alert {
  margin-top: 6px;
  font-size: 12px;
  color: #166534;
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #86efac;
  font-weight: 600;
}

.currency-input {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Print Optimization: Receipt Thermal 58mm/80mm, Barcode Label, Batch Shelf Tags, & Restock List */
@media print {
  @page {
    margin: 0;
    size: auto;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  }

  /* 1. HIDE EVERYTHING OUTSIDE THE ACTIVE MODAL (Zero Blank Pages) */
  header.topbar,
  main.main-container,
  #toast-container,
  #mobile-cart-bar,
  .modal-overlay.hidden,
  .hidden,
  [hidden] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    top: -99999px !important;
    left: -99999px !important;
  }

  /* 2. THE ACTIVE MODAL TAKES OVER THE PRINT DOCUMENT CLEANLY */
  .modal-overlay:not(.hidden) {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    inset: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .modal-overlay:not(.hidden) .modal-card {
    position: static !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    max-height: none !important;
    height: auto !important;
    width: 100% !important;
  }

  /* Hide interactive modal controls when printing */
  .modal-close,
  .modal-actions,
  .receipt-actions-wrap,
  .modal-header,
  .barcode-mode-toggle,
  #modal-barcode-print p,
  #modal-batch-shelf-tags select,
  #modal-batch-shelf-tags label {
    display: none !important;
    visibility: hidden !important;
  }

  /* 3. TARGET: CETAK LABEL BARCODE SATUAN (Thermal / Sticker) - FLUSH AT THE VERY TOP */
  #modal-barcode-print:not(.hidden) .barcode-print-card {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 58mm !important;
    border: none !important;
    background: transparent !important;
  }

  #modal-barcode-print:not(.hidden) .barcode-label-paper {
    display: block !important;
    position: static !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    border: 1.5px solid #000000 !important;
    border-radius: 2px !important;
    width: 52mm !important;
    max-width: 54mm !important;
    box-sizing: border-box !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  #modal-barcode-print:not(.hidden) .barcode-label-paper.mode-item {
    padding: 4px 6px !important;
    width: 48mm !important;
    max-width: 50mm !important;
  }

  #modal-barcode-print:not(.hidden) .barcode-label-paper svg {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    margin: 2px auto !important;
  }

  /* 4. TARGET: CETAK STRUK TRANSAKSI (Thermal 58mm / 80mm) - FLUSH AT THE VERY TOP */
  #modal-receipt:not(.hidden) .receipt-card {
    border: none !important;
    box-shadow: none !important;
    width: 52mm !important;
    max-width: 58mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  #modal-receipt:not(.hidden) .receipt-paper {
    display: block !important;
    position: static !important;
    border: none !important;
    padding: 1mm 0 !important;
    margin: 0 !important;
    font-family: "Courier New", Courier, monospace !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #000000 !important;
    width: 52mm !important;
    max-width: 58mm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  #modal-receipt:not(.hidden) .receipt-paper * {
    color: #000000 !important;
  }

  #modal-receipt:not(.hidden) .receipt-logo-img {
    max-height: 38px !important;
    filter: grayscale(100%) contrast(300%) !important;
    margin: 0 auto 4px auto !important;
    display: block !important;
  }

  #modal-receipt:not(.hidden) .receipt-divider {
    border-bottom: 1px dashed #000000 !important;
    height: 1px !important;
    line-height: 0 !important;
    font-size: 0 !important;
    color: transparent !important;
    margin: 5px 0 !important;
    overflow: hidden !important;
  }

  /* 5. TARGET: CETAK LABEL RAK MASSAL (A4 / HVS) */
  #modal-batch-shelf-tags:not(.hidden) .modal-card {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }

  #modal-batch-shelf-tags:not(.hidden) #batch-shelf-preview {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    background: #ffffff !important;
    padding: 0 !important;
  }

  #modal-batch-shelf-tags:not(.hidden) .batch-shelf-tags-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4mm !important;
    width: 100% !important;
  }

  #modal-batch-shelf-tags:not(.hidden) .shelf-tag-item {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1.5px solid #000000 !important;
  }

  /* 6. TARGET: CETAK DAFTAR KULAKAN / RESTOCK */
  #modal-restock-list:not(.hidden) .modal-card {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }

  #modal-restock-list:not(.hidden) #restock-summary-bar {
    display: flex !important;
    margin: 0 0 10px 0 !important;
  }

  #modal-restock-list:not(.hidden) table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  #modal-restock-list:not(.hidden) th,
  #modal-restock-list:not(.hidden) td {
    border: 1px solid #000000 !important;
    padding: 6px !important;
  }
}

/* ================= BARCODE SINGLE LABEL & STICKER ================= */
.barcode-mode-toggle button {
  transition: all 0.15s ease;
  border-radius: var(--radius-sm);
}

.barcode-label-paper.mode-item {
  padding: 8px 10px !important;
  border-radius: var(--radius-sm);
}

.barcode-label-paper.mode-item #lbl-barcode-name {
  font-size: 13px !important;
  font-weight: 800 !important;
  margin-bottom: 2px !important;
  text-align: center;
}

.barcode-label-paper.mode-item #lbl-price-shelf {
  justify-content: center;
  margin-bottom: 2px !important;
}

.barcode-label-paper.mode-item #lbl-barcode-price-val {
  font-size: 18px !important;
}

.barcode-label-paper.mode-item #lbl-barcode-unit {
  font-size: 11px !important;
}

.barcode-label-paper.mode-item #lbl-barcode-svg-wrap {
  margin-top: 2px !important;
  padding-top: 2px !important;
  border-top: none !important;
}

/* ================= SHELF PRICE TAGS (LABEL HARGA RAK GONDOLA) ================= */
.batch-shelf-tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.shelf-tag-item {
  background: #ffffff;
  border: 1.5px solid #0f172a;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.shelf-tag-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #0f172a;
  padding-bottom: 3px;
  margin-bottom: 5px;
}

.shelf-tag-brand {
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #0f172a;
}

.shelf-tag-cat {
  font-size: 9px;
  font-weight: 800;
  background: #0f172a;
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.shelf-tag-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  color: #0f172a;
  margin-bottom: 6px;
  word-break: break-word;
  min-height: 32px;
}

.shelf-tag-price-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 4px;
}

.shelf-tag-rp {
  font-size: 12px;
  font-weight: 800;
  color: #15803d;
}

.shelf-tag-price {
  font-size: 24px;
  font-weight: 900;
  color: #15803d;
  letter-spacing: -0.5px;
  line-height: 1;
}

.shelf-tag-unit {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-left: 2px;
}

.shelf-tag-tiers {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.shelf-tier-badge {
  font-size: 10px;
  font-weight: 700;
  background: #f0fdf4;
  border-left: 3px solid #16a34a;
  padding: 2px 5px;
  color: #15803d;
  border-radius: 0 3px 3px 0;
}

.shelf-tier-badge.medium {
  background: #eff6ff;
  border-left-color: #2563eb;
  color: #1d4ed8;
}

.shelf-tag-barcode-wrap {
  text-align: center;
  border-top: 1px dashed #cbd5e1;
  padding-top: 4px;
  margin-top: 4px;
}

.shelf-tag-barcode-wrap svg {
  max-width: 100%;
  height: 34px;
}

/* ================= FLOATING TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.25s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.toast-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #f87171;
}

.toast.toast-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #4ade80;
}

.toast.toast-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #facc15;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== FAST TAP BAR (POS) ==================== */
.fast-tap-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 12px;
}

.fast-tap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.fast-tap-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fast-tap-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.fast-tap-chips::-webkit-scrollbar {
  display: none;
}

.fast-tap-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.fast-tap-chip:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.fast-tap-chip:active {
  transform: scale(0.96);
}

.fast-tap-chip:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.fast-tap-chip:focus:not(:focus-visible) {
  outline: none;
  border-color: var(--border-subtle);
}

.fast-tap-chip .chip-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

.fast-tap-chip .chip-price {
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 800;
}

/* ==================== FLOATING MOBILE CART BAR ==================== */
.mobile-cart-bar {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 1000;
  animation: slideUpCart 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

@keyframes slideUpCart {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mobile-cart-bar.hidden {
  display: none !important;
}

.mobile-cart-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-cart-bar-badge {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

.mobile-cart-bar-total {
  font-size: 16px;
  font-weight: 900;
  color: #4ade80;
  letter-spacing: -0.3px;
}

.btn-mobile-checkout {
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.35);
  transition: transform 0.1s ease, background 0.15s ease;
}

.btn-mobile-checkout:active {
  transform: scale(0.97);
  background: #166534;
}

@media (min-width: 821px) {
  .mobile-cart-bar {
    display: none !important;
  }

  .mobile-only {
    display: none !important;
  }

  .desktop-only {
    display: flex !important;
  }

  .pos-cart-pane {
    display: flex !important;
    position: sticky !important;
  }
}

/* ==================== FINANCIAL & MOM REPORT STYLES ==================== */
.report-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-group-toggle {
  display: inline-flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}

.btn-group-toggle .btn {
  border-radius: 0;
  border: none;
  margin: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
}

.btn-group-toggle .btn.active {
  background: var(--color-primary);
  color: #fff;
}

.metric-sub {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 5px;
  color: var(--text-muted);
}

.metric-sub.growth-up {
  color: var(--color-success);
  font-weight: 700;
}

.metric-sub.growth-down {
  color: var(--color-danger);
  font-weight: 700;
}

.cashflow-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .cashflow-breakdown-grid {
    grid-template-columns: 1fr;
  }
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 13.5px;
}

.breakdown-item-name {
  font-weight: 600;
  color: var(--text-main);
  text-transform: capitalize;
}

.breakdown-item-val {
  font-weight: 800;
}

.badge-in {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.badge-out {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 800;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Accessibility: Stop non-essential motion for users who prefer reduced motion (Antislop R-39) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
