:root {
  color-scheme: light;
  --ink: #172019;
  --muted: #6b7168;
  --line: #dfe5da;
  --paper: #fffdf4;
  --panel: #ffffff;
  --field: #f3f5ec;
  --green: #1f7a3f;
  --green-2: #22b35a;
  --orange: #d95112;
  --yellow: #f0c33c;
  --blue: #4c79d8;
  --shadow: 0 22px 60px rgba(23, 32, 25, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 8%, rgba(240, 195, 60, 0.18), transparent 28rem),
    linear-gradient(135deg, #fff8e6 0%, #eef6e9 50%, #fbf3e7 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 88px minmax(0, 1fr);
}

.side-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  border-right: 1px solid rgba(23, 32, 25, 0.1);
  background: rgba(255, 253, 244, 0.84);
  padding: 20px 12px;
  backdrop-filter: blur(24px);
}

.brand {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  height: 42px;
  width: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--green);
  color: white;
  font-size: 22px;
}

.rail-nav {
  display: grid;
  gap: 12px;
}

.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 56px;
  padding: 10px 4px;
  border: 1px solid rgba(23, 32, 25, 0.1);
  border-radius: 14px;
  background: white;
  color: var(--muted);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 8px 20px rgba(23, 32, 25, 0.06);
}

.nav-icon {
  font-size: 18px;
  line-height: 1;
}

.rail-item.active {
  color: var(--ink);
}

.icon-button {
  display: grid;
  height: 44px;
  width: 44px;
  place-items: center;
  border: 1px solid rgba(23, 32, 25, 0.1);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(23, 32, 25, 0.06);
}

.rail-item.active {
  background: var(--ink);
  color: white;
}

.session-card {
  margin-top: auto;
  width: 100%;
  border-radius: 18px;
  background: var(--field);
  padding: 12px;
  text-align: center;
}

.session-card strong {
  display: block;
  font-size: 12px;
  line-height: 1.2;
}

.session-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.workspace {
  padding: 28px;
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 24px;
  max-width: 1540px;
}

.top-bar h1 {
  margin: 6px 0 0;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.ghost-button,
.secondary-button,
.primary-button,
.checkout-button,
.add-button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  font-weight: 950;
}

.ghost-button,
.secondary-button {
  border: 1px solid rgba(23, 32, 25, 0.1);
  background: white;
  color: var(--ink);
  padding: 0 18px;
}

.primary-button,
.checkout-button {
  background: var(--orange);
  color: white;
  padding: 0 22px;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(300px, 0.6fr);
  gap: 18px;
  margin: 0 auto;
  max-width: 1200px;
  align-items: start;
}

.scanner-panel,
.catalog-panel,
.cart-panel,
.product-confirm,
.summary-card,
.payment-card {
  border: 1px solid rgba(23, 32, 25, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.scanner-panel {
  overflow: hidden;
}

.scanner-hero {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(23, 32, 25, 0.12), rgba(23, 32, 25, 0.42)),
    radial-gradient(circle at 70% 35%, #e23b1f 0 42px, transparent 43px),
    radial-gradient(circle at 52% 48%, #f27022 0 28px, transparent 29px),
    linear-gradient(135deg, #d6c09d, #7c8e4f 42%, #2d6c35);
}

.scanner-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

body[data-scanner="live"] .scanner-hero {
  background: #172019;
}

body[data-scanner="live"] .produce-scene {
  opacity: 0;
}

body[data-scanner="fallback"] .scanner-video,
body[data-scanner="ready"] .scanner-video {
  display: none;
}

.scanner-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
}

.glass {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.22);
  color: white;
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.scanner-pill {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 950;
}

.scan-frame {
  position: absolute;
  inset: 86px 54px 110px;
  z-index: 3;
}

.scan-frame span {
  position: absolute;
  height: 38px;
  width: 38px;
  border-color: #eaff66;
}

.scan-frame span:nth-child(1) {
  left: 0;
  top: 0;
  border-left: 4px solid;
  border-top: 4px solid;
}

.scan-frame span:nth-child(2) {
  right: 0;
  top: 0;
  border-right: 4px solid;
  border-top: 4px solid;
}

.scan-frame span:nth-child(3) {
  bottom: 0;
  left: 0;
  border-bottom: 4px solid;
  border-left: 4px solid;
}

.scan-frame span:nth-child(4) {
  bottom: 0;
  right: 0;
  border-bottom: 4px solid;
  border-right: 4px solid;
}

.scan-sweep {
  position: absolute;
  left: 54px;
  right: 54px;
  top: 104px;
  z-index: 3;
  height: 3px;
  border-radius: 999px;
  background: #eaff66;
  box-shadow: 0 0 18px rgba(234, 255, 102, 0.9);
  animation: scannerSweep 2.4s ease-in-out infinite;
}

@keyframes scannerSweep {
  0% {
    transform: translateY(0);
    opacity: 0.15;
  }

  18%,
  82% {
    opacity: 0.95;
  }

  100% {
    transform: translateY(170px);
    opacity: 0.15;
  }
}

.produce-scene {
  position: absolute;
  inset: 84px 0 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transform: rotate(-8deg);
}

.produce {
  display: block;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.22));
}

.produce-tomato {
  color: #db301d;
  font-size: 118px;
}

.produce-carrot {
  color: #ed7d24;
  font-size: 120px;
  transform: rotate(22deg);
}

.produce-kale {
  color: #265f30;
  font-size: 132px;
}

.produce-apple {
  color: #c12822;
  font-size: 86px;
}

.produce-flower {
  color: #f0c33c;
  font-size: 88px;
}

/*
  Translucent gradient overlay — WCAG 2.0 AA compliant.
  White (#fff) on the effective blended bottom color (~#191d1a) = ~19:1 contrast.
  rgba(255,255,255,0.78) on the same base = ~14:1 contrast.
  Both exceed the 4.5:1 AA minimum for normal text.
*/
.scan-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  padding: 72px 20px 22px;
  background: linear-gradient(to bottom, transparent 0%, rgba(23, 32, 25, 0.90) 100%);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scan-match-eyebrow {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scan-match-name {
  margin: 4px 0 2px;
  color: #ffffff;
  font-size: 26px;
  font-weight: 950;
  line-height: 1.05;
}

.scan-match-meta {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.panel-heading h2,
.payment-card h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1;
}

/* Scanner search */
.scanner-search-wrap {
  position: relative;
  padding: 16px 16px 0;
}

.scanner-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field);
  padding: 0 14px;
  color: var(--muted);
  cursor: text;
}

