:root {
  --primary: #0A4D7A;
  --primary-dark: #07395C;
  --primary-mid: #0D5E96;
  --primary-soft: #E6F0F9;
  --topbar-bg: #073D63;
  --drawer-icon: #145B8C;
  --accent: #059669;
  --accent-dark: #047857;
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-alt: #EFF4F9;
  --border: #D9E2EC;
  --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: 0px;
  --dock-h: 58px;
  --topbar-h: 56px;
  --sidebar-w: 296px;
}

*, *::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;
  overflow-x: clip;
  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);
}

/* STRONG PASSWORD LOGIN SCREEN */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 16px;
  background: linear-gradient(160deg, #0A4D7A 0%, #052D49 100%);
}

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

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

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

.login-store-name {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 700;
  color: var(--primary-dark);
}

.login-hint {
  background: var(--primary-soft);
  border: 1px solid #C6DCEF;
  color: var(--primary-dark);
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.login-hint code {
  background: #fff;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 11.5px;
  border: 1px solid #C6DCEF;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pw-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-input-wrap input {
  padding-right: 64px;
}

.pw-toggle-btn {
  position: absolute;
  right: 8px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--surface-alt);
}

.pw-input-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.pw-strength-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 11px;
}

.pw-strength-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.pw-strength-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #DCE5EF;
  overflow: hidden;
  margin-bottom: 8px;
}

.pw-strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--danger);
  transition: width 0.18s ease, background-color 0.18s ease;
}

.pw-rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  font-size: 11.5px;
}

.pw-rule-item {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pw-rule-item.met {
  color: var(--accent-dark);
  font-weight: 600;
}

.login-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.login-foot-note {
  margin: 12px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* APP SHELL & SIDEBAR DRAWER */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

.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(--topbar-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(7, 57, 92, 0.24);
}

.topbar-nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.drawer-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  flex-shrink: 0;
}

.drawer-menu-btn:active {
  background: rgba(255, 255, 255, 0.24);
}

.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: 100%;
}

.topbar-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.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;
}

.topbar-pos-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  border: 1.5px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3), 0 3px 10px rgba(5, 150, 105, 0.45);
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.topbar-pos-btn:active {
  transform: scale(0.96);
}

.topbar-pos-btn.is-on-pos {
  border-color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}

.topbar-pos-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #DC2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* SLIDE-OUT SIDEBAR DRAWER */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  width: min(312px, 85vw);
  background: var(--surface);
  border-radius: 0 18px 18px 0;
  box-shadow: 6px 0 28px rgba(7, 57, 92, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-104%);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  padding-top: env(safe-area-inset-top);
}

.sidebar-drawer.open {
  transform: translateX(0);
}

.drawer-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 14px 10px;
}

.drawer-profile-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.drawer-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2B7CD3 0%, #0A4D7A 100%);
  border: 2.5px solid #93C5FD;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(10, 77, 122, 0.22);
}

.drawer-user-meta {
  min-width: 0;
}

.drawer-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-user-role {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.drawer-user-handle {
  font-size: 11px;
  color: var(--muted);
}

.drawer-logout-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--drawer-icon);
  background: var(--surface-alt);
  flex-shrink: 0;
}

.drawer-logout-btn:active {
  background: var(--primary-soft);
}

.drawer-banner {
  margin: 2px 14px 12px;
  padding: 11px 14px;
  border-radius: 11px;
  background: linear-gradient(135deg, #0D5E96 0%, #0A4D7A 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 3px 10px rgba(10, 77, 122, 0.24);
  cursor: pointer;
}

.drawer-banner.banner-warn {
  background: linear-gradient(135deg, #B45309 0%, #92400E 100%);
}

.drawer-banner-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.drawer-banner-sub {
  font-size: 11px;
  opacity: 0.92;
  margin-top: 2px;
  font-weight: 600;
}

.drawer-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--border);
}

.drawer-mode-card {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border-radius: 12px;
  border: 1.5px solid #CBD8E6;
  background: #fff;
  color: var(--primary-dark);
  text-align: left;
  transition: border-color 0.15s, background-color 0.15s;
}

.drawer-mode-card svg {
  color: var(--drawer-icon);
  flex-shrink: 0;
}

.drawer-mode-card span {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.drawer-mode-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 2px 6px rgba(10, 77, 122, 0.12);
}

