:root {
  --primary: #0F766E;
  --primary-dark: #0D5E57;
  --primary-soft: #CCFBF1;
  --accent: #059669;
  --accent-dark: #047857;
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-alt: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.14);
  --radius: 14px;
  --nav-h: 64px;
  --topbar-h: 56px;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}

body.sheet-open {
  overflow: hidden;
}

button, input, select {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  border-color: var(--primary);
}

.hidden {
  display: none !important;
}

.text-accent {
  color: var(--accent);
}

.text-danger {
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 14px;
  user-select: none;
  transition: transform 0.08s ease, background-color 0.15s ease;
}

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

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

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-dark);
}

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

.btn-outline {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-lg {
  padding: 14px 18px;
  font-size: 16px;
  border-radius: 13px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn-xs {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* STATUS PILLS */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-online {
  background: #D1FAE5;
  color: #065F46;
}

.status-offline {
  background: var(--warning-soft);
  color: #92400E;
}

.status-checking {
  background: var(--surface-alt);
  color: var(--muted);
}

/* PIN SCREEN */
.pin-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(160deg, #0F766E 0%, #0B524C 100%);
}

.pin-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 22px;
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
}

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

.pin-logo {
  border-radius: 14px;
  flex-shrink: 0;
}

.pin-store-name {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.pin-hint {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  text-align: center;
  margin-bottom: 12px;
}

.pin-prompt {
  margin: 4px 0 10px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.pin-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin-bottom: 8px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #CBD5E1;
  background: transparent;
  transition: all 0.12s;
}

.pin-dot.filled {
  border-color: var(--primary);
  background: var(--primary);
  transform: scale(1.1);
}

.pin-error {
  min-height: 20px;
  text-align: center;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
  user-select: none;
}

.pin-key {
  height: 54px;
  border-radius: 14px;
  background: var(--surface-alt);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s, transform 0.06s;
}

.pin-key:active {
  background: #CBD5E1;
  transform: scale(0.96);
}

.pin-key-muted {
  font-size: 14px;
  color: var(--muted);
}

/* APP SHELL */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.topbar-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}

.topbar-store {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48vw;
}

.role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 12px calc(var(--nav-h) + env(safe-area-inset-bottom) + 84px);
}

.tab-view {
  display: none;
}

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

/* TOOLBAR & SEARCH */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  padding-left: 36px;
  padding-right: 32px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface);
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

/* SELL STICKY HEADER & CHIPS */
.sell-sticky-bar {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 20;
  background: var(--bg);
  padding: 8px 0 4px;
  margin: -8px 0 6px;
}

.chip-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.chip-strip::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* PRODUCT GRID */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-tile {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 11px 11px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  user-select: none;
  transition: transform 0.08s ease, border-color 0.15s ease;
}

.product-tile:active {
  transform: scale(0.97);
}

.product-tile.in-cart {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.product-tile.out-of-stock {
  opacity: 0.6;
}

.tile-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
}

.tile-cart-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

.tile-dec-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tile-dec-btn:active {
  background: var(--danger-soft);
  color: var(--danger);
}

.tile-qty-badge {
  min-width: 24px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tile-name {
  margin-top: 4px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
  padding-right: 52px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.tile-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
}

.tile-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.tile-stock {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--muted);
}

.tile-stock.low {
  background: var(--warning-soft);
  color: #92400E;
}

.tile-stock.out {
  background: var(--danger-soft);
  color: var(--danger);
}

/* FLOATING CART BAR */
.cart-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  z-index: 28;
  max-width: 560px;
  margin: 0 auto;
}

.cart-bar-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  padding: 13px 18px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.35);
  transition: transform 0.08s ease;
}

.cart-bar-btn:active {
  transform: scale(0.98);
}

