*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0d12;
  --surface: #111620;
  --surface2: #181e2d;
  --surface3: #1e2638;
  --border: rgba(255, 255, 255, 0.07);
  --accent: #00e5a0;
  --accent2: #00b8ff;
  --accent3: #ff6b6b;
  --accent4: #ffd166;
  --text: #eef2ff;
  --text2: #8892aa;
  --text3: #4a5568;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 72px;
  --top-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --scrollbar-w: 7px;
  --scrollbar-track: rgba(255, 255, 255, 0.06);
  --scrollbar-thumb: rgba(0, 229, 160, 0.4);
  --scrollbar-thumb-hover: rgba(0, 229, 160, 0.65);
  --modal-close-w: 44px;
  /* Sheet cap; body scroll uses --modal-sheet-chrome subtracted (see .modal-sheet-body). */
  --modal-sheet-max-h: min(92dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 8px), 700px);
  --modal-sheet-chrome: 118px;
}

/* Firefox + WebKit: themed scrollbars on all main scroll regions */
html,
body,
.screen,
.notif-menu-list,
.modal-sheet-body,
.search-dropdown,
#screen-home #cart-list {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.screen::-webkit-scrollbar,
.notif-menu-list::-webkit-scrollbar,
.modal-sheet-body::-webkit-scrollbar,
.search-dropdown::-webkit-scrollbar,
#screen-home #cart-list::-webkit-scrollbar {
  width: var(--scrollbar-w);
  height: var(--scrollbar-w);
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.screen::-webkit-scrollbar-track,
.notif-menu-list::-webkit-scrollbar-track,
.modal-sheet-body::-webkit-scrollbar-track,
.search-dropdown::-webkit-scrollbar-track,
#screen-home #cart-list::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.screen::-webkit-scrollbar-thumb,
.notif-menu-list::-webkit-scrollbar-thumb,
.modal-sheet-body::-webkit-scrollbar-thumb,
.search-dropdown::-webkit-scrollbar-thumb,
#screen-home #cart-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.screen::-webkit-scrollbar-thumb:hover,
.notif-menu-list::-webkit-scrollbar-thumb:hover,
.modal-sheet-body::-webkit-scrollbar-thumb:hover,
.search-dropdown::-webkit-scrollbar-thumb:hover,
#screen-home #cart-list::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  font-family: 'Sora', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: block;
}

.app-shell {
  width: 100%;
  max-width: min(430px, 100%);
  min-height: 100svh;
  height: 100dvh;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  position: relative;
}

/* TOP BAR */
.topbar {
  height: var(--top-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1200;
  flex-shrink: 0;
  padding-top: var(--safe-top);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 16px;
  height: 16px;
}

.logo-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.logo-text span {
  color: var(--accent);
}

.cashier-badge {
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(0, 184, 255, 0.15);
  border: 1px solid rgba(0, 184, 255, 0.35);
  color: #7dd3fc;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lang-switch {
  position: relative;
  background: linear-gradient(135deg, #192235, #111827);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  overflow: hidden;
  min-height: 38px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  min-width: 128px;
  height: 38px;
  padding: 0 36px 0 12px;
  cursor: pointer;
  letter-spacing: 0.2px;
}

.lang-select:focus {
  outline: none;
}

.lang-switch:focus-within {
  border-color: rgba(0, 229, 160, 0.65);
  box-shadow: 0 0 0 3px rgba(0, 229, 160, 0.2);
}

.lang-select option {
  color: #111827;
  background: #f8fafc;
}

.lang-switch::after {
  content: '▼';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #b5c3df;
  pointer-events: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:active {
  transform: scale(0.93);
  background: var(--surface3);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text2);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent3);
  position: absolute;
  top: 8px;
  right: 8px;
  border: 2px solid var(--surface);
}

.notif-wrap {
  position: relative;
}

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  background: var(--accent3);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.notif-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-height: 360px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  z-index: 1300;
  display: none;
  overflow: hidden;
}

.notif-menu.open {
  display: block;
}

.notif-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.notif-menu-head span {
  font-size: 13px;
  font-weight: 700;
}

.notif-menu-head button {
  border: none;
  background: transparent;
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.notif-menu-list {
  max-height: 300px;
  overflow-y: auto;
}

.notif-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item.unread {
  background: rgba(0, 184, 255, 0.08);
}

.notif-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.notif-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

.notif-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text3);
}