.drawer-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 0 14px;
  -webkit-overflow-scrolling: touch;
}

.drawer-menu-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.drawer-item {
  width: calc(100% - 14px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px 11px 18px;
  border-radius: 0 26px 26px 0;
  color: #16476D;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.drawer-item svg {
  color: var(--drawer-icon);
  flex-shrink: 0;
}

.drawer-item:hover {
  background: #F1F6FB;
}

.drawer-item.active {
  background: var(--primary-soft);
  color: #083D66;
  font-weight: 700;
}

.drawer-item.drawer-item-pos {
  width: calc(100% - 28px);
  margin: 4px 14px 8px;
  padding: 13px 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.32);
}

.drawer-item.drawer-item-pos svg {
  color: #fff;
}

.drawer-item.drawer-item-pos:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.drawer-item.drawer-item-pos.active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28), 0 6px 16px rgba(5, 150, 105, 0.4);
}

.drawer-pos-pill {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.drawer-item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-badge {
  font-size: 13px;
  font-weight: 700;
  color: #16476D;
  font-variant-numeric: tabular-nums;
  padding-left: 6px;
}

.drawer-badge.badge-alert {
  color: var(--warning);
}

.drawer-bottom-bar {
  height: calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(90deg, #1E73B6 0%, #0A4D7A 100%);
  flex-shrink: 0;
}

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

.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;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 8px;
  scrollbar-width: none;
}

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

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  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;
}

.sell-quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0 6px;
}

.qty-mult-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.qty-mult-strip::-webkit-scrollbar {
  display: none;
}