.cart-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-badge {
  background: rgba(255, 255, 255, 0.22);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.cart-total {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cart-bar-cta {
  font-size: 16px;
  font-weight: 700;
}

/* STOCK & CARDS */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.mini-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}

.mini-stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.mini-stat-val {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mini-stat-warn .mini-stat-val {
  color: var(--warning);
}

.mini-stat-danger .mini-stat-val {
  color: var(--danger);
}

.mini-stat-accent .mini-stat-val {
  color: var(--accent);
}

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

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

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

.item-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 15px;
}

.color-swatch-sm {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.item-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.item-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* SALES DASHBOARD */
.custom-date-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.input-sm {
  padding: 8px 10px;
  font-size: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.kpi-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.export-actions {
  display: flex;
  gap: 6px;
}

.payment-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pay-stat {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 9px 8px;
  text-align: center;
}

.pay-stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.pay-stat-val {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.pay-stat-count {
  font-size: 11px;
  color: var(--muted);
}

.top-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

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

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 12px 0 8px;
}

/* MORE TAB */
.user-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-banner-name {
  font-size: 17px;
  font-weight: 700;
}

.user-banner-role {
  font-size: 13px;
  color: var(--muted);
  text-transform: capitalize;
}

.sync-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  background: var(--surface-alt);
  padding: 10px;
  border-radius: 10px;
}

.sync-info-grid span {
  display: block;
  font-size: 11px;
}

.sync-info-grid strong {
  font-size: 13px;
}

.setup-guide {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.setup-guide summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

.setup-guide ol {
  margin: 8px 0 0;
  padding-left: 18px;
}

.setup-guide li {
  margin-bottom: 4px;
}

.setup-guide code {
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text);
}

/* FORMS */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
}

/* BOTTOM NAVIGATION */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.nav-tab.active {
  color: var(--primary);
}

.nav-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  transition: background-color 0.15s;
}

.nav-tab.active .nav-icon-wrap {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.nav-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  border: 2px solid var(--surface);
}

/* BOTTOM SHEETS */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  animation: sheetUp 0.16s ease-out;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #CBD5E1;
  margin: 8px auto 0;
  flex-shrink: 0;
}

@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0.85; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  touch-action: none;
}

.sheet-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.sheet-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-alt);
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.sheet-body {
  padding: 14px 16px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  flex: 1;
}

.sheet-footer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* CHECKOUT ITEMS & PAYMENTS */
.checkout-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.cart-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border-radius: 12px;
}

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

.cart-item-name {
  font-weight: 600;
  font-size: 14px;
}