/* SCREENS */
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  flex-direction: column;
  padding-bottom: calc(8px + var(--safe-bottom));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  /* Prevents flex min-content width forcing horizontal overflow (zoom-out to see layout). */
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.screen.active {
  display: flex;
}

.screen-start-padding {
  padding-top: 4px;
}

#screen-home {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/*
 * Cart scrolls inside a max height so discount/tax/total + customer + bill stay in reach.
 * Empty state must NOT use flex:1 here — nested flex + max-height was collapsing the list area.
 */
#screen-home #cart-list {
  flex-shrink: 1;
  min-height: min(152px, 38dvh);
  max-height: min(42dvh, 360px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#screen-home #cart-list .empty-state {
  flex: 0 0 auto;
}

/* Totals + customer + bill: never shrink away in column flex layout */
.home-checkout-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

/* BOTTOM NAV */
.bottom-nav {
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 8px calc(8px + var(--safe-bottom));
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s;
  position: relative;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  color: var(--text3);
  transition: color 0.2s;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 0.3px;
  transition: color 0.2s;
}

.nav-item.active svg {
  color: var(--accent);
}

.nav-item.active .nav-label {
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-center {
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 4px;
}

.scan-fab {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #00c896);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 20px rgba(0, 229, 160, 0.35);
  margin-bottom: 8px;
}

.scan-fab:active {
  transform: scale(0.92);
  box-shadow: 0 2px 10px rgba(0, 229, 160, 0.2);
}

.scan-fab svg {
  width: 24px;
  height: 24px;
  color: #000;
}

/* HOME / SEARCH */
.pos-search-bar {
  margin: 16px 16px 12px;
  display: flex;
  gap: 10px;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: border-color 0.2s;
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
}

.search-icon {
  padding: 0 12px;
}

.search-icon svg {
  width: 16px;
  height: 16px;
  color: var(--text3);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  color: var(--text);
  padding: 12px 12px 12px 0;
}

.search-input::placeholder {
  color: var(--text3);
}

/* Search dropdown */
.search-dropdown {
  margin: -8px 16px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  z-index: 20;
  position: relative;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:active {
  background: var(--surface3);
}

.search-result-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.search-result-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.search-result-price {
  font-size: 12px;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

/* CART */
.cart-summary-strip {
  margin: 0 16px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-count-badge {
  background: rgba(0, 229, 160, 0.15);
  border: 1px solid rgba(0, 229, 160, 0.3);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
}

.cart-total-label {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

.cart-total-value {
  font-size: 22px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  letter-spacing: -1px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text3);
  text-transform: uppercase;
  padding: 0 16px;
  margin-bottom: 8px;
}

.cart-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 12px;
  transition: all 0.15s;
  animation: slideIn 0.2s ease;
  max-width: 100%;
  box-sizing: border-box;
}

/* Second row: qty/delete controls stay inside viewport (no sideways scroll) */
#screen-home .cart-item .item-controls {
  flex: 1 1 100%;
  justify-content: flex-end;
  padding-left: 52px;
  box-sizing: border-box;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-color-dot {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  font-weight: 700;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-price {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

.item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
}

.qty-btn:active {
  transform: scale(0.88);
}

.qty-btn svg {
  width: 14px;
  height: 14px;
  color: var(--text2);
}

.qty-val {
  font-size: 14px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.item-del {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
  margin-left: 4px;
}

.item-del:active {
  transform: scale(0.88);
  background: rgba(255, 107, 107, 0.2);
}

.item-del svg {
  width: 14px;
  height: 14px;
  color: var(--accent3);
}

/* CALC SECTION */
.calc-section {
  margin: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: hidden;
  overflow-y: visible;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#calc-section,
#calc-section.show {
  display: block !important;
}

#screen-home #calc-section,
#screen-home #calc-section.show {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
}

#customer-row {
  display: none;
  min-width: 0;
  box-sizing: border-box;
  padding: 0 16px;
  margin: 8px 0 10px;
  overflow: visible;
}

#customer-row.show {
  display: block !important;
}

.customer-fields-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.customer-optional-heading {
  padding: 0 0 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text3);
  text-transform: uppercase;
}

#bill-btn.show {
  display: flex !important;
}

.calc-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  visibility: visible !important;
  opacity: 1 !important;
}