.scanner-search-field svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
  stroke-width: 2;
}

.scanner-search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
}

.scanner-search-results {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(100% - 2px);
  z-index: 10;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 12px 32px rgba(23, 32, 25, 0.14);
  overflow: hidden;
}

.scanner-search-results button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: white;
  padding: 12px 14px;
  text-align: left;
}

.scanner-search-results button:last-child {
  border-bottom: 0;
}

.scanner-search-results button:hover,
.scanner-search-results button:focus {
  background: var(--field);
}

.result-thumb {
  font-size: 24px;
}

.result-name {
  display: block;
  font-weight: 900;
}

.result-meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.result-price {
  border-radius: 999px;
  background: var(--field);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 950;
}

.identify-btn {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: white;
  padding: 0 22px;
  font-weight: 950;
  font-size: 14px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.36);
  transition: transform 0.1s;
}

.identify-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

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

.scan-status {
  min-height: 20px;
  margin: 10px 16px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.product-confirm {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  margin: 0 18px 18px;
  padding: 16px;
}

.product-avatar {
  display: grid;
  height: 76px;
  width: 76px;
  place-items: center;
  border-radius: 18px;
  background: var(--field);
  font-size: 42px;
}

.product-copy h3 {
  margin: 4px 0;
  font-size: 22px;
}

.product-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.amount-control {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  min-height: 52px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.amount-control button {
  display: grid;
  place-items: center;
  border: 0;
  background: var(--field);
  color: var(--green);
}

.amount-control button svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

.amount-control output {
  display: grid;
  place-items: center;
  font-weight: 950;
}

.add-button {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--green);
  color: white;
  padding: 0 18px;
}

.catalog-panel,
.cart-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact {
  margin-bottom: 12px;
}

.count-pill {
  white-space: nowrap;
  border-radius: 999px;
  background: var(--field);
  padding: 8px 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 950;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field);
  padding: 0 14px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 0 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
}

.chip.active {
  border-color: var(--green);
  background: #e8f5e8;
  color: var(--green);
}

.product-list,
.cart-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.product-row,
.cart-row {
  display: grid;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(23, 32, 25, 0.09);
  border-radius: 18px;
  background: white;
  padding: 12px;
}

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

.product-row.active {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.product-thumb {
  display: grid;
  height: 52px;
  width: 52px;
  place-items: center;
  border-radius: 14px;
  background: var(--field);
  font-size: 28px;
}

.product-row strong,
.cart-row strong {
  display: block;
  line-height: 1.1;
}

.product-row span,
.cart-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.price-badge {
  border-radius: 999px;
  background: var(--field);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 950;
}

.cart-panel {
  position: sticky;
  top: 28px;
}

.empty-state {
  display: grid;
  min-height: 132px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: var(--field);
  padding: 18px;
  text-align: center;
}

.empty-state span {
  max-width: 220px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cart-row {
  grid-template-columns: 1fr auto;
}

.remove-item {
  display: grid;
  height: 36px;
  width: 36px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: #f7ebe6;
  color: var(--orange);
  font-size: 20px;
  font-weight: 950;
}

.summary-card,
.payment-card {
  margin-top: 14px;
  padding: 14px;
  box-shadow: none;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-weight: 850;
}

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

.summary-line.total {
  margin-top: 6px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  font-size: 24px;
}

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

.payment-grid button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field);
  color: var(--ink);
  font-weight: 950;
}