.cart-item-price {
  font-size: 12px;
  color: var(--muted);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 19px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qty-val {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.discount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.discount-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.discount-controls {
  display: flex;
  gap: 6px;
  width: 170px;
}

.discount-controls select {
  width: 64px;
  flex-shrink: 0;
}

.totals-box {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.total-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.total-line:last-child {
  margin-bottom: 0;
}

.total-grand {
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 6px;
  font-size: 17px;
  font-weight: 700;
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.pay-tile {
  padding: 11px 8px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.pay-tile.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.change-box {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.change-box span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.change-box strong {
  font-size: 18px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* RECEIPT PREVIEW */
.receipt-paper {
  background: #fff;
  border: 1px dashed #CBD5E1;
  border-radius: 10px;
  padding: 14px;
  max-width: 310px;
  margin: 0 auto;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.4;
  color: #000;
}

.rcpt-center {
  text-align: center;
}

.rcpt-store {
  font-size: 15px;
  font-weight: 700;
}

.rcpt-hr {
  border: none;
  border-top: 1px dashed #94A3B8;
  margin: 8px 0;
}

.rcpt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.rcpt-item {
  margin-bottom: 4px;
}

.rcpt-item-sub {
  display: flex;
  justify-content: space-between;
  color: #334155;
  font-size: 11px;
}

.rcpt-grand {
  font-size: 14px;
  font-weight: 700;
}

.rcpt-void-banner {
  margin: 6px 0;
  padding: 4px;
  border: 1px solid #000;
  text-align: center;
  font-weight: 700;
}

.receipt-actions-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.receipt-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.btn-print-primary {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.receipt-primary-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* STOCK ACTIONS, IMPORT & ADJUSTMENTS */
.stock-action-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.adjust-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.checkout-meta-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: 12px;
}

.inline-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-select-row select {
  flex: 1;
  min-width: 0;
}

.settings-divider {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
}

.bt-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-alt);
}

.import-tip-box {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

.import-tip-box code {
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
}

.import-preview {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  overflow-x: auto;
}

.import-result {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.import-result.has-errors {
  background: var(--warning-soft);
  color: #92400E;
}

textarea {
  resize: vertical;
  min-height: 58px;
}

/* BACKUP UI */
.backup-alert {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--warning-soft);
  color: #92400E;
  font-size: 12px;
  font-weight: 600;
}

.backup-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 8px;
}

.script-box-wrap {
  margin-top: 8px;
  position: relative;
}

.script-box-wrap .btn {
  margin-bottom: 6px;
}

.code-snippet {
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  background: #0F172A;
  color: #E2E8F0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
  overflow-x: auto;
  max-height: 180px;
}

.backup-badge-ok {
  background: #D1FAE5;
  color: #065F46;
}

.backup-badge-partial {
  background: var(--warning-soft);
  color: #92400E;
}

/* ADMIN ADJUSTMENTS & USER ACTIVITY */
.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-scroll-list {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}

.activity-stats-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.activity-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.cash-type-btn {
  padding: 11px 8px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

.cash-type-btn.active[data-cash-type="cash_in"] {
  background: #D1FAE5;
  border-color: var(--accent);
  color: #065F46;
}

.cash-type-btn.active[data-cash-type="cash_out"] {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.cat-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--surface-alt);
  color: var(--muted);
}

.cat-pill.cat-auth {
  background: #E0F2FE;
  color: #0369A1;
}

.cat-pill.cat-sale {
  background: #D1FAE5;
  color: #065F46;
}

.cat-pill.cat-stock {
  background: var(--warning-soft);
  color: #92400E;
}

.cat-pill.cat-adjustment {
  background: #FCE7F3;
  color: #9D174D;
}

.cat-pill.cat-customer {
  background: #EDE9FE;
  color: #5B21B6;
}

.cat-pill.cat-system {
  background: var(--surface-alt);
  color: #334155;
}

.adj-history-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.adj-kpi-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.adj-qty-transition {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

/* PRODUCTS SECTION, REPORTS SECTION & CLEAR CACHE */
.products-val-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.products-val-bar span {
  display: block;
  font-size: 11px;
}

.products-val-bar strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.products-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.products-sort-select {
  width: 122px;
  flex-shrink: 0;
  height: 42px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.products-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

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

.report-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.drawer-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: var(--surface-alt);
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.drawer-summary-grid span {
  display: block;
  font-size: 11px;
}

.drawer-summary-grid strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.report-bars-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.report-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.report-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  min-width: 4px;
}

.report-export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 480px) {
  .report-export-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cache-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-alt);
}

@media (max-width: 380px) {
  .nav-tab {
    font-size: 10px;
  }

  .nav-icon-wrap {
    padding: 3px 8px;
  }
}

/* COLOR PICKER & RESTOCK */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid transparent;
}

.color-dot.active {
  border-color: var(--text);
  transform: scale(1.1);
}

.restock-summary {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

/* TOASTS */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 74px);
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(92vw, 360px);
  pointer-events: none;
}

.toast {
  background: #0F172A;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.toast-error {
  background: var(--danger);
}

.toast-success {
  background: var(--primary-dark);
}

/* MOBILE & LANDSCAPE RESPONSIVE */
@media (max-width: 480px) {
  .item-card {
    flex-wrap: wrap;
  }

  .item-card-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
  }
}

@media (max-width: 420px) {
  .custom-date-row {
    grid-template-columns: 1fr 1fr;
  }

  .custom-date-row > span {
    display: none;
  }

  .custom-date-row > button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .form-row-2,
  .payment-breakdown,
  .sync-info-grid {
    grid-template-columns: 1fr;
  }

  .product-grid {
    gap: 8px;
  }

  .product-tile {
    padding: 10px 9px;
    min-height: 98px;
  }
}

@media (min-width: 520px) {
  .receipt-btn-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-height: 540px) and (orientation: landscape) {
  :root {
    --topbar-h: 48px;
    --nav-h: 54px;
  }

  .pin-card {
    max-width: 560px;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    column-gap: 16px;
    align-items: center;
    padding: 14px 16px;
  }

  .pin-brand,
  .pin-hint,
  .pin-prompt,
  .pin-dots,
  .pin-error,
  #pin-unlock-btn {
    grid-column: 1;
  }

  .pin-keypad {
    grid-column: 2;
    grid-row: 1 / span 6;
    margin-bottom: 0;
    gap: 8px;
  }

  .pin-key {
    height: 42px;
    font-size: 18px;
  }
}

/* TABLET / DESKTOP RESPONSIVE */
@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .sheet-overlay {
    align-items: center;
    padding: 16px;
  }

  .sheet {
    border-radius: 20px;
    max-height: 88dvh;
  }

  .sheet-handle {
    display: none;
  }
}

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

/* PRINT STYLES (58mm / 80mm THERMAL) */
.print-only {
  display: none;
}

@media print {
  @page {
    margin: 0;
  }

  body > *:not(#print-receipt-area) {
    display: none !important;
  }

  #print-receipt-area {
    display: block !important;
    background: #fff !important;
    color: #000 !important;
    font-family: ui-monospace, "Courier New", monospace;
    margin: 0 auto;
    padding: 3mm 2mm;
  }

  #print-receipt-area.receipt-58 {
    width: 54mm;
    font-size: 11px;
    line-height: 1.35;
  }

  #print-receipt-area.receipt-80 {
    width: 74mm;
    font-size: 12px;
    line-height: 1.35;
  }

  #print-receipt-area .rcpt-hr {
    border-top: 1px dashed #000;
  }

  #print-receipt-area .rcpt-item-sub {
    color: #000;
  }
}