/* Never shrink the amount column — it was collapsing to 0 width on narrow phones. */
.calc-row .calc-label {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-row .calc-value {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}

.calc-row:last-child {
  border-bottom: none;
}

.calc-label {
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
}

.calc-value {
  font-size: 14px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}

.calc-value.green {
  color: var(--accent);
}

.calc-value.red {
  color: var(--accent3);
}

.calc-value.total {
  font-size: 18px;
}

.discount-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.mini-input {
  flex: 1 1 0;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s;
}


.customer-fields-row .mini-input {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  padding: 12px 10px;
  display: block;
}
.mini-input:focus {
  border-color: var(--accent);
}

.mini-toggle {
  display: flex;
  background: var(--surface2);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.mini-toggle span {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text3);
  transition: all 0.15s;
}

.mini-toggle span.active {
  background: var(--accent);
  color: #000;
}

/* BILL BUTTON */
.bill-btn {
  margin: 4px 16px 16px;
  background: linear-gradient(135deg, var(--accent), #00b8d4);
  color: #000;
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 800;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  box-sizing: border-box;
  width: auto;
  align-self: stretch;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 20px rgba(0, 229, 160, 0.25);
}

.bill-btn:active {
  transform: scale(0.97);
  box-shadow: none;
}

.bill-btn svg {
  width: 20px;
  height: 20px;
}

.bill-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 5000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  padding-left: max(0px, var(--safe-left));
  padding-right: max(0px, var(--safe-right));
  overscroll-behavior: contain;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-sheet {
  width: 100%;
  max-width: min(430px, 100%);
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 12px 0 0;
  max-height: var(--modal-sheet-max-h);
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 10px;
  flex-shrink: 0;
}

.sheet-title {
  font-size: 15px;
  font-weight: 800;
  padding: 0 calc(14px + var(--modal-close-w)) 10px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  line-height: 1.25;
}

.sheet-corner-close {
  position: absolute;
  top: max(8px, var(--safe-top));
  right: max(10px, var(--safe-right));
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 107, 107, 0.7);
  background: #ff4d4f;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  box-shadow: 0 6px 18px rgba(255, 77, 79, 0.35);
  flex-shrink: 0;
}

.sheet-corner-close:active {
  transform: scale(0.95);
}

/* Cross-axis overflow guard for modal content blocks */
.bill-sheet-content,
.form-row,
.form-actions,
.settings-row,
.app-confirm-body {
  min-width: 0;
  box-sizing: border-box;
}

.app-confirm-sheet {
  max-width: 420px;
  max-height: var(--modal-sheet-max-h);
  border-radius: 20px;
}

.app-confirm-body {
  padding: 14px 16px 16px;
}

.app-confirm-message {
  color: var(--text2);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.app-confirm-actions {
  display: flex;
  gap: 10px;
}

.app-confirm-actions .btn-secondary,
.app-confirm-actions .btn-primary {
  flex: 1;
}

.app-confirm-ok-btn {
  background: linear-gradient(135deg, #ff6b6b, #ff8f8f);
  color: #111;
}

#cashier-list .cashier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

#cashier-list .cashier-row:last-child {
  border-bottom: none;
}

#cashier-list .cashier-meta {
  font-size: 11px;
  color: var(--text3);
}

/* Do not use flex:1 with flex-basis:0 here — parent .modal-sheet only has max-height, so mobile
   browsers give this region 0 height. Cap height explicitly so the form scrolls inside the sheet. */
.modal-sheet-body {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(78dvh, 620px);
  max-height: calc(var(--modal-sheet-max-h) - var(--modal-sheet-chrome));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

#analytics-modal .modal-sheet {
  max-height: var(--modal-sheet-max-h);
}

/* GOOGLE LOGIN MODAL */
.login-modal-sheet {
  border-radius: 22px;
  margin: 18px;
  width: calc(100% - 36px);
  max-width: 390px;
  max-height: var(--modal-sheet-max-h);
  transform: translateY(24px) scale(0.96);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.modal-overlay.open .login-modal-sheet {
  transform: translateY(0) scale(1);
}

.login-modal-sheet .sheet-handle {
  margin: 12px auto 4px;
}

.login-modal-body {
  padding: 12px 22px 22px;
  text-align: center;
}

.login-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin: 0 auto 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-modal-icon svg {
  width: 34px;
  height: 34px;
}

.login-modal-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.login-modal-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text2);
  margin-bottom: 18px;
}

