:root {
  --green: #28a745;
  --green-dark: #16642a;
  --green-soft: #eaf8ee;
  --yellow: #ffca2c;
  --ink: #102318;
  --muted: #64736a;
  --line: #dcece1;
  --surface: #ffffff;
  --surface-2: #f7fbf8;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(18, 84, 38, .11);
  --shadow-soft: 0 10px 28px rgba(18, 84, 38, .08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(40, 167, 69, .13), transparent 34rem),
    linear-gradient(180deg, #fbfefc 0%, #f3faf5 100%);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-navbar,
.topbar {
  background: rgba(22, 100, 42, .94);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(13, 65, 28, .18);
}

.topbar {
  align-items: center;
  color: #fff;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px clamp(14px, 4vw, 32px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-navbar .navbar-brand,
.app-navbar .nav-link,
.app-navbar .navbar-toggler {
  color: #fff;
}

.app-navbar .navbar-brand {
  font-size: 1.08rem;
  letter-spacing: .01em;
}

.app-navbar .navbar-brand b,
.brand b,
.logo-block b {
  color: var(--yellow);
}

.app-navbar .nav-link {
  border-radius: 999px;
  color: rgba(255, 255, 255, .82);
  font-size: .94rem;
  font-weight: 750;
  margin: 2px;
  padding: .58rem .85rem;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active {
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

.app-navbar .navbar-toggler {
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  min-height: 44px;
}

.app-navbar .navbar-toggler-icon {
  filter: invert(1);
}

.brand,
.logo-block {
  align-items: center;
  color: #fff;
  display: inline-flex;
  font-size: 22px;
  gap: 8px;
}

.brand-logo {
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.brand-icon {
  border: 3px solid var(--yellow);
  border-left-color: #fff;
  border-radius: 50%;
  display: inline-block;
  height: 28px;
  position: relative;
  width: 28px;
}

.brand-icon::after {
  background: #fff;
  border-radius: 999px;
  content: "";
  height: 5px;
  position: absolute;
  right: -10px;
  top: 9px;
  width: 14px;
}

.user-chip {
  color: #fff;
  display: flex;
  flex-direction: column;
  font-size: .92rem;
  font-weight: 800;
  line-height: 1.15;
}

.user-chip span {
  color: rgba(255, 255, 255, .72);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.network-banner {
  align-items: center;
  border-radius: 999px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  box-shadow: 0 14px 34px rgba(16, 35, 24, .18);
  color: #fff;
  display: none;
  gap: 10px;
  justify-content: center;
  left: 50%;
  max-width: min(680px, calc(100vw - 20px));
  padding: 10px 14px;
  position: fixed;
  transform: translateX(-50%);
  width: max-content;
  z-index: 1060;
}

.network-banner.visible {
  display: flex;
}

.network-banner.offline {
  background: rgba(180, 35, 24, .96);
}

.network-banner.slow {
  background: rgba(102, 72, 0, .96);
}

.network-banner.draft {
  background: rgba(22, 100, 42, .96);
}

.network-banner button {
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .42);
  box-shadow: none;
  color: #fff;
  min-height: 34px;
  padding: 6px 10px;
}

.unsynced-sales-overlay {
  align-items: center;
  background: rgba(16, 35, 24, .56);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 1090;
}

.unsynced-sales-card {
  background: #fff;
  border: 2px solid #f1d36c;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(16, 35, 24, .32);
  max-width: 520px;
  padding: clamp(18px, 5vw, 28px);
  width: 100%;
}

.unsynced-sales-card h1 {
  color: var(--danger);
  font-weight: 950;
  margin: 0 0 8px;
}

.unsynced-sales-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1.2fr;
  margin-top: 18px;
}

.page {
  margin: 0 auto;
  max-width: 1220px;
  overflow-x: clip;
  padding: 22px clamp(12px, 4vw, 34px) 96px;
}

.hero {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(16, 35, 24, .10), transparent 42%),
    linear-gradient(135deg, #16642a 0%, #28a745 72%);
  border-radius: 22px;
  box-shadow: var(--shadow);
  color: #fff;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
  overflow: hidden;
  padding: clamp(20px, 5vw, 34px);
  position: relative;
}

.hero::after {
  background: rgba(255, 202, 44, .22);
  border-radius: 999px;
  content: "";
  height: 170px;
  position: absolute;
  right: -48px;
  top: -54px;
  width: 170px;
}

.hero h1 {
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 850;
  letter-spacing: -.02em;
  margin: 0;
  position: relative;
  z-index: 1;
}

.hero-actions {
  align-items: flex-end;
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  max-width: 360px;
  position: relative;
  z-index: 1;
}

.pwa-install-hint {
  color: rgba(255, 255, 255, .86);
  font-size: .95rem;
  font-weight: 700;
  margin: 10px 0 0;
  max-width: 520px;
  position: relative;
  z-index: 1;
}

.secondary-primary {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .44);
  color: #fff;
}

.secondary-primary:hover {
  background: rgba(255, 255, 255, .26);
  color: #fff;
}

.eyebrow {
  color: var(--yellow);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .12em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.panel,
.login-card,
.cards article,
.accordion-item {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(220, 236, 225, .92);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.panel {
  margin-bottom: 18px;
  padding: clamp(16px, 4vw, 24px);
}

.panel h1,
.panel h2 {
  color: var(--ink);
  font-weight: 850;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}

.grid {
  display: grid;
  gap: 14px;
}

.cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.cards article {
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(247,251,248,.96));
  padding: 18px;
}

.action-hub {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.action-hub a,
.action-hub .browser-cleanup-tile button,
.step-card {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  color: inherit;
  display: grid;
  gap: 5px;
  height: 100%;
  min-height: 104px;
  padding: 16px;
  text-align: left;
  width: 100%;
}

.action-hub .browser-cleanup-tile {
  margin: 0;
}

.action-hub strong,
.action-hub .browser-cleanup-tile strong,
.step-card strong {
  color: var(--green-dark);
  font-size: 1.05rem;
  font-weight: 900;
}

.action-hub span,
.action-hub .browser-cleanup-tile span,
.step-card span {
  color: var(--muted);
  font-size: .88rem;
}

.action-hub a:hover,
.action-hub .browser-cleanup-tile button:hover,
.step-card:hover {
  border-color: rgba(40, 167, 69, .45);
  transform: translateY(-1px);
}

.action-hub .browser-cleanup-tile button {
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(247,251,248,.96));
}

.next-steps {
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(234,248,238,.8));
}

.step-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.step-card {
  position: relative;
}

.step-card b {
  align-self: end;
  background: var(--green-soft);
  border-radius: 999px;
  color: var(--green-dark);
  display: inline-flex;
  font-size: .76rem;
  font-weight: 900;
  justify-self: start;
  padding: 6px 9px;
}

.step-card.todo {
  border-color: rgba(255, 202, 44, .85);
}

.step-card.todo b {
  background: #fff4bf;
  color: #6c5200;
}

.step-card.done {
  opacity: .72;
}

.cards span,
.metric span {
  color: var(--muted);
  display: block;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cards strong,
.metric strong {
  color: var(--green-dark);
  display: block;
  font-size: clamp(1.45rem, 7vw, 1.95rem);
  line-height: 1.1;
  margin: 8px 0;
}

.cards small,
.muted {
  color: var(--muted);
}

.two-col {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

form {
  display: grid;
  gap: 12px;
}

form.row,
.row,
.input-group,
.d-flex,
.accordion form.row {
  display: flex;
}

label,
.form-label {
  color: var(--green-dark);
  display: grid;
  font-size: .9rem;
  font-weight: 850;
  gap: 6px;
  margin: 0;
}

input,
select,
textarea,
button,
.primary,
.btn {
  border-radius: 12px;
  font: inherit;
  min-height: 46px;
}

input,
select,
textarea,
.form-control,
.form-select {
  background-color: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 48px;
  padding: 11px 13px;
  width: 100%;
}

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

.form-control:focus,
.form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 .22rem rgba(40, 167, 69, .14);
}

button,
.primary,
.btn-success {
  align-items: center;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  border: 0;
  box-shadow: 0 10px 18px rgba(40, 167, 69, .18);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  padding: 11px 16px;
}

button:hover,
.primary:hover,
.btn-success:hover,
.btn-success:focus {
  background: linear-gradient(135deg, #31b853, var(--green-dark));
  color: #fff;
}

.action-hub .browser-cleanup-tile button,
.action-hub .browser-cleanup-tile button:hover,
.action-hub .browser-cleanup-tile button:focus {
  align-items: start;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(247,251,248,.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  color: inherit;
  display: grid;
  justify-content: stretch;
  padding: 16px;
}

.btn-outline-success {
  background: rgba(255, 255, 255, .72);
  border-color: rgba(40, 167, 69, .35);
  color: var(--green-dark);
  font-weight: 800;
}

.btn-outline-success:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.danger {
  background: linear-gradient(135deg, #d92d20, var(--danger));
}

.flash {
  background: #fff8db;
  border: 1px solid #f1d36c;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  color: #5c4600;
  font-weight: 800;
  margin-bottom: 16px;
  padding: 13px 15px;
}

.login-card {
  margin: 34px auto;
  max-width: 440px;
  padding: 24px;
}

.login-card .logo-block {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  border-radius: 16px;
  color: #fff;
  margin-bottom: 20px;
  padding: 14px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
  width: 100%;
}

th {
  background: var(--green-dark);
  color: #fff;
  font-size: .78rem;
  letter-spacing: .06em;
  padding: 12px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: middle;
}

tr:nth-child(even) td {
  background: #f8fcf9;
}

.pill,
.badge {
  border-radius: 999px;
  font-weight: 900;
}

.pill {
  background: #e7f7eb;
  color: var(--green-dark);
  display: inline-block;
  font-size: 12px;
  padding: 6px 10px;
}

.danger-pill {
  background: #fee4e2;
  color: var(--danger);
}

.status {
  background: #eef4f0;
  border-radius: 999px;
  display: inline-block;
  font-weight: 900;
  padding: 9px 13px;
}

.status.ok {
  background: #dcfae6;
  color: var(--green-dark);
}

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

.denoms label,
.stock-count label {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.denoms label {
  align-items: center;
  grid-template-columns: 1fr 110px;
}

.sales-grid {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 8px;
  grid-template-columns: 2fr 1fr 90px 90px 90px;
  margin-bottom: 8px;
  padding: 10px;
}

.sales-grid.head {
  background: transparent;
  border: 0;
  color: var(--green-dark);
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sales-grid small {
  color: var(--muted);
  display: block;
  font-size: .74rem;
  font-weight: 650;
  margin-top: 2px;
}

.stock-intake-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.stock-intake-row {
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) 150px 170px;
  padding: 12px;
}

.stock-intake-row strong {
  color: var(--ink);
  display: block;
  font-weight: 900;
}

.stock-intake-row small {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-top: 3px;
}

.stock-intake-row label {
  font-size: .8rem;
}

.receipt-camera {
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 12px;
  margin: 14px 0 16px;
  padding: 14px;
}

.stock-intake-lines {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.stock-intake-lines-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.stock-intake-lines-head h2,
.stock-intake-lines-head p {
  margin: 0;
}

.stock-intake-add {
  min-height: 52px;
  white-space: nowrap;
}

.stock-intake-table {
  display: grid;
  gap: 10px;
}

.stock-intake-entry {
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1.5fr) 120px 150px 130px auto;
  padding: 12px;
}

.stock-intake-entry label {
  font-size: .8rem;
  position: relative;
}

.stock-intake-product-search {
  width: 100%;
}

.stock-intake-suggestions {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 4px;
  left: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
}

.stock-intake-suggestions button {
  background: #fff;
  border: 1px solid transparent;
  box-shadow: none;
  color: var(--ink);
  justify-content: flex-start;
  min-height: 46px;
  padding: 10px 12px;
  text-align: left;
}

.stock-intake-suggestions button:hover,
.stock-intake-suggestions button:focus {
  background: var(--green-soft);
  border-color: var(--line);
  color: var(--green-dark);
}

.stock-intake-cost {
  background: #f6fbf7;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 2px;
  min-height: 52px;
  padding: 8px 10px;
}

.stock-intake-cost span,
.stock-intake-cost small {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
}

.stock-intake-cost strong {
  color: var(--green-dark);
  font-weight: 900;
}

.stock-intake-remove {
  min-height: 52px;
}

.receipt-photo {
  border: 1px solid var(--line);
  border-radius: 16px;
  display: block;
  max-height: 70vh;
  max-width: min(100%, 620px);
  object-fit: contain;
}

.sales-grid.row-hit {
  animation: rowHit .9s ease;
}

@keyframes rowHit {
  0% { box-shadow: 0 0 0 0 rgba(255, 202, 44, .85); }
  100% { box-shadow: 0 0 0 12px rgba(255, 202, 44, 0); }
}

.barcode-box,
.payment-panel {
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
}

.barcode-box {
  grid-template-columns: minmax(0, 1fr) auto;
}

.barcode-video {
  border-radius: 16px;
  margin-bottom: 14px;
  max-height: 260px;
  object-fit: cover;
  transform-origin: center;
  width: 100%;
}

.barcode-video video,
.barcode-video canvas {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.camera-frame {
  background: #102318;
  border-radius: 16px;
  overflow: hidden;
}

.scanner-panel {
  align-items: center;
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: 180px minmax(0, 1fr);
  margin-bottom: 14px;
  padding: 12px;
}

.scanner-panel .barcode-video {
  aspect-ratio: 4 / 3;
  background: #102318;
  margin: 0;
  min-height: 220px;
  max-height: 260px;
}

.scanner-panel strong,
.scanner-panel span {
  display: block;
}

.scanner-panel strong {
  color: var(--green-dark);
  font-weight: 900;
}

.scanner-panel span {
  color: var(--muted);
  font-size: .88rem;
  margin: 3px 0 10px;
}

.scan-toast {
  align-items: center;
  background: rgba(16, 35, 24, .92);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: .9rem;
  font-weight: 800;
  justify-content: center;
  left: 50%;
  max-width: calc(100vw - 32px);
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  top: 18px;
  transform: translate(-50%, -10px);
  transition: opacity .18s ease, transform .18s ease;
  z-index: 40;
}

.scan-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.scan-toast[data-kind="good"] {
  background: rgba(22, 100, 42, .95);
}

.scan-toast[data-kind="bad"] {
  background: rgba(180, 35, 24, .95);
}

.offline-queue-status {
  background: #fff8db;
  border: 1px solid #f1d36c;
  border-radius: 14px;
  color: #664800;
  font-size: .9rem;
  font-weight: 850;
  margin: 0 0 12px;
  padding: 10px 12px;
}

.offline-queue-status.waiting {
  background: #fff8db;
  border-color: #f1d36c;
  color: #664800;
}

.offline-queue-status.failed {
  background: #fee4e2;
  border-color: #fda29b;
  color: var(--danger);
}

.offline-confirm-overlay {
  align-items: flex-end;
  background: rgba(16, 35, 24, .5);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 14px;
  position: fixed;
  z-index: 1080;
}

.offline-confirm-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(16, 35, 24, .28);
  max-height: min(86vh, 720px);
  max-width: 560px;
  overflow: auto;
  padding: clamp(16px, 4vw, 24px);
  width: 100%;
}

.offline-confirm-card h1 {
  font-weight: 900;
  margin: 0 0 8px;
}

.offline-confirm-lines {
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 0;
  margin: 14px 0;
  overflow: hidden;
}

.offline-confirm-lines div {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 12px;
}

.offline-confirm-lines div:last-child {
  border-bottom: 0;
}

.offline-confirm-payment {
  color: var(--muted);
  font-weight: 850;
  margin-top: 10px;
  text-transform: capitalize;
}

.offline-confirm-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1.4fr;
  margin-top: 16px;
}

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

.camera-actions .btn,
.camera-actions button {
  flex: 1 1 140px;
}

.camera-zoom {
  margin-top: 10px;
}

.cash-camera {
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 12px;
  overflow: hidden;
  padding: 12px;
}

.cash-camera-frame {
  aspect-ratio: 4 / 3;
  background: #102318;
  border-radius: 14px;
  min-height: 180px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.cash-camera video,
.cash-photo-preview {
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  width: 100%;
}

.cash-photo-preview {
  display: block;
}

.cash-photo-preview.captured {
  animation: cashPhotoCaptured .42s cubic-bezier(.2, .9, .2, 1);
}

@keyframes cashPhotoCaptured {
  0% {
    filter: brightness(1.5);
    transform: scale(.96);
  }
  55% {
    filter: brightness(1.08);
    transform: scale(1.025);
  }
  100% {
    filter: brightness(1);
    transform: scale(1);
  }
}

.cash-photo img {
  border: 1px solid var(--line);
  border-radius: 16px;
  max-height: 70vh;
  object-fit: contain;
  width: 100%;
}

.payment-panel {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.register-shell {
  display: grid;
  gap: 16px;
}

.register-shell form {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.register-main,
.register-cart {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  padding: clamp(14px, 3vw, 22px);
}

.register-head {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  margin-bottom: 14px;
}

.page-sales .register-head {
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(220, 236, 225, .9);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(18, 84, 38, .11);
  padding: 12px;
  position: -webkit-sticky;
  position: sticky;
  top: 78px;
  z-index: 1010;
}

.page-sales.sales-search-fixed .register-head {
  left: var(--sales-search-left, 12px);
  position: fixed;
  top: var(--sales-search-top, 78px);
  width: var(--sales-search-width, calc(100vw - 24px));
}

.page-sales.sales-search-fixed .register-main {
  padding-top: calc(clamp(14px, 3vw, 22px) + var(--sales-search-height, 92px));
}

.register-head h1,
.register-cart h2 {
  font-weight: 900;
  letter-spacing: -.02em;
  margin: 0 0 8px;
}

.register-search input {
  background: #fff;
}

.product-tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.category-chips {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

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

.category-chips button {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--green-dark);
  flex: 0 0 auto;
  font-size: .9rem;
  min-height: 42px;
  padding: 9px 13px;
}

.category-chips a {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  color: var(--green-dark);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .9rem;
  font-weight: 900;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
}

.category-chips button.active {
  background: var(--green-dark);
  color: #fff;
}

.category-chips a.active {
  background: var(--green-dark);
  color: #fff;
}

.register-main > .category-chips {
  flex-wrap: nowrap;
  margin-left: -2px;
  margin-right: -2px;
  overflow-x: auto;
  padding: 0 34px 5px 2px;
  scroll-padding-right: 34px;
  scroll-snap-type: x proximity;
}

.register-main > .category-chips button {
  max-width: 100%;
  scroll-snap-align: start;
  white-space: nowrap;
}

.register-main > .category-chips::after {
  content: "";
  flex: 0 0 20px;
}

.category-heading {
  align-self: end;
  color: var(--green-dark);
  font-size: .92rem;
  font-weight: 950;
  grid-column: 1 / -1;
  letter-spacing: .08em;
  margin: 8px 0 0;
  text-transform: uppercase;
}

.product-tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.product-tile.selected {
  border-color: rgba(40, 167, 69, .7);
  box-shadow: 0 12px 26px rgba(40, 167, 69, .12);
}

.product-tile.stock-limit {
  animation: stockLimit .9s ease;
}

@keyframes stockLimit {
  0%, 100% { border-color: var(--line); }
  35% { border-color: var(--danger); box-shadow: 0 0 0 5px rgba(180, 35, 24, .12); }
}

.product-tile strong {
  color: var(--ink);
  display: block;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
}

.product-tile span {
  color: var(--green-dark);
  display: block;
  font-weight: 900;
  margin-top: 6px;
}

.product-tile small {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-top: 2px;
}

.qty-control {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.qty-control button {
  border-radius: 16px;
  flex: 0 0 52px;
  font-size: 1.35rem;
  min-height: 52px;
  padding: 0;
  width: 52px;
}

.qty-control input {
  flex: 0 0 78px;
  font-size: 1.18rem;
  font-weight: 900;
  min-height: 52px;
  min-width: 0;
  text-align: center;
  width: 78px;
}

.register-cart {
  position: sticky;
  top: 86px;
}

.cart-lines {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.cart-lines div {
  align-items: center;
  background: var(--green-soft);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}

.cart-lines span {
  color: var(--ink);
  font-weight: 750;
}

.cart-lines b {
  color: var(--green-dark);
  white-space: nowrap;
}

.cart-total {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-top: 14px;
}

.cart-total span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.cart-total strong {
  color: var(--green-dark);
  font-size: 1.6rem;
  font-weight: 950;
}

.checkout-button {
  font-size: 1.05rem;
  margin-top: 12px;
  width: 100%;
}

.checkout-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.confirm-sale {
  margin-left: auto;
  margin-right: auto;
  max-width: 760px;
}

.confirm-total {
  margin-top: 14px;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.sale-nav {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 12px 0;
}

.sale-nav .btn {
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 180px;
  width: auto !important;
}

@media (max-width: 520px) {
  .sale-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .sale-nav .btn {
    flex: none;
    min-width: 0;
    width: 100% !important;
  }
}

.report-cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.warning-panel {
  border-color: rgba(255, 202, 44, .65);
  box-shadow: 0 18px 44px rgba(255, 202, 44, .15);
}

.warning-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 16px 0;
  padding: 0;
}

.warning-list li {
  background: #fff8db;
  border: 1px solid #f1d36c;
  border-radius: 12px;
  font-weight: 850;
  padding: 10px 12px;
}

.skip-count-box {
  background: #fff8db;
  border: 1px solid #f1d36c;
  border-radius: 16px;
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
  padding: 12px;
}

.skip-count-box form {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.skip-count-box p {
  margin: 0;
}

.stock-draft-box {
  background: #eef8ff;
  border: 1px solid #9bd2f5;
  border-radius: 16px;
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 14px;
}

.stock-draft-box p {
  margin: 0;
}

.stock-count {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.stock-count label {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 110px;
}

.stock-count-row[hidden] {
  display: none;
}

.stock-count-row.stock-count-mismatch {
  background: #fff3cd;
  border-color: #f1b84b;
  box-shadow: 0 0 0 3px rgba(241, 184, 75, .16);
}

.stock-count-row.stock-count-mismatch input {
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .12);
}

.stock-mismatch-badge {
  background: #fee4e2;
  border-radius: 999px;
  color: var(--danger);
  display: inline-flex;
  font-size: .72rem;
  font-weight: 900;
  margin-left: 8px;
  padding: 3px 8px;
  text-transform: uppercase;
}

.stock-count small {
  color: var(--muted);
  display: block;
  font-weight: 600;
  margin-top: 2px;
}

.metric {
  background: linear-gradient(135deg, var(--green-soft), #fff);
  border-radius: 16px;
  margin-top: 18px;
  padding: 18px;
}

.accordion {
  display: grid;
  gap: 10px;
}

.accordion-item {
  border: 1px solid var(--line);
  overflow: hidden;
}

.accordion-button {
  border-radius: 0 !important;
  color: var(--ink);
  font-weight: 850;
  min-height: 54px;
}

.accordion-button:not(.collapsed) {
  background: var(--green-soft);
  color: var(--green-dark);
}

.accordion-button:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 .2rem rgba(40, 167, 69, .14);
}

.price-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 960px;
  padding: clamp(16px, 4vw, 28px);
}

.price-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.price-header {
  align-items: center;
  border-bottom: 5px solid var(--green);
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  position: relative;
}

.price-header::after {
  background: var(--yellow);
  bottom: -5px;
  content: "";
  height: 5px;
  left: 0;
  position: absolute;
  width: 140px;
}

.price-header img {
  border-radius: 16px;
  height: 86px;
  width: 86px;
}

.price-header h1 {
  color: var(--green-dark);
  font-weight: 900;
  margin: 0;
}

.price-header p {
  margin: 0;
}

.price-table {
  min-width: 0;
}

.price-table th {
  background: var(--green-dark);
}

.price-table .category-row td {
  background: var(--yellow);
  color: #1f2d1f;
  font-weight: 900;
}

.price-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 10px;
}

.bottom-nav {
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(220, 236, 225, .9);
  border-radius: 22px 22px 0 0;
  bottom: 0;
  box-shadow: 0 -14px 34px rgba(18, 84, 38, .14);
  display: none;
  grid-template-columns: repeat(5, 1fr);
  left: 0;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 20;
}

.bottom-nav a {
  align-items: center;
  border-radius: 16px;
  color: var(--muted);
  display: flex;
  font-size: .72rem;
  font-weight: 900;
  justify-content: center;
  min-height: 52px;
  padding: 7px 4px;
  text-align: center;
}

.bottom-nav a.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

@media (max-width: 850px) {
  body {
    background: #f6fbf7;
  }

  .app-navbar .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }

  .app-navbar .navbar-collapse {
    background: rgba(16, 35, 24, .18);
    border-radius: 16px;
    margin-top: 10px;
    padding: 8px;
  }

  .brand-logo {
    height: 38px;
    width: 38px;
  }

  .page {
    padding: 12px 8px 92px;
  }

  .hero {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    max-width: none;
    width: 100%;
  }

  .hero-actions .primary {
    justify-content: center;
    width: 100%;
  }

  .table-wrap,
  .panel {
    max-width: 100%;
  }

  .row.g-2 > [class*="col"],
  .row.g-2 > [class*="col-"] {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .input-group {
    align-items: stretch;
    flex-direction: column;
  }

  .input-group .btn,
  .input-group .form-control {
    border-radius: 12px !important;
    width: 100%;
  }

  .cards,
  .two-col {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: flex-start;
    border-radius: 20px;
    flex-direction: column;
    padding: 22px;
  }

  .hero .primary,
  .hero .btn {
    width: 100%;
  }

  .panel {
    border-radius: 18px;
    margin-bottom: 12px;
    padding: 15px;
  }

  .cards {
    gap: 10px;
  }

  .action-hub,
  .step-list {
    grid-template-columns: 1fr 1fr;
  }

  .action-hub a {
    min-height: 96px;
    padding: 14px;
  }

  .cards article {
    padding: 15px;
  }

  .nav {
    display: none;
  }

  .bottom-nav {
    display: grid;
  }

  .denoms {
    grid-template-columns: 1fr;
  }

  .denoms label {
    grid-template-columns: 1fr 118px;
  }

  .sales-grid {
    grid-template-columns: minmax(130px, 1fr) 72px 72px 72px;
    overflow-x: auto;
  }

  .barcode-box,
  .payment-panel {
    grid-template-columns: 1fr;
  }

  .register-shell form {
    grid-template-columns: 1fr;
  }

  .register-shell {
    padding-bottom: 132px;
  }

  .register-head {
    align-items: stretch;
    gap: 8px;
    grid-template-columns: 1fr;
    margin-bottom: 8px;
  }

  .register-head .eyebrow,
  .register-head .muted {
    display: none;
  }

  .register-head h1 {
    font-size: 1.35rem;
    margin-bottom: 0;
  }

  .register-search input {
    min-height: 44px;
  }

  .register-cart {
    background: rgba(255, 255, 255, .97);
    border-radius: 20px 20px 0 0;
    bottom: 65px;
    box-shadow: 0 -14px 36px rgba(18, 84, 38, .18);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    left: 0;
    max-height: 144px;
    overflow-y: auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    top: auto;
    z-index: 18;
  }

  .register-cart h2,
  .cart-lines {
    display: none;
  }

  .register-cart .payment-panel {
    gap: 8px;
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    margin: 0;
    padding: 6px;
  }

  .register-cart .payment-panel label:nth-child(2),
  .register-cart .payment-panel label:nth-child(3) {
    display: none;
  }

  .register-cart.show-payment-details .payment-panel label:nth-child(2),
  .register-cart.show-payment-details .payment-panel label:nth-child(3) {
    display: grid;
  }

  .register-cart.show-payment-details {
    max-height: min(48vh, 292px);
  }

  .cart-total {
    border-top: 0;
    min-width: 0;
    padding-top: 0;
  }

  .cart-total strong {
    font-size: 1.35rem;
  }

  .checkout-button {
    align-self: center;
    margin-top: 0;
    min-height: 48px;
    min-width: 118px;
    width: auto;
  }

  .checkout-actions {
    align-items: stretch;
    display: flex;
    gap: 8px;
  }

  .checkout-actions .btn,
  .checkout-actions .checkout-button {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  .product-tiles {
    grid-template-columns: 1fr;
  }

  .product-tile {
    align-items: center;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 10px;
  }

  .qty-control {
    gap: 6px;
  }

  .qty-control button,
  .qty-control input {
    flex-basis: 42px;
    min-height: 44px;
    width: 42px;
  }

  .qty-control input {
    flex-basis: 56px;
    width: 56px;
  }

  .scanner-panel {
    grid-template-columns: 104px minmax(0, 1fr);
    margin-bottom: 8px;
    padding: 8px;
  }

  .scanner-panel .barcode-video {
    max-height: 132px;
    min-height: 132px;
  }

  .scanner-panel span,
  .scanner-panel .camera-zoom {
    display: none;
  }

  .scanner-panel .btn {
    min-height: 40px;
    padding: 8px 10px;
  }

  .camera-actions .btn,
  .camera-actions button {
    flex-basis: 96px;
    min-height: 38px;
    padding: 7px 9px;
  }

  .sales-grid span:nth-child(2),
  .sales-grid.head b:nth-child(2) {
    display: none;
  }

  .stock-count label {
    align-items: center;
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .price-header {
    align-items: flex-start;
  }

  .price-header img {
    height: 64px;
    width: 64px;
  }

  .price-actions {
    justify-content: stretch;
  }

  .price-actions .btn {
    flex: 1;
  }

  .price-sheet {
    border-radius: 14px;
    padding: 12px;
    width: 100%;
  }

  .price-table,
  .price-table thead,
  .price-table tbody,
  .price-table tr,
  .price-table td {
    display: block;
    width: 100%;
  }

  .price-table {
    border-spacing: 0;
  }

  .price-table thead {
    display: none;
  }

  .price-table tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
  }

  .price-table td {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 42px;
    padding: 10px 12px;
    text-align: right !important;
    white-space: normal;
    word-break: break-word;
  }

  .price-table td::before {
    color: var(--muted);
    content: attr(data-label);
    flex: 0 0 92px;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
  }

  .price-table td:last-child {
    border-bottom: 0;
    color: var(--green-dark);
    font-size: 1.1rem;
  }

  .price-table .category-row {
    border: 0;
    margin: 12px 0 8px;
  }

  .price-table .category-row td {
    border: 0;
    border-radius: 10px;
    display: block;
    text-align: left !important;
  }

  .price-table .category-row td::before {
    content: "";
    display: none;
  }

  .price-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 430px) {
  .navbar-brand span {
    font-size: .96rem;
  }

  .page {
    padding-left: 6px;
    padding-right: 6px;
  }

  .user-chip {
    display: none;
  }

  .sales-grid {
    grid-template-columns: 1fr;
  }

  .action-hub,
  .step-list {
    grid-template-columns: 1fr;
  }

  .stock-count label {
    grid-template-columns: 1fr;
  }

  .skip-count-box form {
    grid-template-columns: 1fr;
  }

  .sales-grid.head {
    display: none;
  }

  .sales-grid input {
    min-width: 100%;
  }

  .register-shell {
    padding-bottom: 124px;
  }

  .register-main {
    padding: 8px;
  }

  .scanner-panel {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .scanner-panel .barcode-video {
    max-height: 104px;
    min-height: 104px;
  }

  .cash-camera-frame {
    min-height: 210px;
  }

  .category-chips button {
    font-size: .82rem;
    min-height: 38px;
    padding: 8px 10px;
  }

  .register-main > .category-chips button {
    flex: 0 0 auto;
  }

  .product-tile {
    border-radius: 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px;
  }

  .product-tile strong {
    font-size: .96rem;
  }

  .register-cart {
    border-radius: 16px 16px 0 0;
    bottom: 62px;
    max-height: 168px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }

  .register-cart .payment-panel {
    grid-template-columns: 1fr;
    padding: 7px;
  }

  .cart-total strong {
    font-size: 1.18rem;
  }

  .checkout-button {
    min-width: 104px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .checkout-actions .btn,
  .checkout-actions .checkout-button {
    font-size: .9rem;
  }

  .checkout-actions {
    gap: 6px;
  }

  .qty-control {
    gap: 5px;
  }

  .qty-control button {
    flex-basis: 42px;
    min-height: 44px;
    width: 42px;
  }

  .qty-control input {
    flex-basis: 56px;
    min-height: 44px;
    width: 56px;
  }

  table {
    min-width: 560px;
  }
}

@media (max-width: 850px) {
  .page-sales.sales-keyboard-open .app-navbar,
  .sales-keyboard-open .register-cart,
  .sales-keyboard-open .bottom-nav {
    display: none !important;
  }

  .page-sales.sales-keyboard-open .page {
    padding: 6px 6px 8px;
  }

  .sales-keyboard-open .register-shell {
    padding-bottom: 8px;
  }

  .page-sales.sales-keyboard-open .register-main {
    border-radius: 14px;
    padding: 6px;
  }

  .page-sales.sales-keyboard-open .register-head {
    border-radius: 14px;
    margin-bottom: 6px;
    padding: 7px;
    top: 6px;
  }

  .page-sales.sales-keyboard-open.sales-search-fixed .register-head {
    top: 6px;
  }

  .page-sales.sales-keyboard-open .register-head > div,
  .page-sales.sales-keyboard-open .scanner-panel {
    display: none;
  }

  .page-sales.sales-keyboard-open .register-search input {
    min-height: 42px;
  }

  .page-sales.sales-keyboard-open .category-chips {
    margin-bottom: 8px;
    padding-bottom: 2px;
  }

  .page-sales.sales-keyboard-open .product-tile {
    gap: 8px;
    padding: 7px;
  }

  .network-banner {
    border-radius: 14px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    font-size: .86rem;
    max-width: calc(100vw - 12px);
    padding: 9px 10px;
    width: calc(100vw - 12px);
  }

  .sales-keyboard-open .network-banner {
    bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .page-sales .network-banner {
    bottom: auto;
    top: calc(8px + env(safe-area-inset-top));
    z-index: 1070;
  }

  .offline-confirm-overlay {
    align-items: flex-end;
    padding: 8px;
  }

  .offline-confirm-card {
    border-radius: 18px 18px 0 0;
    max-height: 88vh;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .offline-confirm-actions {
    grid-template-columns: 1fr;
  }

  .unsynced-sales-overlay {
    align-items: flex-end;
    padding: 8px;
  }

  .unsynced-sales-card {
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .unsynced-sales-actions {
    grid-template-columns: 1fr;
  }
}

/* Mobile-first sales register refresh */
.page-sales .register-shell form {
  grid-template-columns: 1fr;
}

.page-sales .register-main {
  border-radius: 14px;
  padding: clamp(10px, 3vw, 16px);
}

.page-sales .register-head {
  align-items: stretch;
  grid-template-columns: 1fr;
  margin-bottom: 10px;
}

.page-sales .register-search {
  display: grid;
  gap: 8px;
}

.page-sales .register-search > span {
  color: var(--green-dark);
  font-weight: 950;
}

.category-first-note,
.category-empty-state {
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--green-dark);
  font-weight: 950;
  padding: 12px;
}

.category-empty-state {
  text-align: center;
}

.search-control {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 6px;
}

.search-control:focus-within {
  border-color: rgba(40, 167, 69, .65);
  box-shadow: 0 0 0 4px rgba(40, 167, 69, .12);
}

.search-control input {
  border: 0;
  box-shadow: none;
  min-height: 48px;
  padding: 0 10px;
}

.search-control input:focus {
  box-shadow: none;
}

.scanner-fab {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: .92rem;
  justify-content: center;
  min-height: 48px;
  min-width: 78px;
  padding: 0 16px;
}

.page-sales .category-chips {
  gap: 8px;
  margin: 0 -10px 12px;
  overflow-x: auto;
  padding: 0 10px 6px;
  scroll-padding: 10px;
}

.page-sales .category-chips::after {
  content: "";
  flex: 0 0 1px;
}

.page-sales .category-chips button {
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: .95rem;
  min-height: 48px;
  padding: 10px 16px;
  white-space: nowrap;
}

.page-sales .product-tiles {
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.page-sales .product-tile {
  border-radius: 12px;
  gap: 12px;
  grid-template-columns: 1fr;
  padding: 12px;
  content-visibility: auto;
  contain-intrinsic-size: 142px;
}

.page-sales .product-tile strong {
  font-size: 1.05rem;
}

.product-tap-zone {
  border-radius: 10px;
  cursor: pointer;
  margin: -4px;
  min-height: 64px;
  padding: 4px;
}

.product-tile.just-added {
  animation: productAdded .32s ease;
}

@keyframes productAdded {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, .3);
    transform: scale(1);
  }
  45% {
    box-shadow: 0 0 0 6px rgba(40, 167, 69, .14);
    transform: scale(1.015);
  }
  100% {
    box-shadow: 0 8px 20px rgba(18, 84, 38, .06);
    transform: scale(1);
  }
}

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

.quick-add-chips button {
  background: var(--green-soft);
  border: 1px solid rgba(40, 167, 69, .25);
  border-radius: 999px;
  box-shadow: none;
  color: var(--green-dark);
  font-size: .95rem;
  font-weight: 950;
  min-height: 48px;
  padding: 8px 10px;
}

.quick-add-chips button:active {
  background: var(--green);
  color: #fff;
}

.page-sales .product-tile span {
  font-size: 1.08rem;
}

.page-sales .product-tile small {
  font-size: .94rem;
  font-weight: 850;
}

.page-sales .qty-control {
  display: grid;
  grid-template-columns: 56px minmax(76px, 1fr) 56px;
  justify-content: stretch;
  width: 100%;
}

.page-sales .qty-control button,
.page-sales .qty-control input {
  border-radius: 12px;
  flex-basis: auto;
  min-height: 56px;
  width: 100%;
}

.page-sales .qty-minus {
  background: #fee4e2;
  border-color: #fda29b;
  color: var(--danger);
}

.page-sales .qty-plus {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.cart-sheet-summary {
  align-items: center;
  background: #fff;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 62px;
  padding: 8px 10px;
  width: 100%;
}

.cart-summary-review {
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--ink);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 48px;
  min-width: 0;
  padding: 0;
  text-align: left;
}

.cart-summary-review b,
.cart-summary-review strong {
  color: var(--green-dark);
  font-weight: 950;
}

.cart-summary-review small {
  color: var(--muted);
  display: block;
  font-weight: 850;
}

.cart-summary-checkout {
  min-height: 50px;
  min-width: 112px;
  padding: 10px 14px;
}

.cart-sheet-body {
  display: grid;
  gap: 10px;
}

.page-sales .cart-line {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto 44px 44px 44px;
}

.page-sales .cart-line span {
  min-width: 0;
}

.page-sales .cart-line button {
  border-radius: 10px;
  box-shadow: none;
  font-size: 1rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
}

.page-sales .cart-line button[data-cart-step="-1"],
.page-sales .cart-line button[data-cart-remove] {
  background: #fee4e2;
  border-color: #fda29b;
  color: var(--danger);
}

.page-sales .cart-line button[data-cart-step="1"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

@media (min-width: 900px) {
  .page-sales .register-shell form {
    grid-template-columns: minmax(0, 1fr) 380px;
  }

  .page-sales .register-cart {
    position: sticky;
    top: 86px;
  }

  .page-sales .cart-sheet-summary {
    display: none;
  }
}

@media (max-width: 899px) {
  .page-sales .page {
    padding-bottom: 178px;
  }

  .page-sales .register-shell {
    padding-bottom: 0;
  }

  .page-sales .register-head {
    border-radius: 14px;
    padding: 8px;
    top: 8px;
  }

  .page-sales .scanner-panel {
    display: none;
    grid-template-columns: 1fr;
    margin-bottom: 10px;
  }

  .page-sales.sales-scanner-open .scanner-panel {
    display: grid;
  }

  .page-sales .scanner-panel .barcode-video {
    max-height: 220px;
    min-height: 180px;
  }

  .page-sales .camera-actions .btn,
  .page-sales .camera-actions button {
    flex: 1 1 calc(50% - 4px);
    min-height: 48px;
  }

  .page-sales .product-tiles {
    grid-template-columns: 1fr;
  }

  .page-sales .product-tile {
    box-shadow: 0 8px 20px rgba(18, 84, 38, .06);
  }

  .page-sales .register-cart {
    background: rgba(255, 255, 255, .98);
    border-radius: 16px 16px 0 0;
    bottom: calc(62px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 36px rgba(18, 84, 38, .2);
    display: grid;
    gap: 8px;
    left: 0;
    max-height: 112px;
    overflow: hidden;
    padding: 8px;
    position: fixed;
    right: 0;
    top: auto;
    z-index: 28;
  }

  .page-sales .register-cart.expanded,
  .page-sales .register-cart.show-payment-details {
    max-height: min(78vh, 640px);
    overflow: auto;
  }

  .page-sales .cart-sheet-body {
    display: none;
  }

  .page-sales .register-cart.expanded .cart-sheet-body,
  .page-sales .register-cart.show-payment-details .cart-sheet-body {
    display: grid;
  }

  .page-sales .register-cart.expanded .cart-sheet-summary,
  .page-sales .register-cart.show-payment-details .cart-sheet-summary {
    border-bottom: 1px solid var(--line);
    border-radius: 12px;
  }

  .page-sales .register-cart h2 {
    display: none;
  }

  .page-sales .cart-lines {
    display: grid;
    margin: 0;
    max-height: 30vh;
    overflow: auto;
  }

  .page-sales .cart-line {
    grid-template-columns: minmax(0, 1fr) auto 48px 48px 48px;
    padding: 8px;
  }

  .page-sales .cart-total {
    padding-top: 8px;
  }

  .page-sales .payment-panel {
    grid-template-columns: 1fr;
    margin: 0;
    padding: 8px;
  }

  .page-sales .payment-panel label,
  .page-sales .payment-panel select,
  .page-sales .payment-panel input {
    min-height: 48px;
  }

  .page-sales .checkout-actions {
    grid-template-columns: 1fr 1.35fr;
  }

  .page-sales .checkout-actions .btn,
  .page-sales .checkout-button {
    margin: 0;
    min-height: 54px;
  }
}

@media (max-width: 520px) {
  .page-sales .page {
    padding-left: 6px;
    padding-right: 6px;
  }

  .page-sales .register-main {
    padding: 8px;
  }

  .page-sales .category-heading {
    margin-top: 6px;
  }

  .page-sales .product-tile {
    padding: 10px;
  }

  .page-sales .qty-control {
    grid-template-columns: 54px minmax(70px, 1fr) 54px;
  }

  .page-sales .cart-sheet-summary {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 8px;
    padding: 7px;
  }

  .page-sales .cart-summary-checkout {
    min-width: 0;
    padding-left: 10px;
    padding-right: 10px;
  }

  .page-sales .cart-line {
    grid-template-columns: 1fr 48px 48px 48px;
  }

  .page-sales .cart-line b {
    grid-column: 1 / -1;
  }
}

@media (max-width: 850px) {
  .page-sales.sales-keyboard-open .app-navbar,
  .page-sales.sales-keyboard-open .register-cart,
  .page-sales.sales-keyboard-open .bottom-nav {
    display: none !important;
  }

  .page-sales.sales-keyboard-open .page {
    padding-bottom: 8px;
  }

  .page-sales.sales-keyboard-open .register-head {
    top: 6px;
  }
}

/* Item-first mobile sales layout */
@media (max-width: 899px) {
  .page-sales .register-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .page-sales .category-first-note {
    font-size: 1rem;
    order: 1;
    padding: 10px 12px;
  }

  .page-sales .category-chips {
    background: rgba(246, 251, 247, .98);
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: -2px -8px 0;
    overflow: visible;
    order: 2;
    padding: 4px 8px 8px;
    position: sticky;
    top: 8px;
    z-index: 12;
  }

  .page-sales .category-chips button {
    border-radius: 12px;
    font-size: .96rem;
    min-height: 64px;
    padding: 10px;
    white-space: normal;
  }

  .page-sales:not(.sales-category-selected) .category-chips button {
    font-size: 1.02rem;
    min-height: 76px;
  }

  .page-sales .register-head {
    background: transparent;
    border: 0;
    box-shadow: none;
    margin: 0;
    order: 3;
    padding: 0;
    position: static;
  }

  .page-sales:not(.sales-category-selected) .register-head {
    display: none;
  }

  .page-sales.sales-search-fixed .register-head {
    position: static;
    width: auto;
  }

  .page-sales.sales-search-fixed .register-main {
    padding-top: 8px;
  }

  .page-sales .register-search {
    gap: 0;
  }

  .page-sales .register-search > span {
    display: none;
  }

  .page-sales .search-control {
    border-radius: 12px;
    gap: 6px;
    padding: 4px;
  }

  .page-sales .search-control input {
    font-size: .95rem;
    min-height: 42px;
    padding: 0 8px;
  }

  .page-sales .scanner-fab {
    border-radius: 10px;
    font-size: .88rem;
    min-height: 42px;
    min-width: 64px;
    padding: 0 10px;
  }

  .page-sales #offlineSalesQueueStatus {
    order: 4;
  }

  .page-sales .scanner-panel {
    order: 5;
  }

  .page-sales.sales-scanner-open .scanner-panel {
    background: rgba(255, 255, 255, .98);
    border: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    bottom: calc(62px + env(safe-area-inset-bottom));
    box-shadow: 0 -18px 46px rgba(16, 35, 24, .28);
    display: grid;
    gap: 10px;
    left: 0;
    margin: 0;
    max-height: min(78vh, 640px);
    overflow: auto;
    padding: 12px;
    position: fixed;
    right: 0;
    top: auto;
    z-index: 1060;
  }

  .page-sales.sales-scanner-open .scanner-panel::before {
    background: rgba(16, 35, 24, .28);
    content: "";
    inset: -100vh 0 100%;
    pointer-events: none;
    position: absolute;
  }

  .page-sales.sales-scanner-open .scanner-panel .barcode-video {
    max-height: 52vh;
    min-height: 260px;
  }

  .page-sales .scan-toast {
    order: 6;
  }

  .page-sales .category-empty-state {
    order: 7;
  }

  .page-sales .product-tiles {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    order: 8;
  }

  .page-sales .category-heading {
    display: none;
  }

  .page-sales .product-tile {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    display: grid;
    gap: 7px;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 0;
    padding: 9px;
  }

  .page-sales .product-tap-zone {
    align-content: center;
    display: grid;
    margin: 0;
    min-height: 0;
    padding: 0;
  }

  .page-sales .product-tile strong {
    font-size: .95rem;
    line-height: 1.12;
  }

  .page-sales .product-tile span {
    font-size: 1rem;
    margin-top: 5px;
  }

  .page-sales .product-tile small {
    font-size: .76rem;
    margin-top: 3px;
  }

  .page-sales .quick-add-chips {
    display: none;
  }

  .page-sales .qty-control {
    gap: 5px;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .page-sales .qty-control button,
  .page-sales .qty-control input {
    border-radius: 10px;
    font-size: 1rem;
    min-height: 40px;
  }

  .page-sales .qty-control input {
    font-size: 1rem;
    padding-left: 2px;
    padding-right: 2px;
  }
}

@media (max-width: 370px) {
  .page-sales .product-tiles {
    grid-template-columns: 1fr 1fr;
  }

  .page-sales .product-tile {
    padding: 7px;
  }

  .page-sales .qty-control {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .page-sales .qty-control button,
  .page-sales .qty-control input {
    min-height: 38px;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  body {
    background: #fff;
  }

  .app-navbar,
  .bottom-nav,
  .no-print,
  .flash {
    display: none !important;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .price-sheet {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
    padding: 0;
  }

  .price-table {
    font-size: 12px;
  }

  .price-table tr {
    break-inside: avoid;
  }
}

/* ============================================================
   Touch-first sales register (mobile POS)
   Flow: Step 1 pick a category  ->  Step 2 tap items.
   Search and scanner are tucked behind small buttons so the
   item tiles get the whole screen.
   ============================================================ */
.page-sales .pos {
  margin: 0 auto;
  max-width: 1180px;
}

.page-sales .pos-form {
  display: block;
}

/* Only one step is shown at a time */
.page-sales .pos-screen-prod {
  display: none;
}

.page-sales.sales-category-selected .pos-screen-cat,
.page-sales.sales-search-open .pos-screen-cat,
.page-sales.sales-scanner-open .pos-screen-cat {
  display: none;
}

.page-sales.sales-category-selected .pos-screen-prod,
.page-sales.sales-search-open .pos-screen-prod,
.page-sales.sales-scanner-open .pos-screen-prod {
  display: block;
}

/* ---------- Step 1: category screen ---------- */
.page-sales .pos-step-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
  margin: 2px 2px 14px;
}

.page-sales .pos-step-head strong {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 950;
  letter-spacing: -.02em;
}

.page-sales .pos-step-head span {
  color: var(--green-dark);
  font-weight: 900;
}

.page-sales .pos-cat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin: 0;
  overflow: visible;
  padding: 0;
  position: static;
}

.page-sales .pos-cat-grid::after {
  display: none;
}

.page-sales .pos-cat-grid button {
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-height: 104px;
  padding: 16px;
  text-align: left;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  white-space: normal;
}

.page-sales .pos-cat-grid button:active {
  border-color: var(--green);
  box-shadow: 0 6px 16px rgba(40, 167, 69, .18);
  transform: scale(.98);
}

.page-sales .pos-cat-name {
  color: var(--green-dark);
  font-size: 1.12rem;
  font-weight: 950;
  line-height: 1.15;
}

.page-sales .pos-cat-meta {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

/* ---------- Step 2: product header ---------- */
.page-sales .pos-prod-head {
  align-items: center;
  background: rgba(247, 251, 248, .96);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
  padding: 6px;
  position: -webkit-sticky;
  position: sticky;
  top: 76px;
  z-index: 18;
}

.page-sales .pos-back {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
  color: var(--green-dark);
  flex: 0 0 auto;
  font-size: .92rem;
  font-weight: 900;
  min-height: 46px;
  padding: 0 14px;
}

.page-sales .pos-back:active {
  background: var(--green-soft);
}

.page-sales .pos-current-cat {
  color: var(--ink);
  flex: 1 1 auto;
  font-size: 1.05rem;
  font-weight: 950;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-sales .pos-tools {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.page-sales .pos-tool {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
  color: var(--green-dark);
  display: inline-flex;
  font-size: 1.2rem;
  justify-content: center;
  min-height: 46px;
  min-width: 46px;
  padding: 0;
}

.page-sales .pos-tool[aria-pressed="true"] {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.page-sales.sales-scanner-open #openScannerButton {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

/* revealed search bar */
.page-sales .pos-search {
  display: block;
  margin: 0 0 10px;
}

.page-sales .pos-search[hidden] {
  display: none;
}

.page-sales .pos-search .search-control {
  border-radius: 12px;
  grid-template-columns: 1fr;
  padding: 4px 6px;
}

.page-sales .pos-search input {
  min-height: 46px;
}

/* ---------- product grid + tiles ---------- */
.page-sales .category-heading {
  display: none;
}

.page-sales .category-empty-state {
  display: none;
}

.page-sales .pos-prod-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin: 0;
}

.page-sales .pos-tile {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 8px;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  padding: 10px;
  position: relative;
}

.page-sales .pos-tile.selected {
  border-color: var(--green);
  box-shadow: 0 8px 20px rgba(40, 167, 69, .18);
}

.page-sales .pos-tile .product-tap-zone {
  align-content: start;
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  display: grid;
  margin: 0;
  min-height: 64px;
  padding: 2px;
  text-align: left;
  width: 100%;
}

.page-sales .pos-tile .product-tap-zone:active {
  background: var(--green-soft);
}

.page-sales .pos-tile strong {
  color: var(--ink);
  display: block;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.18;
}

.page-sales .pos-tile span {
  color: var(--green-dark);
  display: block;
  font-size: 1.05rem;
  font-weight: 950;
  margin-top: 6px;
}

.page-sales .pos-tile small {
  color: var(--muted);
  display: block;
  font-size: .78rem;
  font-weight: 800;
  margin-top: 2px;
}

.page-sales .pos-tile-qty {
  align-items: center;
  background: var(--green);
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: .95rem;
  font-weight: 950;
  height: 30px;
  justify-content: center;
  min-width: 30px;
  padding: 0 8px;
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
}

.page-sales .pos-tile-qty:empty {
  display: none;
}

.page-sales .pos-tile .qty-control {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  justify-content: stretch;
  width: 100%;
}

.page-sales .pos-tile .qty-control button {
  border-radius: 12px;
  flex: none;
  font-size: 1.3rem;
  min-height: 48px;
  padding: 0;
  width: 100%;
}

.page-sales .pos-tile .qty-minus {
  background: #fee4e2;
  border: 1px solid #fda29b;
  box-shadow: none;
  color: var(--danger);
}

.page-sales .pos-tile .qty-plus {
  background: var(--green);
  border: 1px solid var(--green);
  box-shadow: none;
  color: #fff;
}

.page-sales .pos-tile .qty-control input {
  border-radius: 12px;
  flex: none;
  font-size: 1.15rem;
  font-weight: 900;
  min-height: 48px;
  text-align: center;
  width: 100%;
}

/* ---------- cart ---------- */
.page-sales .pos-cart {
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  display: block;
  margin-top: 14px;
  padding: 12px;
}

.page-sales .pos-cart-bar {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.page-sales .pos-cart-glance {
  align-items: center;
  background: var(--green-soft);
  border: 0;
  border-radius: 14px;
  box-shadow: none;
  color: var(--ink);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 56px;
  min-width: 0;
  padding: 8px 14px;
  text-align: left;
}

.page-sales .pos-cart-count {
  display: grid;
  min-width: 0;
}

.page-sales .pos-cart-count b {
  color: var(--green-dark);
  font-size: 1.05rem;
  font-weight: 950;
}

.page-sales .pos-cart-count small {
  color: var(--muted);
  font-weight: 800;
}

.page-sales .pos-cart-glance strong {
  color: var(--green-dark);
  font-size: 1.15rem;
  font-weight: 950;
  white-space: nowrap;
}

.page-sales .pos-cart-bar .cart-summary-checkout {
  border-radius: 14px;
  min-height: 56px;
  min-width: 120px;
  padding: 0 18px;
}

.page-sales .pos-cart-body {
  display: block;
  margin-top: 12px;
}

.page-sales .pos-cart-body h2 {
  font-size: 1.05rem;
  font-weight: 950;
  margin: 0 0 8px;
}

.page-sales .pos-cart .cart-line {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto 44px 44px 44px;
}

.page-sales .pos-cart .cart-line span {
  font-weight: 800;
  min-width: 0;
}

.page-sales .pos-cart .cart-line b {
  color: var(--green-dark);
  white-space: nowrap;
}

.page-sales .pos-cart .cart-line button {
  border-radius: 10px;
  box-shadow: none;
  font-size: 1.05rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
}

.page-sales .pos-cart .cart-line button[data-cart-step="-1"],
.page-sales .pos-cart .cart-line button[data-cart-remove] {
  background: #fee4e2;
  border: 1px solid #fda29b;
  color: var(--danger);
}

.page-sales .pos-cart .cart-line button[data-cart-step="1"] {
  background: var(--green);
  border: 1px solid var(--green);
  color: #fff;
}

.page-sales .pos-cart .payment-panel {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  margin: 12px 0 0;
}

.page-sales .pos-cart .payment-panel label {
  display: grid;
  font-weight: 850;
  gap: 4px;
}

.page-sales .pos-cart .checkout-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1.4fr;
  margin-top: 12px;
}

.page-sales .pos-cart .checkout-actions .btn,
.page-sales .pos-cart .checkout-actions .checkout-button {
  margin: 0;
  min-height: 52px;
}

/* ---------- scanner sheet ---------- */
.page-sales .scanner-panel {
  display: none;
}

.page-sales.sales-scanner-open .scanner-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
}

/* ===================== Desktop ===================== */
@media (min-width: 900px) {
  .page-sales .pos-form {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .page-sales .pos-cart {
    margin-top: 0;
    position: -webkit-sticky;
    position: sticky;
    top: 86px;
  }

  .page-sales .pos-cart-bar {
    display: none;
  }

  .page-sales .pos-prod-head {
    top: 80px;
  }
}

/* ===================== Mobile ===================== */
@media (max-width: 899px) {
  .page-sales .page {
    padding: 10px 8px calc(150px + env(safe-area-inset-bottom));
  }

  .page-sales .pos-step-head strong {
    font-size: 1.15rem;
  }

  .page-sales .pos-cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-sales .pos-cat-grid button {
    min-height: 96px;
  }

  .page-sales .pos-prod-head {
    top: 56px;
  }

  .page-sales .pos-prod-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Cart becomes a bottom sheet above the tab bar */
  .page-sales .pos-cart {
    border-radius: 18px 18px 0 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 38px rgba(18, 84, 38, .2);
    left: 0;
    margin: 0;
    max-height: 86px;
    overflow: hidden;
    padding: 8px;
    position: fixed;
    right: 0;
    z-index: 26;
  }

  .page-sales .pos-cart.expanded,
  .page-sales .pos-cart.show-payment-details {
    max-height: min(80vh, 660px);
    overflow: auto;
  }

  .page-sales .pos-cart-body {
    display: none;
  }

  .page-sales .pos-cart.expanded .pos-cart-body,
  .page-sales .pos-cart.show-payment-details .pos-cart-body {
    display: block;
  }

  /* Scanner becomes a bottom sheet too */
  .page-sales.sales-scanner-open .scanner-panel {
    border-radius: 18px 18px 0 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    box-shadow: 0 -18px 46px rgba(16, 35, 24, .28);
    left: 0;
    margin: 0;
    max-height: min(80vh, 640px);
    overflow: auto;
    position: fixed;
    right: 0;
    z-index: 1060;
  }

  .page-sales.sales-scanner-open .scanner-panel .barcode-video {
    max-height: 52vh;
    min-height: 240px;
  }

  /* When the keyboard is up (search/payment), free the screen */
  .page-sales.sales-keyboard-open .app-navbar,
  .page-sales.sales-keyboard-open .pos-cart,
  .page-sales.sales-keyboard-open .bottom-nav {
    display: none !important;
  }

  .page-sales.sales-keyboard-open .pos-prod-head {
    top: 6px;
  }
}

@media (max-width: 380px) {
  .page-sales .pos-tile {
    padding: 8px;
  }

  .page-sales .pos-tile strong {
    font-size: .92rem;
  }

  .page-sales .pos-tile .qty-control {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .page-sales .pos-tile .qty-control button,
  .page-sales .pos-tile .qty-control input {
    min-height: 44px;
  }

  .page-sales .pos-back {
    font-size: 0;
    min-width: 46px;
    padding: 0 12px;
  }

  .page-sales .pos-back span {
    font-size: 1.2rem;
  }
}

.public-catalogue-page {
  background:
    radial-gradient(circle at top right, rgba(255, 202, 44, .2), transparent 22rem),
    linear-gradient(180deg, #f5fbf6 0%, #eef8f1 100%);
  color: var(--ink);
}

.public-catalogue {
  margin: 0 auto;
  max-width: 1180px;
  min-height: 100vh;
  padding: clamp(14px, 4vw, 34px);
}

.catalogue-hero {
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 202, 44, .28), transparent 15rem),
    linear-gradient(135deg, #0f742e, #063f1b);
  border-radius: 28px;
  box-shadow: var(--shadow);
  color: #fff;
  overflow: hidden;
  padding: clamp(18px, 4vw, 34px);
}

.catalogue-nav {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: clamp(34px, 8vw, 72px);
}

.catalogue-brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  font-size: 1.08rem;
  font-weight: 900;
}

.catalogue-brand img {
  background: rgba(255, 255, 255, .14);
  border-radius: 15px;
  height: 46px;
  padding: 5px;
  width: 46px;
}

.catalogue-brand b {
  color: var(--yellow);
}

.catalogue-login {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  min-height: 44px;
  padding: 11px 16px;
}

.catalogue-hero-copy {
  max-width: 680px;
}

.catalogue-hero-copy h1 {
  font-size: clamp(2.1rem, 7vw, 4.4rem);
  letter-spacing: -.045em;
  line-height: .96;
  margin: 0 0 14px;
}

.catalogue-hero-copy p:not(.eyebrow) {
  color: rgba(255, 255, 255, .88);
  font-size: clamp(1rem, 2.3vw, 1.25rem);
  line-height: 1.45;
  margin: 0 0 14px;
}

.catalogue-hero-copy small {
  color: rgba(255, 255, 255, .75);
  font-weight: 700;
}

.catalogue-tools {
  align-items: stretch;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(240px, 360px) 1fr;
  margin: 18px 0;
}

.catalogue-search {
  color: var(--green-dark);
  font-weight: 900;
}

.catalogue-search input {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  display: block;
  font: inherit;
  font-size: 1rem;
  margin-top: 7px;
  min-height: 56px;
  padding: 0 16px;
  width: 100%;
}

.catalogue-categories {
  align-content: end;
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 25px 2px 2px;
  scrollbar-width: thin;
}

.catalogue-categories button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-dark);
  flex: 0 0 auto;
  font: inherit;
  font-weight: 900;
  min-height: 48px;
  padding: 0 18px;
}

.catalogue-categories button.active {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.catalogue-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.catalogue-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 18px;
}

.catalogue-card[hidden] {
  display: none;
}

.catalogue-category {
  align-self: flex-start;
  background: var(--green-soft);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: .78rem;
  font-weight: 900;
  margin-bottom: 14px;
  padding: 6px 10px;
}

.catalogue-card h2 {
  color: var(--ink);
  font-size: 1.18rem;
  line-height: 1.15;
  margin: 0 0 8px;
}

.catalogue-card p {
  color: var(--muted);
  font-weight: 750;
  margin: 0 0 auto;
}

.catalogue-price {
  margin-top: 20px;
}

.catalogue-card strong {
  color: var(--green-dark);
  display: block;
  font-size: 1.45rem;
}

.pos-discount-tile {
  border-color: rgba(255, 202, 44, .9) !important;
}

.pos-price {
  align-items: flex-start;
  color: var(--green-dark);
  display: flex;
  flex-direction: column;
  font-weight: 900;
  gap: 1px;
}

.pos-price del,
.price-list-old-price {
  color: var(--muted);
  font-size: .86em;
  font-weight: 800;
}

.pos-price b {
  color: var(--green-dark);
}

.pos-discount-badge,
.price-list-discount {
  align-self: flex-start;
  background: #fff4c2;
  border-radius: 999px;
  color: #6a4b00;
  display: inline-block;
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
  margin-top: 2px;
  padding: 4px 8px;
}

.price-list-discount {
  margin-left: 8px;
}

.catalogue-price del {
  color: var(--muted);
  display: block;
  font-weight: 800;
  margin-bottom: 2px;
}

.catalogue-card.has-discount {
  border-color: rgba(255, 202, 44, .85);
}

.catalogue-discount {
  align-self: flex-start;
  background: #fff4c2;
  border-radius: 999px;
  color: #6a4b00;
  font-size: .78rem;
  font-weight: 900;
  margin-top: 9px;
  padding: 6px 10px;
}

.catalogue-empty,
.catalogue-no-results {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  margin: 18px 0;
  padding: 24px;
}

.catalogue-footer {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: .92rem;
  font-weight: 750;
  gap: 10px;
  justify-content: space-between;
  padding: 22px 4px 8px;
}

@media (max-width: 720px) {
  .public-catalogue {
    padding: 10px;
  }

  .catalogue-hero {
    border-radius: 22px;
    min-height: 330px;
  }

  .catalogue-nav {
    margin-bottom: 42px;
  }

  .catalogue-login {
    font-size: .9rem;
    padding-inline: 13px;
  }

  .catalogue-tools {
    display: block;
  }

  .catalogue-categories {
    margin: 12px -10px 0;
    padding: 0 10px 4px;
  }

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

  .catalogue-card {
    border-radius: 18px;
    min-height: 168px;
    padding: 14px;
  }

  .catalogue-card h2 {
    font-size: 1rem;
  }

  .catalogue-card strong {
    font-size: 1.18rem;
  }
}

@media (max-width: 720px) {
  .receipt-camera {
    margin-inline: -4px;
    padding: 10px;
  }

  .stock-intake-lines-head {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-intake-add {
    width: 100%;
  }

  .stock-intake-entry {
    grid-template-columns: 1fr 1fr;
  }

  .stock-intake-entry label:first-child,
  .stock-intake-cost,
  .stock-intake-remove {
    grid-column: 1 / -1;
  }

  .stock-intake-remove {
    width: 100%;
  }

  .stock-intake-row {
    grid-template-columns: 1fr 1fr;
  }

  .stock-intake-row > div {
    grid-column: 1 / -1;
  }

  .stock-intake-row label {
    min-width: 0;
  }
}