.qty-pill {
  min-width: 38px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.layout-toggle-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

/* 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: 106px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  user-select: none;
  transition: transform 0.08s ease, border-color 0.15s ease, background-color 0.15s ease;
}

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

.product-tile.in-cart {
  border-color: var(--primary);
  background: #F4F9FE;
  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: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.tile-qty-badge {
  min-width: 26px;
  height: 28px;
  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: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-tile.in-cart .tile-name {
  padding-right: 66px;
}

.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);
}

/* 3-COL COMPACT & LIST MODES FOR MOBILE */
.product-grid.grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.product-grid.grid-compact .product-tile {
  padding: 9px 8px 8px;
  min-height: 88px;
  border-radius: 12px;
}

.product-grid.grid-compact .tile-name {
  font-size: 12.5px;
}

.product-grid.grid-compact .tile-price {
  font-size: 13.5px;
}

.product-grid.grid-compact .tile-meta {
  display: none;
}

.product-grid.grid-compact .tile-stock {
  font-size: 10px;
  padding: 1px 5px;
}

.product-grid.grid-list {
  grid-template-columns: 1fr;
  gap: 8px;
}

.product-grid.grid-list .product-tile {
  flex-direction: row;
  align-items: center;
  min-height: 62px;
  padding: 10px 12px 10px 14px;
  gap: 10px;
}

.product-grid.grid-list .tile-accent {
  width: 5px;
  height: auto;
  right: auto;
  bottom: 0;
}

.product-grid.grid-list .product-tile > div:first-of-type {
  flex: 1;
  min-width: 0;
}

.product-grid.grid-list .tile-name {
  margin-top: 0;
  padding-right: 0;
}

.product-grid.grid-list .tile-bottom {
  margin-top: 0;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.product-grid.grid-list .tile-cart-controls {
  position: static;
  order: 3;
}

/* FLOATING CART BAR */
.cart-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 28;
  max-width: 580px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

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

.cart-draft-btn {
  flex-shrink: 0;
  background: var(--surface);
  color: var(--primary-dark);
  border: 1.5px solid #B7D4EB;
  border-radius: 16px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}

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

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

.drafts-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.draft-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #D97706;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.checkout-footer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkout-draft-banner {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.footer-style-box {
  margin-top: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.footer-lines-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-line-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-line-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 120px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer-line-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-size-btn,
.footer-bold-btn {
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

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

.footer-bold-btn.active {
  background: #0F172A;
  border-color: #0F172A;
  color: #fff;
}

.footer-live-preview {
  background: #fff;
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  font-family: ui-monospace, "Courier New", monospace;
}

.cart-bar-btn.cart-pop {
  animation: cartPop 0.2s ease-out;
}

@keyframes cartPop {
  0% { transform: scale(0.97); }
  55% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.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;
  flex-wrap: wrap;
  gap: 10px;
}

/* MOBILE THUMB-ZONE QUICK DOCK */
.mobile-quick-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 34;
  height: calc(var(--dock-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.07);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: visible;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  min-height: 44px;
}

.dock-btn.active {
  color: var(--primary);
  font-weight: 700;
}

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

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

.dock-count {
  position: absolute;
  top: -3px;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
}

.dock-btn.dock-btn-pos {
  position: relative;
  color: #047857;
  font-weight: 800;
}

.dock-btn.dock-btn-pos .dock-icon-wrap {
  margin-top: -16px;
  width: 52px;
  height: 40px;
  padding: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.42);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.dock-btn.dock-btn-pos.active .dock-icon-wrap {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35), 0 8px 18px rgba(5, 150, 105, 0.48);
}

.dock-pos-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #DC2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.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 {
  min-height: 44px;
  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-footer-line {
  line-height: 1.32;
  margin: 2px 0;
  word-break: break-word;
}

.rcpt-line-sm {
  font-size: 10.5px;
}

.rcpt-line-md {
  font-size: 12px;
}

.rcpt-line-lg {
  font-size: 15px;
  line-height: 1.25;
}

.rcpt-line-xl {
  font-size: 18px;
  line-height: 1.2;
}

.rcpt-line-bold {
  font-weight: 800;
  color: #000;
  letter-spacing: 0.01em;
}

.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(auto-fit, minmax(105px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.finance-top-header {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

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

.finance-cta-btn {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 800;
  border-radius: 11px;
}

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

.finance-mode-pills .chip {
  justify-content: center;
}

.finance-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-tabs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.cat-tabs-grid .chip {
  justify-content: center;
}

.cat-inline-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-color-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
}

.cat-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.login-links-row {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 8px;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.login-info-box {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #C6DDF0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.45;
}

.login-info-box.ok {
  background: #ECFDF5;
  color: #065F46;
  border-color: #A7F3D0;
}

.login-info-box.err {
  background: var(--danger-soft);
  color: #991B1B;
  border-color: #FECACA;
}

.smtp-hint-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 12px;
  color: #334155;
  margin-bottom: 10px;
  line-height: 1.45;
}

.smtp-test-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.smtp-test-row input {
  flex: 1;
  min-width: 0;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-pill.role-superadmin {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.role-pill.role-admin {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.role-pill.role-manager {
  background: #EDE9FE;
  color: #5B21B6;
}

.role-pill.role-cashier {
  background: var(--surface-alt);
  color: #475569;
}

.perm-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.perm-card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

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

.perm-head-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.perm-view-switch {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}

.perm-view-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.perm-view-btn.active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

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

.perm-role-card {
  text-align: left;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.perm-role-card.role-superadmin { border-top-color: #D97706; }
.perm-role-card.role-admin { border-top-color: #0A4D7A; }
.perm-role-card.role-manager { border-top-color: #7C3AED; }
.perm-role-card.role-cashier { border-top-color: #64748B; }

.perm-role-card:hover {
  background: var(--surface);
  border-color: #CBD5E1;
}

.perm-role-card.active {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(10, 77, 122, 0.14);
}

.perm-role-card.role-superadmin.active {
  border-color: #D97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15);
}

.perm-role-card.role-manager.active {
  border-color: #7C3AED;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.14);
}

.perm-role-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.perm-role-card-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.perm-role-lvl {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}

.perm-role-stats {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.perm-coverage-bar {
  display: flex;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: #E2E8F0;
  gap: 1px;
}

.perm-coverage-bar .seg-full { background: var(--accent); }
.perm-coverage-bar .seg-basic { background: var(--primary); }
.perm-coverage-bar .seg-none { background: #E2E8F0; }

.perm-role-banner {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.perm-banner-copy {
  font-size: 12.5px;
  color: #334155;
  line-height: 1.4;
  flex: 1;
  min-width: 220px;
}

.perm-state-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.perm-state-pill.editable {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.perm-state-pill.locked {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.perm-state-pill.readonly {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #C6DDF0;
}

.perm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.perm-search-wrap {
  flex: 1;
  min-width: 190px;
}

.perm-search-wrap input {
  width: 100%;
}

.perm-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.perm-bulk-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.perm-legend {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.perm-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 2px;
}

.perm-dot.dot-none { background: var(--danger); }
.perm-dot.dot-basic { background: var(--primary); }
.perm-dot.dot-full { background: var(--accent); }

.perm-groups-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.perm-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.perm-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475569;
}

.perm-group-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.perm-group-count {
  font-size: 10.5px;
  font-weight: 700;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--muted);
}

.perm-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.perm-mod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.perm-mod-card:hover {
  border-color: #CBD5E1;
}

.perm-mod-card.is-modified {
  border-left: 3.5px solid #D97706;
  background: #FFFBEB;
}

.perm-mod-top {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.perm-mod-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.perm-mod-meta {
  flex: 1;
  min-width: 0;
}

.perm-mod-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.perm-mod-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.perm-mod-badge-mod {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #92400E;
}

.perm-mod-desc {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}

.perm-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.perm-lvl-btn {
  padding: 6px 6px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748B;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s ease;
}

.perm-lvl-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.perm-lvl-btn.active {
  opacity: 1 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.perm-lvl-btn.active[data-perm-lvl="none"] {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #B91C1C;
}

.perm-lvl-btn.active[data-perm-lvl="basic"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.perm-lvl-btn.active[data-perm-lvl="full"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.perm-matrix-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.perm-matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
  font-size: 12.5px;
}

.perm-matrix-table th,
.perm-matrix-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}

.perm-matrix-table th:first-child,
.perm-matrix-table td:first-child {
  text-align: left;
}

.perm-matrix-table thead th {
  background: #F8FAFC;
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
}

.perm-matrix-group-row td {
  background: #F1F5F9;
  text-align: left !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
  padding: 6px 10px;
}

.perm-cell-pill {
  min-width: 66px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.perm-cell-pill:disabled {
  cursor: not-allowed;
  opacity: 0.88;
}

.perm-cell-pill.lvl-full {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
}

.perm-cell-pill.lvl-basic {
  background: var(--primary-soft);
  border-color: #BAE6FD;
  color: var(--primary-dark);
}

.perm-cell-pill.lvl-none {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B;
}

.perm-cell-pill.is-dirty {
  box-shadow: 0 0 0 2px #F59E0B;
}

.perm-save-bar {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.perm-save-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 760px) {
  .perm-role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .perm-cards-grid {
    grid-template-columns: 1fr;
  }
}

.pur-item-builder {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.summary-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.summary-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.summary-row.summary-total {
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
}

.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-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.report-export-head h3 {
  margin: 0;
}

.export-format-switch {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}

.export-fmt-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
}

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

.report-full-export-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.export-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-excel {
  border-color: #A7F3D0 !important;
  background: #ECFDF5 !important;
  color: #065F46 !important;
  font-weight: 700;
}

.btn-pdf {
  border-color: #FECACA !important;
  background: #FEF2F2 !important;
  color: #991B1B !important;
  font-weight: 700;
}

.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) {
  .topbar-pos-btn {
    height: 32px;
    padding: 0 9px;
    font-size: 11.5px;
    gap: 4px;
  }

  .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: 380px) {
  .form-row-2,
  .payment-breakdown,
  .sync-info-grid {
    grid-template-columns: 1fr;
  }

  .product-grid {
    gap: 8px;
  }

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

  .product-grid.grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-store {
    max-width: 100%;
    font-size: 14px;
  }
}

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

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

  .login-card {
    padding: 16px 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) {
  :root {
    --dock-h: 0px;
  }

  .app-shell {
    padding-left: var(--sidebar-w);
  }

  .mobile-quick-dock {
    display: none;
  }

  .drawer-menu-btn {
    display: none;
  }

  .drawer-backdrop {
    display: none !important;
  }

  .sidebar-drawer {
    width: var(--sidebar-w);
    transform: none !important;
    border-radius: 0;
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 12px rgba(15, 23, 42, 0.06);
  }

  .cart-bar {
    left: calc(var(--sidebar-w) + 12px);
    bottom: 16px;
  }

  .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;
  }

  #print-receipt-area .rcpt-line-sm {
    font-size: 10px;
  }

  #print-receipt-area .rcpt-line-md {
    font-size: 12px;
  }

  #print-receipt-area .rcpt-line-lg {
    font-size: 15px;
    line-height: 1.25;
  }

  #print-receipt-area .rcpt-line-xl {
    font-size: 18px;
    line-height: 1.2;
  }

  #print-receipt-area .rcpt-line-bold {
    font-weight: 800;
    color: #000;
  }
}