.login-modal-actions {
  display: flex;
  gap: 10px;
}

.login-modal-actions .btn-secondary {
  flex: 1;
}

.google-login-btn {
  flex: 1.7;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, #fff 0%, #f2f6ff 100%);
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 0 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 8px 22px rgba(255, 255, 255, 0.14);
}

.google-login-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

/* SCREEN PIN MODALS */
.pin-modal-sheet {
  border-radius: 20px;
  margin: 18px;
  width: calc(100% - 36px);
  max-width: 390px;
  max-height: var(--modal-sheet-max-h);
  transform: translateY(24px) scale(0.96);
  padding-bottom: 16px;
}

.modal-overlay.open .pin-modal-sheet {
  transform: translateY(0) scale(1);
}

.pin-modal-sheet .sheet-handle {
  margin-bottom: 12px;
}

.pin-modal-body {
  padding: 8px 18px 0;
}

.pin-modal-note {
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.45;
}

.pin-input {
  text-align: center;
  letter-spacing: 4px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.pin-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.pin-modal-actions button {
  flex: 1;
}

.pin-reset-link {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--accent2);
  font-size: 12px;
  font-weight: 700;
  margin-top: 10px;
  cursor: pointer;
}

/* SCANNER */
.modal-sheet-body .scanner-viewport {
  margin: 14px 18px 12px;
}

.scanner-viewport {
  margin: 20px 20px 16px;
  height: 200px;
  border-radius: 18px;
  background: #000;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(0, 229, 160, 0.3);
}

.scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.scanner-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 160, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 160, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
  z-index: 1;
}

.scanner-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scan 2s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(0, 229, 160, 0.8);
  z-index: 2;
}

@keyframes scan {
  0% {
    top: 20%;
  }

  50% {
    top: 80%;
  }

  100% {
    top: 20%;
  }
}

.scanner-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--accent);
  border-style: solid;
  z-index: 2;
}

.scanner-corner.tl {
  top: 12px;
  left: 12px;
  border-width: 3px 0 0 3px;
  border-radius: 4px 0 0 0;
}

.scanner-corner.tr {
  top: 12px;
  right: 12px;
  border-width: 3px 3px 0 0;
  border-radius: 0 4px 0 0;
}

.scanner-corner.bl {
  bottom: 12px;
  left: 12px;
  border-width: 0 0 3px 3px;
  border-radius: 0 0 0 4px;
}

.scanner-corner.br {
  bottom: 12px;
  right: 12px;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 4px 0;
}

.scanner-label {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(0, 229, 160, 0.8);
  font-weight: 600;
  letter-spacing: 1px;
  z-index: 2;
}

.scanner-status {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 3;
}