.payment-grid button.active {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.payment-grid button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.payment-note {
  min-height: 38px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.checkout-button {
  width: 100%;
  margin-top: 14px;
  background: var(--orange);
}

.checkout-button:disabled {
  cursor: not-allowed;
  background: #d4d8cf;
  color: #777d73;
}

.receipt-dialog {
  width: min(92vw, 520px);
  border: 0;
  border-radius: 26px;
  background: transparent;
  padding: 0;
}

.receipt-dialog::backdrop {
  background: rgba(23, 32, 25, 0.48);
  backdrop-filter: blur(8px);
}

.receipt-modal {
  border-radius: 26px;
  background: var(--paper);
  padding: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
}

.receipt-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.receipt-paper {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: white;
  padding: 26px 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.receipt-paper::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 12px;
  background: repeating-linear-gradient(135deg, transparent 0 10px, var(--paper) 10px 20px);
}

.receipt-paper header {
  display: grid;
  gap: 4px;
  text-align: center;
}

.receipt-brand {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 30px;
  font-weight: 950;
  letter-spacing: 0;
}

.receipt-paper header span,
.receipt-paper footer span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.qr-box {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 132px;
  height: 132px;
  margin: 22px auto;
  border: 8px solid white;
  border-radius: 14px;
  background: white;
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 28px rgba(23, 32, 25, 0.12);
}

.qr-box span {
  border-radius: 3px;
  background: #e4e4e4;
}

.qr-box span:nth-child(1),
.qr-box span:nth-child(2),
.qr-box span:nth-child(5),
.qr-box span:nth-child(6),
.qr-box span:nth-child(7),
.qr-box span:nth-child(11),
.qr-box span:nth-child(13),
.qr-box span:nth-child(15),
.qr-box span:nth-child(18),
.qr-box span:nth-child(21),
.qr-box span:nth-child(23),
.qr-box span:nth-child(24),
.qr-box span:nth-child(25) {
  background: #111;
}

.receipt-lines {
  display: grid;
  gap: 10px;
  border-top: 1px dashed #b9b9b9;
  border-bottom: 1px dashed #b9b9b9;
  padding: 16px 0;
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.receipt-paper footer {
  display: grid;
  gap: 12px;
  padding: 16px 0 6px;
}

.receipt-paper footer div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt-paper footer strong {
  font-size: 18px;
}

.receipt-paper footer p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.modal-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .side-rail {
    position: fixed;
    right: 14px;
    bottom: 14px;
    left: 14px;
    top: auto;
    z-index: 20;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    gap: 4px;
    border: none;
    border-radius: 28px;
    background: rgba(20, 26, 21, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
      0 8px 40px rgba(0, 0, 0, 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: 10px 12px;
  }

  .brand,
  .session-card {
    display: none;
  }

  .rail-nav {
    display: flex;
    flex: 1;
    gap: 4px;
  }

  .rail-item {
    flex: 1;
    background: transparent;
    border: none;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.4);
    border-radius: 18px;
    padding: 8px 4px;
    min-height: 52px;
    transition: color 0.15s, background 0.15s;
  }

  .rail-item svg {
    width: 20px;
    height: 20px;
  }

  .rail-item.active {
    background: rgba(255, 255, 255, 0.11);
    color: white;
  }

  .workspace {
    padding: 14px 12px 96px;
  }

  .top-bar {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
  }

  .top-actions {
    justify-content: space-between;
  }

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

  .scanner-hero {
    min-height: min(62vh, 430px);
    border-radius: 0;
  }

  .product-confirm {
    margin: 0 12px 12px;
  }

  .payment-grid,
  .modal-footer {
    grid-template-columns: 1fr;
  }

  .scan-frame {
    inset: 72px 34px 126px;
  }

  .scan-sweep {
    left: 34px;
    right: 34px;
    top: 88px;
  }

  .scan-overlay {
    padding: 86px 16px 18px;
  }

  .scan-match-name {
    font-size: 24px;
  }

  .identify-btn {
    align-self: stretch;
    justify-content: center;
  }

  .cart-panel {
    padding: 14px;
  }

  .summary-line.total {
    font-size: 22px;
  }
}
