:root {
  color-scheme: light;
  --ink: #13201d;
  --muted: #697571;
  --line: #d8e0dc;
  --panel: #ffffff;
  --soft: #eef4f1;
  --brand: #0f3d36;
  --brand-2: #f2b84b;
  --danger: #a33b30;
  --shadow: 0 18px 50px rgba(19, 32, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f7f8f5;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.topbar,
.scanner-panel,
.cart-panel,
.checkout-panel,
.receipt-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.app-logo-frame {
  position: relative;
  flex: 0 1 430px;
  width: min(430px, 64vw);
  height: 88px;
  overflow: hidden;
}

.app-logo {
  position: absolute;
  top: -150px;
  left: -105px;
  width: 600px;
  height: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

h2 {
  font-size: 1.2rem;
}

.mode-pill {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-button {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.scanner-panel,
.cart-panel,
.checkout-panel,
.receipt-panel {
  padding: 14px;
}

.video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #101916;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: var(--brand-2);
  box-shadow: 0 0 16px rgba(242, 184, 75, 0.75);
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: #e9f1ed;
}

.camera-empty span {
  color: #b8c5c0;
}

.scanner-actions,
.section-heading,
.receipt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scanner-actions {
  margin-top: 12px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary,
.checkout {
  background: var(--brand);
  color: white;
}

.secondary,
.ghost,
.manual-form button {
  background: var(--soft);
  color: var(--brand);
}

.primary,
.secondary,
.checkout {
  flex: 1;
  padding: 0 14px;
}

.ghost {
  padding: 0 12px;
}

.manual-form {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.manual-form label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.manual-form div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input {
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.manual-form button {
  padding: 0 14px;
}

.status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.cart-lines,
.receipt-lines {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.line strong {
  display: block;
}

.product-link {
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.product-link:hover,
.product-link:focus-visible {
  color: var(--brand);
  text-decoration: underline;
}

.line small {
  color: var(--muted);
}

.availability {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand);
  font-weight: 750;
}

.availability.muted {
  color: var(--muted);
  font-weight: 600;
}

.availability span {
  color: var(--muted);
  font-weight: 600;
}

.qty {
  display: inline-grid;
  grid-template-columns: 34px 36px 34px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty button {
  min-height: 34px;
  border-radius: 0;
  background: white;
  color: var(--brand);
}

.qty span {
  text-align: center;
  font-weight: 800;
}

.cart-empty {
  margin-top: 12px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.cart-summary {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #fbfcfa;
}

.cart-summary div {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 10px;
}

.cart-summary span {
  color: var(--muted);
}

.cart-summary strong {
  font-size: 1rem;
}

.totals {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cart-total-row {
  margin-top: 0;
}

.totals strong {
  font-size: 1.45rem;
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.payment {
  background: var(--soft);
  color: var(--brand);
  border: 2px solid transparent;
}

.payment.selected {
  border-color: var(--brand);
  background: #e1eee9;
}

.checkout {
  width: 100%;
  margin-top: 12px;
}

.receipt-meta {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) 1.1fr;
  gap: 10px;
  margin: 14px 0 0;
}

.receipt-hero {
  display: grid;
  gap: 3px;
  padding: 14px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
}

.receipt-hero span,
.receipt-hero small {
  color: #cfe1da;
  font-size: 0.84rem;
}

.receipt-hero strong {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.receipt-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.receipt-facts div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.receipt-facts span,
.receipt-line small,
.receipt-line span,
.receipt-summary span,
.receipt-payments span,
.receipt-payments small {
  color: var(--muted);
  font-size: 0.84rem;
}

.receipt-facts strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 700;
}

.receipt-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.receipt-line-main,
.receipt-line-amounts {
  display: grid;
  gap: 4px;
}

.receipt-line-main strong {
  overflow-wrap: anywhere;
}

.receipt-line-amounts {
  justify-items: end;
  text-align: right;
}

.receipt-summary,
.receipt-payments {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #fbfcfa;
}

.receipt-summary div,
.receipt-payments div {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 10px;
}

.receipt-summary-total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.receipt-summary-total strong {
  font-size: 1.25rem;
}

.receipt-payments h3 {
  margin: 0 0 2px;
  font-size: 1rem;
}

.receipt-payments small {
  grid-column: 1 / -1;
  text-align: right;
}

.receipt-paid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: #eef4f1;
  color: var(--brand);
}

.receipt-paid span {
  color: var(--muted);
}

.receipt-paid strong {
  font-size: 1.45rem;
}

.hidden {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(19, 32, 29, 0.42);
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.modal-close {
  flex: 0 0 auto;
}

.product-detail-body {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-detail-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.product-detail-grid span,
.modal-muted {
  color: var(--muted);
}

.product-detail-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-description {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.spec-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.spec-list h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  color: var(--brand);
  font-size: 1rem;
}

.spec-list dl {
  display: grid;
  grid-template-columns: minmax(128px, 0.38fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.spec-list dl:last-child {
  border-bottom: 0;
}

.spec-list dt {
  min-width: 0;
  color: var(--ink);
  font-weight: 750;
}

.spec-list dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.modal-error {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

@media (min-width: 760px) {
  .shell {
    grid-template-columns: 1.1fr 0.9fr;
    align-content: start;
  }

  .topbar,
  .receipt-panel {
    grid-column: 1 / -1;
  }

  .checkout-panel {
    align-self: start;
  }
}

@media (max-width: 420px) {
  .shell {
    padding: 10px;
  }

  .topbar,
  .scanner-panel,
  .cart-panel,
  .checkout-panel,
  .receipt-panel {
    padding: 12px;
  }

  .topbar {
    gap: 10px;
  }

  .app-logo-frame {
    flex-basis: 250px;
    width: min(250px, 58vw);
    height: 54px;
  }

  .app-logo {
    top: -88px;
    left: -62px;
    width: 354px;
  }

  .manual-form div,
  .payment-grid,
  .receipt-meta,
  .receipt-facts,
  .product-detail-grid {
    grid-template-columns: 1fr;
  }

  .receipt-line {
    grid-template-columns: 1fr;
  }

  .receipt-line-amounts {
    justify-items: start;
    text-align: left;
  }
}