.scanner-actions {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scanner-manual {
  display: flex;
  gap: 8px;
}

.scan-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.scan-input:focus {
  border-color: var(--accent);
}

/* BUTTONS */
.btn-primary {
  background: var(--accent);
  color: #000;
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary:active {
  transform: scale(0.94);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn-secondary:active {
  transform: scale(0.94);
}

/* PRODUCTS */
.products-header {
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.products-search-row {
  width: 100%;
}

.products-search-wrap {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.products-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

@media (min-width: 520px) {
  .products-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.products-toolbar-btn {
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}

.products-grid {
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.product-card > :not(.product-card-bg) {
  position: relative;
  z-index: 1;
}

.product-card:active {
  transform: scale(0.96);
  border-color: var(--accent);
}

.product-card-bg {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  opacity: 0.06;
  z-index: 0;
  pointer-events: none;
}

.product-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: 700;
}

.product-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.product-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.product-stock {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 500;
}

.product-stock.low {
  color: var(--accent3);
}

.product-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.product-edit-btn {
  flex: 1;
  background: rgba(0, 184, 255, 0.1);
  border: 1px solid rgba(0, 184, 255, 0.2);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.product-del-btn {
  flex: 1;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.2);
  color: var(--accent3);
  font-size: 11px;
  font-weight: 700;
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.product-history-btn {
  flex: 1;
  background: rgba(0, 229, 160, 0.1);
  border: 1px solid rgba(0, 229, 160, 0.25);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 5px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.product-history-btn,
.product-edit-btn,
.product-del-btn {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stock-history-block-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text2);
  margin: 10px 0 6px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.stock-history-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
}

.stock-history-search-block {
  padding: 0 16px 10px;
}

.stock-history-search-wrap {
  width: 100%;
}

.stock-history-screen-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text3);
}

.stock-history-screen-list {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Product sales & profit (same card rhythm as products grid) */
.product-sales-range-block {
  padding: 0 16px 10px;
}

.product-sales-date-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.product-sales-date-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  flex: 1 1 140px;
  min-width: 0;
}

.product-sales-date-input {
  width: 100%;
}

.product-sales-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}

.product-sales-total-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-sales-total-chip--profit .product-sales-total-chip-val {
  color: var(--accent);
}

.product-sales-total-chip-lbl {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
}

.product-sales-total-chip-val {
  font-size: 16px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}

.product-sales-card {
  cursor: default;
}

.product-sales-card:active {
  transform: none;
}

.product-sales-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  margin-top: 6px;
}

.product-sales-line span:first-child {
  color: var(--text3);
  font-weight: 600;
}

.product-sales-line span:last-child {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}

.product-sales-line--profit {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.product-sales-profit--neg span:last-child {
  color: var(--accent3);
}

.stock-history-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 10px;
  margin-bottom: 0;
}

.stock-history-product {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.stock-history-product-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stock-history-product-stock {
  font-size: 13px;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.stock-history-movements-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.stock-history-entry {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.stock-history-entry:last-child {
  margin-bottom: 0;
}

.stock-history-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.stock-history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.stock-history-badge--in {
  background: rgba(0, 229, 160, 0.18);
  color: var(--accent);
  border: 1px solid rgba(0, 229, 160, 0.35);
}

.stock-history-badge--out {
  background: rgba(255, 107, 107, 0.14);
  color: var(--accent3);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.stock-history-badge--adj {
  background: rgba(0, 184, 255, 0.12);
  color: var(--accent2);
  border: 1px solid rgba(0, 184, 255, 0.28);
}

.stock-history-entry-qty {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.stock-history-entry-meta {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.4;
  margin-bottom: 4px;
}

.stock-history-entry-when {
  font-size: 11px;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
}

.add-product-btn {
  margin: 12px 16px;
  background: rgba(0, 229, 160, 0.08);
  border: 1px dashed rgba(0, 229, 160, 0.3);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.add-product-btn:active {
  background: rgba(0, 229, 160, 0.15);
}

.add-product-btn svg {
  width: 18px;
  height: 18px;
}

/* ORDERS */
.orders-filter {
  position: relative;
  padding: 16px 16px 12px;
  display: flex;
  gap: 8px;
  /* overflow-x: auto; */
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.orders-filter::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
}

.filter-chip.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.filter-chip:active {
  transform: scale(0.93);
}

.orders-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.order-card:active {
  border-color: var(--accent2);
}

.order-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.order-id {
  font-size: 13px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent2);
}

.order-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.order-status.paid {
  background: rgba(0, 229, 160, 0.1);
  color: var(--accent);
}

.order-status.pending {
  background: rgba(255, 209, 102, 0.1);
  color: var(--accent4);
}

.order-status.cancelled {
  background: rgba(255, 107, 107, 0.1);
  color: var(--accent3);
}

.order-customer {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.order-date {
  font-size: 12px;
  color: var(--text3);
}

.order-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.order-items-count {
  font-size: 12px;
  color: var(--text2);
}

.order-total {
  font-size: 16px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
}

.order-due-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 209, 102, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.28);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent4);
}

.order-due-strip strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

.order-collect-card {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.order-collect-submit {
  width: 100%;
  margin-top: 10px;
  border-radius: var(--radius-sm);
}

.wa-resend {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 211, 102, 0.1);
  border: 1px solid rgba(37, 211, 102, 0.25);
  color: #25d366;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.wa-resend:active {
  transform: scale(0.93);
  background: rgba(37, 211, 102, 0.2);
}

.wa-resend svg {
  width: 14px;
  height: 14px;
}

/* SETTINGS */
.settings-profile {
  margin: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #000;
  flex-shrink: 0;
}

.profile-name {
  font-size: 17px;
  font-weight: 800;
}

.profile-sub {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

.settings-section {
  margin: 0 16px 16px;
}

.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row:active {
  background: var(--surface2);
}

.settings-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-icon svg {
  width: 18px;
  height: 18px;
}

.settings-text {
  flex: 1;
}

.settings-label {
  font-size: 14px;
  font-weight: 600;
}

.settings-desc {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.counter-summary-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.counter-summary-row:last-of-type {
  border-bottom: none;
}

#counter-summary {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#counter-summary strong {
  display: inline-block;
  margin-bottom: 4px;
}

.settings-chevron svg {
  width: 16px;
  height: 16px;
  color: var(--text3);
}

.toggle-switch {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--accent);
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle-switch.off {
  background: var(--surface3);
}

.toggle-switch.off::after {
  transform: translateX(0);
}

.toggle-switch::after {
  transform: translateX(20px);
}

/* BILL */
.bill-sheet-content {
  padding: 0 20px 20px;
}

.bill-header {
  text-align: center;
  padding: 16px 0 20px;
  border-bottom: 1px dashed var(--border);
}

.bill-shop {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.bill-shop span {
  color: var(--accent);
}

.bill-tagline {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

.bill-meta {
  font-size: 12px;
  color: var(--text2);
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
}

.bill-items {
  padding: 16px 0;
  border-bottom: 1px dashed var(--border);
}

.bill-item-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
}

.bill-item-name {
  color: var(--text);
  font-weight: 500;
  flex: 1;
}

.bill-item-qty {
  color: var(--text2);
  padding: 0 12px;
  font-family: 'JetBrains Mono', monospace;
}

.bill-item-sub {
  color: var(--text);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.bill-totals {
  padding: 14px 0 16px;
  border-bottom: 1px dashed var(--border);
}

.bill-total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text2);
}

.bill-total-row.final {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}

.bill-total-row.final span:last-child {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.bill-payment-panel {
  padding: 14px 0 4px;
  border-bottom: 1px dashed var(--border);
}

.bill-credit-customer-row {
  padding: 10px 0 0;
}

.bill-credit-customer-row .form-label {
  display: block;
  margin-bottom: 6px;
}

.bill-credit-name-input {
  width: 100%;
  box-sizing: border-box;
}

.bill-payment-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.payment-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.pay-type-btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pay-type-btn.active {
  border-color: rgba(0, 229, 160, 0.55);
  background: rgba(0, 229, 160, 0.12);
  color: var(--accent);
}

.credit-advance-block .mini-input {
  width: 100%;
}

.bill-due-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 209, 102, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.25);
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}

.bill-due-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  color: var(--accent4);
}

.bill-credit-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text3);
}

/* Reduce visual motion where user prefers it (accessibility best practice). */
@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;
  }
}

.wa-phone-row {
  display: flex;
  gap: 8px;
  padding: 16px 0 12px;
}

.wa-phone-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.wa-phone-input:focus {
  border-color: #25d366;
}

.wa-share-btn {
  background: #25d366;
  color: #fff;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}

.wa-share-btn:active {
  transform: scale(0.94);
}

.wa-share-btn svg {
  width: 18px;
  height: 18px;
}

/* FORM */
.form-row {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
}

.amount-input {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.2px;
}

/* Hide browser number spinners if any number fields remain */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
}

/* STATS */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 12px 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.stat-val {
  font-size: 14px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.3px;
}

.stat-label {
  font-size: 9px;
  color: var(--text3);
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* EMPTY STATE */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  gap: 12px;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.empty-icon svg {
  width: 30px;
  height: 30px;
  color: var(--text3);
}

.empty-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.empty-sub {
  font-size: 12px;
  color: var(--text3);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  opacity: 0;
  transition: all 0.3s;
  z-index: 6000;
  white-space: nowrap;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: rgba(0, 229, 160, 0.4);
  color: var(--accent);
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.4);
  color: var(--accent3);
}

/* PULSE DOT */
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 6px;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* LOADING SPINNER */
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


.pos-search-bar {
  position: relative;
  z-index: 20;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #000000;
  border-radius: 14px;
  margin-top: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  z-index: 30;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #1b1b1b;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.search-result-item:hover {
  background: #262729;
}

.tutorial-list {
  padding: 6px 16px 8px;
  display: grid;
  gap: 10px;
}

.tutorial-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 4px 2px 0;
}

.tutorial-section-label--videos {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.tutorial-clip--empty {
  min-height: 76px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-align: center;
  padding: 12px;
}

.tutorial-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.tutorial-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.tutorial-step {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(0, 229, 160, 0.12);
  border: 1px solid rgba(0, 229, 160, 0.28);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.tutorial-arrow {
  color: var(--accent2);
  font-weight: 800;
  font-size: 12px;
}

.tutorial-clip {
  min-height: 76px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, rgba(0, 229, 160, 0.16), rgba(0, 184, 255, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  overflow: hidden;
}

.tutorial-clip video {
  width: 100%;
  max-height: 190px;
  border-radius: 10px;
  background: #000;
}

.tutorial-heading {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.tutorial-text {
  font-size: 13px;
  color: var(--text2);
}

/* ACCESSIBILITY UPGRADE: low-vision + color-blind friendly */
:root {
  --text2: #b7c2da;
  --text3: #8d9ab6;
  --border: rgba(255, 255, 255, 0.2);
}

html {
  font-size: 15px;
}

body {
  line-height: 1.5;
}

/* Do not include .screen here — it must keep min-height:0 (see below) so the home
   scroll area does not clip the bottom (customer fields looked like thin lines). */
.modal-sheet,
.settings-group,
.cart-item,
.product-card,
.order-card,
.search-input-wrap,
.form-input,
.mini-input,
.btn-primary,
.btn-secondary,
.bill-btn,
.icon-btn,
.qty-btn,
.item-del,
.wa-resend {
  min-height: 44px;
}

.screen {
  min-height: 0;
  min-width: 0;
}

.nav-label,
.form-label,
.settings-desc,
.notif-meta,
.calc-label {
  font-size: 12px;
}

.search-input,
.form-input,
.mini-input,
.settings-label,
.item-name,
.product-name,
.order-id,
.order-customer {
  font-size: 14px;
}

.product-price,
.item-price,
.order-total,
.calc-value,
.cart-total-value {
  font-size: 16px;
  letter-spacing: 0;
}

.section-title {
  font-size: 12px;
  letter-spacing: 0.8px;
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

.scan-fab {
  width: 50px;
  height: 50px;
  border-radius: 16px;
}

.scan-fab svg {
  width: 21px;
  height: 21px;
}

.qty-btn,
.item-del {
  width: 34px;
  height: 34px;
}

.qty-btn svg,
.item-del svg {
  width: 13px;
  height: 13px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.nav-item:focus-visible,
.scan-fab:focus-visible,
.icon-btn:focus-visible,
.product-card:focus-visible,
.order-card:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 2px;
}

.nav-item.active .nav-label {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.order-status {
  border: 1px solid currentColor;
  font-weight: 800;
}

.qty-btn,
.item-del {
  width: 38px;
  height: 38px;
}

.scanner-label,
.scanner-status {
  font-size: 13px;
  font-weight: 700;
}

@media (prefers-contrast: more) {
  :root {
    --surface: #0c1118;
    --surface2: #131a25;
    --surface3: #1b2433;
    --text: #ffffff;
    --text2: #d3ddf3;
    --text3: #c1cce5;
    --border: rgba(255, 255, 255, 0.35);
  }
}

@media (max-width: 768px) {
  #screen-home #cart-list {
    max-height: min(36dvh, 300px);
    padding-bottom: 2px;
  }

  html,
  body {
    min-height: 100svh;
  }

  .app-shell {
    max-width: none;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-left: none;
    border-right: none;
  }

  :root {
    --top-h: 58px;
    --nav-h: 68px;
  }

  html {
    font-size: 14px;
  }

  .topbar {
    padding: 0 12px;
  }

  .logo-text {
    font-size: 16px;
  }

  .topbar-right {
    gap: 6px;
  }

  .lang-select {
    min-width: 104px;
    max-width: 116px;
    height: 36px;
    font-size: 12px;
    padding: 0 30px 0 10px;
  }

  .lang-switch {
    border-radius: 10px;
    min-height: 36px;
  }

  .lang-switch::after {
    right: 10px;
  }

  .screen {
    padding-bottom: 10px;
  }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .product-history-btn {
    grid-column: 1 / -1;
    font-size: 12px;
  }

  .cart-summary-strip,
  .calc-section,
  .settings-section {
    margin-left: 12px;
    margin-right: 12px;
  }

  .section-title,
  .cart-list,
  .orders-list,
  .settings-profile {
    padding-left: 12px;
    padding-right: 12px;
  }

  .modal-overlay {
    padding: 0 6px;
  }

  .modal-sheet {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    --modal-close-w: 38px;
  }

  .sheet-title {
    font-size: 16px;
    padding-left: 14px;
    padding-right: calc(10px + var(--modal-close-w));
    padding-bottom: 12px;
  }

  .sheet-corner-close {
    width: 32px;
    height: 32px;
    font-size: 22px;
  }

  .app-confirm-actions {
    flex-direction: column;
  }

  .app-confirm-actions .btn-secondary,
  .app-confirm-actions .btn-primary {
    width: 100%;
  }

  .form-row,
  .form-actions,
  .scanner-actions,
  .bill-sheet-content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .settings-label,
  .settings-desc {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .calc-section {
    overflow: hidden;
  }

  .discount-input-row {
    flex-wrap: wrap;
    row-gap: 8px;
    align-items: center;
  }

  .discount-input-row .mini-input {
    min-width: 0;
    flex: 1 1 120px;
  }

  .discount-input-row .mini-toggle {
    flex: 0 0 auto;
  }

  .discount-input-row>span {
    margin-left: auto;
  }

  .calc-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
  }

  #disp-total {
    font-size: 17px;
  }
}

@media (max-width: 768px) {
  #customer-row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 12px;
    padding-right: 12px;
  }
}
@media (max-width: 680px) {
  #customer-row {
    margin-left: 10px !important;
    margin-right: 10px !important;
    padding-left: 12px;
    padding-right: 12px;
  }

  .calc-section,
  .cart-summary-strip,
  .bill-btn {
    margin-left: 10px;
    margin-right: 10px;
  }

  .discount-input-row {
    padding-left: 12px;
    padding-right: 12px;
  }

  .calc-row {
    padding-left: 12px;
    padding-right: 12px;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 400px) {
  :root {
    --top-h: 56px;
    --nav-h: 64px;
  }

  .topbar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .logo-text {
    font-size: 14px;
  }

  .topbar-right {
    gap: 5px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .lang-select {
    min-width: 90px;
    max-width: 96px;
    font-size: 11px;
    padding-right: 26px;
  }

  .stats-row {
    padding: 10px 10px 8px;
    gap: 8px;
  }

  .pos-search-bar {
    margin: 12px 10px 8px;
  }

  .products-grid {
    gap: 8px;
    padding: 0 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cart-list,
  .orders-list {
    padding-left: 10px;
    padding-right: 10px;
  }

  .section-title {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Ultra small screens / smartwatch-like webviews */
@media (max-width: 320px),
(max-height: 320px) {
  :root {
    --top-h: 50px;
    --nav-h: 56px;
  }

  html {
    font-size: 12px;
  }

  .topbar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .logo-text,
  .cashier-badge,
  .lang-switch {
    display: none;
  }

  .topbar-right {
    gap: 4px;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
  }

  .screen-start-padding {
    padding-top: 2px;
  }

  .section-title,
  .cart-list,
  .orders-list,
  .settings-profile {
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* Tablet and up: progressive enhancement */
@media (min-width: 769px) {
  .app-shell {
    width: 100%;
    max-width: min(460px, 100%);
    min-height: 100dvh;
    height: 100dvh;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .modal-sheet {
    max-width: min(460px, 100%);
  }
}

@media (min-width: 1024px) {
  .app-shell {
    max-width: min(480px, 100%);
  }

  .modal-sheet {
    max-width: min(480px, 100%);
  }
}

@media (min-width: 1366px) {
  .app-shell {
    max-width: min(500px, 100%);
  }

  .modal-sheet {
    max-width: min(500px, 100%);
  }
}

@media (max-height: 540px) and (orientation: landscape) {
  :root {
    --top-h: 50px;
    --nav-h: 58px;
  }

  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .logo-icon {
    width: 26px;
    height: 26px;
  }

  .logo-text {
    font-size: 13px;
  }

  .lang-select {
    height: 32px;
  }

  .screen {
    padding-bottom: calc(4px + var(--safe-bottom));
  }

  .stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 12px;
  }

  .modal-sheet {
    max-height: calc(100dvh - 4px);
  }
}

@media (max-height: 560px) {
  .screen-start-padding {
    padding-top: 10px;
  }

  .stats-row {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #screen-home #cart-list {
    max-height: min(28dvh, 240px);
    min-height: min(100px, 26dvh);
    overflow-y: auto;
  }

  .calc-section {
    margin-top: 8px;
  }
}